43 lines
1.0 KiB
Plaintext
43 lines
1.0 KiB
Plaintext
syntax = "v1"
|
|
|
|
type (
|
|
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/index/product
|
|
)
|
|
service index-api {
|
|
@handler getProductById
|
|
get /:productId (GetProductByIdReq) returns (GetProductByIdResp)
|
|
|
|
@handler getProductList
|
|
get /list (GetProductListReq) returns (GetProductListResp)
|
|
}
|
|
|