add tickets api

This commit is contained in:
2026-09-18 16:08:35 +07:00
parent 32191529a5
commit 1be16d706e
11 changed files with 778 additions and 185 deletions
+5
View File
@@ -22,6 +22,7 @@ import (
"evening_detective_server/internal/repos/screen_sessions_repo"
"evening_detective_server/internal/repos/team_answers_repo"
"evening_detective_server/internal/repos/teams_repo"
"evening_detective_server/internal/repos/tickets_repo"
"evening_detective_server/internal/repos/users_repo"
"evening_detective_server/internal/services/answer_service"
"evening_detective_server/internal/services/file_service"
@@ -32,6 +33,7 @@ import (
"evening_detective_server/internal/services/participation_service"
"evening_detective_server/internal/services/scenarios_service"
"evening_detective_server/internal/services/team_service"
"evening_detective_server/internal/services/ticket_service"
"evening_detective_server/internal/services/ui_service"
"evening_detective_server/internal/services/users_service"
proto "evening_detective_server/proto"
@@ -130,6 +132,7 @@ func main() {
)
gameRepo := games_repo.NewGamesRepo(dbpool)
teamRepo := teams_repo.NewTeamsRepo(dbpool)
ticketRepo := tickets_repo.New(dbpool)
storyteller := storytelling.NewStory(cleaner)
actionsRepo := actions_repo.NewActionsRepo(dbpool)
applicationsRepo := applications_repo.NewApplicationsRepo(dbpool)
@@ -155,6 +158,7 @@ func main() {
teamService := team_service.NewTeamService(gameRepo, teamRepo, passwordGenerator, os.Getenv("APP_BASE_URL"), emailSender)
participationService := participation_service.NewParticipationService(teamRepo, os.Getenv("APP_BASE_URL"))
ticketService := ticket_service.New(ticketRepo, os.Getenv("APP_BASE_URL"))
go participationService.RunParticipationEmails(context.Background(), emailSender, os.Getenv("PARTICIPATION_SECRET"), os.Getenv("GAME_TIMEZONE"))
go reviewService.RunReviewReminderEmails(context.Background(), emailSender)
@@ -211,6 +215,7 @@ func main() {
answerService,
reviewService,
teamService,
ticketService,
participationService,
screenRepo,
mapRepo,
@@ -792,6 +792,51 @@
]
}
},
"/api/games/{gameId}/tickets": {
"post": {
"summary": "Выпустить билеты на игру",
"operationId": "EveningDetectiveServer_IssueGameTickets",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/evening_detective_serverIssueGameTicketsRsp"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "gameId",
"in": "path",
"required": true,
"type": "integer",
"format": "int32"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/EveningDetectiveServerIssueGameTicketsBody"
}
}
],
"tags": [
"Билеты"
],
"security": [
{
"": []
}
]
}
},
"/api/games/{id}": {
"get": {
"summary": "Получить игру",
@@ -2980,6 +3025,15 @@
}
}
},
"EveningDetectiveServerIssueGameTicketsBody": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "int32"
}
}
},
"EveningDetectiveServerModerateGameReviewBody": {
"type": "object",
"properties": {
@@ -3976,6 +4030,21 @@
}
}
},
"evening_detective_serverIssueGameTicketsRsp": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"tickets": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/evening_detective_serverTicket"
}
}
}
},
"evening_detective_serverKey": {
"type": "object",
"properties": {
@@ -4571,6 +4640,18 @@
},
"description": "Строка итоговой таблицы: команда, баллы по вопросам, сумма и место."
},
"evening_detective_serverTicket": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"url": {
"type": "string"
}
}
},
"evening_detective_serverUnbindScreenRsp": {
"type": "object",
"properties": {