36 lines
839 B
Go
36 lines
839 B
Go
|
|
// Code scaffolded by goctl. Safe to edit.
|
||
|
|
// goctl 1.10.1
|
||
|
|
|
||
|
|
package logic
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
|
||
|
|
"img_infinite_canvas/internal/svc"
|
||
|
|
"img_infinite_canvas/internal/types"
|
||
|
|
|
||
|
|
"github.com/zeromicro/go-zero/core/logx"
|
||
|
|
)
|
||
|
|
|
||
|
|
type UpsertBrandKitLogic struct {
|
||
|
|
logx.Logger
|
||
|
|
ctx context.Context
|
||
|
|
svcCtx *svc.ServiceContext
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewUpsertBrandKitLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpsertBrandKitLogic {
|
||
|
|
return &UpsertBrandKitLogic{
|
||
|
|
Logger: logx.WithContext(ctx),
|
||
|
|
ctx: ctx,
|
||
|
|
svcCtx: svcCtx,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (l *UpsertBrandKitLogic) UpsertBrandKit(req *types.UpsertBrandKitRequest) (resp *types.BrandKitResponse, err error) {
|
||
|
|
kit, err := l.svcCtx.BrandKitService.Upsert(l.ctx, req.Id, req.Document, req.IsDefault)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return &types.BrandKitResponse{BrandKit: toAPIBrandKit(kit)}, nil
|
||
|
|
}
|