2023-07-24 09:22:06 +00:00
|
|
|
syntax = "v1"
|
|
|
|
|
|
|
|
info (
|
|
|
|
title: // TODO: add title
|
|
|
|
desc: // TODO: add description
|
|
|
|
author: ""
|
|
|
|
email: ""
|
|
|
|
)
|
|
|
|
|
|
|
|
import "basic.api"
|
|
|
|
|
|
|
|
service auth {
|
|
|
|
@handler UserLoginHandler
|
|
|
|
post /api/auth/login(RequestUserLogin) returns (response);
|
2023-08-27 15:54:28 +00:00
|
|
|
|
2023-08-24 03:47:22 +00:00
|
|
|
@handler UserRegisterHandler
|
|
|
|
post /api/auth/register(RequestUserRegister) returns (response);
|
2023-08-27 15:54:28 +00:00
|
|
|
|
2023-07-24 09:22:06 +00:00
|
|
|
@handler AcceptCookieHandler
|
2023-07-24 11:17:02 +00:00
|
|
|
post /api/auth/accept-cookie(request) returns (response);
|
2023-08-27 15:54:28 +00:00
|
|
|
|
2023-07-24 09:22:06 +00:00
|
|
|
@handler UserGoogleLoginHandler
|
2023-07-24 11:17:02 +00:00
|
|
|
get /api/auth/oauth2/login/google(RequestGoogleLogin) returns (response);
|
2023-08-27 15:54:28 +00:00
|
|
|
|
2023-07-26 16:03:38 +00:00
|
|
|
@handler UserEmailConfirmationHandler
|
|
|
|
get /api/auth/email/confirmation(RequestEmailConfirmation) returns (response);
|
2023-08-27 15:54:28 +00:00
|
|
|
|
2023-07-24 09:22:06 +00:00
|
|
|
@handler UserEmailRegisterHandler
|
2023-08-11 09:39:18 +00:00
|
|
|
post /api/auth/oauth2/register(RequestEmailRegister) returns (response);
|
2023-08-27 15:54:28 +00:00
|
|
|
|
2023-08-11 09:39:18 +00:00
|
|
|
@handler UserResetTokenHandler
|
|
|
|
get /api/auth/reset/token(RequestUserResetToken) returns (response);
|
2023-08-27 15:54:28 +00:00
|
|
|
|
2023-08-11 09:39:18 +00:00
|
|
|
@handler UserResetPasswordHandler
|
2023-08-14 06:09:38 +00:00
|
|
|
post /api/auth/reset/password(RequestUserResetPassword) returns (response);
|
2023-07-24 09:22:06 +00:00
|
|
|
}
|
|
|
|
|
2023-08-11 09:39:18 +00:00
|
|
|
type (
|
2023-08-24 03:47:22 +00:00
|
|
|
|
2023-08-11 09:39:18 +00:00
|
|
|
// UserAddAddressHandler 用户登录请求结构
|
|
|
|
RequestUserLogin {
|
|
|
|
Email string `json:"email"`
|
|
|
|
Password string `json:"password"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// UserLoginHandler 用户登录请求结构
|
|
|
|
DataUserLogin {
|
|
|
|
Token string `json:"token"` // 登录jwt token
|
2023-08-23 08:51:47 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
// UserAddAddressHandler 用户登录请求结构
|
|
|
|
RequestUserRegister {
|
2023-08-27 15:54:28 +00:00
|
|
|
Wid string `json:"wid"` // websocket的id
|
2023-08-24 03:47:22 +00:00
|
|
|
|
|
|
|
FirstName string `json:"first_name"` // 首名
|
|
|
|
LastName string `json:"last_name"` // 名
|
|
|
|
Resetaurant string `json:"resetaurant"` // 餐厅类型
|
|
|
|
Email string `json:"email"` // email
|
|
|
|
Password string `json:"password"` // 密码
|
2023-08-23 08:51:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// UserLoginHandler 用户登录请求结构
|
2023-08-24 03:47:22 +00:00
|
|
|
// DataUserRegister{
|
|
|
|
// Token string `json:"token"` // 登录jwt token
|
|
|
|
// }
|
2023-08-11 09:39:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
|
|
|
|
// RequestUserResetToken 请求重置token, 一定不为null
|
|
|
|
RequestUserResetToken {
|
|
|
|
Wid string `json:"wid"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// UserResetTokenHandler 返回重置token
|
|
|
|
DataResetToken {
|
|
|
|
ResetToken string `json:"reset_token"` // 获取重置的token
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestUserResetPassword 重置密码
|
|
|
|
RequestUserResetPassword {
|
|
|
|
ResetToken string `json:"reset_token"` // 附带重置token, 确保流程唯一
|
|
|
|
Password string `json:"password"` // 附带的hash密码
|
|
|
|
}
|
|
|
|
)
|
2023-07-24 09:22:06 +00:00
|
|
|
|
|
|
|
type RequestGoogleLogin {
|
|
|
|
Code string `form:"code"`
|
|
|
|
Scope string `form:"scope"`
|
|
|
|
AuthUser string `form:"authuser"`
|
|
|
|
Prompt string `form:"prompt"`
|
2023-07-26 16:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type RequestEmailConfirmation {
|
2023-07-27 08:48:43 +00:00
|
|
|
Token string `query:"token"` // 操作Token
|
2023-07-24 09:22:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type RequestEmailRegister {
|
2023-08-11 04:07:26 +00:00
|
|
|
Wid string `json:"wid"`
|
2023-08-24 03:47:22 +00:00
|
|
|
Email string `json:"email"`
|
2023-07-24 09:22:06 +00:00
|
|
|
RegisterToken string `json:"register_token"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// DataGuest 游客获取toekn请求结构
|
|
|
|
type DataGuest {
|
|
|
|
Token string `json:"token"` // 登录jwt token
|
|
|
|
}
|