From 20662dc9daad45eaf9266d2a939b2ff83a51da7a Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Tue, 28 Jul 2026 20:38:03 +0700 Subject: [PATCH] add game --- api/main.proto | 22 +- cmd/evening_detective_server/main.go | 16 +- .../main.swagger.json | 105 +++---- internal/app/server.go | 56 +++- internal/app/team_mapper.go | 10 +- internal/repos/actions_repo/repo.go | 103 +++++++ internal/repos/application.go | 7 + internal/repos/applications_repo/repo.go | 81 ++++++ internal/repos/team.go | 9 +- internal/repos/teams_repo/repo.go | 32 +++ internal/services/game_service/application.go | 6 + .../game_service/application_mapper.go | 21 ++ internal/services/game_service/service.go | 116 +++++++- internal/services/game_service/team.go | 12 +- .../services/scenarios_service/service.go | 11 +- .../20260728015952_create_actions_table.sql | 13 + ...260728020014_create_applications_table.sql | 15 + proto/main.pb.go | 259 ++++++++++-------- proto/main.pb.gw.go | 38 +-- proto/main_grpc.pb.go | 30 +- 20 files changed, 729 insertions(+), 233 deletions(-) create mode 100644 internal/repos/actions_repo/repo.go create mode 100644 internal/repos/application.go create mode 100644 internal/repos/applications_repo/repo.go create mode 100644 internal/services/game_service/application.go create mode 100644 internal/services/game_service/application_mapper.go create mode 100644 migrations/20260728015952_create_actions_table.sql create mode 100644 migrations/20260728020014_create_applications_table.sql diff --git a/api/main.proto b/api/main.proto index 7b6dd82..72994ed 100644 --- a/api/main.proto +++ b/api/main.proto @@ -419,9 +419,9 @@ service EveningDetectiveServer { }; } - rpc GetTeamActions(GetTeamActionsReq) returns (GetTeamActionsRsp) { + rpc GetTeamStory(GetTeamStoryReq) returns (GetTeamStoryRsp) { option (google.api.http) = { - get: "/api/teams/{id}/actions" + get: "/api/teams/{id}/story" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { security: { @@ -749,10 +749,12 @@ message Game { } message Team { - int32 id = 1; - string name = 2; - string status = 3; - string password = 4; + int32 id = 1; + string name = 2; + string status = 3; + string password = 4; + int32 actions_count = 5; + repeated Application applications = 6; } message GetGameReq { @@ -819,14 +821,14 @@ message GiveTeamApplicationsRsp { string error = 1; } -message GetTeamActionsReq { +message GetTeamStoryReq { int64 id = 1; string password = 2; } -message GetTeamActionsRsp { - string error = 1; - repeated Place places = 2; +message GetTeamStoryRsp { + string error = 1; + Story story = 2; } message AddTeamActionReq { diff --git a/cmd/evening_detective_server/main.go b/cmd/evening_detective_server/main.go index 3a3cdce..4eb6c5c 100644 --- a/cmd/evening_detective_server/main.go +++ b/cmd/evening_detective_server/main.go @@ -4,10 +4,14 @@ import ( "context" _ "embed" "evening_detective_server/internal/app" + "evening_detective_server/internal/modules/cleaner" "evening_detective_server/internal/modules/email_sender" "evening_detective_server/internal/modules/file_storage" "evening_detective_server/internal/modules/password_generator" "evening_detective_server/internal/modules/processor_jwt" + "evening_detective_server/internal/modules/storytelling" + "evening_detective_server/internal/repos/actions_repo" + "evening_detective_server/internal/repos/applications_repo" "evening_detective_server/internal/repos/games_repo" "evening_detective_server/internal/repos/refresh_tokens_repo" "evening_detective_server/internal/repos/scenarios_repo" @@ -75,18 +79,28 @@ func main() { } fileService := file_service.NewFileService(fileStorage) scenariosRepo := scenarios_repo.NewScenariosRepo(dbpool) + cleaner := cleaner.NewCleaner() scenarioService := scenarios_service.NewScenarioService( scenariosRepo, + cleaner, os.Getenv("FILE_PREFIX_DOMAIN"), ) gameRepo := games_repo.NewGamesRepo(dbpool) teamRepo := teams_repo.NewTeamsRepo(dbpool) + storyteller := storytelling.NewStory() + actionsRepo := actions_repo.NewActionsRepo(dbpool) + applicationsRepo := applications_repo.NewApplicationsRepo(dbpool) gameService := game_service.NewGameService( gameRepo, teamRepo, scenariosRepo, + scenarioService, os.Getenv("FILE_PREFIX_DOMAIN"), passwordGenerator, + storyteller, + cleaner, + actionsRepo, + applicationsRepo, ) // Create a listener on TCP port @@ -109,7 +123,7 @@ func main() { "/crabs.evening_detective_server.EveningDetectiveServer/DownloadFile": true, "/crabs.evening_detective_server.EveningDetectiveServer/GetScenario": true, "/crabs.evening_detective_server.EveningDetectiveServer/GetScenariosCatalog": true, - "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamActions": true, + "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamStory": true, "/crabs.evening_detective_server.EveningDetectiveServer/AddTeamAction": true, }, processorJWT, diff --git a/cmd/evening_detective_server/main.swagger.json b/cmd/evening_detective_server/main.swagger.json index 611d078..830611e 100644 --- a/cmd/evening_detective_server/main.swagger.json +++ b/cmd/evening_detective_server/main.swagger.json @@ -903,47 +903,6 @@ } }, "/api/teams/{id}/actions": { - "get": { - "summary": "Получить ходы", - "operationId": "EveningDetectiveServer_GetTeamActions", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/evening_detective_serverGetTeamActionsRsp" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "type": "string", - "format": "int64" - }, - { - "name": "password", - "in": "query", - "required": false, - "type": "string" - } - ], - "tags": [ - "Ходы" - ], - "security": [ - { - "": [] - } - ] - }, "post": { "summary": "Сделать ход", "operationId": "EveningDetectiveServer_AddTeamAction", @@ -1065,6 +1024,49 @@ ] } }, + "/api/teams/{id}/story": { + "get": { + "summary": "Получить ходы", + "operationId": "EveningDetectiveServer_GetTeamStory", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/evening_detective_serverGetTeamStoryRsp" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + }, + { + "name": "password", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Ходы" + ], + "security": [ + { + "": [] + } + ] + } + }, "/api/test/echo": { "post": { "summary": "Проверить обработку данных", @@ -1745,18 +1747,14 @@ } } }, - "evening_detective_serverGetTeamActionsRsp": { + "evening_detective_serverGetTeamStoryRsp": { "type": "object", "properties": { "error": { "type": "string" }, - "places": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/evening_detective_serverPlace" - } + "story": { + "$ref": "#/definitions/evening_detective_serverStory" } } }, @@ -2002,6 +2000,17 @@ }, "password": { "type": "string" + }, + "actionsCount": { + "type": "integer", + "format": "int32" + }, + "applications": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/evening_detective_serverApplication" + } } } }, diff --git a/internal/app/server.go b/internal/app/server.go index 0d76865..b0b2e89 100644 --- a/internal/app/server.go +++ b/internal/app/server.go @@ -605,15 +605,51 @@ func (s *server) GiveTeamApplications(ctx context.Context, req *proto.GiveTeamAp return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - panic("unimplemented") + err := s.gameService.GiveTeamApplications( + ctx, + int(req.Id), + req.Name, + ) + if err != nil { + return &proto.GiveTeamApplicationsRsp{ + Error: err.Error(), + }, nil + } + + return &proto.GiveTeamApplicationsRsp{}, nil } -func (s *server) GetTeamActions(ctx context.Context, req *proto.GetTeamActionsReq) (*proto.GetTeamActionsRsp, error) { - panic("unimplemented") +func (s *server) GetTeamStory(ctx context.Context, req *proto.GetTeamStoryReq) (*proto.GetTeamStoryRsp, error) { + story, err := s.gameService.GetTeamActions( + ctx, + int(req.Id), + req.Password, + ) + if err != nil { + return &proto.GetTeamStoryRsp{ + Error: err.Error(), + }, nil + } + + return &proto.GetTeamStoryRsp{ + Story: mapStory(story), + }, nil } func (s *server) AddTeamAction(ctx context.Context, req *proto.AddTeamActionReq) (*proto.AddTeamActionRsp, error) { - panic("unimplemented") + err := s.gameService.AddTeamAction( + ctx, + int(req.Id), + req.Password, + req.Code, + ) + if err != nil { + return &proto.AddTeamActionRsp{ + Error: err.Error(), + }, nil + } + + return &proto.AddTeamActionRsp{}, nil } func (s *server) DeleteLastTeamAction(ctx context.Context, req *proto.DeleteLastTeamActionReq) (*proto.DeleteLastTeamActionRsp, error) { @@ -622,5 +658,15 @@ func (s *server) DeleteLastTeamAction(ctx context.Context, req *proto.DeleteLast return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - panic("unimplemented") + err := s.gameService.DeleteLastTeamAction( + ctx, + int(req.Id), + ) + if err != nil { + return &proto.DeleteLastTeamActionRsp{ + Error: err.Error(), + }, nil + } + + return &proto.DeleteLastTeamActionRsp{}, nil } diff --git a/internal/app/team_mapper.go b/internal/app/team_mapper.go index c507570..8cda6d5 100644 --- a/internal/app/team_mapper.go +++ b/internal/app/team_mapper.go @@ -9,10 +9,12 @@ func mapTeam( o *game_service.Team, ) *proto.Team { return &proto.Team{ - Id: int32(o.ID), - Name: o.Name, - Status: o.Status, - Password: o.Password, + Id: int32(o.ID), + Name: o.Name, + Status: o.Status, + Password: o.Password, + ActionsCount: int32(o.ActionsCount), + Applications: mapApplications(o.Applications), } } diff --git a/internal/repos/actions_repo/repo.go b/internal/repos/actions_repo/repo.go new file mode 100644 index 0000000..a0234d5 --- /dev/null +++ b/internal/repos/actions_repo/repo.go @@ -0,0 +1,103 @@ +package actions_repo + +import ( + "context" + + "github.com/jackc/pgx/v5/pgxpool" +) + +type ActionsRepo struct { + pool *pgxpool.Pool +} + +func NewActionsRepo(pool *pgxpool.Pool) *ActionsRepo { + return &ActionsRepo{ + pool: pool, + } +} + +func (r *ActionsRepo) AddAction(ctx context.Context, teamId int, code string) (int, error) { + id := 0 + err := r.pool.QueryRow( + ctx, + `INSERT INTO actions (code, team_id) + VALUES ($1, $2) + RETURNING id`, + code, + teamId, + ).Scan(&id) + + if err != nil { + return 0, err + } + return id, nil +} + +func (r *ActionsRepo) GetActionsByTeamID(ctx context.Context, teamId int) ([]string, error) { + rows, err := r.pool.Query( + ctx, + `SELECT + code + FROM actions + WHERE team_id = $1 + ORDER BY created_at ASC`, + teamId, + ) + if err != nil { + return nil, err + } + defer rows.Close() + + var codes []string + for rows.Next() { + code := "" + err := rows.Scan( + &code, + ) + if err != nil { + return nil, err + } + codes = append(codes, code) + } + if err := rows.Err(); err != nil { + return nil, err + } + + return codes, nil +} + +func (r *ActionsRepo) GetActionsCountByTeamIDs(ctx context.Context, teamIds []int) (map[int]int, error) { + rows, err := r.pool.Query( + ctx, + `SELECT + team_id, + count(*) + FROM actions + WHERE team_id = ANY($1) + GROUP BY team_id`, + teamIds, + ) + if err != nil { + return nil, err + } + defer rows.Close() + + res := make(map[int]int, len(teamIds)) + for rows.Next() { + id := 0 + count := 0 + err := rows.Scan( + &id, + &count, + ) + if err != nil { + return nil, err + } + res[id] = count + } + if err := rows.Err(); err != nil { + return nil, err + } + + return res, nil +} diff --git a/internal/repos/application.go b/internal/repos/application.go new file mode 100644 index 0000000..436e360 --- /dev/null +++ b/internal/repos/application.go @@ -0,0 +1,7 @@ +package repos + +type Application struct { + Name string + Image string + TeamId int +} diff --git a/internal/repos/applications_repo/repo.go b/internal/repos/applications_repo/repo.go new file mode 100644 index 0000000..b08a6e5 --- /dev/null +++ b/internal/repos/applications_repo/repo.go @@ -0,0 +1,81 @@ +package applications_repo + +import ( + "context" + "evening_detective_server/internal/repos" + + "github.com/jackc/pgx/v5/pgxpool" +) + +type ApplicationsRepo struct { + pool *pgxpool.Pool +} + +func NewApplicationsRepo(pool *pgxpool.Pool) *ApplicationsRepo { + return &ApplicationsRepo{ + pool: pool, + } +} + +func (r *ApplicationsRepo) AddApplication( + ctx context.Context, + teamId int, + name string, + image string, +) (int, error) { + id := 0 + err := r.pool.QueryRow( + ctx, + `INSERT INTO applications (name, image, team_id) + VALUES ($1, $2, $3) + RETURNING id`, + name, + image, + teamId, + ).Scan(&id) + + if err != nil { + return 0, err + } + return id, nil +} + +func (r *ApplicationsRepo) GetApplicationsByTeamIDsAndState( + ctx context.Context, + teamIds []int, + state string, +) (map[int][]*repos.Application, error) { + rows, err := r.pool.Query( + ctx, + `SELECT + name, + image, + team_id + FROM applications + WHERE team_id = ANY($1)`, + teamIds, + ) + if err != nil { + return nil, err + } + defer rows.Close() + + res := make(map[int][]*repos.Application, len(teamIds)) + for rows.Next() { + application := &repos.Application{} + err := rows.Scan( + &application.Name, + &application.Image, + &application.TeamId, + ) + if err != nil { + return nil, err + } + res[application.TeamId] = append(res[application.TeamId], application) + } + if err := rows.Err(); err != nil { + return nil, err + } + + return res, nil +} diff --git a/internal/repos/team.go b/internal/repos/team.go index 8a4fc74..ed00bdd 100644 --- a/internal/repos/team.go +++ b/internal/repos/team.go @@ -1,8 +1,9 @@ package repos type Team struct { - ID int - Name string - Status string - Password string + ID int + Name string + Status string + Password string + ScenarioId int } diff --git a/internal/repos/teams_repo/repo.go b/internal/repos/teams_repo/repo.go index 0013123..cd1b813 100644 --- a/internal/repos/teams_repo/repo.go +++ b/internal/repos/teams_repo/repo.go @@ -5,6 +5,7 @@ import ( "errors" "evening_detective_server/internal/repos" + "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgxpool" ) @@ -22,6 +23,37 @@ func NewTeamsRepo(pool *pgxpool.Pool) *TeamsRepo { } } +func (r *TeamsRepo) GetTeamByID(ctx context.Context, id int) (*repos.Team, error) { + team := &repos.Team{} + row := r.pool.QueryRow( + ctx, + `SELECT + id, + name, + status, + password, + scenario_id + FROM teams + WHERE id = $1`, + id, + ) + err := row.Scan( + &team.ID, + &team.Name, + &team.Status, + &team.Password, + &team.ScenarioId, + ) + if err != nil { + if errors.Is(err, pgx.ErrNoRows) { + return nil, ErrTeamNotFound + } + return nil, err + } + + return team, nil +} + func (r *TeamsRepo) GetTeamsByGameID( ctx context.Context, gameId int, diff --git a/internal/services/game_service/application.go b/internal/services/game_service/application.go new file mode 100644 index 0000000..23fd842 --- /dev/null +++ b/internal/services/game_service/application.go @@ -0,0 +1,6 @@ +package game_service + +type Application struct { + Name string + Image string +} diff --git a/internal/services/game_service/application_mapper.go b/internal/services/game_service/application_mapper.go new file mode 100644 index 0000000..9eeaf53 --- /dev/null +++ b/internal/services/game_service/application_mapper.go @@ -0,0 +1,21 @@ +package game_service + +import ( + "evening_detective_server/internal/modules/storytelling" + "evening_detective_server/internal/repos" +) + +func mapApplications(o []*repos.Application) []*storytelling.Application { + res := make([]*storytelling.Application, 0, len(o)) + for _, item := range o { + res = append(res, mapApplication(item)) + } + return res +} + +func mapApplication(o *repos.Application) *storytelling.Application { + return &storytelling.Application{ + Name: o.Name, + Image: o.Image, + } +} diff --git a/internal/services/game_service/service.go b/internal/services/game_service/service.go index d7abc3b..b97b847 100644 --- a/internal/services/game_service/service.go +++ b/internal/services/game_service/service.go @@ -2,10 +2,15 @@ package game_service import ( "context" + "evening_detective_server/internal/modules/cleaner" "evening_detective_server/internal/modules/password_generator" + "evening_detective_server/internal/modules/storytelling" + "evening_detective_server/internal/repos/actions_repo" + "evening_detective_server/internal/repos/applications_repo" "evening_detective_server/internal/repos/games_repo" "evening_detective_server/internal/repos/scenarios_repo" "evening_detective_server/internal/repos/teams_repo" + "evening_detective_server/internal/services/scenarios_service" "time" ) @@ -13,23 +18,38 @@ type GameService struct { gamesRepo *games_repo.GamesRepo teamsRepo *teams_repo.TeamsRepo scenariosRepo *scenarios_repo.ScenariosRepo + scenarioService *scenarios_service.ScenarioService domain string passwordGenerator password_generator.IPasswordGenerator + storyteller storytelling.IStory + cleaner cleaner.ICleaner + actionsRepo *actions_repo.ActionsRepo + applicationsRepo *applications_repo.ApplicationsRepo } func NewGameService( gamesRepo *games_repo.GamesRepo, teamsRepo *teams_repo.TeamsRepo, scenariosRepo *scenarios_repo.ScenariosRepo, + scenarioService *scenarios_service.ScenarioService, domain string, passwordGenerator password_generator.IPasswordGenerator, + storyteller storytelling.IStory, + cleaner cleaner.ICleaner, + actionsRepo *actions_repo.ActionsRepo, + applicationsRepo *applications_repo.ApplicationsRepo, ) *GameService { return &GameService{ gamesRepo: gamesRepo, teamsRepo: teamsRepo, scenariosRepo: scenariosRepo, + scenarioService: scenarioService, domain: domain, passwordGenerator: passwordGenerator, + storyteller: storyteller, + cleaner: cleaner, + actionsRepo: actionsRepo, + applicationsRepo: applicationsRepo, } } @@ -65,7 +85,30 @@ func (s *GameService) GetGame( return nil, err } game.Teams = teams - return mapGame(game, s.domain), nil + + res := mapGame(game, s.domain) + + teamIds := make([]int, 0, len(game.Teams)) + for _, team := range game.Teams { + teamIds = append(teamIds, team.ID) + } + + actionsCountByTeamIDs, err := s.actionsRepo.GetActionsCountByTeamIDs(ctx, teamIds) + if err != nil { + return nil, err + } + + needApplicationsByTeamIDs, err := s.applicationsRepo.GetApplicationsByTeamIDsAndState(ctx, teamIds, "need") + if err != nil { + return nil, err + } + + for _, team := range res.Teams { + team.ActionsCount = actionsCountByTeamIDs[team.ID] + team.Applications = mapApplications(needApplicationsByTeamIDs[team.ID]) + } + + return res, nil } func (s *GameService) DeleteGame( @@ -121,3 +164,74 @@ func (s *GameService) UpdateTeam(ctx context.Context, teamId int, name string) e func (s *GameService) DeleteTeam(ctx context.Context, teamId int) error { return s.teamsRepo.DeleteTeam(ctx, teamId) } + +func (s *GameService) GiveTeamApplications(ctx context.Context, teamId int, name string) error { + panic("unimplemented") +} + +func (s *GameService) GetTeamActions(ctx context.Context, teamId int, password string) (*storytelling.Story, error) { + team, err := s.teamsRepo.GetTeamByID(ctx, teamId) + if err != nil { + return nil, err + } + + if team.Password != password { + return nil, teams_repo.ErrTeamNotFound + } + + actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId) + if err != nil { + return nil, err + } + + scenario, err := s.scenarioService.GetFullScenarioByID(ctx, team.ScenarioId) + if err != nil { + return nil, err + } + + return s.storyteller.GetStory(scenario.Story, actions), nil +} + +func (s *GameService) AddTeamAction(ctx context.Context, teamId int, password string, actionCode string) error { + team, err := s.teamsRepo.GetTeamByID(ctx, teamId) + if err != nil { + return err + } + + if team.Password != password { + return teams_repo.ErrTeamNotFound + } + + code := s.cleaner.ClearCode(actionCode) + _, err = s.actionsRepo.AddAction(ctx, teamId, code) + if err != nil { + return err + } + + actions, err := s.actionsRepo.GetActionsByTeamID(ctx, teamId) + if err != nil { + return err + } + + scenario, err := s.scenarioService.GetFullScenarioByID(ctx, team.ScenarioId) + if err != nil { + return err + } + + teamStory := s.storyteller.GetStory(scenario.Story, actions) + + lastPlace := teamStory.Places[len(teamStory.Places)-1] + + for _, application := range lastPlace.Applications { + _, err := s.applicationsRepo.AddApplication(ctx, teamId, application.Name, application.Image) + if err != nil { + return err + } + } + + return nil +} + +func (s *GameService) DeleteLastTeamAction(ctx context.Context, teamId int) error { + panic("unimplemented") +} diff --git a/internal/services/game_service/team.go b/internal/services/game_service/team.go index 17cd4c3..2f82090 100644 --- a/internal/services/game_service/team.go +++ b/internal/services/game_service/team.go @@ -1,8 +1,12 @@ package game_service +import "evening_detective_server/internal/modules/storytelling" + type Team struct { - ID int - Name string - Status string - Password string + ID int + Name string + Status string + Password string + ActionsCount int + Applications []*storytelling.Application } diff --git a/internal/services/scenarios_service/service.go b/internal/services/scenarios_service/service.go index 494b38c..29d56d9 100644 --- a/internal/services/scenarios_service/service.go +++ b/internal/services/scenarios_service/service.go @@ -3,6 +3,7 @@ package scenarios_service import ( "context" "errors" + "evening_detective_server/internal/modules/cleaner" "evening_detective_server/internal/modules/storytelling" "evening_detective_server/internal/repos/scenarios_repo" "strings" @@ -10,15 +11,18 @@ import ( type ScenarioService struct { scenariosRepo *scenarios_repo.ScenariosRepo + cleaner cleaner.ICleaner domain string } func NewScenarioService( scenariosRepo *scenarios_repo.ScenariosRepo, + cleaner cleaner.ICleaner, domain string, ) *ScenarioService { return &ScenarioService{ scenariosRepo: scenariosRepo, + cleaner: cleaner, domain: domain, } } @@ -167,7 +171,8 @@ func (s *ScenarioService) getStory(ctx context.Context, id int) (*storytelling.S func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storytelling.Story) error { mapCodes := map[string]struct{}{} for _, place := range story.Places { - mapCodes[place.Code] = struct{}{} + code := s.cleaner.ClearCode(place.Code) + mapCodes[code] = struct{}{} place.Image = strings.TrimPrefix(place.Image, s.domain) } if len(mapCodes) != len(story.Places) { @@ -176,9 +181,11 @@ func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storyt cleanPlaces := make([]*storytelling.Place, 0, len(story.Places)) for _, place := range story.Places { - if place.Code == "" { + code := s.cleaner.ClearCode(place.Code) + if code == "" { continue } + place.Code = code cleanPlaces = append(cleanPlaces, place) } story.Places = cleanPlaces diff --git a/migrations/20260728015952_create_actions_table.sql b/migrations/20260728015952_create_actions_table.sql new file mode 100644 index 0000000..7c31cd1 --- /dev/null +++ b/migrations/20260728015952_create_actions_table.sql @@ -0,0 +1,13 @@ +-- +goose Up +CREATE TABLE + IF NOT EXISTS actions ( + id SERIAL PRIMARY KEY, + code TEXT, + team_id INTEGER, + created_at TIMESTAMP NOT NULL DEFAULT NOW (), + + CONSTRAINT fk_actions_team FOREIGN KEY (team_id) REFERENCES teams (id) ON DELETE CASCADE + ); + +-- +goose Down +DROP TABLE IF EXISTS actions; diff --git a/migrations/20260728020014_create_applications_table.sql b/migrations/20260728020014_create_applications_table.sql new file mode 100644 index 0000000..e60b32a --- /dev/null +++ b/migrations/20260728020014_create_applications_table.sql @@ -0,0 +1,15 @@ +-- +goose Up +CREATE TABLE + IF NOT EXISTS applications ( + id SERIAL PRIMARY KEY, + name TEXT, + image TEXT, + team_id INTEGER, + status VARCHAR(50) DEFAULT 'need', + created_at TIMESTAMP NOT NULL DEFAULT NOW (), + + CONSTRAINT fk_applications_team FOREIGN KEY (team_id) REFERENCES teams (id) ON DELETE CASCADE + ); + +-- +goose Down +DROP TABLE IF EXISTS applications; diff --git a/proto/main.pb.go b/proto/main.pb.go index 5b539c8..25b01e4 100644 --- a/proto/main.pb.go +++ b/proto/main.pb.go @@ -3131,6 +3131,8 @@ type Team struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` + ActionsCount int32 `protobuf:"varint,5,opt,name=actions_count,json=actionsCount,proto3" json:"actions_count,omitempty"` + Applications []*Application `protobuf:"bytes,6,rep,name=applications,proto3" json:"applications,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -3193,6 +3195,20 @@ func (x *Team) GetPassword() string { return "" } +func (x *Team) GetActionsCount() int32 { + if x != nil { + return x.ActionsCount + } + return 0 +} + +func (x *Team) GetApplications() []*Application { + if x != nil { + return x.Applications + } + return nil +} + type GetGameReq struct { state protoimpl.MessageState `protogen:"open.v1"` Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` @@ -3873,7 +3889,7 @@ func (x *GiveTeamApplicationsRsp) GetError() string { return "" } -type GetTeamActionsReq struct { +type GetTeamStoryReq struct { state protoimpl.MessageState `protogen:"open.v1"` Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` @@ -3881,20 +3897,20 @@ type GetTeamActionsReq struct { sizeCache protoimpl.SizeCache } -func (x *GetTeamActionsReq) Reset() { - *x = GetTeamActionsReq{} +func (x *GetTeamStoryReq) Reset() { + *x = GetTeamStoryReq{} mi := &file_main_proto_msgTypes[76] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GetTeamActionsReq) String() string { +func (x *GetTeamStoryReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetTeamActionsReq) ProtoMessage() {} +func (*GetTeamStoryReq) ProtoMessage() {} -func (x *GetTeamActionsReq) ProtoReflect() protoreflect.Message { +func (x *GetTeamStoryReq) ProtoReflect() protoreflect.Message { mi := &file_main_proto_msgTypes[76] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3906,47 +3922,47 @@ func (x *GetTeamActionsReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetTeamActionsReq.ProtoReflect.Descriptor instead. -func (*GetTeamActionsReq) Descriptor() ([]byte, []int) { +// Deprecated: Use GetTeamStoryReq.ProtoReflect.Descriptor instead. +func (*GetTeamStoryReq) Descriptor() ([]byte, []int) { return file_main_proto_rawDescGZIP(), []int{76} } -func (x *GetTeamActionsReq) GetId() int64 { +func (x *GetTeamStoryReq) GetId() int64 { if x != nil { return x.Id } return 0 } -func (x *GetTeamActionsReq) GetPassword() string { +func (x *GetTeamStoryReq) GetPassword() string { if x != nil { return x.Password } return "" } -type GetTeamActionsRsp struct { +type GetTeamStoryRsp struct { state protoimpl.MessageState `protogen:"open.v1"` Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` - Places []*Place `protobuf:"bytes,2,rep,name=places,proto3" json:"places,omitempty"` + Story *Story `protobuf:"bytes,2,opt,name=story,proto3" json:"story,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *GetTeamActionsRsp) Reset() { - *x = GetTeamActionsRsp{} +func (x *GetTeamStoryRsp) Reset() { + *x = GetTeamStoryRsp{} mi := &file_main_proto_msgTypes[77] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GetTeamActionsRsp) String() string { +func (x *GetTeamStoryRsp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetTeamActionsRsp) ProtoMessage() {} +func (*GetTeamStoryRsp) ProtoMessage() {} -func (x *GetTeamActionsRsp) ProtoReflect() protoreflect.Message { +func (x *GetTeamStoryRsp) ProtoReflect() protoreflect.Message { mi := &file_main_proto_msgTypes[77] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3958,21 +3974,21 @@ func (x *GetTeamActionsRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetTeamActionsRsp.ProtoReflect.Descriptor instead. -func (*GetTeamActionsRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use GetTeamStoryRsp.ProtoReflect.Descriptor instead. +func (*GetTeamStoryRsp) Descriptor() ([]byte, []int) { return file_main_proto_rawDescGZIP(), []int{77} } -func (x *GetTeamActionsRsp) GetError() string { +func (x *GetTeamStoryRsp) GetError() string { if x != nil { return x.Error } return "" } -func (x *GetTeamActionsRsp) GetPlaces() []*Place { +func (x *GetTeamStoryRsp) GetStory() *Story { if x != nil { - return x.Places + return x.Story } return nil } @@ -4360,12 +4376,14 @@ const file_main_proto_rawDesc = "" + "\bstart_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\astartAt\x12\x16\n" + "\x06status\x18\x05 \x01(\tR\x06status\x12D\n" + "\bscenario\x18\x06 \x01(\v2(.crabs.evening_detective_server.ScenarioR\bscenario\x12:\n" + - "\x05teams\x18\a \x03(\v2$.crabs.evening_detective_server.TeamR\x05teams\"^\n" + + "\x05teams\x18\a \x03(\v2$.crabs.evening_detective_server.TeamR\x05teams\"\xd4\x01\n" + "\x04Team\x12\x0e\n" + "\x02id\x18\x01 \x01(\x05R\x02id\x12\x12\n" + "\x04name\x18\x02 \x01(\tR\x04name\x12\x16\n" + "\x06status\x18\x03 \x01(\tR\x06status\x12\x1a\n" + - "\bpassword\x18\x04 \x01(\tR\bpassword\"\x1c\n" + + "\bpassword\x18\x04 \x01(\tR\bpassword\x12#\n" + + "\ractions_count\x18\x05 \x01(\x05R\factionsCount\x12O\n" + + "\fapplications\x18\x06 \x03(\v2+.crabs.evening_detective_server.ApplicationR\fapplications\"\x1c\n" + "\n" + "GetGameReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x05R\x02id\"\\\n" + @@ -4406,13 +4424,13 @@ const file_main_proto_rawDesc = "" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + "\x04name\x18\x02 \x01(\tR\x04name\"/\n" + "\x17GiveTeamApplicationsRsp\x12\x14\n" + - "\x05error\x18\x01 \x01(\tR\x05error\"?\n" + - "\x11GetTeamActionsReq\x12\x0e\n" + + "\x05error\x18\x01 \x01(\tR\x05error\"=\n" + + "\x0fGetTeamStoryReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" + - "\bpassword\x18\x02 \x01(\tR\bpassword\"h\n" + - "\x11GetTeamActionsRsp\x12\x14\n" + - "\x05error\x18\x01 \x01(\tR\x05error\x12=\n" + - "\x06places\x18\x02 \x03(\v2%.crabs.evening_detective_server.PlaceR\x06places\"R\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\"d\n" + + "\x0fGetTeamStoryRsp\x12\x14\n" + + "\x05error\x18\x01 \x01(\tR\x05error\x12;\n" + + "\x05story\x18\x02 \x01(\v2%.crabs.evening_detective_server.StoryR\x05story\"R\n" + "\x10AddTeamActionReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" + "\bpassword\x18\x02 \x01(\tR\bpassword\x12\x12\n" + @@ -4422,7 +4440,7 @@ const file_main_proto_rawDesc = "" + "\x17DeleteLastTeamActionReq\x12\x0e\n" + "\x02id\x18\x01 \x01(\x03R\x02id\"/\n" + "\x17DeleteLastTeamActionRsp\x12\x14\n" + - "\x05error\x18\x01 \x01(\tR\x05error2\x88>\n" + + "\x05error\x18\x01 \x01(\tR\x05error2\x80>\n" + "\x16EveningDetectiveServer\x12\xa6\x01\n" + "\x04Ping\x12'.crabs.evening_detective_server.PingReq\x1a'.crabs.evening_detective_server.PingRsp\"L\x92A3\x12)Проверить доступностьb\x06\n" + "\x04\n" + @@ -4514,11 +4532,11 @@ const file_main_proto_rawDesc = "" + "DeleteTeam\x12-.crabs.evening_detective_server.DeleteTeamReq\x1a-.crabs.evening_detective_server.DeleteTeamRsp\"I\x92A/\n" + "\x0eКоманда\x12\x1dУдалить команду\x82\xd3\xe4\x93\x02\x11*\x0f/api/teams/{id}\x12\xdd\x01\n" + "\x14GiveTeamApplications\x127.crabs.evening_detective_server.GiveTeamApplicationsReq\x1a7.crabs.evening_detective_server.GiveTeamApplicationsRsp\"S\x92A)\n" + - "\x0eКоманда\x12\x17Выдать улику\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/api/teams/{id}/applications\x12\xc7\x01\n" + - "\x0eGetTeamActions\x121.crabs.evening_detective_server.GetTeamActionsReq\x1a1.crabs.evening_detective_server.GetTeamActionsRsp\"O\x92A-\n" + + "\x0eКоманда\x12\x17Выдать улику\x82\xd3\xe4\x93\x02!:\x01*\"\x1c/api/teams/{id}/applications\x12\xbf\x01\n" + + "\fGetTeamStory\x12/.crabs.evening_detective_server.GetTeamStoryReq\x1a/.crabs.evening_detective_server.GetTeamStoryRsp\"M\x92A-\n" + "\bХоды\x12\x19Получить ходыb\x06\n" + "\x04\n" + - "\x00\x12\x00\x82\xd3\xe4\x93\x02\x19\x12\x17/api/teams/{id}/actions\x12\xc3\x01\n" + + "\x00\x12\x00\x82\xd3\xe4\x93\x02\x17\x12\x15/api/teams/{id}/story\x12\xc3\x01\n" + "\rAddTeamAction\x120.crabs.evening_detective_server.AddTeamActionReq\x1a0.crabs.evening_detective_server.AddTeamActionRsp\"N\x92A)\n" + "\bХоды\x12\x15Сделать ходb\x06\n" + "\x04\n" + @@ -4625,8 +4643,8 @@ var file_main_proto_goTypes = []any{ (*DeleteTeamRsp)(nil), // 73: crabs.evening_detective_server.DeleteTeamRsp (*GiveTeamApplicationsReq)(nil), // 74: crabs.evening_detective_server.GiveTeamApplicationsReq (*GiveTeamApplicationsRsp)(nil), // 75: crabs.evening_detective_server.GiveTeamApplicationsRsp - (*GetTeamActionsReq)(nil), // 76: crabs.evening_detective_server.GetTeamActionsReq - (*GetTeamActionsRsp)(nil), // 77: crabs.evening_detective_server.GetTeamActionsRsp + (*GetTeamStoryReq)(nil), // 76: crabs.evening_detective_server.GetTeamStoryReq + (*GetTeamStoryRsp)(nil), // 77: crabs.evening_detective_server.GetTeamStoryRsp (*AddTeamActionReq)(nil), // 78: crabs.evening_detective_server.AddTeamActionReq (*AddTeamActionRsp)(nil), // 79: crabs.evening_detective_server.AddTeamActionRsp (*DeleteLastTeamActionReq)(nil), // 80: crabs.evening_detective_server.DeleteLastTeamActionReq @@ -4659,90 +4677,91 @@ var file_main_proto_depIdxs = []int32{ 82, // 21: crabs.evening_detective_server.Game.start_at:type_name -> google.protobuf.Timestamp 36, // 22: crabs.evening_detective_server.Game.scenario:type_name -> crabs.evening_detective_server.Scenario 61, // 23: crabs.evening_detective_server.Game.teams:type_name -> crabs.evening_detective_server.Team - 60, // 24: crabs.evening_detective_server.GetGameRsp.game:type_name -> crabs.evening_detective_server.Game - 82, // 25: crabs.evening_detective_server.UpdateGameReq.start_at:type_name -> google.protobuf.Timestamp - 38, // 26: crabs.evening_detective_server.GetTeamActionsRsp.places:type_name -> crabs.evening_detective_server.Place - 0, // 27: crabs.evening_detective_server.EveningDetectiveServer.Ping:input_type -> crabs.evening_detective_server.PingReq - 2, // 28: crabs.evening_detective_server.EveningDetectiveServer.Echo:input_type -> crabs.evening_detective_server.EchoReq - 4, // 29: crabs.evening_detective_server.EveningDetectiveServer.Signup:input_type -> crabs.evening_detective_server.SignupReq - 6, // 30: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:input_type -> crabs.evening_detective_server.RefreshPasswordReq - 8, // 31: crabs.evening_detective_server.EveningDetectiveServer.Login:input_type -> crabs.evening_detective_server.LoginReq - 10, // 32: crabs.evening_detective_server.EveningDetectiveServer.Refresh:input_type -> crabs.evening_detective_server.RefreshReq - 12, // 33: crabs.evening_detective_server.EveningDetectiveServer.GetUsers:input_type -> crabs.evening_detective_server.GetUsersReq - 15, // 34: crabs.evening_detective_server.EveningDetectiveServer.GetUserById:input_type -> crabs.evening_detective_server.GetUserByIdReq - 17, // 35: crabs.evening_detective_server.EveningDetectiveServer.GetMe:input_type -> crabs.evening_detective_server.GetMeReq - 19, // 36: crabs.evening_detective_server.EveningDetectiveServer.AddUserRole:input_type -> crabs.evening_detective_server.AddUserRoleReq - 21, // 37: crabs.evening_detective_server.EveningDetectiveServer.DeleteUserRole:input_type -> crabs.evening_detective_server.DeleteUserRoleReq - 23, // 38: crabs.evening_detective_server.EveningDetectiveServer.GetPermissions:input_type -> crabs.evening_detective_server.GetPermissionsReq - 25, // 39: crabs.evening_detective_server.EveningDetectiveServer.UploadFile:input_type -> crabs.evening_detective_server.UploadFileReq - 27, // 40: crabs.evening_detective_server.EveningDetectiveServer.DownloadFile:input_type -> crabs.evening_detective_server.DownloadFileReq - 28, // 41: crabs.evening_detective_server.EveningDetectiveServer.AddScenario:input_type -> crabs.evening_detective_server.AddScenarioReq - 30, // 42: crabs.evening_detective_server.EveningDetectiveServer.GetMyScenarios:input_type -> crabs.evening_detective_server.GetMyScenariosReq - 32, // 43: crabs.evening_detective_server.EveningDetectiveServer.GetScenariosCatalog:input_type -> crabs.evening_detective_server.GetScenariosCatalogReq - 34, // 44: crabs.evening_detective_server.EveningDetectiveServer.GetFullScenario:input_type -> crabs.evening_detective_server.GetScenarioReq - 34, // 45: crabs.evening_detective_server.EveningDetectiveServer.GetScenario:input_type -> crabs.evening_detective_server.GetScenarioReq - 42, // 46: crabs.evening_detective_server.EveningDetectiveServer.UpdateScenario:input_type -> crabs.evening_detective_server.UpdateScenarioReq - 44, // 47: crabs.evening_detective_server.EveningDetectiveServer.PublicScenario:input_type -> crabs.evening_detective_server.PublicScenarioReq - 46, // 48: crabs.evening_detective_server.EveningDetectiveServer.DraftScenario:input_type -> crabs.evening_detective_server.DraftScenarioReq - 48, // 49: crabs.evening_detective_server.EveningDetectiveServer.DeleteScenario:input_type -> crabs.evening_detective_server.DeleteScenarioReq - 50, // 50: crabs.evening_detective_server.EveningDetectiveServer.AddScenarioPlace:input_type -> crabs.evening_detective_server.AddScenarioPlaceReq - 52, // 51: crabs.evening_detective_server.EveningDetectiveServer.UpdateScenarioPlace:input_type -> crabs.evening_detective_server.UpdateScenarioPlaceReq - 54, // 52: crabs.evening_detective_server.EveningDetectiveServer.DeleteScenarioPlace:input_type -> crabs.evening_detective_server.DeleteScenarioPlaceReq - 56, // 53: crabs.evening_detective_server.EveningDetectiveServer.AddGame:input_type -> crabs.evening_detective_server.AddGameReq - 58, // 54: crabs.evening_detective_server.EveningDetectiveServer.GetGames:input_type -> crabs.evening_detective_server.GetGamesReq - 62, // 55: crabs.evening_detective_server.EveningDetectiveServer.GetGame:input_type -> crabs.evening_detective_server.GetGameReq - 64, // 56: crabs.evening_detective_server.EveningDetectiveServer.UpdateGame:input_type -> crabs.evening_detective_server.UpdateGameReq - 66, // 57: crabs.evening_detective_server.EveningDetectiveServer.DeleteGame:input_type -> crabs.evening_detective_server.DeleteGameReq - 68, // 58: crabs.evening_detective_server.EveningDetectiveServer.AddTeam:input_type -> crabs.evening_detective_server.AddTeamReq - 70, // 59: crabs.evening_detective_server.EveningDetectiveServer.UpdateTeam:input_type -> crabs.evening_detective_server.UpdateTeamReq - 72, // 60: crabs.evening_detective_server.EveningDetectiveServer.DeleteTeam:input_type -> crabs.evening_detective_server.DeleteTeamReq - 74, // 61: crabs.evening_detective_server.EveningDetectiveServer.GiveTeamApplications:input_type -> crabs.evening_detective_server.GiveTeamApplicationsReq - 76, // 62: crabs.evening_detective_server.EveningDetectiveServer.GetTeamActions:input_type -> crabs.evening_detective_server.GetTeamActionsReq - 78, // 63: crabs.evening_detective_server.EveningDetectiveServer.AddTeamAction:input_type -> crabs.evening_detective_server.AddTeamActionReq - 80, // 64: crabs.evening_detective_server.EveningDetectiveServer.DeleteLastTeamAction:input_type -> crabs.evening_detective_server.DeleteLastTeamActionReq - 1, // 65: crabs.evening_detective_server.EveningDetectiveServer.Ping:output_type -> crabs.evening_detective_server.PingRsp - 3, // 66: crabs.evening_detective_server.EveningDetectiveServer.Echo:output_type -> crabs.evening_detective_server.EchoRsp - 5, // 67: crabs.evening_detective_server.EveningDetectiveServer.Signup:output_type -> crabs.evening_detective_server.SignupRsp - 7, // 68: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:output_type -> crabs.evening_detective_server.RefreshPasswordRsp - 9, // 69: crabs.evening_detective_server.EveningDetectiveServer.Login:output_type -> crabs.evening_detective_server.LoginRsp - 11, // 70: crabs.evening_detective_server.EveningDetectiveServer.Refresh:output_type -> crabs.evening_detective_server.RefreshRsp - 13, // 71: crabs.evening_detective_server.EveningDetectiveServer.GetUsers:output_type -> crabs.evening_detective_server.GetUsersRsp - 16, // 72: crabs.evening_detective_server.EveningDetectiveServer.GetUserById:output_type -> crabs.evening_detective_server.GetUserByIdRsp - 18, // 73: crabs.evening_detective_server.EveningDetectiveServer.GetMe:output_type -> crabs.evening_detective_server.GetMeRsp - 20, // 74: crabs.evening_detective_server.EveningDetectiveServer.AddUserRole:output_type -> crabs.evening_detective_server.AddUserRoleRsp - 22, // 75: crabs.evening_detective_server.EveningDetectiveServer.DeleteUserRole:output_type -> crabs.evening_detective_server.DeleteUserRoleRsp - 24, // 76: crabs.evening_detective_server.EveningDetectiveServer.GetPermissions:output_type -> crabs.evening_detective_server.GetPermissionsRsp - 26, // 77: crabs.evening_detective_server.EveningDetectiveServer.UploadFile:output_type -> crabs.evening_detective_server.UploadFileRsp - 83, // 78: crabs.evening_detective_server.EveningDetectiveServer.DownloadFile:output_type -> google.api.HttpBody - 29, // 79: crabs.evening_detective_server.EveningDetectiveServer.AddScenario:output_type -> crabs.evening_detective_server.AddScenarioRsp - 31, // 80: crabs.evening_detective_server.EveningDetectiveServer.GetMyScenarios:output_type -> crabs.evening_detective_server.GetMyScenariosRsp - 33, // 81: crabs.evening_detective_server.EveningDetectiveServer.GetScenariosCatalog:output_type -> crabs.evening_detective_server.GetScenariosCatalogRsp - 35, // 82: crabs.evening_detective_server.EveningDetectiveServer.GetFullScenario:output_type -> crabs.evening_detective_server.GetScenarioRsp - 35, // 83: crabs.evening_detective_server.EveningDetectiveServer.GetScenario:output_type -> crabs.evening_detective_server.GetScenarioRsp - 43, // 84: crabs.evening_detective_server.EveningDetectiveServer.UpdateScenario:output_type -> crabs.evening_detective_server.UpdateScenarioRsp - 45, // 85: crabs.evening_detective_server.EveningDetectiveServer.PublicScenario:output_type -> crabs.evening_detective_server.PublicScenarioRsp - 47, // 86: crabs.evening_detective_server.EveningDetectiveServer.DraftScenario:output_type -> crabs.evening_detective_server.DraftScenarioRsp - 49, // 87: crabs.evening_detective_server.EveningDetectiveServer.DeleteScenario:output_type -> crabs.evening_detective_server.DeleteScenarioRsp - 51, // 88: crabs.evening_detective_server.EveningDetectiveServer.AddScenarioPlace:output_type -> crabs.evening_detective_server.AddScenarioPlaceRsp - 53, // 89: crabs.evening_detective_server.EveningDetectiveServer.UpdateScenarioPlace:output_type -> crabs.evening_detective_server.UpdateScenarioPlaceRsp - 55, // 90: crabs.evening_detective_server.EveningDetectiveServer.DeleteScenarioPlace:output_type -> crabs.evening_detective_server.DeleteScenarioPlaceRsp - 57, // 91: crabs.evening_detective_server.EveningDetectiveServer.AddGame:output_type -> crabs.evening_detective_server.AddGameRsp - 59, // 92: crabs.evening_detective_server.EveningDetectiveServer.GetGames:output_type -> crabs.evening_detective_server.GetGamesRsp - 63, // 93: crabs.evening_detective_server.EveningDetectiveServer.GetGame:output_type -> crabs.evening_detective_server.GetGameRsp - 65, // 94: crabs.evening_detective_server.EveningDetectiveServer.UpdateGame:output_type -> crabs.evening_detective_server.UpdateGameRsp - 67, // 95: crabs.evening_detective_server.EveningDetectiveServer.DeleteGame:output_type -> crabs.evening_detective_server.DeleteGameRsp - 69, // 96: crabs.evening_detective_server.EveningDetectiveServer.AddTeam:output_type -> crabs.evening_detective_server.AddTeamRsp - 71, // 97: crabs.evening_detective_server.EveningDetectiveServer.UpdateTeam:output_type -> crabs.evening_detective_server.UpdateTeamRsp - 73, // 98: crabs.evening_detective_server.EveningDetectiveServer.DeleteTeam:output_type -> crabs.evening_detective_server.DeleteTeamRsp - 75, // 99: crabs.evening_detective_server.EveningDetectiveServer.GiveTeamApplications:output_type -> crabs.evening_detective_server.GiveTeamApplicationsRsp - 77, // 100: crabs.evening_detective_server.EveningDetectiveServer.GetTeamActions:output_type -> crabs.evening_detective_server.GetTeamActionsRsp - 79, // 101: crabs.evening_detective_server.EveningDetectiveServer.AddTeamAction:output_type -> crabs.evening_detective_server.AddTeamActionRsp - 81, // 102: crabs.evening_detective_server.EveningDetectiveServer.DeleteLastTeamAction:output_type -> crabs.evening_detective_server.DeleteLastTeamActionRsp - 65, // [65:103] is the sub-list for method output_type - 27, // [27:65] is the sub-list for method input_type - 27, // [27:27] is the sub-list for extension type_name - 27, // [27:27] is the sub-list for extension extendee - 0, // [0:27] is the sub-list for field type_name + 39, // 24: crabs.evening_detective_server.Team.applications:type_name -> crabs.evening_detective_server.Application + 60, // 25: crabs.evening_detective_server.GetGameRsp.game:type_name -> crabs.evening_detective_server.Game + 82, // 26: crabs.evening_detective_server.UpdateGameReq.start_at:type_name -> google.protobuf.Timestamp + 37, // 27: crabs.evening_detective_server.GetTeamStoryRsp.story:type_name -> crabs.evening_detective_server.Story + 0, // 28: crabs.evening_detective_server.EveningDetectiveServer.Ping:input_type -> crabs.evening_detective_server.PingReq + 2, // 29: crabs.evening_detective_server.EveningDetectiveServer.Echo:input_type -> crabs.evening_detective_server.EchoReq + 4, // 30: crabs.evening_detective_server.EveningDetectiveServer.Signup:input_type -> crabs.evening_detective_server.SignupReq + 6, // 31: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:input_type -> crabs.evening_detective_server.RefreshPasswordReq + 8, // 32: crabs.evening_detective_server.EveningDetectiveServer.Login:input_type -> crabs.evening_detective_server.LoginReq + 10, // 33: crabs.evening_detective_server.EveningDetectiveServer.Refresh:input_type -> crabs.evening_detective_server.RefreshReq + 12, // 34: crabs.evening_detective_server.EveningDetectiveServer.GetUsers:input_type -> crabs.evening_detective_server.GetUsersReq + 15, // 35: crabs.evening_detective_server.EveningDetectiveServer.GetUserById:input_type -> crabs.evening_detective_server.GetUserByIdReq + 17, // 36: crabs.evening_detective_server.EveningDetectiveServer.GetMe:input_type -> crabs.evening_detective_server.GetMeReq + 19, // 37: crabs.evening_detective_server.EveningDetectiveServer.AddUserRole:input_type -> crabs.evening_detective_server.AddUserRoleReq + 21, // 38: crabs.evening_detective_server.EveningDetectiveServer.DeleteUserRole:input_type -> crabs.evening_detective_server.DeleteUserRoleReq + 23, // 39: crabs.evening_detective_server.EveningDetectiveServer.GetPermissions:input_type -> crabs.evening_detective_server.GetPermissionsReq + 25, // 40: crabs.evening_detective_server.EveningDetectiveServer.UploadFile:input_type -> crabs.evening_detective_server.UploadFileReq + 27, // 41: crabs.evening_detective_server.EveningDetectiveServer.DownloadFile:input_type -> crabs.evening_detective_server.DownloadFileReq + 28, // 42: crabs.evening_detective_server.EveningDetectiveServer.AddScenario:input_type -> crabs.evening_detective_server.AddScenarioReq + 30, // 43: crabs.evening_detective_server.EveningDetectiveServer.GetMyScenarios:input_type -> crabs.evening_detective_server.GetMyScenariosReq + 32, // 44: crabs.evening_detective_server.EveningDetectiveServer.GetScenariosCatalog:input_type -> crabs.evening_detective_server.GetScenariosCatalogReq + 34, // 45: crabs.evening_detective_server.EveningDetectiveServer.GetFullScenario:input_type -> crabs.evening_detective_server.GetScenarioReq + 34, // 46: crabs.evening_detective_server.EveningDetectiveServer.GetScenario:input_type -> crabs.evening_detective_server.GetScenarioReq + 42, // 47: crabs.evening_detective_server.EveningDetectiveServer.UpdateScenario:input_type -> crabs.evening_detective_server.UpdateScenarioReq + 44, // 48: crabs.evening_detective_server.EveningDetectiveServer.PublicScenario:input_type -> crabs.evening_detective_server.PublicScenarioReq + 46, // 49: crabs.evening_detective_server.EveningDetectiveServer.DraftScenario:input_type -> crabs.evening_detective_server.DraftScenarioReq + 48, // 50: crabs.evening_detective_server.EveningDetectiveServer.DeleteScenario:input_type -> crabs.evening_detective_server.DeleteScenarioReq + 50, // 51: crabs.evening_detective_server.EveningDetectiveServer.AddScenarioPlace:input_type -> crabs.evening_detective_server.AddScenarioPlaceReq + 52, // 52: crabs.evening_detective_server.EveningDetectiveServer.UpdateScenarioPlace:input_type -> crabs.evening_detective_server.UpdateScenarioPlaceReq + 54, // 53: crabs.evening_detective_server.EveningDetectiveServer.DeleteScenarioPlace:input_type -> crabs.evening_detective_server.DeleteScenarioPlaceReq + 56, // 54: crabs.evening_detective_server.EveningDetectiveServer.AddGame:input_type -> crabs.evening_detective_server.AddGameReq + 58, // 55: crabs.evening_detective_server.EveningDetectiveServer.GetGames:input_type -> crabs.evening_detective_server.GetGamesReq + 62, // 56: crabs.evening_detective_server.EveningDetectiveServer.GetGame:input_type -> crabs.evening_detective_server.GetGameReq + 64, // 57: crabs.evening_detective_server.EveningDetectiveServer.UpdateGame:input_type -> crabs.evening_detective_server.UpdateGameReq + 66, // 58: crabs.evening_detective_server.EveningDetectiveServer.DeleteGame:input_type -> crabs.evening_detective_server.DeleteGameReq + 68, // 59: crabs.evening_detective_server.EveningDetectiveServer.AddTeam:input_type -> crabs.evening_detective_server.AddTeamReq + 70, // 60: crabs.evening_detective_server.EveningDetectiveServer.UpdateTeam:input_type -> crabs.evening_detective_server.UpdateTeamReq + 72, // 61: crabs.evening_detective_server.EveningDetectiveServer.DeleteTeam:input_type -> crabs.evening_detective_server.DeleteTeamReq + 74, // 62: crabs.evening_detective_server.EveningDetectiveServer.GiveTeamApplications:input_type -> crabs.evening_detective_server.GiveTeamApplicationsReq + 76, // 63: crabs.evening_detective_server.EveningDetectiveServer.GetTeamStory:input_type -> crabs.evening_detective_server.GetTeamStoryReq + 78, // 64: crabs.evening_detective_server.EveningDetectiveServer.AddTeamAction:input_type -> crabs.evening_detective_server.AddTeamActionReq + 80, // 65: crabs.evening_detective_server.EveningDetectiveServer.DeleteLastTeamAction:input_type -> crabs.evening_detective_server.DeleteLastTeamActionReq + 1, // 66: crabs.evening_detective_server.EveningDetectiveServer.Ping:output_type -> crabs.evening_detective_server.PingRsp + 3, // 67: crabs.evening_detective_server.EveningDetectiveServer.Echo:output_type -> crabs.evening_detective_server.EchoRsp + 5, // 68: crabs.evening_detective_server.EveningDetectiveServer.Signup:output_type -> crabs.evening_detective_server.SignupRsp + 7, // 69: crabs.evening_detective_server.EveningDetectiveServer.RefreshPassword:output_type -> crabs.evening_detective_server.RefreshPasswordRsp + 9, // 70: crabs.evening_detective_server.EveningDetectiveServer.Login:output_type -> crabs.evening_detective_server.LoginRsp + 11, // 71: crabs.evening_detective_server.EveningDetectiveServer.Refresh:output_type -> crabs.evening_detective_server.RefreshRsp + 13, // 72: crabs.evening_detective_server.EveningDetectiveServer.GetUsers:output_type -> crabs.evening_detective_server.GetUsersRsp + 16, // 73: crabs.evening_detective_server.EveningDetectiveServer.GetUserById:output_type -> crabs.evening_detective_server.GetUserByIdRsp + 18, // 74: crabs.evening_detective_server.EveningDetectiveServer.GetMe:output_type -> crabs.evening_detective_server.GetMeRsp + 20, // 75: crabs.evening_detective_server.EveningDetectiveServer.AddUserRole:output_type -> crabs.evening_detective_server.AddUserRoleRsp + 22, // 76: crabs.evening_detective_server.EveningDetectiveServer.DeleteUserRole:output_type -> crabs.evening_detective_server.DeleteUserRoleRsp + 24, // 77: crabs.evening_detective_server.EveningDetectiveServer.GetPermissions:output_type -> crabs.evening_detective_server.GetPermissionsRsp + 26, // 78: crabs.evening_detective_server.EveningDetectiveServer.UploadFile:output_type -> crabs.evening_detective_server.UploadFileRsp + 83, // 79: crabs.evening_detective_server.EveningDetectiveServer.DownloadFile:output_type -> google.api.HttpBody + 29, // 80: crabs.evening_detective_server.EveningDetectiveServer.AddScenario:output_type -> crabs.evening_detective_server.AddScenarioRsp + 31, // 81: crabs.evening_detective_server.EveningDetectiveServer.GetMyScenarios:output_type -> crabs.evening_detective_server.GetMyScenariosRsp + 33, // 82: crabs.evening_detective_server.EveningDetectiveServer.GetScenariosCatalog:output_type -> crabs.evening_detective_server.GetScenariosCatalogRsp + 35, // 83: crabs.evening_detective_server.EveningDetectiveServer.GetFullScenario:output_type -> crabs.evening_detective_server.GetScenarioRsp + 35, // 84: crabs.evening_detective_server.EveningDetectiveServer.GetScenario:output_type -> crabs.evening_detective_server.GetScenarioRsp + 43, // 85: crabs.evening_detective_server.EveningDetectiveServer.UpdateScenario:output_type -> crabs.evening_detective_server.UpdateScenarioRsp + 45, // 86: crabs.evening_detective_server.EveningDetectiveServer.PublicScenario:output_type -> crabs.evening_detective_server.PublicScenarioRsp + 47, // 87: crabs.evening_detective_server.EveningDetectiveServer.DraftScenario:output_type -> crabs.evening_detective_server.DraftScenarioRsp + 49, // 88: crabs.evening_detective_server.EveningDetectiveServer.DeleteScenario:output_type -> crabs.evening_detective_server.DeleteScenarioRsp + 51, // 89: crabs.evening_detective_server.EveningDetectiveServer.AddScenarioPlace:output_type -> crabs.evening_detective_server.AddScenarioPlaceRsp + 53, // 90: crabs.evening_detective_server.EveningDetectiveServer.UpdateScenarioPlace:output_type -> crabs.evening_detective_server.UpdateScenarioPlaceRsp + 55, // 91: crabs.evening_detective_server.EveningDetectiveServer.DeleteScenarioPlace:output_type -> crabs.evening_detective_server.DeleteScenarioPlaceRsp + 57, // 92: crabs.evening_detective_server.EveningDetectiveServer.AddGame:output_type -> crabs.evening_detective_server.AddGameRsp + 59, // 93: crabs.evening_detective_server.EveningDetectiveServer.GetGames:output_type -> crabs.evening_detective_server.GetGamesRsp + 63, // 94: crabs.evening_detective_server.EveningDetectiveServer.GetGame:output_type -> crabs.evening_detective_server.GetGameRsp + 65, // 95: crabs.evening_detective_server.EveningDetectiveServer.UpdateGame:output_type -> crabs.evening_detective_server.UpdateGameRsp + 67, // 96: crabs.evening_detective_server.EveningDetectiveServer.DeleteGame:output_type -> crabs.evening_detective_server.DeleteGameRsp + 69, // 97: crabs.evening_detective_server.EveningDetectiveServer.AddTeam:output_type -> crabs.evening_detective_server.AddTeamRsp + 71, // 98: crabs.evening_detective_server.EveningDetectiveServer.UpdateTeam:output_type -> crabs.evening_detective_server.UpdateTeamRsp + 73, // 99: crabs.evening_detective_server.EveningDetectiveServer.DeleteTeam:output_type -> crabs.evening_detective_server.DeleteTeamRsp + 75, // 100: crabs.evening_detective_server.EveningDetectiveServer.GiveTeamApplications:output_type -> crabs.evening_detective_server.GiveTeamApplicationsRsp + 77, // 101: crabs.evening_detective_server.EveningDetectiveServer.GetTeamStory:output_type -> crabs.evening_detective_server.GetTeamStoryRsp + 79, // 102: crabs.evening_detective_server.EveningDetectiveServer.AddTeamAction:output_type -> crabs.evening_detective_server.AddTeamActionRsp + 81, // 103: crabs.evening_detective_server.EveningDetectiveServer.DeleteLastTeamAction:output_type -> crabs.evening_detective_server.DeleteLastTeamActionRsp + 66, // [66:104] is the sub-list for method output_type + 28, // [28:66] is the sub-list for method input_type + 28, // [28:28] is the sub-list for extension type_name + 28, // [28:28] is the sub-list for extension extendee + 0, // [0:28] is the sub-list for field type_name } func init() { file_main_proto_init() } diff --git a/proto/main.pb.gw.go b/proto/main.pb.gw.go index 1abae76..ddac661 100644 --- a/proto/main.pb.gw.go +++ b/proto/main.pb.gw.go @@ -1266,11 +1266,11 @@ func local_request_EveningDetectiveServer_GiveTeamApplications_0(ctx context.Con return msg, metadata, err } -var filter_EveningDetectiveServer_GetTeamActions_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var filter_EveningDetectiveServer_GetTeamStory_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -func request_EveningDetectiveServer_GetTeamActions_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_EveningDetectiveServer_GetTeamStory_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq GetTeamActionsReq + protoReq GetTeamStoryReq metadata runtime.ServerMetadata err error ) @@ -1288,16 +1288,16 @@ func request_EveningDetectiveServer_GetTeamActions_0(ctx context.Context, marsha if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_GetTeamActions_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_GetTeamStory_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetTeamActions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetTeamStory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_EveningDetectiveServer_GetTeamActions_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_EveningDetectiveServer_GetTeamStory_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( - protoReq GetTeamActionsReq + protoReq GetTeamStoryReq metadata runtime.ServerMetadata err error ) @@ -1312,10 +1312,10 @@ func local_request_EveningDetectiveServer_GetTeamActions_0(ctx context.Context, if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_GetTeamActions_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_GetTeamStory_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetTeamActions(ctx, &protoReq) + msg, err := server.GetTeamStory(ctx, &protoReq) return msg, metadata, err } @@ -2109,25 +2109,25 @@ func RegisterEveningDetectiveServerHandlerServer(ctx context.Context, mux *runti } forward_EveningDetectiveServer_GiveTeamApplications_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_GetTeamActions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_GetTeamStory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamActions", runtime.WithHTTPPathPattern("/api/teams/{id}/actions")) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamStory", runtime.WithHTTPPathPattern("/api/teams/{id}/story")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_EveningDetectiveServer_GetTeamActions_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_EveningDetectiveServer_GetTeamStory_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_EveningDetectiveServer_GetTeamActions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_EveningDetectiveServer_GetTeamStory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_AddTeamAction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -2804,22 +2804,22 @@ func RegisterEveningDetectiveServerHandlerClient(ctx context.Context, mux *runti } forward_EveningDetectiveServer_GiveTeamApplications_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_GetTeamActions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle(http.MethodGet, pattern_EveningDetectiveServer_GetTeamStory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamActions", runtime.WithHTTPPathPattern("/api/teams/{id}/actions")) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamStory", runtime.WithHTTPPathPattern("/api/teams/{id}/story")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_EveningDetectiveServer_GetTeamActions_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_EveningDetectiveServer_GetTeamStory_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_EveningDetectiveServer_GetTeamActions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_EveningDetectiveServer_GetTeamStory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_AddTeamAction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) @@ -2894,7 +2894,7 @@ var ( pattern_EveningDetectiveServer_UpdateTeam_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"api", "teams", "id"}, "")) pattern_EveningDetectiveServer_DeleteTeam_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"api", "teams", "id"}, "")) pattern_EveningDetectiveServer_GiveTeamApplications_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "applications"}, "")) - pattern_EveningDetectiveServer_GetTeamActions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "actions"}, "")) + pattern_EveningDetectiveServer_GetTeamStory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "story"}, "")) pattern_EveningDetectiveServer_AddTeamAction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "actions"}, "")) pattern_EveningDetectiveServer_DeleteLastTeamAction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "teams", "id", "last-actions"}, "")) ) @@ -2935,7 +2935,7 @@ var ( forward_EveningDetectiveServer_UpdateTeam_0 = runtime.ForwardResponseMessage forward_EveningDetectiveServer_DeleteTeam_0 = runtime.ForwardResponseMessage forward_EveningDetectiveServer_GiveTeamApplications_0 = runtime.ForwardResponseMessage - forward_EveningDetectiveServer_GetTeamActions_0 = runtime.ForwardResponseMessage + forward_EveningDetectiveServer_GetTeamStory_0 = runtime.ForwardResponseMessage forward_EveningDetectiveServer_AddTeamAction_0 = runtime.ForwardResponseMessage forward_EveningDetectiveServer_DeleteLastTeamAction_0 = runtime.ForwardResponseMessage ) diff --git a/proto/main_grpc.pb.go b/proto/main_grpc.pb.go index 410280d..d49081f 100644 --- a/proto/main_grpc.pb.go +++ b/proto/main_grpc.pb.go @@ -55,7 +55,7 @@ const ( EveningDetectiveServer_UpdateTeam_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/UpdateTeam" EveningDetectiveServer_DeleteTeam_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DeleteTeam" EveningDetectiveServer_GiveTeamApplications_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GiveTeamApplications" - EveningDetectiveServer_GetTeamActions_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamActions" + EveningDetectiveServer_GetTeamStory_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetTeamStory" EveningDetectiveServer_AddTeamAction_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddTeamAction" EveningDetectiveServer_DeleteLastTeamAction_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/DeleteLastTeamAction" ) @@ -99,7 +99,7 @@ type EveningDetectiveServerClient interface { UpdateTeam(ctx context.Context, in *UpdateTeamReq, opts ...grpc.CallOption) (*UpdateTeamRsp, error) DeleteTeam(ctx context.Context, in *DeleteTeamReq, opts ...grpc.CallOption) (*DeleteTeamRsp, error) GiveTeamApplications(ctx context.Context, in *GiveTeamApplicationsReq, opts ...grpc.CallOption) (*GiveTeamApplicationsRsp, error) - GetTeamActions(ctx context.Context, in *GetTeamActionsReq, opts ...grpc.CallOption) (*GetTeamActionsRsp, error) + GetTeamStory(ctx context.Context, in *GetTeamStoryReq, opts ...grpc.CallOption) (*GetTeamStoryRsp, error) AddTeamAction(ctx context.Context, in *AddTeamActionReq, opts ...grpc.CallOption) (*AddTeamActionRsp, error) DeleteLastTeamAction(ctx context.Context, in *DeleteLastTeamActionReq, opts ...grpc.CallOption) (*DeleteLastTeamActionRsp, error) } @@ -462,10 +462,10 @@ func (c *eveningDetectiveServerClient) GiveTeamApplications(ctx context.Context, return out, nil } -func (c *eveningDetectiveServerClient) GetTeamActions(ctx context.Context, in *GetTeamActionsReq, opts ...grpc.CallOption) (*GetTeamActionsRsp, error) { +func (c *eveningDetectiveServerClient) GetTeamStory(ctx context.Context, in *GetTeamStoryReq, opts ...grpc.CallOption) (*GetTeamStoryRsp, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetTeamActionsRsp) - err := c.cc.Invoke(ctx, EveningDetectiveServer_GetTeamActions_FullMethodName, in, out, cOpts...) + out := new(GetTeamStoryRsp) + err := c.cc.Invoke(ctx, EveningDetectiveServer_GetTeamStory_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -531,7 +531,7 @@ type EveningDetectiveServerServer interface { UpdateTeam(context.Context, *UpdateTeamReq) (*UpdateTeamRsp, error) DeleteTeam(context.Context, *DeleteTeamReq) (*DeleteTeamRsp, error) GiveTeamApplications(context.Context, *GiveTeamApplicationsReq) (*GiveTeamApplicationsRsp, error) - GetTeamActions(context.Context, *GetTeamActionsReq) (*GetTeamActionsRsp, error) + GetTeamStory(context.Context, *GetTeamStoryReq) (*GetTeamStoryRsp, error) AddTeamAction(context.Context, *AddTeamActionReq) (*AddTeamActionRsp, error) DeleteLastTeamAction(context.Context, *DeleteLastTeamActionReq) (*DeleteLastTeamActionRsp, error) mustEmbedUnimplementedEveningDetectiveServerServer() @@ -649,8 +649,8 @@ func (UnimplementedEveningDetectiveServerServer) DeleteTeam(context.Context, *De func (UnimplementedEveningDetectiveServerServer) GiveTeamApplications(context.Context, *GiveTeamApplicationsReq) (*GiveTeamApplicationsRsp, error) { return nil, status.Error(codes.Unimplemented, "method GiveTeamApplications not implemented") } -func (UnimplementedEveningDetectiveServerServer) GetTeamActions(context.Context, *GetTeamActionsReq) (*GetTeamActionsRsp, error) { - return nil, status.Error(codes.Unimplemented, "method GetTeamActions not implemented") +func (UnimplementedEveningDetectiveServerServer) GetTeamStory(context.Context, *GetTeamStoryReq) (*GetTeamStoryRsp, error) { + return nil, status.Error(codes.Unimplemented, "method GetTeamStory not implemented") } func (UnimplementedEveningDetectiveServerServer) AddTeamAction(context.Context, *AddTeamActionReq) (*AddTeamActionRsp, error) { return nil, status.Error(codes.Unimplemented, "method AddTeamAction not implemented") @@ -1310,20 +1310,20 @@ func _EveningDetectiveServer_GiveTeamApplications_Handler(srv interface{}, ctx c return interceptor(ctx, in, info, handler) } -func _EveningDetectiveServer_GetTeamActions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetTeamActionsReq) +func _EveningDetectiveServer_GetTeamStory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTeamStoryReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(EveningDetectiveServerServer).GetTeamActions(ctx, in) + return srv.(EveningDetectiveServerServer).GetTeamStory(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: EveningDetectiveServer_GetTeamActions_FullMethodName, + FullMethod: EveningDetectiveServer_GetTeamStory_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(EveningDetectiveServerServer).GetTeamActions(ctx, req.(*GetTeamActionsReq)) + return srv.(EveningDetectiveServerServer).GetTeamStory(ctx, req.(*GetTeamStoryReq)) } return interceptor(ctx, in, info, handler) } @@ -1512,8 +1512,8 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{ Handler: _EveningDetectiveServer_GiveTeamApplications_Handler, }, { - MethodName: "GetTeamActions", - Handler: _EveningDetectiveServer_GetTeamActions_Handler, + MethodName: "GetTeamStory", + Handler: _EveningDetectiveServer_GetTeamStory_Handler, }, { MethodName: "AddTeamAction",