Link data
Linking data between music module and art module by adding cover artwork for albums
Update
music.model.ts
file inside the libs/codegen/music/src
directory@Entity('album')
export class Album {
....
@Prop({
examples: ['9c754c102e022513cb8dfb5c645a648b2369b4678236032b1370bd2176379853']
})
coverArtworkId: string;
...
}
Build module, so the changes in the model come to effect
pnx affected:build
Update API
pnx g @logosphere/sdk:api --module music
pnx affected:build
pnx affected:test
pnx docker music
docker-compose -f apps/music/docker/local/docker-compose.yaml up -d
Mutation:
mutation albumUpdate($album: AlbumInput!) {
albumSave(album: $album) {
id
subjectId
name
genre
coverArtworkId
createdAt
updatedAt
}
}
Variables:
{
"album": {
"id": "de15f717dd6f4639513a43f4f4716cd32ed35b05524c77a4a825450cd907786d",
"coverArtworkId": "c12d4725ee5dc9870e23f51cf06d09260aebfa9c17c3a1111cd96a2a9406752a",
"name": "1989"
}
}
Output:
{
"data": {
"albumSave": {
"id": "4b27e8c8a72b0b8e5b986fdec5b1cb761ca5bcd0c23a9d7526efe785f9c0d942",
"subjectId": "369435906932740",
"name": "1989",
"genre": "Pop",
"coverArtworkId": "c12d4725ee5dc9870e23f51cf06d09260aebfa9c17c3a1111cd96a2a9406752a",
"createdAt": "2022-07-21T06:03:26.866Z",
"updatedAt": "2022-07-21T06:03:26.866Z"
}
}
}
Last modified 9mo ago