thread-master/backend/internal/logic/setting/delete_setting_logic.go

25 lines
605 B
Go
Raw Normal View History

2026-06-26 08:37:04 +00:00
package setting
import (
"context"
"haixun-backend/internal/svc"
"haixun-backend/internal/types"
)
type DeleteSettingLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDeleteSettingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteSettingLogic {
return &DeleteSettingLogic{ctx: ctx, svcCtx: svcCtx}
}
func (l *DeleteSettingLogic) DeleteSetting(req *types.SettingKeyPath) error {
2026-06-26 16:02:06 +00:00
if err := authorizeSettingAccess(l.ctx, l.svcCtx, req.Scope, req.ScopeID); err != nil {
return err
}
2026-06-26 08:37:04 +00:00
return l.svcCtx.Setting.Delete(l.ctx, req.Scope, req.ScopeID, req.Key)
}