31 lines
735 B
Go
31 lines
735 B
Go
package threads_account
|
|
|
|
import (
|
|
"context"
|
|
|
|
"haixun-backend/internal/svc"
|
|
"haixun-backend/internal/types"
|
|
)
|
|
|
|
type GetThreadsAccountLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewGetThreadsAccountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetThreadsAccountLogic {
|
|
return &GetThreadsAccountLogic{ctx: ctx, svcCtx: svcCtx}
|
|
}
|
|
|
|
func (l *GetThreadsAccountLogic) GetThreadsAccount(req *types.ThreadsAccountPath) (*types.ThreadsAccountData, error) {
|
|
tenantID, uid, err := actorFrom(l.ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
item, err := l.svcCtx.ThreadsAccount.Get(l.ctx, tenantID, uid, req.ID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
out := toThreadsAccountData(*item)
|
|
return &out, nil
|
|
}
|