thread-master/apps/backend/internal/logic/radar/delete_archived_watch_logic.go

38 lines
958 B
Go
Raw Normal View History

2026-08-13 02:22:24 +00:00
package radar
import (
"context"
"apps/backend/internal/svc"
"apps/backend/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteArchivedWatchLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDeleteArchivedWatchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteArchivedWatchLogic {
return &DeleteArchivedWatchLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// DeleteArchivedWatch permanently removes only an already archived watch.
// Its sweeps and opportunities remain available as historical records.
func (l *DeleteArchivedWatchLogic) DeleteArchivedWatch(req *types.WatchIdReq) (*types.OkData, error) {
uid, err := ownerUID(l.ctx)
if err != nil {
return nil, err
}
if err := l.svcCtx.Radar.DeleteArchivedWatch(l.ctx, uid, req.Id); err != nil {
return nil, err
}
return &types.OkData{Ok: true, Message: "archived watch deleted"}, nil
}