2025-02-26 08:45:27 +00:00
|
|
|
package usecase
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2025-02-26 15:29:00 +00:00
|
|
|
|
|
|
|
"code.30cm.net/digimon/app-cloudep-permission-server/pkg/domain/permission"
|
2025-02-26 08:45:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type RoleUseCase interface {
|
|
|
|
List(ctx context.Context, param ListQuery) ([]Role, int64, error)
|
|
|
|
All(ctx context.Context, clientID *string) ([]Role, error)
|
|
|
|
GetByID(ctx context.Context, id string) (*Role, error)
|
|
|
|
GetByUID(ctx context.Context, uid string) (*Role, error)
|
|
|
|
Create(ctx context.Context, role CreateRoleReq) error
|
|
|
|
Update(ctx context.Context, id string, data CreateRoleReq) error
|
|
|
|
Delete(ctx context.Context, id string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type ListQuery struct {
|
|
|
|
PageSize int64 // 必填
|
|
|
|
PageIndex int64 // 必填
|
|
|
|
ClientID *string
|
|
|
|
UID *string
|
|
|
|
Name *string
|
|
|
|
Status *permission.Status
|
|
|
|
}
|
|
|
|
|
|
|
|
type Role struct {
|
|
|
|
ID string `json:"id"`
|
|
|
|
Name string `json:"name"` // 角色名稱
|
|
|
|
UID string `json:"uid"`
|
|
|
|
ClientID string `json:"client_id"`
|
|
|
|
Status permission.Status `json:"status"` // 例如 1: 啟用, 0: 停用
|
|
|
|
CreateAt int64 `json:"create_at"`
|
|
|
|
UpdateAt int64 `json:"update_at"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type CreateRoleReq struct {
|
2025-02-26 15:29:00 +00:00
|
|
|
Name string `json:"name"` // 角色名稱
|
|
|
|
UID string `json:"uid"`
|
|
|
|
ClientID string `json:"client_id"`
|
|
|
|
Status permission.Status `json:"status"` // 例如 1: 啟用, 0: 停用
|
2025-02-26 08:45:27 +00:00
|
|
|
}
|