47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
"code.30cm.net/digimon/app-cloudep-permission-server/pkg/domain/entity"
|
|
"code.30cm.net/digimon/app-cloudep-permission-server/pkg/domain/permission"
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
)
|
|
|
|
type PermissionRepository interface {
|
|
Insert(ctx context.Context, permission entity.Permission) error
|
|
Update(ctx context.Context, id string, req UpdatePermission) error
|
|
Delete(ctx context.Context, id string) error
|
|
GetPermission
|
|
Index
|
|
}
|
|
|
|
type GetPermission interface {
|
|
// GetAll 取得所有權限列表
|
|
GetAll(ctx context.Context, status *permission.Status) ([]entity.Permission, error)
|
|
// GetAllIntoIDMap 以權限 ID 作為鍵取得所有權限的映射
|
|
GetAllIntoIDMap(ctx context.Context, status *permission.Status) (map[string]entity.Permission, error)
|
|
// FindOne 根據查詢條件取得單筆權限資料
|
|
FindOne(ctx context.Context, query PermissionQuery) (entity.Permission, error)
|
|
// FindByNames 根據權限名稱列表查詢權限資料
|
|
FindByNames(ctx context.Context, names []string) ([]entity.Permission, error)
|
|
}
|
|
|
|
type Index interface {
|
|
Index20250214UP(ctx context.Context) (*mongo.Cursor, error)
|
|
}
|
|
|
|
type PermissionQuery struct {
|
|
HTTPMethod string
|
|
HTTPPath string
|
|
}
|
|
|
|
type UpdatePermission struct {
|
|
ParentID *string
|
|
Name *string
|
|
HTTPMethod *string
|
|
HTTPPath *string
|
|
Status *permission.Status
|
|
Type *permission.Type
|
|
}
|