feat(tester): add UpdateParticipant endpoint
This commit is contained in:
parent
e1720e7f82
commit
dd87d63860
8 changed files with 45 additions and 1 deletions
|
@ -228,3 +228,19 @@ func (r *ContestRepository) UpdateContest(ctx context.Context, id int32, contest
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
const (
|
||||
updateParticipantQuery = "UPDATE participants SET name = COALESCE(?, name) WHERE id = ?"
|
||||
)
|
||||
|
||||
func (r *ContestRepository) UpdateParticipant(ctx context.Context, id int32, participantUpdate models.ParticipantUpdate) error {
|
||||
const op = "ContestRepository.UpdateParticipant"
|
||||
|
||||
query := r.db.Rebind(updateParticipantQuery)
|
||||
_, err := r.db.ExecContext(ctx, query, participantUpdate.Name, id)
|
||||
if err != nil {
|
||||
return handlePgErr(err, op)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue