Parts schema and scaffolld, with file uploading for the image (through Filestack)
This commit is contained in:
35
api/src/graphql/parts.sdl.ts
Normal file
35
api/src/graphql/parts.sdl.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
export const schema = gql`
|
||||
type Part {
|
||||
id: Int!
|
||||
name: String!
|
||||
description: String
|
||||
availableStock: Int!
|
||||
imageUrl: String!
|
||||
createdAt: DateTime!
|
||||
}
|
||||
|
||||
type Query {
|
||||
parts: [Part!]! @requireAuth
|
||||
part(id: Int!): Part @requireAuth
|
||||
}
|
||||
|
||||
input CreatePartInput {
|
||||
name: String!
|
||||
description: String
|
||||
availableStock: Int!
|
||||
imageUrl: String!
|
||||
}
|
||||
|
||||
input UpdatePartInput {
|
||||
name: String
|
||||
description: String
|
||||
availableStock: Int
|
||||
imageUrl: String
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
createPart(input: CreatePartInput!): Part! @requireAuth
|
||||
updatePart(id: Int!, input: UpdatePartInput!): Part! @requireAuth
|
||||
deletePart(id: Int!): Part! @requireAuth
|
||||
}
|
||||
`
|
||||
Reference in New Issue
Block a user