34 lines
809 B
Go
34 lines
809 B
Go
package placement_topic
|
|
|
|
import (
|
|
"context"
|
|
|
|
branddomain "haixun-backend/internal/model/brand/domain/usecase"
|
|
topicdomain "haixun-backend/internal/model/placement_topic/domain/usecase"
|
|
"haixun-backend/internal/svc"
|
|
)
|
|
|
|
type WorkflowScope struct {
|
|
TopicID string
|
|
BrandID string
|
|
Topic topicdomain.TopicSummary
|
|
Brand branddomain.BrandSummary
|
|
}
|
|
|
|
func resolveScope(ctx context.Context, svcCtx *svc.ServiceContext, tenantID, uid, topicID string) (*WorkflowScope, error) {
|
|
topic, err := svcCtx.PlacementTopic.Get(ctx, tenantID, uid, topicID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
brand, err := svcCtx.Brand.Get(ctx, tenantID, uid, topic.BrandID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &WorkflowScope{
|
|
TopicID: topic.ID,
|
|
BrandID: topic.BrandID,
|
|
Topic: *topic,
|
|
Brand: *brand,
|
|
}, nil
|
|
}
|