
* feat: add roles based access * feat: update roles env + todo * feat: add roles to update profile * feat: add role based oauth * feat: validate role for a given token
125 lines
2.1 KiB
GraphQL
125 lines
2.1 KiB
GraphQL
# GraphQL schema example
|
|
#
|
|
# https://gqlgen.com/getting-started/
|
|
scalar Int64
|
|
scalar Map
|
|
scalar Any
|
|
|
|
type Meta {
|
|
version: String!
|
|
isGoogleLoginEnabled: Boolean!
|
|
isFacebookLoginEnabled: Boolean!
|
|
isTwitterLoginEnabled: Boolean!
|
|
isGithubLoginEnabled: Boolean!
|
|
isEmailVerificationEnabled: Boolean!
|
|
isBasicAuthenticationEnabled: Boolean!
|
|
}
|
|
|
|
type User {
|
|
id: ID!
|
|
email: String!
|
|
signupMethod: String!
|
|
firstName: String
|
|
lastName: String
|
|
emailVerifiedAt: Int64
|
|
image: String
|
|
createdAt: Int64
|
|
updatedAt: Int64
|
|
roles: [String!]!
|
|
}
|
|
|
|
type VerificationRequest {
|
|
id: ID!
|
|
identifier: String
|
|
token: String
|
|
email: String
|
|
expires: Int64
|
|
createdAt: Int64
|
|
updatedAt: Int64
|
|
}
|
|
|
|
type Error {
|
|
message: String!
|
|
reason: String!
|
|
}
|
|
|
|
type AuthResponse {
|
|
message: String!
|
|
accessToken: String
|
|
accessTokenExpiresAt: Int64
|
|
user: User
|
|
}
|
|
|
|
type Response {
|
|
message: String!
|
|
}
|
|
|
|
input SignUpInput {
|
|
firstName: String
|
|
lastName: String
|
|
email: String!
|
|
password: String!
|
|
confirmPassword: String!
|
|
image: String
|
|
roles: [String]
|
|
}
|
|
|
|
input LoginInput {
|
|
email: String!
|
|
password: String!
|
|
role: String
|
|
}
|
|
|
|
input VerifyEmailInput {
|
|
token: String!
|
|
}
|
|
|
|
input ResendVerifyEmailInput {
|
|
email: String!
|
|
}
|
|
|
|
input UpdateProfileInput {
|
|
oldPassword: String
|
|
newPassword: String
|
|
confirmNewPassword: String
|
|
firstName: String
|
|
lastName: String
|
|
image: String
|
|
email: String
|
|
# roles: [String]
|
|
}
|
|
|
|
input ForgotPasswordInput {
|
|
email: String!
|
|
}
|
|
|
|
input ResetPasswordInput {
|
|
token: String!
|
|
password: String!
|
|
confirmPassword: String!
|
|
}
|
|
|
|
input DeleteUserInput {
|
|
email: String!
|
|
}
|
|
|
|
type Mutation {
|
|
signup(params: SignUpInput!): AuthResponse!
|
|
login(params: LoginInput!): AuthResponse!
|
|
logout: Response!
|
|
updateProfile(params: UpdateProfileInput!): Response!
|
|
verifyEmail(params: VerifyEmailInput!): AuthResponse!
|
|
resendVerifyEmail(params: ResendVerifyEmailInput!): Response!
|
|
forgotPassword(params: ForgotPasswordInput!): Response!
|
|
resetPassword(params: ResetPasswordInput!): Response!
|
|
deleteUser(params: DeleteUserInput!): Response!
|
|
}
|
|
|
|
type Query {
|
|
meta: Meta!
|
|
users: [User!]!
|
|
token(role: String): AuthResponse
|
|
profile: User!
|
|
verificationRequests: [VerificationRequest!]!
|
|
}
|