Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
HUNG-rushb committed Dec 14, 2023
1 parent 10d0a7b commit 9911a55
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Type_Definitions/Album_Album.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const albumDefs = gql`
allAlbums: [Album]!
userAllAlbum(data: UserAllAlbumInput!): [Album]!
albumInfo(data: AlbumInfoInput!): [Post]!
postNotInAlbum(data: NotInAlbumInfoInput!): [Post]!
}
input UserAllAlbumInput {
Expand All @@ -17,6 +18,11 @@ const albumDefs = gql`
albumId: ID!
}
input NotInAlbumInfoInput {
userId: ID!
albumId: ID!
}
extend type Mutation {
createAlbum(data: CreateAlbumInput!): Album!
Expand Down
10 changes: 10 additions & 0 deletions src/resolvers/Query/ALBUM.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ const albumQuery = {
},
});
},
postNotInAlbum: async (parent, args, info) => {
return await prisma.post.findMany({
where: {
userId: args.data.userId,
NOT: {
albumId: { has: args.data.albumId },
},
},
});
},
};

export default albumQuery;

0 comments on commit 9911a55

Please sign in to comment.