generated from VLADIMIR/template
fix
This commit is contained in:
@@ -14,3 +14,7 @@ linters:
|
|||||||
run:
|
run:
|
||||||
relative-path-mode: gomod
|
relative-path-mode: gomod
|
||||||
timeout: 5m
|
timeout: 5m
|
||||||
|
|
||||||
|
issues:
|
||||||
|
max-issues-per-linter: 0
|
||||||
|
max-same-issues: 0
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package main starts the evening detective backend.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -292,7 +293,7 @@ func main() {
|
|||||||
|
|
||||||
docsHandler := v5emb.New("API", "/swagger/doc.json", "/docs/")
|
docsHandler := v5emb.New("API", "/swagger/doc.json", "/docs/")
|
||||||
mainMux.Handle("/docs/", docsHandler)
|
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")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
if _, err := w.Write(swaggerJSON); err != nil {
|
if _, err := w.Write(swaggerJSON); err != nil {
|
||||||
log.Printf("write swagger document: %v", err)
|
log.Printf("write swagger document: %v", err)
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// Пакет docs встраивает юридические документы в бинарник и раздаёт их
|
// Package docs встраивает юридические документы в бинарник и раздаёт их
|
||||||
// по постоянным URL (/terms, /privacy, /consent), на которые сервис
|
// по постоянным URL (/terms, /privacy, /consent), на которые сервис
|
||||||
// ссылается при фиксации акцептов соглашений (user_agreements).
|
// ссылается при фиксации акцептов соглашений (user_agreements).
|
||||||
package docs
|
package docs
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package app exposes the backend transport handlers.
|
||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func (r *passwordRepo) GetUserByID(_ context.Context, id int) (*repos.User, erro
|
|||||||
}
|
}
|
||||||
return nil, users_repo.ErrUserNotFound
|
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 {
|
if r.saveErr != nil {
|
||||||
return r.saveErr
|
return r.saveErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ func TestClientInfoFromContext(t *testing.T) {
|
|||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
var ctx context.Context = context.Background()
|
ctx := context.Background()
|
||||||
if tt.md != nil {
|
if tt.md != nil {
|
||||||
ctx = metadata.NewIncomingContext(ctx, tt.md)
|
ctx = metadata.NewIncomingContext(ctx, tt.md)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
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)
|
claims, claimsErr := claimsFromContext(ctx)
|
||||||
if claimsErr != nil {
|
if claimsErr != nil {
|
||||||
return nil, claimsErr
|
return nil, claimsErr
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ func (s *server) GetGameResults(ctx context.Context, req *proto.GetGameResultsRe
|
|||||||
}, nil
|
}, 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)
|
claims, claimsErr := claimsFromContext(ctx)
|
||||||
if claimsErr != nil {
|
if claimsErr != nil {
|
||||||
return nil, claimsErr
|
return nil, claimsErr
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func (s *server) AddScenario(ctx context.Context, req *proto.AddScenarioReq) (*p
|
|||||||
}, nil
|
}, 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)
|
claims, claimsErr := claimsFromContext(ctx)
|
||||||
if claimsErr != nil {
|
if claimsErr != nil {
|
||||||
return nil, claimsErr
|
return nil, claimsErr
|
||||||
@@ -48,7 +48,7 @@ func (s *server) GetMyScenarios(ctx context.Context, req *proto.GetMyScenariosRe
|
|||||||
}, nil
|
}, 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)
|
scenarios, err := s.scenarioService.GetScenariosCatalog(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, scenarioErrorStatus(err, "не удалось получить каталог сценариев")
|
return nil, scenarioErrorStatus(err, "не удалось получить каталог сценариев")
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ func (s *server) Signup(ctx context.Context, req *proto.SignupReq) (*proto.Signu
|
|||||||
return &proto.SignupRsp{}, nil
|
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)
|
claims, ok := processor_jwt.ClaimsFromContext(ctx)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, status.Errorf(codes.Unauthenticated, "claims is not provided")
|
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
|
}, 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)
|
claims, claimsErr := claimsFromContext(ctx)
|
||||||
if claimsErr != nil {
|
if claimsErr != nil {
|
||||||
return nil, claimsErr
|
return nil, claimsErr
|
||||||
@@ -176,7 +176,7 @@ func (s *server) GetUserByID(ctx context.Context, req *proto.GetUserByIDReq) (*p
|
|||||||
}, nil
|
}, 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)
|
claims, claimsErr := claimsFromContext(ctx)
|
||||||
if claimsErr != nil {
|
if claimsErr != nil {
|
||||||
return nil, claimsErr
|
return nil, claimsErr
|
||||||
@@ -219,7 +219,7 @@ func (s *server) DeleteUserRole(ctx context.Context, req *proto.DeleteUserRoleRe
|
|||||||
return &proto.DeleteUserRoleRsp{}, nil
|
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)
|
claims, claimsErr := claimsFromContext(ctx)
|
||||||
if claimsErr != nil {
|
if claimsErr != nil {
|
||||||
return nil, claimsErr
|
return nil, claimsErr
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package cleaner normalizes user-provided text and codes.
|
||||||
package cleaner
|
package cleaner
|
||||||
|
|
||||||
type ICleaner interface {
|
type ICleaner interface {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Пакет scenario_archive — сборка и разбор ZIP-архива сценария.
|
// Package scenario_archive собирает и разбирает ZIP-архивы сценариев.
|
||||||
// Архив: scenario.json (описание и история) + images/<имя> (файлы изображений).
|
// Архив: scenario.json (описание и история) + images/<имя> (файлы изображений).
|
||||||
// Все пути внутри архива относительные.
|
// Все пути внутри архива относительные.
|
||||||
package scenario_archive
|
package scenario_archive
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package actions_repo provides database access for team actions.
|
||||||
package actions_repo
|
package actions_repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package applications_repo provides database access for team applications.
|
||||||
package applications_repo
|
package applications_repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package games_repo provides database access for games.
|
||||||
package games_repo
|
package games_repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package health_repo provides database health checks.
|
||||||
package health_repo
|
package health_repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package file_service handles file upload and download operations.
|
||||||
package file_service
|
package file_service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package gameplay_service implements team gameplay operations.
|
||||||
package gameplay_service
|
package gameplay_service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ func TestStreamableHTTPEndToEnd(t *testing.T) {
|
|||||||
|
|
||||||
// Проверка, что структуры моков сериализуемы (защита от изменения типов
|
// Проверка, что структуры моков сериализуемы (защита от изменения типов
|
||||||
// storytelling/game_service без обновления моков).
|
// storytelling/game_service без обновления моков).
|
||||||
func TestMockTypesUsable(t *testing.T) {
|
func TestMockTypesUsable(_ *testing.T) {
|
||||||
_ = defaultStory()
|
_ = defaultStory()
|
||||||
_ = defaultGame()
|
_ = defaultGame()
|
||||||
_ = (*game_model.Game)(nil)
|
_ = (*game_model.Game)(nil)
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ type fakeGamePlayer struct {
|
|||||||
viaMCP bool
|
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 {
|
if f.err != nil {
|
||||||
return nil, nil, nil, f.err
|
return nil, nil, nil, f.err
|
||||||
}
|
}
|
||||||
return f.story, f.game, nil, nil
|
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
|
f.viaMCP = viaMCP
|
||||||
if f.err != nil {
|
if f.err != nil {
|
||||||
return f.err
|
return f.err
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
// Ensure timezone data is available in minimal runtime images.
|
||||||
_ "time/tzdata"
|
_ "time/tzdata"
|
||||||
|
|
||||||
"evening_detective_server/internal/modules/email_sender"
|
"evening_detective_server/internal/modules/email_sender"
|
||||||
|
|||||||
@@ -68,14 +68,14 @@ func TestConclusionLifecycle(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
copy, err := svc.GetFullScenarioByID(ctx, imported)
|
importedScenario, err := svc.GetFullScenarioByID(ctx, imported)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
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")
|
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)
|
file, err := storage.Get(ctx, name)
|
||||||
if err != nil || name == "ending.mp4" || string(file.Data) != "video" {
|
if err != nil || name == "ending.mp4" || string(file.Data) != "video" {
|
||||||
t.Fatalf("video import: %q, %v", name, err)
|
t.Fatalf("video import: %q, %v", name, err)
|
||||||
@@ -134,7 +134,7 @@ func (s *fakeStorage) Delete(_ context.Context, name string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *fakeStorage) MimeType(filename string) string {
|
func (s *fakeStorage) MimeType(_ string) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user