diff --git a/db/migrations/1587097918918-AddCoverArt.ts b/db/migrations/1587097918918-AddCoverArt.ts new file mode 100644 index 0000000..ded7eaa --- /dev/null +++ b/db/migrations/1587097918918-AddCoverArt.ts @@ -0,0 +1,14 @@ +import {MigrationInterface, QueryRunner} from "typeorm"; + +export class AddCoverArt1587097918918 implements MigrationInterface { + name = 'AddCoverArt1587097918918' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "items" ADD "cover_art" character varying`, undefined); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "items" DROP COLUMN "cover_art"`, undefined); + } + +} diff --git a/generated/binding.ts b/generated/binding.ts index d97c86d..cd4fceb 100644 --- a/generated/binding.ts +++ b/generated/binding.ts @@ -76,7 +76,9 @@ export type CollectionItemOrderByInput = 'createdAt_ASC' | 'itemDetailsId_ASC' | 'itemDetailsId_DESC' | 'plays_ASC' | - 'plays_DESC' + 'plays_DESC' | + 'mbid_ASC' | + 'mbid_DESC' export type ItemOrderByInput = 'createdAt_ASC' | 'createdAt_DESC' | @@ -95,7 +97,9 @@ export type ItemOrderByInput = 'createdAt_ASC' | 'disambiguation_ASC' | 'disambiguation_DESC' | 'artist_ASC' | - 'artist_DESC' + 'artist_DESC' | + 'coverArt_ASC' | + 'coverArt_DESC' export type ReviewOrderByInput = 'createdAt_ASC' | 'createdAt_DESC' | @@ -155,6 +159,7 @@ export interface CollectionItemCreateInput { userId: ID_Output itemDetailsId: ID_Output plays?: Float | null + mbid?: String | null } export interface CollectionItemUpdateInput { @@ -163,6 +168,7 @@ export interface CollectionItemUpdateInput { userId?: ID_Input | null itemDetailsId?: ID_Input | null plays?: Float | null + mbid?: String | null } export interface CollectionItemWhereInput { @@ -210,6 +216,11 @@ export interface CollectionItemWhereInput { plays_lt?: Int | null plays_lte?: Int | null plays_in?: Int[] | Int | null + mbid_eq?: String | null + mbid_contains?: String | null + mbid_startsWith?: String | null + mbid_endsWith?: String | null + mbid_in?: String[] | String | null } export interface CollectionItemWhereUniqueInput { @@ -223,6 +234,7 @@ export interface ItemCreateInput { title: String disambiguation?: String | null artist: String + coverArt?: String | null } export interface ItemUpdateInput { @@ -232,6 +244,7 @@ export interface ItemUpdateInput { title?: String | null disambiguation?: String | null artist?: String | null + coverArt?: String | null } export interface ItemWhereInput { @@ -290,6 +303,11 @@ export interface ItemWhereInput { artist_startsWith?: String | null artist_endsWith?: String | null artist_in?: String[] | String | null + coverArt_eq?: String | null + coverArt_contains?: String | null + coverArt_startsWith?: String | null + coverArt_endsWith?: String | null + coverArt_in?: String[] | String | null } export interface ItemWhereUniqueInput { @@ -475,10 +493,12 @@ export interface CollectionItem extends BaseGraphQLObject { itemDetails?: Item | null itemDetailsId: String plays?: Int | null + mbid?: String | null reviews?: Array | null artist: String title: String - mbid: String + rating: String + reviewBody: String } export interface Item extends BaseGraphQLObject { @@ -496,6 +516,7 @@ export interface Item extends BaseGraphQLObject { title: String disambiguation?: String | null artist: String + coverArt?: String | null collectionItem?: Array | null } diff --git a/generated/classes.ts b/generated/classes.ts index 81ee53c..36ec78c 100644 --- a/generated/classes.ts +++ b/generated/classes.ts @@ -269,7 +269,10 @@ export enum ItemOrderByEnum { disambiguation_DESC = "disambiguation_DESC", artist_ASC = "artist_ASC", - artist_DESC = "artist_DESC" + artist_DESC = "artist_DESC", + + coverArt_ASC = "coverArt_ASC", + coverArt_DESC = "coverArt_DESC" } registerEnumType(ItemOrderByEnum, { @@ -442,6 +445,21 @@ export class ItemWhereInput { @TypeGraphQLField(() => [String], { nullable: true }) artist_in?: string[]; + + @TypeGraphQLField({ nullable: true }) + coverArt_eq?: string; + + @TypeGraphQLField({ nullable: true }) + coverArt_contains?: string; + + @TypeGraphQLField({ nullable: true }) + coverArt_startsWith?: string; + + @TypeGraphQLField({ nullable: true }) + coverArt_endsWith?: string; + + @TypeGraphQLField(() => [String], { nullable: true }) + coverArt_in?: string[]; } @TypeGraphQLInputType() @@ -469,6 +487,9 @@ export class ItemCreateInput { @TypeGraphQLField() artist!: string; + + @TypeGraphQLField({ nullable: true }) + coverArt?: string; } @TypeGraphQLInputType() @@ -490,6 +511,9 @@ export class ItemUpdateInput { @TypeGraphQLField({ nullable: true }) artist?: string; + + @TypeGraphQLField({ nullable: true }) + coverArt?: string; } @ArgsType() @@ -746,7 +770,10 @@ export enum CollectionItemOrderByEnum { itemDetailsId_DESC = "itemDetailsId_DESC", plays_ASC = "plays_ASC", - plays_DESC = "plays_DESC" + plays_DESC = "plays_DESC", + + mbid_ASC = "mbid_ASC", + mbid_DESC = "mbid_DESC" } registerEnumType(CollectionItemOrderByEnum, { @@ -886,6 +913,21 @@ export class CollectionItemWhereInput { @TypeGraphQLField(() => [Int], { nullable: true }) plays_in?: number[]; + + @TypeGraphQLField({ nullable: true }) + mbid_eq?: string; + + @TypeGraphQLField({ nullable: true }) + mbid_contains?: string; + + @TypeGraphQLField({ nullable: true }) + mbid_startsWith?: string; + + @TypeGraphQLField({ nullable: true }) + mbid_endsWith?: string; + + @TypeGraphQLField(() => [String], { nullable: true }) + mbid_in?: string[]; } @TypeGraphQLInputType() @@ -910,6 +952,9 @@ export class CollectionItemCreateInput { @TypeGraphQLField({ nullable: true }) plays?: number; + + @TypeGraphQLField({ nullable: true }) + mbid?: string; } @TypeGraphQLInputType() @@ -928,6 +973,9 @@ export class CollectionItemUpdateInput { @TypeGraphQLField({ nullable: true }) plays?: number; + + @TypeGraphQLField({ nullable: true }) + mbid?: string; } @ArgsType() diff --git a/generated/schema.graphql b/generated/schema.graphql index 12abb8a..7831c61 100644 --- a/generated/schema.graphql +++ b/generated/schema.graphql @@ -71,10 +71,12 @@ type CollectionItem implements BaseGraphQLObject { itemDetails: Item itemDetailsId: String! plays: Int + mbid: String reviews: [Review!] artist: String! title: String! - mbid: String! + rating: String! + reviewBody: String! } input CollectionItemCreateInput { @@ -83,6 +85,7 @@ input CollectionItemCreateInput { userId: ID! itemDetailsId: ID! plays: Float + mbid: String } enum CollectionItemOrderByInput { @@ -102,6 +105,8 @@ enum CollectionItemOrderByInput { itemDetailsId_DESC plays_ASC plays_DESC + mbid_ASC + mbid_DESC } input CollectionItemUpdateInput { @@ -110,6 +115,7 @@ input CollectionItemUpdateInput { userId: ID itemDetailsId: ID plays: Float + mbid: String } input CollectionItemWhereInput { @@ -157,6 +163,11 @@ input CollectionItemWhereInput { plays_lt: Int plays_lte: Int plays_in: [Int!] + mbid_eq: String + mbid_contains: String + mbid_startsWith: String + mbid_endsWith: String + mbid_in: [String!] } input CollectionItemWhereUniqueInput { @@ -187,6 +198,7 @@ type Item implements BaseGraphQLObject { title: String! disambiguation: String artist: String! + coverArt: String collectionItem: [CollectionItem!] } @@ -197,6 +209,7 @@ input ItemCreateInput { title: String! disambiguation: String artist: String! + coverArt: String } enum ItemOrderByInput { @@ -218,6 +231,8 @@ enum ItemOrderByInput { disambiguation_DESC artist_ASC artist_DESC + coverArt_ASC + coverArt_DESC } input ItemUpdateInput { @@ -227,6 +242,7 @@ input ItemUpdateInput { title: String disambiguation: String artist: String + coverArt: String } input ItemWhereInput { @@ -285,6 +301,11 @@ input ItemWhereInput { artist_startsWith: String artist_endsWith: String artist_in: [String!] + coverArt_eq: String + coverArt_contains: String + coverArt_startsWith: String + coverArt_endsWith: String + coverArt_in: [String!] } input ItemWhereUniqueInput { diff --git a/src/modules/item/item.model.ts b/src/modules/item/item.model.ts index 6c90d6b..afc2da7 100644 --- a/src/modules/item/item.model.ts +++ b/src/modules/item/item.model.ts @@ -21,6 +21,9 @@ export class Item extends BaseModel { @StringField() artist!: string; + @StringField({ nullable: true }) + coverArt?: string; + @OneToMany( () => CollectionItem, (collectionItem: CollectionItem) => collectionItem.itemDetails