-
Notifications
You must be signed in to change notification settings - Fork 7
/
sanctum.graphql
84 lines (70 loc) · 2.44 KB
/
sanctum.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
type User {
id: ID!
name: String!
email: String!
}
type AccessToken {
token: String!
}
input LoginInput {
email: String! @rules(apply: ["required", "email"])
password: String! @rules(apply: ["required", "string"])
}
type LogoutResponse {
status: LogoutStatus!
message: String!
}
type RegisterResponse {
token: String
status: RegisterStatus!
}
type EmailVerificationResponse {
status: EmailVerificationStatus!
}
input VerifyEmailInput {
id: ID! @rules(apply: ["required", "exists:users,id"])
hash: String! @rules(apply: ["required", "string"])
}
input RegisterInput {
name: String! @rules(apply: ["required", "string"])
email: String! @rules(apply: ["required", "email", "unique:users,email"])
password: String! @rules(apply: ["required", "confirmed"])
password_confirmation: String! @rules(apply: ["required", "string"])
verification_url: VerificationUrlInput
}
"""
The url used to verify the email address.
Use __ID__ and __HASH__ to inject values.
e.g; `https://my-front-end.com/verify-email?id=__ID__&hash=__HASH__`
"""
input VerificationUrlInput {
url: String! @rules(apply: ["required", "url"])
}
input ForgotPasswordInput {
email: String! @rules(apply: ["required", "email"])
reset_password_url: ResetPasswordUrlInput
}
"""
The url used to reset the password.
Use the `__EMAIL__` and `__TOKEN__` placeholders to inject the reset password email and token.
e.g; `https://my-front-end.com?reset-password?email=__EMAIL__&token=__TOKEN__`
"""
input ResetPasswordUrlInput {
url: String! @rules(apply: ["required", "url"])
}
type ForgotPasswordResponse {
status: ForgotPasswordStatus!
message: String
}
extend type Mutation {
login(input: LoginInput @spread): AccessToken!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\Login")
logout: LogoutResponse! @guard
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\Logout")
register(input: RegisterInput @spread): RegisterResponse!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\Register")
verifyEmail(input: VerifyEmailInput! @spread): EmailVerificationResponse!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\VerifyEmail")
forgotPassword(input: ForgotPasswordInput! @spread): ForgotPasswordResponse!
@field(resolver: "DanielDeWit\\LighthouseSanctum\\GraphQL\\Mutations\\ForgotPassword")
}