Skip to content

Commit

Permalink
chore: Add contest id to response after creation
Browse files Browse the repository at this point in the history
  • Loading branch information
jus1d committed Jan 18, 2025
1 parent fbc6869 commit 51bb8f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/app/handler/contests.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ func (h *Handler) CreateContest(c echo.Context) error {
}
}

return c.NoContent(http.StatusCreated)
return c.JSON(http.StatusCreated, response.ContestID{
ID: contest.ID,
})
}

func (h *Handler) GetContestByID(c echo.Context) error {
Expand Down
4 changes: 4 additions & 0 deletions internal/app/handler/dto/response/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package response

import "time"

type ContestID struct {
ID int32 `json:"id"`
}

type ContestDetailed struct {
ID int32 `json:"id"`
CreatorID int32 `json:"creator_id"`
Expand Down

0 comments on commit 51bb8f8

Please sign in to comment.