Skip to content

Commit

Permalink
Added coverArt to item
Browse files Browse the repository at this point in the history
  • Loading branch information
FOSSforlife committed Apr 17, 2020
1 parent 0a3f8f8 commit 41a2f41
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 6 deletions.
14 changes: 14 additions & 0 deletions db/migrations/1587097918918-AddCoverArt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {MigrationInterface, QueryRunner} from "typeorm";

export class AddCoverArt1587097918918 implements MigrationInterface {
name = 'AddCoverArt1587097918918'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "items" ADD "cover_art" character varying`, undefined);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "items" DROP COLUMN "cover_art"`, undefined);
}

}
27 changes: 24 additions & 3 deletions generated/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' |
Expand All @@ -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' |
Expand Down Expand Up @@ -155,6 +159,7 @@ export interface CollectionItemCreateInput {
userId: ID_Output
itemDetailsId: ID_Output
plays?: Float | null
mbid?: String | null
}

export interface CollectionItemUpdateInput {
Expand All @@ -163,6 +168,7 @@ export interface CollectionItemUpdateInput {
userId?: ID_Input | null
itemDetailsId?: ID_Input | null
plays?: Float | null
mbid?: String | null
}

export interface CollectionItemWhereInput {
Expand Down Expand Up @@ -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 {
Expand All @@ -223,6 +234,7 @@ export interface ItemCreateInput {
title: String
disambiguation?: String | null
artist: String
coverArt?: String | null
}

export interface ItemUpdateInput {
Expand All @@ -232,6 +244,7 @@ export interface ItemUpdateInput {
title?: String | null
disambiguation?: String | null
artist?: String | null
coverArt?: String | null
}

export interface ItemWhereInput {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -475,10 +493,12 @@ export interface CollectionItem extends BaseGraphQLObject {
itemDetails?: Item | null
itemDetailsId: String
plays?: Int | null
mbid?: String | null
reviews?: Array<Review> | null
artist: String
title: String
mbid: String
rating: String
reviewBody: String
}

export interface Item extends BaseGraphQLObject {
Expand All @@ -496,6 +516,7 @@ export interface Item extends BaseGraphQLObject {
title: String
disambiguation?: String | null
artist: String
coverArt?: String | null
collectionItem?: Array<CollectionItem> | null
}

Expand Down
52 changes: 50 additions & 2 deletions generated/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -469,6 +487,9 @@ export class ItemCreateInput {

@TypeGraphQLField()
artist!: string;

@TypeGraphQLField({ nullable: true })
coverArt?: string;
}

@TypeGraphQLInputType()
Expand All @@ -490,6 +511,9 @@ export class ItemUpdateInput {

@TypeGraphQLField({ nullable: true })
artist?: string;

@TypeGraphQLField({ nullable: true })
coverArt?: string;
}

@ArgsType()
Expand Down Expand Up @@ -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, {
Expand Down Expand Up @@ -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()
Expand All @@ -910,6 +952,9 @@ export class CollectionItemCreateInput {

@TypeGraphQLField({ nullable: true })
plays?: number;

@TypeGraphQLField({ nullable: true })
mbid?: string;
}

@TypeGraphQLInputType()
Expand All @@ -928,6 +973,9 @@ export class CollectionItemUpdateInput {

@TypeGraphQLField({ nullable: true })
plays?: number;

@TypeGraphQLField({ nullable: true })
mbid?: string;
}

@ArgsType()
Expand Down
23 changes: 22 additions & 1 deletion generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -83,6 +85,7 @@ input CollectionItemCreateInput {
userId: ID!
itemDetailsId: ID!
plays: Float
mbid: String
}

enum CollectionItemOrderByInput {
Expand All @@ -102,6 +105,8 @@ enum CollectionItemOrderByInput {
itemDetailsId_DESC
plays_ASC
plays_DESC
mbid_ASC
mbid_DESC
}

input CollectionItemUpdateInput {
Expand All @@ -110,6 +115,7 @@ input CollectionItemUpdateInput {
userId: ID
itemDetailsId: ID
plays: Float
mbid: String
}

input CollectionItemWhereInput {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -187,6 +198,7 @@ type Item implements BaseGraphQLObject {
title: String!
disambiguation: String
artist: String!
coverArt: String
collectionItem: [CollectionItem!]
}

Expand All @@ -197,6 +209,7 @@ input ItemCreateInput {
title: String!
disambiguation: String
artist: String!
coverArt: String
}

enum ItemOrderByInput {
Expand All @@ -218,6 +231,8 @@ enum ItemOrderByInput {
disambiguation_DESC
artist_ASC
artist_DESC
coverArt_ASC
coverArt_DESC
}

input ItemUpdateInput {
Expand All @@ -227,6 +242,7 @@ input ItemUpdateInput {
title: String
disambiguation: String
artist: String
coverArt: String
}

input ItemWhereInput {
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/modules/item/item.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export class Item extends BaseModel {
@StringField()
artist!: string;

@StringField({ nullable: true })
coverArt?: string;

@OneToMany(
() => CollectionItem,
(collectionItem: CollectionItem) => collectionItem.itemDetails
Expand Down

0 comments on commit 41a2f41

Please sign in to comment.