first commit
This commit is contained in:
154
apps/admin/admin.api
Normal file
154
apps/admin/admin.api
Normal file
@@ -0,0 +1,154 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "Enterprise API"
|
||||
desc: "API for managing enterprise reviews and authentication"
|
||||
author: "Your Name"
|
||||
date: "2024-09-25"
|
||||
)
|
||||
|
||||
type (
|
||||
LoginReq {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
LoginResp {}
|
||||
)
|
||||
|
||||
type (
|
||||
GetPendingEnterpriseReq {
|
||||
Page int64 `form:"page"`
|
||||
PageSize int64 `form:"pageSize"`
|
||||
}
|
||||
GetPendingEnterpriseResp {
|
||||
Total int64 `json:"total"`
|
||||
List []EnterpriseItem `json:"list"`
|
||||
}
|
||||
ReviewEnterpriseReq {
|
||||
EnterpriseID int64 `json:"enterpriseId"`
|
||||
Status string `json:"status"`
|
||||
Remarks string `json:"remarks"`
|
||||
}
|
||||
ReviewEnterpriseResp {}
|
||||
)
|
||||
|
||||
type EnterpriseItem {
|
||||
Id int64 `json:"id"` // 企业ID
|
||||
EnterpriseName string `json:"enterpriseName"` // 企业名称
|
||||
CreditCode string `json:"creditCode"` // 企业信用代码
|
||||
LegalPerson string `json:"legalPerson"` // 法人
|
||||
EnterpriseContact string `json:"enterpriseContact"` // 企业联系方式
|
||||
AuthStatus string `json:"authStatus"` // 认证状态
|
||||
BusinessLicense string `json:"businessLicense"`
|
||||
CreatedAt string `json:"createdAt"` // 创建时间
|
||||
UpdatedAt string `json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
type (
|
||||
UserInfoResp {
|
||||
username string `json:"username"`
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
group: auth
|
||||
prefix: /api/admin/auth
|
||||
)
|
||||
service admin-api {
|
||||
@handler login
|
||||
post /login (LoginReq) returns (LoginResp)
|
||||
}
|
||||
|
||||
@server (
|
||||
group: user
|
||||
prefix: /api/admin/user
|
||||
middleware: AuthInterceptor
|
||||
)
|
||||
service admin-api {
|
||||
@handler getUserInfo
|
||||
get /info returns (UserInfoResp)
|
||||
}
|
||||
|
||||
@server (
|
||||
group: review
|
||||
prefix: /api/admin/enterprise
|
||||
middleware: AuthInterceptor
|
||||
)
|
||||
service admin-api {
|
||||
@handler reviewEnterprise
|
||||
post /review (ReviewEnterpriseReq) returns (ReviewEnterpriseResp)
|
||||
|
||||
@handler getPendingEnterprise
|
||||
get /pending (GetPendingEnterpriseReq) returns (GetPendingEnterpriseResp)
|
||||
}
|
||||
|
||||
type (
|
||||
CreateProductReq {
|
||||
ProductName string `json:"productName"`
|
||||
ProductCode string `json:"productCode"`
|
||||
ProductDescription string `json:"productDescription"`
|
||||
ProductContent string `json:"productContent"`
|
||||
ProductGroup string `json:"productGroup"`
|
||||
ProductPrice float64 `json:"productPrice"`
|
||||
}
|
||||
UpdateProductReq {
|
||||
ProductId int64 `json:"productId"`
|
||||
ProductName string `json:"productName"`
|
||||
ProductCode string `json:"productCode"`
|
||||
ProductDescription string `json:"productDescription"`
|
||||
ProductContent string `json:"productContent"`
|
||||
ProductGroup string `json:"productGroup"`
|
||||
ProductPrice float64 `json:"productPrice"`
|
||||
}
|
||||
DeleteProductReq {
|
||||
ProductId int64 `json:"productId"`
|
||||
}
|
||||
GetProductByIdReq {
|
||||
ProductId int64 `path:"productId"`
|
||||
}
|
||||
GetProductByIdResp {
|
||||
ProductItem
|
||||
}
|
||||
GetProductListReq {
|
||||
Page int64 `form:"page"`
|
||||
PageSize int64 `form:"pageSize"`
|
||||
}
|
||||
GetProductListResp {
|
||||
Total int64 `json:"total"`
|
||||
List []ProductItem `json:"list"`
|
||||
}
|
||||
ProductItem {
|
||||
ProductId int64 `json:"productId"`
|
||||
ProductName string `json:"productName"`
|
||||
ProductCode string `json:"productCode"`
|
||||
ProductDescription string `json:"productDescription"`
|
||||
ProductContent string `json:"productContent"`
|
||||
ProductGroup string `json:"productGroup"`
|
||||
ProductPrice float64 `json:"productPrice"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
group: product
|
||||
prefix: /api/admin/product
|
||||
middleware: AuthInterceptor
|
||||
)
|
||||
service admin-api {
|
||||
@handler createProduct
|
||||
post /create (CreateProductReq)
|
||||
|
||||
@handler updateProduct
|
||||
post /update (UpdateProductReq)
|
||||
|
||||
@handler deleteProduct
|
||||
post /delete (DeleteProductReq)
|
||||
|
||||
@handler getProductById
|
||||
get /:productId (GetProductByIdReq) returns (GetProductByIdResp)
|
||||
|
||||
@handler getProductList
|
||||
get /list (GetProductListReq) returns (GetProductListResp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user