init: init refactor
This commit is contained in:
@@ -0,0 +1,231 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "系统服务API"
|
||||
desc: "客户端管理、角色管理、菜单管理、操作日志等HTTP接口"
|
||||
author: "sundynix"
|
||||
version: "v1.0.0"
|
||||
)
|
||||
|
||||
type (
|
||||
// ---------- 通用 ----------
|
||||
IdReq {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
IdsReq {
|
||||
Ids []string `json:"ids"`
|
||||
}
|
||||
PageReq {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
Keyword string `json:"keyword,optional"`
|
||||
}
|
||||
// ---------- 客户端 ----------
|
||||
ClientReq {
|
||||
ClientId string `json:"clientId"`
|
||||
Name string `json:"name"`
|
||||
GrantType string `json:"grantType,optional"`
|
||||
AdditionalInfo string `json:"additionalInfo,optional"`
|
||||
ActiveTimeout int64 `json:"activeTimeout,optional"`
|
||||
}
|
||||
ClientUpdateReq {
|
||||
Id string `json:"id"`
|
||||
ClientId string `json:"clientId,optional"`
|
||||
Name string `json:"name,optional"`
|
||||
GrantType string `json:"grantType,optional"`
|
||||
AdditionalInfo string `json:"additionalInfo,optional"`
|
||||
ActiveTimeout int64 `json:"activeTimeout,optional"`
|
||||
}
|
||||
ClientListReq {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
Name string `json:"name,optional"`
|
||||
}
|
||||
// ---------- 角色 ----------
|
||||
RoleReq {
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Sort int `json:"sort,optional"`
|
||||
MenuIds []string `json:"menuIds,optional"`
|
||||
}
|
||||
RoleUpdateReq {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name,optional"`
|
||||
Code string `json:"code,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
MenuIds []string `json:"menuIds,optional"`
|
||||
}
|
||||
RoleListReq {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
Name string `json:"name,optional"`
|
||||
}
|
||||
// ---------- 菜单 ----------
|
||||
MenuReq {
|
||||
ParentId string `json:"parentId,optional"`
|
||||
Category int `json:"category,optional"`
|
||||
Name string `json:"name"`
|
||||
Title string `json:"title,optional"`
|
||||
Code string `json:"code,optional"`
|
||||
Path string `json:"path,optional"`
|
||||
Permission string `json:"permission,optional"`
|
||||
Locale string `json:"locale,optional"`
|
||||
Icon string `json:"icon,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
}
|
||||
MenuUpdateReq {
|
||||
Id string `json:"id"`
|
||||
ParentId string `json:"parentId,optional"`
|
||||
Category int `json:"category,optional"`
|
||||
Name string `json:"name,optional"`
|
||||
Title string `json:"title,optional"`
|
||||
Code string `json:"code,optional"`
|
||||
Path string `json:"path,optional"`
|
||||
Permission string `json:"permission,optional"`
|
||||
Locale string `json:"locale,optional"`
|
||||
Icon string `json:"icon,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
}
|
||||
// ---------- 操作日志 ----------
|
||||
OperationRecordListReq {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
Method string `json:"method,optional"`
|
||||
Path string `json:"path,optional"`
|
||||
Status int `json:"status,optional"`
|
||||
}
|
||||
// ---------- 字典 ----------
|
||||
DictReq {
|
||||
Type string `json:"type"`
|
||||
Label string `json:"label"`
|
||||
Value string `json:"value"`
|
||||
Sort int `json:"sort,optional"`
|
||||
Desc string `json:"desc,optional"`
|
||||
}
|
||||
DictUpdateReq {
|
||||
Id string `json:"id"`
|
||||
Type string `json:"type,optional"`
|
||||
Label string `json:"label,optional"`
|
||||
Value string `json:"value,optional"`
|
||||
Sort int `json:"sort,optional"`
|
||||
Desc string `json:"desc,optional"`
|
||||
}
|
||||
DictListReq {
|
||||
Current int `json:"current,optional"`
|
||||
PageSize int `json:"pageSize,optional"`
|
||||
Type string `json:"type,optional"`
|
||||
}
|
||||
)
|
||||
|
||||
// ========== 需要鉴权的接口 ==========
|
||||
@server (
|
||||
prefix: /api/sys
|
||||
group: client
|
||||
jwt: Auth
|
||||
)
|
||||
service system-api {
|
||||
@doc "创建客户端"
|
||||
@handler CreateClient
|
||||
post /client/create (ClientReq)
|
||||
|
||||
@doc "更新客户端"
|
||||
@handler UpdateClient
|
||||
put /client/update (ClientUpdateReq)
|
||||
|
||||
@doc "删除客户端"
|
||||
@handler DeleteClient
|
||||
delete /client/delete (IdsReq)
|
||||
|
||||
@doc "客户端列表"
|
||||
@handler GetClientList
|
||||
post /client/list (ClientListReq)
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: /api/sys
|
||||
group: role
|
||||
jwt: Auth
|
||||
)
|
||||
service system-api {
|
||||
@doc "创建角色"
|
||||
@handler CreateRole
|
||||
post /role/create (RoleReq)
|
||||
|
||||
@doc "更新角色"
|
||||
@handler UpdateRole
|
||||
put /role/update (RoleUpdateReq)
|
||||
|
||||
@doc "删除角色"
|
||||
@handler DeleteRole
|
||||
delete /role/delete (IdsReq)
|
||||
|
||||
@doc "角色列表"
|
||||
@handler GetRoleList
|
||||
post /role/list (RoleListReq)
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: /api/sys
|
||||
group: menu
|
||||
jwt: Auth
|
||||
)
|
||||
service system-api {
|
||||
@doc "创建菜单"
|
||||
@handler CreateMenu
|
||||
post /menu/create (MenuReq)
|
||||
|
||||
@doc "更新菜单"
|
||||
@handler UpdateMenu
|
||||
put /menu/update (MenuUpdateReq)
|
||||
|
||||
@doc "删除菜单"
|
||||
@handler DeleteMenu
|
||||
delete /menu/delete (IdsReq)
|
||||
|
||||
@doc "菜单列表(树形)"
|
||||
@handler GetMenuList
|
||||
get /menu/list
|
||||
|
||||
@doc "根据角色获取菜单"
|
||||
@handler GetMenuByRole
|
||||
post /menu/byRole (IdReq)
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: /api/sys
|
||||
group: operationRecord
|
||||
jwt: Auth
|
||||
)
|
||||
service system-api {
|
||||
@doc "操作日志列表"
|
||||
@handler GetOperationRecordList
|
||||
post /log/list (OperationRecordListReq)
|
||||
|
||||
@doc "删除操作日志"
|
||||
@handler DeleteOperationRecord
|
||||
delete /log/delete (IdsReq)
|
||||
}
|
||||
|
||||
@server (
|
||||
prefix: /api/sys
|
||||
group: dict
|
||||
jwt: Auth
|
||||
)
|
||||
service system-api {
|
||||
@doc "创建字典"
|
||||
@handler CreateDict
|
||||
post /dict/create (DictReq)
|
||||
|
||||
@doc "更新字典"
|
||||
@handler UpdateDict
|
||||
put /dict/update (DictUpdateReq)
|
||||
|
||||
@doc "删除字典"
|
||||
@handler DeleteDict
|
||||
delete /dict/delete (IdsReq)
|
||||
|
||||
@doc "字典列表"
|
||||
@handler GetDictList
|
||||
post /dict/list (DictListReq)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user