refactor: split backend transport and domain modules

This commit is contained in:
2026-08-14 01:04:21 +08:00
parent acba9624d7
commit e6775f0966
59 changed files with 2733 additions and 1963 deletions
+11
View File
@@ -0,0 +1,11 @@
package dto
import "encoding/json"
type AnnouncementRequest struct {
ID uint `json:"ID"`
Title string `json:"title"`
Content string `json:"content"`
UserID *uint `json:"userID"`
Attachments json.RawMessage `json:"attachments"`
}
+71
View File
@@ -0,0 +1,71 @@
package dto
import "time"
type APIRequest struct {
ID uint `json:"ID"`
Path string `json:"path"`
Description string `json:"description"`
APIGroup string `json:"apiGroup"`
Method string `json:"method"`
}
type APIListRequest struct {
Page int `json:"page"`
PageSize int `json:"pageSize"`
Path string `json:"path"`
Description string `json:"description"`
APIGroup string `json:"apiGroup"`
Method string `json:"method"`
}
type APIResponse struct {
ID uint `json:"ID"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
DeletedAt any `json:"DeletedAt"`
Path string `json:"path"`
Description string `json:"description"`
APIGroup string `json:"apiGroup"`
Method string `json:"method"`
}
type DeleteAPIRequest struct {
ID uint `json:"ID"`
}
type DeleteAPIsRequest struct {
IDs []uint `json:"ids"`
}
type GetAPIRequest struct {
ID uint `json:"id"`
}
type SetAPIRolesRequest struct {
APIID uint `json:"apiId"`
AuthorityIDs []uint `json:"authorityIds"`
}
type IgnoreAPIRequest struct {
Path string `json:"path"`
Method string `json:"method"`
Flag bool `json:"flag"`
}
type ApplyAPISyncRequest struct {
NewAPIs []APIRequest `json:"newApis"`
DeleteAPIs []APIRequest `json:"deleteApis"`
}
type PolicyPathRequest struct {
Path string `json:"path"`
Method string `json:"method"`
}
type SetPolicyPathsRequest struct {
AuthorityID uint `json:"authorityId"`
Infos []PolicyPathRequest `json:"casbinInfos"`
}
type GetPolicyPathsRequest struct {
AuthorityID uint `json:"authorityId"`
}
type APISyncResponse struct {
NewAPIs []*APIResponse `json:"newApis"`
DeleteAPIs []*APIResponse `json:"deleteApis"`
IgnoreAPIs []*APIResponse `json:"ignoreApis"`
}
+35
View File
@@ -0,0 +1,35 @@
package dto
type AuthorityRequest struct {
AuthorityID uint `json:"authorityId"`
AuthorityName string `json:"authorityName"`
ParentID *uint `json:"parentId"`
DataScope int `json:"dataScope"`
DefaultRouter string `json:"defaultRouter"`
}
type CopyAuthorityRequest struct {
Authority AuthorityRequest `json:"authority"`
OldAuthorityID uint `json:"oldAuthorityId"`
}
type DeleteAuthorityRequest struct {
AuthorityID uint `json:"authorityId"`
}
type SetRoleUsersRequest struct {
AuthorityID uint `json:"authorityId"`
UserIDs []uint `json:"userIds"`
}
type SetDataScopeRequest struct {
AuthorityID uint `json:"authorityId"`
DataScope int `json:"dataScope"`
DepartmentIDs []uint `json:"deptIds"`
}
type AuthorityResponse struct {
AuthorityID uint `json:"authorityId"`
AuthorityName string `json:"authorityName"`
ParentID *uint `json:"parentId"`
DataScope int `json:"dataScope"`
DefaultRouter string `json:"defaultRouter"`
}
+7
View File
@@ -0,0 +1,7 @@
package dto
type SendEmailRequest struct {
To string `json:"to"`
Subject string `json:"subject"`
Body string `json:"body"`
}
+110
View File
@@ -0,0 +1,110 @@
package dto
type MenuMetaRequest struct {
ActiveName string `json:"activeName"`
KeepAlive bool `json:"keepAlive"`
DefaultMenu bool `json:"defaultMenu"`
Title string `json:"title"`
Icon string `json:"icon"`
CloseTab bool `json:"closeTab"`
TransitionType string `json:"transitionType"`
}
type MenuButtonRequest struct {
ID uint `json:"ID"`
Name string `json:"name"`
Description string `json:"desc"`
}
type MenuParameterRequest struct {
ID uint `json:"ID"`
Type string `json:"type"`
Key string `json:"key"`
Value string `json:"value"`
}
type MenuRequest struct {
ID uint `json:"ID"`
ParentID uint `json:"parentId"`
Path string `json:"path"`
Name string `json:"name"`
Hidden bool `json:"hidden"`
Component string `json:"component"`
Sort int `json:"sort"`
Meta MenuMetaRequest `json:"meta"`
MenuButtons []MenuButtonRequest `json:"menuBtn"`
Parameters []MenuParameterRequest `json:"parameters"`
}
type DeleteMenuRequest struct {
ID uint `json:"ID"`
}
type GetMenuRequest struct {
ID uint `json:"id"`
}
type AuthorityMenuItemRequest struct {
ID uint `json:"ID"`
}
type SetAuthorityMenusRequest struct {
AuthorityID uint `json:"authorityId"`
Menus []AuthorityMenuItemRequest `json:"menus"`
}
type GetAuthorityMenusRequest struct {
AuthorityID uint `json:"authorityId"`
}
type SetMenuRolesRequest struct {
MenuID uint `json:"menuId"`
AuthorityIDs []uint `json:"authorityIds"`
}
type MenuMetaResponse struct {
ActiveName string `json:"activeName"`
KeepAlive bool `json:"keepAlive"`
DefaultMenu bool `json:"defaultMenu"`
Title string `json:"title"`
Icon string `json:"icon"`
CloseTab bool `json:"closeTab"`
TransitionType string `json:"transitionType"`
}
type MenuButtonResponse struct {
ID uint `json:"ID"`
Name string `json:"name"`
Description string `json:"desc"`
SysBaseMenuID uint `json:"sysBaseMenuID"`
}
type MenuParameterResponse struct {
ID uint `json:"ID"`
SysBaseMenuID uint `json:"SysBaseMenuID"`
Type string `json:"type"`
Key string `json:"key"`
Value string `json:"value"`
}
type MenuResponse struct {
ID uint `json:"ID"`
ParentID uint `json:"parentId"`
Path string `json:"path"`
Name string `json:"name"`
Hidden bool `json:"hidden"`
Component string `json:"component"`
Sort int `json:"sort"`
Meta MenuMetaResponse `json:"meta"`
Children []*MenuResponse `json:"children"`
Parameters []MenuParameterResponse `json:"parameters"`
MenuButtons []MenuButtonResponse `json:"menuBtn"`
Buttons map[string]uint `json:"btns"`
}
type AuthorityMenuResponse struct {
MenuID uint `json:"menuId"`
AuthorityID uint `json:"authorityId"`
SysBaseMenu *MenuResponse `json:"sysBaseMenu"`
ParentID uint `json:"parentId"`
}
+83
View File
@@ -0,0 +1,83 @@
package dto
import "time"
type DepartmentRequest struct {
ID uint `json:"ID"`
Name string `json:"name"`
ParentID uint `json:"parentId"`
Sort int `json:"sort"`
LeaderID uint `json:"leaderId"`
Status bool `json:"status"`
}
type DepartmentListRequest struct {
Name string `json:"name"`
}
type DeleteDepartmentRequest struct {
ID uint `json:"ID"`
}
type SetDepartmentUsersRequest struct {
DepartmentID uint `json:"deptId"`
UserIDs []uint `json:"userIds"`
}
type SetUserDepartmentsRequest struct {
ID uint `json:"ID"`
DepartmentIDs []uint `json:"deptIds"`
Primary uint `json:"primaryDeptId"`
}
type DepartmentResponse struct {
ID uint `json:"ID"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
DeletedAt any `json:"DeletedAt"`
Name string `json:"name"`
ParentID uint `json:"parentId"`
Ancestors string `json:"ancestors"`
Sort int `json:"sort"`
LeaderID uint `json:"leaderId"`
Leader any `json:"leader"`
Status bool `json:"status"`
Children []*DepartmentResponse `json:"children"`
NamePath string `json:"namePath"`
}
type PositionRequest struct {
ID uint `json:"ID"`
Name string `json:"name"`
Code string `json:"code"`
Sort int `json:"sort"`
Status bool `json:"status"`
Remark string `json:"remark"`
}
type PositionListRequest struct {
Page int `json:"page"`
PageSize int `json:"pageSize"`
Name string `json:"name"`
Code string `json:"code"`
}
type DeletePositionRequest struct {
ID uint `json:"ID"`
}
type SetPositionUsersRequest struct {
PositionID uint `json:"positionId"`
UserIDs []uint `json:"userIds"`
}
type SetUserPositionsRequest struct {
ID uint `json:"ID"`
PositionIDs []uint `json:"positionIds"`
}
type PositionResponse struct {
ID uint `json:"ID"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt time.Time `json:"UpdatedAt"`
DeletedAt any `json:"DeletedAt"`
Name string `json:"name"`
Code string `json:"code"`
Sort int `json:"sort"`
Status bool `json:"status"`
Remark string `json:"remark"`
}
+12
View File
@@ -0,0 +1,12 @@
package dto
type GetAuthorityButtonsRequest struct {
MenuID uint `json:"menuID"`
AuthorityID uint `json:"authorityId"`
}
type SetAuthorityButtonsRequest struct {
MenuID uint `json:"menuID"`
AuthorityID uint `json:"authorityId"`
Selected []uint `json:"selected"`
}
+28
View File
@@ -0,0 +1,28 @@
package dto
import "encoding/json"
type TaskRequest struct {
ID uint `json:"ID"`
Name string `json:"name"`
Description string `json:"description"`
Spec string `json:"spec"`
WithSeconds bool `json:"withSeconds"`
ExecutorType string `json:"executorType"`
MethodName string `json:"methodName"`
Params json.RawMessage `json:"params"`
HTTPURL string `json:"httpUrl"`
HTTPMethod string `json:"httpMethod"`
HTTPHeader json.RawMessage `json:"httpHeader"`
HTTPBody string `json:"httpBody"`
HTTPAllowPrivate bool `json:"httpAllowPrivate"`
Enabled bool `json:"enabled"`
}
type DeleteTaskRequest struct {
ID uint `json:"ID"`
}
type ToggleTaskRequest struct {
ID uint `json:"ID"`
Enabled bool `json:"enabled"`
}