49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
export const schema = gql`
|
|
type User {
|
|
id: Int!
|
|
firstName: String!
|
|
lastName: String!
|
|
email: String!
|
|
hashedPassword: String!
|
|
salt: String!
|
|
resetToken: String
|
|
resetTokenExpiresAt: DateTime
|
|
roles: String!
|
|
transactions: [Transaction]!
|
|
}
|
|
|
|
type Query {
|
|
users: [User!]! @requireAuth(roles: "admin")
|
|
user(id: Int!): User @requireAuth(roles: "admin")
|
|
}
|
|
|
|
input CreateUserInput {
|
|
firstName: String!
|
|
lastName: String!
|
|
email: String!
|
|
hashedPassword: String!
|
|
salt: String!
|
|
resetToken: String
|
|
resetTokenExpiresAt: DateTime
|
|
roles: String!
|
|
}
|
|
|
|
input UpdateUserInput {
|
|
firstName: String
|
|
lastName: String
|
|
email: String
|
|
hashedPassword: String
|
|
salt: String
|
|
resetToken: String
|
|
resetTokenExpiresAt: DateTime
|
|
roles: String
|
|
}
|
|
|
|
type Mutation {
|
|
createUser(input: CreateUserInput!): User! @requireAuth(roles: "admin")
|
|
updateUser(id: Int!, input: UpdateUserInput!): User!
|
|
@requireAuth(roles: "admin")
|
|
deleteUser(id: Int!): User! @requireAuth(roles: "admin")
|
|
}
|
|
`
|