diff --git a/repository/account/account.go b/repository/account/account.go index 524b9ba..8c9eac3 100644 --- a/repository/account/account.go +++ b/repository/account/account.go @@ -392,9 +392,28 @@ func (r *AccountRepository) DeleteLeadTarget(ctx context.Context, id int64) erro return nil } -func (r *AccountRepository) GetLeadTarget(ctx context.Context, accountID string) ([]model.LeadTarget, error) { +func (r *AccountRepository) GetLeadTarget(ctx context.Context, accountID string, quizID int32) ([]model.LeadTarget, error) { + rows, err := r.queries.GetLeadTarget(ctx, sqlcgen.GetLeadTargetParams{ + Accountid: accountID, + Quizid: quizID, + }) + if err != nil { + return nil, err + } + var leadTargets []model.LeadTarget + for _, row := range rows { + leadTargets = append(leadTargets, model.LeadTarget{ + ID: row.ID, + AccountID: row.Accountid, + Type: row.Type, + QuizID: row.Quizid, + Target: row.Target, + Deleted: row.Deleted, + CreatedAt: row.Createdat, + }) + } - return []model.LeadTarget{}, nil + return leadTargets, nil } func (r *AccountRepository) UpdateLeadTarget(ctx context.Context, req model.LeadTarget) (model.LeadTarget, error) {