This commit is contained in:
2026-10-03 12:38:11 +07:00
parent 119b22d63e
commit c16c1ed5ac
22 changed files with 34 additions and 20 deletions
+4
View File
@@ -14,3 +14,7 @@ linters:
run:
relative-path-mode: gomod
timeout: 5m
issues:
max-issues-per-linter: 0
max-same-issues: 0
+2 -1
View File
@@ -1,3 +1,4 @@
// Package main starts the evening detective backend.
package main
import (
@@ -292,7 +293,7 @@ func main() {
docsHandler := v5emb.New("API", "/swagger/doc.json", "/docs/")
mainMux.Handle("/docs/", docsHandler)
mainMux.HandleFunc("/swagger/doc.json", func(w http.ResponseWriter, r *http.Request) {
mainMux.HandleFunc("/swagger/doc.json", func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
if _, err := w.Write(swaggerJSON); err != nil {
log.Printf("write swagger document: %v", err)
+1 -1
View File
@@ -1,4 +1,4 @@
// Пакет docs встраивает юридические документы в бинарник и раздаёт их
// Package docs встраивает юридические документы в бинарник и раздаёт их
// по постоянным URL (/terms, /privacy, /consent), на которые сервис
// ссылается при фиксации акцептов соглашений (user_agreements).
package docs
+1
View File
@@ -1,3 +1,4 @@
// Package app exposes the backend transport handlers.
package app
import (
+1 -1
View File
@@ -60,7 +60,7 @@ func (r *passwordRepo) GetUserByID(_ context.Context, id int) (*repos.User, erro
}
return nil, users_repo.ErrUserNotFound
}
func (r *passwordRepo) UpdateUserPassword(_ context.Context, email, hash string) error {
func (r *passwordRepo) UpdateUserPassword(_ context.Context, _, hash string) error {
if r.saveErr != nil {
return r.saveErr
}
+1 -1
View File
@@ -80,7 +80,7 @@ func TestClientInfoFromContext(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
var ctx context.Context = context.Background()
ctx := context.Background()
if tt.md != nil {
ctx = metadata.NewIncomingContext(ctx, tt.md)
}
+1 -1
View File
@@ -72,7 +72,7 @@ func (s *server) GetGameReviewsForModeration(ctx context.Context, req *proto.Get
return &proto.GetGameReviewsRsp{AverageRating: average, ReviewsCount: count, Reviews: mapGameReviews(reviews)}, nil
}
func (s *server) GetReviewsForModeration(ctx context.Context, req *proto.GetReviewsForModerationReq) (*proto.GetGameReviewsRsp, error) {
func (s *server) GetReviewsForModeration(ctx context.Context, _ *proto.GetReviewsForModerationReq) (*proto.GetGameReviewsRsp, error) {
claims, claimsErr := claimsFromContext(ctx)
if claimsErr != nil {
return nil, claimsErr
+1 -1
View File
@@ -127,7 +127,7 @@ func (s *server) GetGameResults(ctx context.Context, req *proto.GetGameResultsRe
}, nil
}
func (s *server) GetGames(ctx context.Context, req *proto.GetGamesReq) (*proto.GetGamesRsp, error) {
func (s *server) GetGames(ctx context.Context, _ *proto.GetGamesReq) (*proto.GetGamesRsp, error) {
claims, claimsErr := claimsFromContext(ctx)
if claimsErr != nil {
return nil, claimsErr
+2 -2
View File
@@ -29,7 +29,7 @@ func (s *server) AddScenario(ctx context.Context, req *proto.AddScenarioReq) (*p
}, nil
}
func (s *server) GetMyScenarios(ctx context.Context, req *proto.GetMyScenariosReq) (*proto.GetMyScenariosRsp, error) {
func (s *server) GetMyScenarios(ctx context.Context, _ *proto.GetMyScenariosReq) (*proto.GetMyScenariosRsp, error) {
claims, claimsErr := claimsFromContext(ctx)
if claimsErr != nil {
return nil, claimsErr
@@ -48,7 +48,7 @@ func (s *server) GetMyScenarios(ctx context.Context, req *proto.GetMyScenariosRe
}, nil
}
func (s *server) GetScenariosCatalog(ctx context.Context, req *proto.GetScenariosCatalogReq) (*proto.GetScenariosCatalogRsp, error) {
func (s *server) GetScenariosCatalog(ctx context.Context, _ *proto.GetScenariosCatalogReq) (*proto.GetScenariosCatalogRsp, error) {
scenarios, err := s.scenarioService.GetScenariosCatalog(ctx)
if err != nil {
return nil, scenarioErrorStatus(err, "не удалось получить каталог сценариев")
+4 -4
View File
@@ -33,7 +33,7 @@ func (s *server) Signup(ctx context.Context, req *proto.SignupReq) (*proto.Signu
return &proto.SignupRsp{}, nil
}
func (s *server) DeleteAccount(ctx context.Context, req *proto.DeleteAccountReq) (*proto.DeleteAccountRsp, error) {
func (s *server) DeleteAccount(ctx context.Context, _ *proto.DeleteAccountReq) (*proto.DeleteAccountRsp, error) {
claims, ok := processor_jwt.ClaimsFromContext(ctx)
if !ok {
return nil, status.Errorf(codes.Unauthenticated, "claims is not provided")
@@ -143,7 +143,7 @@ func (s *server) Refresh(ctx context.Context, req *proto.RefreshReq) (*proto.Ref
}, nil
}
func (s *server) GetUsers(ctx context.Context, req *proto.GetUsersReq) (*proto.GetUsersRsp, error) {
func (s *server) GetUsers(ctx context.Context, _ *proto.GetUsersReq) (*proto.GetUsersRsp, error) {
claims, claimsErr := claimsFromContext(ctx)
if claimsErr != nil {
return nil, claimsErr
@@ -176,7 +176,7 @@ func (s *server) GetUserByID(ctx context.Context, req *proto.GetUserByIDReq) (*p
}, nil
}
func (s *server) GetMe(ctx context.Context, req *proto.GetMeReq) (*proto.GetMeRsp, error) {
func (s *server) GetMe(ctx context.Context, _ *proto.GetMeReq) (*proto.GetMeRsp, error) {
claims, claimsErr := claimsFromContext(ctx)
if claimsErr != nil {
return nil, claimsErr
@@ -219,7 +219,7 @@ func (s *server) DeleteUserRole(ctx context.Context, req *proto.DeleteUserRoleRe
return &proto.DeleteUserRoleRsp{}, nil
}
func (s *server) GetPermissions(ctx context.Context, req *proto.GetPermissionsReq) (*proto.GetPermissionsRsp, error) {
func (s *server) GetPermissions(ctx context.Context, _ *proto.GetPermissionsReq) (*proto.GetPermissionsRsp, error) {
claims, claimsErr := claimsFromContext(ctx)
if claimsErr != nil {
return nil, claimsErr
+1
View File
@@ -1,3 +1,4 @@
// Package cleaner normalizes user-provided text and codes.
package cleaner
type ICleaner interface {
+1 -1
View File
@@ -1,4 +1,4 @@
// Пакет scenario_archive — сборка и разбор ZIP-архива сценария.
// Package scenario_archive собирает и разбирает ZIP-архивы сценариев.
// Архив: scenario.json (описание и история) + images/<имя> (файлы изображений).
// Все пути внутри архива относительные.
package scenario_archive
+1
View File
@@ -1,3 +1,4 @@
// Package actions_repo provides database access for team actions.
package actions_repo
import (
+1
View File
@@ -1,3 +1,4 @@
// Package applications_repo provides database access for team applications.
package applications_repo
import (
+1
View File
@@ -1,3 +1,4 @@
// Package games_repo provides database access for games.
package games_repo
import (
+1
View File
@@ -1,3 +1,4 @@
// Package health_repo provides database health checks.
package health_repo
import (
@@ -1,3 +1,4 @@
// Package file_service handles file upload and download operations.
package file_service
import (
@@ -1,3 +1,4 @@
// Package gameplay_service implements team gameplay operations.
package gameplay_service
import (
+1 -1
View File
@@ -79,7 +79,7 @@ func TestStreamableHTTPEndToEnd(t *testing.T) {
// Проверка, что структуры моков сериализуемы (защита от изменения типов
// storytelling/game_service без обновления моков).
func TestMockTypesUsable(t *testing.T) {
func TestMockTypesUsable(_ *testing.T) {
_ = defaultStory()
_ = defaultGame()
_ = (*game_model.Game)(nil)
@@ -25,14 +25,14 @@ type fakeGamePlayer struct {
viaMCP bool
}
func (f *fakeGamePlayer) GetTeamActions(_ context.Context, teamID int, password string) (*storytelling.Story, *game_model.Game, []actions_repo.Action, error) {
func (f *fakeGamePlayer) GetTeamActions(_ context.Context, _ int, _ string) (*storytelling.Story, *game_model.Game, []actions_repo.Action, error) {
if f.err != nil {
return nil, nil, nil, f.err
}
return f.story, f.game, nil, nil
}
func (f *fakeGamePlayer) AddTeamAction(_ context.Context, teamID int, password, code string, viaMCP bool) error {
func (f *fakeGamePlayer) AddTeamAction(_ context.Context, _ int, _, _ string, viaMCP bool) error {
f.viaMCP = viaMCP
if f.err != nil {
return f.err
@@ -12,6 +12,7 @@ import (
"net/url"
"strings"
"time"
// Ensure timezone data is available in minimal runtime images.
_ "time/tzdata"
"evening_detective_server/internal/modules/email_sender"
@@ -68,14 +68,14 @@ func TestConclusionLifecycle(t *testing.T) {
if err != nil {
t.Fatal(err)
}
copy, err := svc.GetFullScenarioByID(ctx, imported)
importedScenario, err := svc.GetFullScenarioByID(ctx, imported)
if err != nil {
t.Fatal(err)
}
if copy.Story.Conclusion == nil || copy.Story.Conclusion.Text != conclusion.Text {
if importedScenario.Story.Conclusion == nil || importedScenario.Story.Conclusion.Text != conclusion.Text {
t.Fatal("lost conclusion on import")
}
name := strings.TrimPrefix(copy.Story.Conclusion.Video, testDomain)
name := strings.TrimPrefix(importedScenario.Story.Conclusion.Video, testDomain)
file, err := storage.Get(ctx, name)
if err != nil || name == "ending.mp4" || string(file.Data) != "video" {
t.Fatalf("video import: %q, %v", name, err)
@@ -134,7 +134,7 @@ func (s *fakeStorage) Delete(_ context.Context, name string) error {
return nil
}
func (s *fakeStorage) MimeType(filename string) string {
func (s *fakeStorage) MimeType(_ string) string {
return ""
}