diff --git a/repository/account/account.go b/repository/account/account.go index f24d0e5..1c33031 100644 --- a/repository/account/account.go +++ b/repository/account/account.go @@ -364,12 +364,31 @@ func (r *AccountRepository) ManualDone(ctx context.Context, userID string) error } func (r *AccountRepository) PostLeadTarget(ctx context.Context, req model.LeadTarget) (model.LeadTarget, error) { - - return model.LeadTarget{}, nil + row, err := r.queries.CreateLeadTarget(ctx, sqlcgen.CreateLeadTargetParams{ + Accountid: req.AccountID, + Type: req.Type, + Quizid: req.QuizID, + Target: req.Target, + }) + if err != nil { + return model.LeadTarget{}, err + } + return model.LeadTarget{ + ID: row.ID, + AccountID: row.Accountid, + Type: row.Type, + QuizID: row.Quizid, + Target: row.Target, + Deleted: row.Deleted, + CreatedAt: row.Createdat, + }, nil } func (r *AccountRepository) DeleteLeadTarget(ctx context.Context, id int64) error { - + err := r.queries.DeleteLeadTarget(ctx, id) + if err != nil { + return err + } return nil } @@ -379,6 +398,20 @@ func (r *AccountRepository) GetLeadTarget(ctx context.Context, id int64) (model. } func (r *AccountRepository) UpdateLeadTarget(ctx context.Context, req model.LeadTarget) (model.LeadTarget, error) { - - return model.LeadTarget{}, nil + row, err := r.queries.UpdateLeadTarget(ctx, sqlcgen.UpdateLeadTargetParams{ + Target: req.Target, + ID: req.ID, + }) + if err != nil { + return model.LeadTarget{}, nil + } + return model.LeadTarget{ + ID: row.ID, + AccountID: row.Accountid, + Type: row.Type, + QuizID: row.Quizid, + Target: row.Target, + Deleted: row.Deleted, + CreatedAt: row.Createdat, + }, nil }