Skip to content

v0.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@FOSSforlife FOSSforlife released this 17 Apr 06:24
984d5fd
  • The Patrician API initializes a Postgres 12 database and a GraphQL API to interface with it, all using the Warthog framework which combines TypeORM, TypeGraphQL, and auto-generated endpoints.
  • The database stores users, items (albums/EPs/etc) inside user "collections", and reviews for each item.
    • Each user has one collection, which is initialized as an empty array upon signing up.
    • Each review can optionally contain a title, rating, and body. Right now the rating accepts any string (as opposed to a number), because I want rating systems to be flexible.
  • Users can create accounts using the createUser mutation, which is now a full signup function that uses secure password salting.
  • Users and items have a many-to-many relation that uses a join table (CollectionItem) to store reviews and other user-specific item data. The Item table is used for aggregated metadata, which will eventually be normalized using online databases such as MusicBrainz.
    • Some properties from Item (artist and title) are accessible on the CollectionItem API entity for ease of use, which closes #2
  • All of the functionality has been tested using the "v0.1" release of patrician.
  • From this point on, major and minor versions of patrician-api and patrician will be released alongside each other, with the goal that each update is compatible with its counterpart (e.g. v0.1 to v0.1). This is important because until V1, minor versions will almost always include breaking changes.

Initial Schema

In future version announcements, this section will be a list of changes from the last minor or major release.

I'll only be listing the basic types, not the generated input types (CreateInput, UpdateInput, WhereInput, OrderByInput). For the full schema, see schema.graphql.

User

type User implements BaseGraphQLObject {
  id: ID!
  createdAt: DateTime!
  createdById: String!
  updatedAt: DateTime
  updatedById: String
  deletedAt: DateTime
  deletedById: String
  version: Int!
  username: String!
  email: String
  bio: String
  accountSettings: JSONObject
  collection: [CollectionItem!]
}

Item

type Item implements BaseGraphQLObject {
  id: ID!
  createdAt: DateTime!
  createdById: String!
  updatedAt: DateTime
  updatedById: String
  deletedAt: DateTime
  deletedById: String
  version: Int!
  mbid: String
  rymId: Int
  spotifyId: String
  title: String
  title: String!
  disambiguation: String
  artist: String
  artist: String!
  coverArt: String
  collectionItem: [CollectionItem!]
}

CollectionItem

type CollectionItem implements BaseGraphQLObject {
  id: ID!
  createdAt: DateTime!
  createdById: String!
  updatedAt: DateTime
  updatedById: String
  deletedAt: DateTime
  deletedById: String
  version: Int!
  customTitle: String
  customArtist: String
  user: User
  userId: String!
  itemDetails: Item
  itemDetailsId: String!
  plays: Int
  mbid: String
  reviews: [Review!]
  artist: String!
  title: String!
  rating: String!
  reviewBody: String!
}

Review

type Review implements BaseGraphQLObject {
  id: ID!
  createdAt: DateTime!
  createdById: String!
  updatedAt: DateTime
  updatedById: String
  deletedAt: DateTime
  deletedById: String
  version: Int!
  collectionItem: CollectionItem
  collectionItemId: String!
  rating: String
  title: String
  body: String
}