feat(tester): add UpdateContest endpoint
This commit is contained in:
parent
2bc625363d
commit
e1720e7f82
8 changed files with 45 additions and 1 deletions
|
@ -212,3 +212,19 @@ func (r *ContestRepository) ListParticipants(ctx context.Context, contestId int3
|
|||
|
||||
return participants, count, nil
|
||||
}
|
||||
|
||||
const (
|
||||
updateContestQuery = "UPDATE contests SET title = COALESCE(?, title) WHERE id = ?"
|
||||
)
|
||||
|
||||
func (r *ContestRepository) UpdateContest(ctx context.Context, id int32, contestUpdate models.ContestUpdate) error {
|
||||
const op = "ContestRepository.UpdateContest"
|
||||
|
||||
query := r.db.Rebind(updateContestQuery)
|
||||
_, err := r.db.ExecContext(ctx, query, contestUpdate.Title, id)
|
||||
if err != nil {
|
||||
return handlePgErr(err, op)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue