Files
moteva/server/internal/logic/dashboard_logic.go
T

42 lines
913 B
Go
Raw Normal View History

// 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 DashboardLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDashboardLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DashboardLogic {
return &DashboardLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *DashboardLogic) Dashboard() (resp *types.DashboardResponse, err error) {
credits, actions, projects, inspiration, err := l.svcCtx.DesignService.Dashboard(l.ctx)
if err != nil {
return nil, err
}
return &types.DashboardResponse{
Credits: credits,
QuickActions: toAPIQuickActions(actions),
Projects: toAPISummaries(projects),
Inspiration: toAPIInspirations(inspiration),
}, nil
}