fix:
This commit is contained in:
parent
30ac81b789
commit
81e75e5a9c
22 changed files with 42 additions and 29 deletions
6
Makefile
6
Makefile
|
@ -1,3 +1,6 @@
|
||||||
|
tag = latest
|
||||||
|
|
||||||
|
|
||||||
gen:
|
gen:
|
||||||
@buf generate
|
@buf generate
|
||||||
dev:
|
dev:
|
||||||
|
@ -6,4 +9,5 @@ dev:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@make gen
|
@make gen
|
||||||
# TODO: build dockerfile
|
@docker build . -t ms-tester:${tag}
|
||||||
|
@#docker push ms-tester:${tag}
|
||||||
|
|
1
go.mod
1
go.mod
|
@ -14,6 +14,7 @@ require (
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
git.sch9.ru/new_gate/models v0.0.1 // indirect
|
||||||
github.com/OneOfOne/xxhash v1.2.8 // indirect
|
github.com/OneOfOne/xxhash v1.2.8 // indirect
|
||||||
github.com/agnivade/levenshtein v1.1.1 // indirect
|
github.com/agnivade/levenshtein v1.1.1 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -1,5 +1,9 @@
|
||||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
|
git.sch9.ru/new_gate/models v0.0.0-20240923183834-466a81903af8 h1:PwRvUZ1iSZO1Na+0HXpjYiCgt5gxqh3aKbWtV64FDXk=
|
||||||
|
git.sch9.ru/new_gate/models v0.0.0-20240923183834-466a81903af8/go.mod h1:oLUfkN1hwclYTj8Y+br5ShZHLB4y2StRwf+mhc33NNc=
|
||||||
|
git.sch9.ru/new_gate/models v0.0.1 h1:VmRUUNNFrX1ZN26wuyfa5Z8il7VuIN49XjXsCtDQhLs=
|
||||||
|
git.sch9.ru/new_gate/models v0.0.1/go.mod h1:oLUfkN1hwclYTj8Y+br5ShZHLB4y2StRwf+mhc33NNc=
|
||||||
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
|
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
|
||||||
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
|
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
|
||||||
|
|
|
@ -3,7 +3,7 @@ package lib
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Env string `env:"ENV" env-default:"prod"`
|
Env string `env:"ENV" env-default:"prod"`
|
||||||
Pandoc string `env:"PANDOC" required:"true"`
|
Pandoc string `env:"PANDOC" required:"true"`
|
||||||
Auth string `env:"PANDOC" required:"true"`
|
Auth string `env:"AUTH" required:"true"`
|
||||||
Address string `env:"ADDRESS" required:"true"`
|
Address string `env:"ADDRESS" required:"true"`
|
||||||
PostgresDSN string `env:"POSTGRES_DSN" required:"true"`
|
PostgresDSN string `env:"POSTGRES_DSN" required:"true"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"git.sch9.ru/new_gate/models"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ContestStorage interface {
|
type ContestStorage interface {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LanguageStorage interface {
|
type LanguageStorage interface {
|
||||||
|
|
|
@ -2,8 +2,8 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"git.sch9.ru/new_gate/models"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ParticipantStorage interface {
|
type ParticipantStorage interface {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
"github.com/open-policy-agent/opa/rego"
|
"github.com/open-policy-agent/opa/rego"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"git.sch9.ru/new_gate/models"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ProblemStorage interface {
|
type ProblemStorage interface {
|
||||||
|
|
|
@ -2,8 +2,8 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"git.sch9.ru/new_gate/models"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SolutionStorage interface {
|
type SolutionStorage interface {
|
||||||
|
|
|
@ -2,8 +2,8 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"git.sch9.ru/new_gate/models"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TaskStorage interface {
|
type TaskStorage interface {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserStorage interface {
|
type UserStorage interface {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,7 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -21,7 +21,7 @@ func NewLanguageStorage(db *sqlx.DB, logger *zap.Logger) *LanguageStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (storage *LanguageStorage) ReadLanguageById(ctx context.Context, id int32) (*models.Language, error) {
|
func (storage *LanguageStorage) ReadLanguageById(ctx context.Context, id int32) (*models.Language, error) {
|
||||||
if(id<=int32(len(models.Languages))) {
|
if id <= int32(len(models.Languages)) {
|
||||||
return nil, lib.StorageError(nil, lib.ErrNotFound, "language not found")
|
return nil, lib.StorageError(nil, lib.ErrNotFound, "language not found")
|
||||||
}
|
}
|
||||||
return &models.Languages[id], nil
|
return &models.Languages[id], nil
|
||||||
|
|
|
@ -2,7 +2,7 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package storage
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,7 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,7 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,7 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ package transport
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"git.sch9.ru/new_gate/models"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
|
||||||
sessionv1 "git.sch9.ru/new_gate/ms-tester/pkg/go/gen/proto/session/v1"
|
sessionv1 "git.sch9.ru/new_gate/ms-tester/pkg/go/gen/proto/session/v1"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
|
|
|
@ -2,8 +2,8 @@ package transport
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"git.sch9.ru/new_gate/models"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
|
||||||
problemv1 "git.sch9.ru/new_gate/ms-tester/pkg/go/gen/proto/problem/v1"
|
problemv1 "git.sch9.ru/new_gate/ms-tester/pkg/go/gen/proto/problem/v1"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
|
|
|
@ -2,7 +2,7 @@ package transport
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"git.sch9.ru/new_gate/ms-tester/pkg/models"
|
"git.sch9.ru/new_gate/models"
|
||||||
problemv1 "git.sch9.ru/new_gate/ms-tester/pkg/go/gen/proto/problem/v1"
|
problemv1 "git.sch9.ru/new_gate/ms-tester/pkg/go/gen/proto/problem/v1"
|
||||||
sessionv1 "git.sch9.ru/new_gate/ms-tester/pkg/go/gen/proto/session/v1"
|
sessionv1 "git.sch9.ru/new_gate/ms-tester/pkg/go/gen/proto/session/v1"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -58,10 +58,14 @@ func NewTesterServer(
|
||||||
}
|
}
|
||||||
|
|
||||||
grpcServer := grpc.NewServer(
|
grpcServer := grpc.NewServer(
|
||||||
grpc.UnaryInterceptor(server.ErrUnwrappingUnaryInterceptor()),
|
grpc.ChainUnaryInterceptor(
|
||||||
grpc.StreamInterceptor(server.ErrUnwrappingStreamInterceptor()),
|
server.ErrUnwrappingUnaryInterceptor(),
|
||||||
grpc.UnaryInterceptor(server.AuthUnaryInterceptor()),
|
server.AuthUnaryInterceptor(),
|
||||||
grpc.StreamInterceptor(server.AuthStreamInterceptor()),
|
),
|
||||||
|
grpc.ChainStreamInterceptor(
|
||||||
|
server.ErrUnwrappingStreamInterceptor(),
|
||||||
|
server.AuthStreamInterceptor(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
problemv1.RegisterProblemServiceServer(grpcServer, server)
|
problemv1.RegisterProblemServiceServer(grpcServer, server)
|
||||||
|
|
Loading…
Reference in a new issue