This task consists of implementing the create Tournament complete flow, on three layers:
http handler
service
repository
The handler: (take cmd/api/handlers/player/create.go as reference)
The handler should be a POST handler at the /tournaments path.
I expects a core.TournamentCreateParams request body (see cmd/api/core/tournament.go)
It should then create a domain.Tournament from it with this initial information and consume a TournamentService.Create function sending the request context and the tournament as parameters. The field AccountID can be set with a default value of "1" for now.
If the service returns an error it should be handled with the core.RespondError function
The service: (take pkg/services/player/create.go as reference)
The service receives a context object and the Tournament to be created.
It should populate the Tournament missing information, like the creation time
It should then consume a TournamentRepository.Insert funciton, sending the context and the domain.Tournament to be created
If the repo returns an error it should be handled properly
The repo: (take pkg/repositories/mongo/player(insert.go as reference)
The service receives the context and the domain.Tournament to insert
This task consists of implementing the create Tournament complete flow, on three layers:
The handler: (take cmd/api/handlers/player/create.go as reference)
/tournaments
path.core.TournamentCreateParams
request body (seecmd/api/core/tournament.go
)domain.Tournament
from it with this initial information and consume a TournamentService.Create function sending the request context and the tournament as parameters. The field AccountID can be set with a default value of "1" for now.core.RespondError
functionThe service: (take pkg/services/player/create.go as reference)
The repo: (take pkg/repositories/mongo/player(insert.go as reference)
Notes: