api 模板的修改

This commit is contained in:
eson
2023-06-05 17:56:55 +08:00
parent 6c717ce30e
commit ef46164dc3
86 changed files with 1329 additions and 108 deletions

23
server_api/about-us.api Normal file
View File

@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
type request {
// TODO: add members here and delete this comment
Name string `path:"name,options=you|me"` // parameters are auto validated
}
type response {
// TODO: add members here and delete this comment
Message string `json:"message"`
}
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

21
server_api/basic.api Normal file
View File

@@ -0,0 +1,21 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
// response 统一返回码
type response {
Code int `json:"code"`
Message string `json:"msg"`
Data interface{} `json:"data"`
}
// Auth jwt认证认证的安全参数
type Auth {
AccessSecret string `json:"AccessSecret"`
AccessExpire int `json:"AccessExpire"`
}

View File

@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
type request {
// TODO: add members here and delete this comment
Name string `path:"name,options=you|me"` // parameters are auto validated
}
type response {
// TODO: add members here and delete this comment
Message string `json:"message"`
}
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

23
server_api/contact-us.api Normal file
View File

@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
type request {
// TODO: add members here and delete this comment
Name string `path:"name,options=you|me"` // parameters are auto validated
}
type response {
// TODO: add members here and delete this comment
Message string `json:"message"`
}
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

View File

@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: // 个人文件传输
desc: // 图片,pdf,设计logo等
author: ""
email: ""
)
type request {
// TODO: add members here and delete this comment
Name string `path:"name,options=you|me"` // parameters are auto validated
}
type response {
// TODO: add members here and delete this comment
Message string `json:"message"`
}
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

23
server_api/designs.api Normal file
View File

@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
type request {
// TODO: add members here and delete this comment
Name string `path:"name,options=you|me"` // parameters are auto validated
}
type response {
// TODO: add members here and delete this comment
Message string `json:"message"`
}
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

23
server_api/faq.api Normal file
View File

@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
type request {
// TODO: add members here and delete this comment
Name string `path:"name,options=you|me"` // parameters are auto validated
}
type response {
// TODO: add members here and delete this comment
Message string `json:"message"`
}
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

View File

@@ -0,0 +1,102 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
type request {
// TODO: add members here and delete this comment
// Name string `form:"name"` // parameters are auto validated
}
type RequestBasicInfoForm {
FirstName string `form:"first_name,optional" db:"first_name"` // FirstName
LastName string `form:"last_name,optional" db:"last_name"` // LastName
Company string `form:"company,optional" db:"company"` // 公司名称
Mobile string `form:"mobile,optional" db:"mobile"` // 手机号码
Email string `form:"email" db:"email"` // 邮箱
Status int64 `form:"status,optional" db:"status"` // 1正常 0不正常
IsOrderStatusEmail int64 `form:"is_order_status_email,optional" db:"is_order_status_email"` // 订单状态改变时是否接收邮件
IsEmailAdvertisement int64 `form:"is_email_advertisement,optional" db:"is_email_advertisement"` // 是否接收邮件广告
IsOrderStatusPhone int64 `form:"is_order_status_phone,optional" db:"is_order_status_phone"` // 订单状态改变是是否接收电话
IsPhoneAdvertisement int64 `form:"is_phone_advertisement,optional" db:"is_phone_advertisement"` // 是否接收短信广告
IsOpenRender int64 `form:"is_open_render,optional" db:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsLowRendering int64 `form:"is_low_rendering,optional" db:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg int64 `form:"is_remove_bg,optional" db:"is_remove_bg"` // 用户上传logo是否去除背景
NewPassword string `form:"new_password,optional" db:"new_password"` // new_password 如果存在新密码
}
// UserLoginHandler 用户登录请求结构
type RequestUserLogin {
Name string `form:"name"`
Password string `form:"pwd"`
}
// UserLoginHandler 用户登录请求结构
type DataUserLogin {
Token string `json:"token"`
}
// UserBasicInfoHandler 返回data结构
type DataUserBasicInfo {
Id int64 `db:"id"` // ID
FaceId int64 `db:"face_id"` // facebook的userid
Sub int64 `db:"sub"` // google的sub
FirstName string `db:"first_name"` // FirstName
LastName string `db:"last_name"` // LastName
Username string `db:"username"` // 用户名
Company string `db:"company"` // 公司名称
Mobile string `db:"mobile"` // 手机号码
AuthKey string `db:"auth_key"`
PasswordHash string `db:"password_hash"`
VerificationToken string `db:"verification_token"`
PasswordResetToken string `db:"password_reset_token"`
Email string `db:"email"` // 邮箱
Type int64 `db:"type"` // 1普通餐厅 2连锁餐厅
Status int64 `db:"status"` // 1正常 0不正常
IsDel int64 `db:"is_del"` // 是否删除 1删除
CreatedAt int64 `db:"created_at"` // 添加时间
UpdatedAt int64 `db:"updated_at"` // 更新时间
IsOrderStatusEmail int64 `db:"is_order_status_email"` // 订单状态改变时是否接收邮件
IsEmailAdvertisement int64 `db:"is_email_advertisement"` // 是否接收邮件广告
IsOrderStatusPhone int64 `db:"is_order_status_phone"` // 订单状态改变是是否接收电话
IsPhoneAdvertisement int64 `db:"is_phone_advertisement"` // 是否接收短信广告
IsOpenRender int64 `db:"is_open_render"` // 是否打开个性化渲染1开启0关闭
IsThousandFace int64 `db:"is_thousand_face"` // 是否已经存在千人千面1存在0不存在
IsLowRendering int64 `db:"is_low_rendering"` // 是否开启低渲染模型渲染
IsRemoveBg int64 `db:"is_remove_bg"` // 用户上传logo是否去除背景
}
// /user/get-type reponse.data 结构
type DataGetType {
Id int64 `db:"id" json:"key"` // ID
Name string `db:"name" json:"name"` // 餐厅名字
}
service home-user-auth {
@handler UserLoginHandler
post /user/login(RequestUserLogin) returns (response);
@handler UserFontsHandler
get /user/fonts(request) returns (response);
@handler GetTypeHandler
get /user/get-type(request) returns (response);
@handler UserSaveBasicInfoHandler
post /user/basic-info(RequestBasicInfoForm) returns (response);
}
@server(
jwt: Auth
)
service home-user-auth {
@handler UserBasicInfoHandler
get /user/basic-info(request) returns (response);
}

23
server_api/orders.api Normal file
View File

@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
type request {
// TODO: add members here and delete this comment
Name string `path:"name,options=you|me"` // parameters are auto validated
}
type response {
// TODO: add members here and delete this comment
Message string `json:"message"`
}
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

21
server_api/product.api Normal file
View File

@@ -0,0 +1,21 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
type GetProductListReq {
// TODO: add members here and delete this comment
Cid uint32 `form:"cid"`
Size uint32 `form:"size"`
Page uint32 `form:"page"`
IsDemo uint32 `form:"is_demo" , options=0|1"`
}
service product {
@handler GetProductListHandler
get /product/list(GetProductListReq) returns (response);
}

23
server_api/profile.api Normal file
View File

@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
type request {
// TODO: add members here and delete this comment
Name string `path:"name,options=you|me"` // parameters are auto validated
}
type response {
// TODO: add members here and delete this comment
Message string `json:"message"`
}
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

View File

@@ -0,0 +1,23 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
type request {
// TODO: add members here and delete this comment
Name string `path:"name,options=you|me"` // parameters are auto validated
}
type response {
// TODO: add members here and delete this comment
Message string `json:"message"`
}
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}