41 lines
937 B
Go
41 lines
937 B
Go
// Code scaffolded by goctl. Safe to edit.
|
|
// goctl 1.10.1
|
|
|
|
package logic
|
|
|
|
import (
|
|
"context"
|
|
|
|
sharingmodule "img_infinite_canvas/internal/modules/sharing"
|
|
"img_infinite_canvas/internal/svc"
|
|
"img_infinite_canvas/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type GetProjectLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewGetProjectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProjectLogic {
|
|
return &GetProjectLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *GetProjectLogic) GetProject(req *types.ProjectIdRequest) (resp *types.ProjectResponse, err error) {
|
|
project, err := l.svcCtx.DesignService.GetProject(l.ctx, req.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if access, ok := sharingmodule.AccessFromContext(l.ctx); ok {
|
|
project = filterSharedProject(project, access)
|
|
}
|
|
|
|
return toProjectResponse(project), nil
|
|
}
|