adding fetch preactions by partId

This commit is contained in:
Yen Colon
2021-01-19 22:19:40 -04:00
parent 26235158fa
commit 136f2966b5
4 changed files with 79 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ export const schema = gql`
type Query {
partReactions: [PartReaction!]!
partReaction(id: String!): PartReaction
partReactionsByPartId(partId: String!): [PartReaction!]!
}
input TogglePartReactionInput {

View File

@@ -15,6 +15,12 @@ export const partReaction = ({ id }) => {
})
}
export const partReactionsByPartId = ({ partId }) => {
return db.partReaction.findMany({
where: { partId: partId },
})
}
export const togglePartReaction = async ({ input }) => {
// if write fails emote_userId_partId @@unique constraint, then delete it instead
requireAuth()