From 6e627d06d1a9f35ffdc6e2e87f68e50ba2275fc9 Mon Sep 17 00:00:00 2001 From: Falokut <71385842+Falokut@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:16:49 +0300 Subject: [PATCH] Formatting the code and ensuring it conforms to the linter's requirements. --- .Dockerignore | 1 - .github/workflows/go.yml | 24 ++ .github/workflows/golangci-lint.yml | 55 +++ .golangci.yml | 160 +++++++++ README.md | 10 +- cmd/server/app.go | 85 +++-- go.mod | 32 +- go.sum | 76 ++--- internal/cinemaservice/cinemaservice.go | 21 +- internal/config/config.go | 10 +- internal/events/ordersEvents.go | 2 +- internal/handler/handler.go | 94 +++--- internal/models/order.go | 50 +-- internal/models/orderItem.go | 2 +- internal/models/orderPreview.go | 4 +- internal/models/processOrderDTO.go | 6 +- internal/models/ticket.go | 2 +- internal/paymentservice/paymentServiceStub.go | 70 ++-- internal/profilesservice/profilesservice.go | 11 +- .../mongorepository/cinemaOrdersRepository.go | 167 +++++----- internal/repository/mongorepository/mongo.go | 8 +- .../repository/rediscache/reserveCache.go | 55 ++- internal/repository/repository.go | 20 +- internal/service/service.go | 174 +++++----- .../v1/protos/cinema_orders_service_v1.pb.go | 315 +++++++++--------- .../protos/cinema_orders_service_v1.pb.gw.go | 132 ++++---- .../cinema_orders_service_v1_messages.pb.go | 130 ++++---- pkg/logging/logging.go | 52 ++- pkg/sliceutils/sliceutils_test.go | 6 + .../v1/cinema_orders_service_v1.proto | 12 +- .../cinema_orders_service_v1_messages.proto | 32 +- .../cinema_orders_service_v1.swagger.json | 4 +- 32 files changed, 1033 insertions(+), 789 deletions(-) create mode 100644 .github/workflows/go.yml create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .golangci.yml diff --git a/.Dockerignore b/.Dockerignore index b070a6a..ad1950c 100644 --- a/.Dockerignore +++ b/.Dockerignore @@ -7,4 +7,3 @@ Makefile *.md *.txt *.proto -**/movies_db/ diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..d9ff0a1 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,24 @@ +# This workflow will tests a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21.4' + + - name: Test + run: go test -v ./... diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..7e44da9 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,55 @@ +name: golangci-lint +on: + push: + branches: + - master + - main + pull_request: + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + # pull-requests: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.22.0" + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v4 + with: + # Require: The version of golangci-lint to use. + # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. + # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. + version: latest + + # Optional: working directory, useful for monorepos + # working-directory: somedir + + # Optional: golangci-lint command line arguments. + # + # Note: By default, the `.golangci.yml` file should be at the root of the repository. + # The location of the configuration file can be changed by using `--config=` + # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true, then all caching functionality will be completely disabled, + # takes precedence over all other caching options. + # skip-cache: true + + # Optional: if set to true, then the action won't cache or restore ~/go/pkg. + # skip-pkg-cache: true + + # Optional: if set to true, then the action won't cache or restore ~/.cache/go-build. + # skip-build-cache: true + + # Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'. + # install-mode: "goinstall" diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..d2bcad9 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,160 @@ +linters-settings: + dupl: + threshold: 100 + funlen: + lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. + statements: 75 + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + enabled-tags: + - diagnostic + - experimental + - performance + - style + disabled-checks: + - dupImport # https://github.com/go-critic/go-critic/issues/845 + - ifElseChain + - octalLiteral + - whyNoLint + - ptrToRefParam + gocyclo: + min-complexity: 15 + gofmt: + rewrite-rules: + - pattern: "interface{}" + replacement: "any" + gomnd: + # don't include the "operation" and "assign" + checks: + - argument + - case + - condition + - return + ignored-numbers: + - "0" + - "1" + - "2" + - "3" + ignored-functions: + - strings.SplitN + govet: + settings: + printf: + funcs: + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf + enable: + - nilness + - shadow + errorlint: + asserts: false + lll: + line-length: 140 + misspell: + locale: US + nolintlint: + allow-unused: false # report any unused nolint directives + require-explanation: false # don't require an explanation for nolint directives + require-specific: false # don't require nolint directives to be specific about which linter is being skipped + revive: + rules: + - name: unexported-return + disabled: true + - name: unused-parameter + maligned: + suggest-new: true + +linters: + disable-all: true + enable: + - bodyclose + - dogsled + - dupl + - errcheck + - errorlint + - exportloopref + - funlen + - gocheckcompilerdirectives + - gochecknoinits + - goconst + - gocritic + - gocyclo + - gofmt + - gomnd + - goprintffuncname + - gosimple + - govet + - ineffassign + - lll + - misspell + - noctx + - nolintlint + - revive + - staticcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + - whitespace + + # don't enable: + # - asciicheck + # - gochecknoglobals + # - gocognit + # - godot + # - godox + # - goerr113 + # - nestif + # - prealloc + # - testpackage + # - wsl + +issues: + exclude: + - "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked" + - "exported (type|method|function) (.+) should have comment or be unexported" + - "ST1000: at least one file in a package should have a package comment" + # Excluding configuration per-path, per-linter, per-text and per-source + exclude-rules: + - path: _test\.go + linters: + - gomnd + - path: pkg/golinters/errcheck.go + linters: [staticcheck] + text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" + - path: pkg/commands/run.go + linters: [staticcheck] + text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" + - path: pkg/commands/run.go + linters: [staticcheck] + text: "SA1019: c.cfg.Run.ShowStats is deprecated: use Output.ShowStats instead." + + - path: pkg/golinters/gofumpt.go + linters: [staticcheck] + text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." + - path: pkg/golinters/staticcheck_common.go + linters: [staticcheck] + text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." + - path: pkg/lint/lintersdb/manager.go + linters: [staticcheck] + text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." + + - path: pkg/golinters/unused.go + linters: [gocritic] + text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" + - path: test/(fix|linters)_test.go + linters: [gocritic] + text: "string `gocritic.go` has 3 occurrences, make it a constant" + +run: + timeout: 5m + skip-dirs: + - test/testdata_etc # test files + - internal/cache # extracted from Go code + - internal/renameio # extracted from Go code + - internal/robustio # extracted from Go code diff --git a/README.md b/README.md index 9111e7e..0f46454 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ +# Cinema service [![Go Report Card](https://goreportcard.com/badge/github.com/Falokut/cinema_orders_service)](https://goreportcard.com/report/github.com/Falokut/cinema_orders_service) +[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/Falokut/cinema_orders_service) +![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/Falokut/cinema_orders_service) +[![Go](https://github.com/Falokut/cinema_orders_service/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/Falokut/cinema_orders_service/actions/workflows/go.yml) ![](https://changkun.de/urlstat?mode=github&repo=Falokut/cinema_orders_service) +[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE) +--- # Content @@ -60,8 +66,8 @@ if supported values is empty, then any type values are supported |refund_sleep_time|payment_service||time.Duration with positive duration|the time after which the order status changes TO REFUNDED|[supported values](#timeduration-yaml-supported-values)| |addr|profiles_service|PROFILES_SERVICE_ADDR|string|address of the profiles service|all valid addresses formatted like host:port or ip-address:port| |secure_config|profiles_service||nested yml configuration [secure config](#secure-connection-config)||| -|addr|cinema_service|CINEMA_SERVICE_ADDR|string|address of the profiles service|all valid addresses formatted like host:port or ip-address:port| -|secure_config|cinema_service||nested yml configuration [secure config](#secure-connection-config)||| +|addr|cinema_orders_service|CINEMA_SERVICE_ADDR|string|address of the profiles service|all valid addresses formatted like host:port or ip-address:port| +|secure_config|cinema_orders_service||nested yml configuration [secure config](#secure-connection-config)||| ### time.Duration yaml supported values diff --git a/cmd/server/app.go b/cmd/server/app.go index 3f7eb68..cd1ad2a 100644 --- a/cmd/server/app.go +++ b/cmd/server/app.go @@ -29,22 +29,29 @@ import ( "github.com/sirupsen/logrus" ) -func main() { - logging.NewEntry(logging.ConsoleOutput) +func initHealthcheck(cfg *config.Config, shutdown chan error, resources []healthcheck.HealthcheckResource) { logger := logging.GetLogger() - cfg := config.GetConfig() + logger.Info("Healthcheck initializing") + healthcheckManager := healthcheck.NewHealthManager(logger.Logger, + resources, cfg.HealthcheckPort, nil) + go func() { + logger.Info("Healthcheck server running") + if err := healthcheckManager.RunHealthcheckEndpoint(); err != nil { + logger.Errorf("Shutting down, can't run healthcheck endpoint %v", err) + shutdown <- err + } + }() +} - logLevel, err := logrus.ParseLevel(cfg.LogLevel) - if err != nil { - logger.Fatal(err) - } - logger.Logger.SetLevel(logLevel) +func initMetrics(cfg *config.Config, shutdown chan error) (metrics.Metrics, error) { + logger := logging.GetLogger() tracer, closer, err := jaegerTracer.InitJaeger(cfg.JaegerConfig) if err != nil { logger.Errorf("Shutting down, error while creating tracer %v", err) - return + return nil, err } + logger.Info("Jaeger connected") defer closer.Close() opentracing.SetGlobalTracer(tracer) @@ -53,27 +60,51 @@ func main() { metric, err := metrics.CreateMetrics(cfg.PrometheusConfig.Name) if err != nil { logger.Errorf("Shutting down, error while creating metrics %v", err) - return + return nil, err } - shutdown := make(chan error, 1) go func() { logger.Info("Metrics server running") if err := metrics.RunMetricServer(cfg.PrometheusConfig.ServerConfig); err != nil { logger.Errorf("Shutting down, error while running metrics server %v", err) shutdown <- err - return } }() - cinemaOrdersDB, err := mongo_repository.NewMongoDB(cfg.DbConnectionString) + return metric, nil +} + +func main() { + logging.NewEntry(logging.ConsoleOutput) + logger := logging.GetLogger() + cfg := config.GetConfig() + + logLevel, err := logrus.ParseLevel(cfg.LogLevel) + if err != nil { + logger.Fatal(err) + } + logger.Logger.SetLevel(logLevel) + + shutdown := make(chan error, 1) + metric, err := initMetrics(cfg, shutdown) + if err != nil { + logger.Error(err) + return + } + cinemaOrdersDB, err := mongo_repository.NewMongoDB(cfg.DBConnectionString) if err != nil { logger.Errorf("Shutting down, connection to the database not established %v", err) return } - defer cinemaOrdersDB.Disconnect(context.Background()) + defer func() { + derr := cinemaOrdersDB.Disconnect(context.Background()) + if derr != nil { + logger.Errorf("Error while closing connection %v", derr) + return + } + }() cinemaRepo := mongo_repository.NewCinemaOrdersRepository( - logger.Logger, cinemaOrdersDB, cfg.DbName) + logger.Logger, cinemaOrdersDB, cfg.DBName) reserveRdb, err := rediscache.NewRedisCache(&redis.Options{ Network: cfg.ReserveCache.Network, @@ -87,16 +118,8 @@ func main() { } defer reserveRdb.Shutdown(context.Background()) reserveCache := rediscache.NewReserveCache(reserveRdb, logger.Logger) - go func() { - logger.Info("Healthcheck initializing") - healthcheckManager := healthcheck.NewHealthManager(logger.Logger, - []healthcheck.HealthcheckResource{cinemaRepo, reserveCache}, cfg.HealthcheckPort, nil) - if err := healthcheckManager.RunHealthcheckEndpoint(); err != nil { - logger.Errorf("Shutting down, error while running healthcheck endpoint %s", err.Error()) - shutdown <- err - return - } - }() + + initHealthcheck(cfg, shutdown, []healthcheck.HealthcheckResource{reserveCache, cinemaRepo}) cinemaService, err := cinema_service.NewCinemaService( cfg.CinemaServiceConfig.Addr, @@ -127,7 +150,7 @@ func main() { logger.Logger, ) - service := service.NewCinemaOrdersService(logger.Logger, + s := service.NewCinemaOrdersService(logger.Logger, cinemaRepo, reserveCache, cfg.SeatReservationTime, @@ -137,11 +160,11 @@ func main() { ordersEvents, ) - handler := handler.NewCinemaOrdersHandler(logger.Logger, service) + h := handler.NewCinemaOrdersHandler(logger.Logger, s) logger.Info("Server initializing") - s := server.NewServer(logger.Logger, handler) + serv := server.NewServer(logger.Logger, h) go func() { - if err := s.Run(getListenServerConfig(cfg), metric, nil, nil); err != nil { + if err := serv.Run(getListenServerConfig(cfg), metric, nil, nil); err != nil { logger.Errorf("Shutting down, error while running server %s", err.Error()) shutdown <- err return @@ -158,7 +181,7 @@ func main() { break } - s.Shutdown() + serv.Shutdown() } func getListenServerConfig(cfg *config.Config) server.Config { @@ -174,7 +197,7 @@ func getListenServerConfig(cfg *config.Config) server.Config { return errors.New("can't convert") } - return cinema_orders_service.RegisterCinemaOrdersServiceV1HandlerServer(context.Background(), + return cinema_orders_service.RegisterCinemaOrdersServiceV1HandlerServer(ctx, mux, serv) }, } diff --git a/go.mod b/go.mod index 2ee9692..b9c0bb7 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,12 @@ module github.com/Falokut/cinema_orders_service -go 1.22 +go 1.22.0 require ( - github.com/Falokut/cinema_service v0.0.0-20240220084546-284e271b6345 + github.com/Falokut/cinema_service v0.0.0-20240323181217-55959521890d github.com/Falokut/grpc_rest_server v1.0.9 github.com/Falokut/healthcheck v0.0.0-20231124155013-bff54f9bc002 - github.com/Falokut/online_cinema_ticket_office.loggerwrapper v0.0.0-20231130151717-09aa21496f83 - github.com/Falokut/profiles_service v0.0.0-20240221183117-65f87e6f89a4 + github.com/Falokut/profiles_service v0.0.0-20240313184108-d9bd7fb366d7 github.com/google/uuid v1.6.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 @@ -19,17 +18,17 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/uber/jaeger-client-go v2.30.0+incompatible go.mongodb.org/mongo-driver v1.14.0 - golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 - google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 + google.golang.org/genproto/googleapis/api v0.0.0-20240325203815-454cdb8f5daa + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( github.com/golang/snappy v0.0.4 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/montanaflynn/stats v0.7.1 // indirect - github.com/stretchr/testify v1.8.4 + github.com/stretchr/testify v1.9.0 github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect @@ -44,7 +43,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect github.com/joho/godotenv v1.5.1 // indirect @@ -52,18 +51,17 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.48.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/common v0.51.1 // indirect + github.com/prometheus/procfs v0.13.0 // indirect github.com/soheilhy/cmux v0.1.5 // indirect github.com/uber/jaeger-lib v2.4.1+incompatible // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/crypto v0.20.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa // indirect gopkg.in/yaml.v3 v3.0.1 // indirect olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect ) diff --git a/go.sum b/go.sum index b17fc20..37c9b1d 100644 --- a/go.sum +++ b/go.sum @@ -3,18 +3,16 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/Falokut/cinema_service v0.0.0-20240220084546-284e271b6345 h1:OgjYFsjaAJEzUmrOXs5/pcv0h+HbRsv87VG1/pEET90= -github.com/Falokut/cinema_service v0.0.0-20240220084546-284e271b6345/go.mod h1:frdPWBBTFGjJzIBTJskTG/1jEi0xM0x0TZYun8DnLJY= +github.com/Falokut/cinema_service v0.0.0-20240323181217-55959521890d h1:YcxgbwAMYXzn8lOY3sAA9cyezwvNB4uPOYYQnbxPCzI= +github.com/Falokut/cinema_service v0.0.0-20240323181217-55959521890d/go.mod h1:B0jYDNrZSWZ6exFBrYsA7vKkEF5zVQ33bfpuUyDKhnc= github.com/Falokut/grpc_rest_server v1.0.9 h1:yj+RRtoWeRFTUv1uYcKIZnOJLkISAiM0XrXdNmCOgvI= github.com/Falokut/grpc_rest_server v1.0.9/go.mod h1:589fm83mJbEUyDx2MeqQ/1zF79j8zzTVhctQccCheX0= github.com/Falokut/healthcheck v0.0.0-20231124155013-bff54f9bc002 h1:lnv8v7IvCnKxRbrWjINHOWHpZPpFDSqv0QFi8v1UM4E= github.com/Falokut/healthcheck v0.0.0-20231124155013-bff54f9bc002/go.mod h1:S4mxGDEYOzK4c5KgTs2tCSNovzu7lLaNSIPG4lX3a1w= github.com/Falokut/interceptors v1.0.5 h1:yxGbnf/q60p0Mv4UX0+ioOblzEsdY+ATz+ToDFlJMec= github.com/Falokut/interceptors v1.0.5/go.mod h1:TWflfMzIINRNvfp61dkznvzXwdrV1pxkHzybVZK/cgw= -github.com/Falokut/online_cinema_ticket_office.loggerwrapper v0.0.0-20231130151717-09aa21496f83 h1:tqDIrLbp2lhDNev8zlWxY0X4rAZQeyUnLL6wcJ3CBP8= -github.com/Falokut/online_cinema_ticket_office.loggerwrapper v0.0.0-20231130151717-09aa21496f83/go.mod h1:KBQXfAaJe51Oc6J1Uu+3Z8sIm1POZ6qQWAzc1/ioA9c= -github.com/Falokut/profiles_service v0.0.0-20240221183117-65f87e6f89a4 h1:sPN5F/X4n1ZfE5DMhjxuqxZJZ/1/M8TXysqrhJyrhgg= -github.com/Falokut/profiles_service v0.0.0-20240221183117-65f87e6f89a4/go.mod h1:uO9gvkFZxNhFHR75q8sOmgdtXiBmBImegRxfY/oiTPg= +github.com/Falokut/profiles_service v0.0.0-20240313184108-d9bd7fb366d7 h1:E8jlid2q+G5vt82bpvrM0f6E/UKgSJSJ7L7csMr1oEU= +github.com/Falokut/profiles_service v0.0.0-20240313184108-d9bd7fb366d7/go.mod h1:JVhHbllQaahoPAY40zTkRogtm5Wbo6qJOVh9TkQzkhM= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -50,13 +48,11 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -104,10 +100,12 @@ github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdU github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= -github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= -github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/prometheus/common v0.51.0 h1:vT5R9NAlW4V6k8Wruk7ikrHaHRsrPbduM/cKTOdQM/k= +github.com/prometheus/common v0.51.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= +github.com/prometheus/common v0.51.1 h1:eIjN50Bwglz6a/c3hAgSMcofL3nD+nFQkV6Dd4DsQCw= +github.com/prometheus/common v0.51.1/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q= +github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= +github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= github.com/redis/go-redis/v9 v9.5.1 h1:H1X4D3yHPaYrkL5X06Wh6xNVM/pX0Ft4RV0vMGvLBh8= github.com/redis/go-redis/v9 v9.5.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= @@ -122,16 +120,16 @@ github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaOOb6ThwMmTEbhRwtKR97o= github.com/uber/jaeger-client-go v2.30.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVKhn2Um6rjCsSsg= @@ -161,11 +159,13 @@ golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg= -golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 h1:6R2FC06FonbXQ8pK11/PDFY6N6LWlf9KlzibaCapmqc= +golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ= +golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw= +golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -188,8 +188,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -214,8 +214,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -250,23 +250,23 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= -google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= -google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4= +google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= +google.golang.org/genproto/googleapis/api v0.0.0-20240325203815-454cdb8f5daa h1:Jt1XW5PaLXF1/ePZrznsh/aAUvI7Adfc3LY1dAKlzRs= +google.golang.org/genproto/googleapis/api v0.0.0-20240325203815-454cdb8f5daa/go.mod h1:K4kfzHtI0kqWA79gecJarFtDn/Mls+GxQcg3Zox91Ac= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa h1:RBgMaUMP+6soRkik4VoN8ojR2nex2TqZwjSSogic+eo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/internal/cinemaservice/cinemaservice.go b/internal/cinemaservice/cinemaservice.go index e51306a..8b1c466 100644 --- a/internal/cinemaservice/cinemaservice.go +++ b/internal/cinemaservice/cinemaservice.go @@ -47,19 +47,21 @@ func NewCinemaService(addr string, }, nil } -func (s *CinemaService) Shutdown() error { +func (s *CinemaService) Shutdown() { if s.conn == nil { - return nil + return } - return s.conn.Close() + if err := s.conn.Close(); err != nil { + s.logger.Error("cinema service error while closing connection", err.Error()) + } } -func (s *CinemaService) GetScreeningTicketPrice(ctx context.Context, screeningId int64) (price uint32, err error) { +func (s *CinemaService) GetScreeningTicketPrice(ctx context.Context, screeningID int64) (price uint32, err error) { defer s.handleError(ctx, &err, "GetScreeningTicketPrice") res, err := s.client.GetScreening(ctx, &cinema_service.GetScreeningRequest{ - ScreeningId: screeningId, + ScreeningID: screeningID, Mask: &fieldmaskpb.FieldMask{Paths: []string{"ticket_price"}}, }) @@ -70,13 +72,13 @@ func (s *CinemaService) GetScreeningTicketPrice(ctx context.Context, screeningId return uint32(res.TicketPrice.Value), nil } -func (s *CinemaService) GetScreening(ctx context.Context, screeningId int64) (screening service.Screening, err error) { +func (s *CinemaService) GetScreening(ctx context.Context, screeningID int64) (screening service.Screening, err error) { defer s.handleError(ctx, &err, "GetScreening") mask := &fieldmaskpb.FieldMask{} mask.Paths = []string{"hall_configuration", "start_time"} res, err := s.client.GetScreening(ctx, &cinema_service.GetScreeningRequest{ - ScreeningId: screeningId, + ScreeningID: screeningID, Mask: mask}) if err != nil { @@ -98,11 +100,11 @@ func (s *CinemaService) GetScreening(ctx context.Context, screeningId int64) (sc }, nil } -func (s *CinemaService) GetScreeningStartTime(ctx context.Context, screeningId int64) (startTime time.Time, err error) { +func (s *CinemaService) GetScreeningStartTime(ctx context.Context, screeningID int64) (startTime time.Time, err error) { defer s.handleError(ctx, &err, "GetScreeningStartTime") res, err := s.client.GetScreening(ctx, &cinema_service.GetScreeningRequest{ - ScreeningId: screeningId, + ScreeningID: screeningID, Mask: &fieldmaskpb.FieldMask{Paths: []string{"start_time"}}, }) if err != nil { @@ -135,7 +137,6 @@ func (s *CinemaService) logError(err error, functionName string) { }, ).Error("cinema service error occurred") } - } func (s *CinemaService) handleError(ctx context.Context, err *error, functionName string) { diff --git a/internal/config/config.go b/internal/config/config.go index 6675546..4465edc 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -7,8 +7,8 @@ import ( "time" "github.com/Falokut/cinema_orders_service/pkg/jaeger" + "github.com/Falokut/cinema_orders_service/pkg/logging" "github.com/Falokut/cinema_orders_service/pkg/metrics" - logging "github.com/Falokut/online_cinema_ticket_office.loggerwrapper" "github.com/ilyakaznacheev/cleanenv" "google.golang.org/grpc" "google.golang.org/grpc/credentials" @@ -30,8 +30,8 @@ type Config struct { ServerConfig metrics.MetricsServerConfig `yaml:"server_config"` } `yaml:"prometheus"` - DbConnectionString string `yaml:"db_connection_string" env:"DB_CONNECTION_STRING"` - DbName string `yaml:"db_name" env:"DB_NAME"` + DBConnectionString string `yaml:"db_connection_string" env:"DB_CONNECTION_STRING"` + DBName string `yaml:"db_name" env:"DB_NAME"` JaegerConfig jaeger.Config `yaml:"jaeger"` ReserveCache struct { Network string `yaml:"network" env:"RESERVE_CACHE_NETWORK"` @@ -86,7 +86,7 @@ type DialMethod = string const ( Insecure DialMethod = "INSECURE" - NilTlsConfig DialMethod = "NIL_TLS_CONFIG" + NilTLSConfig DialMethod = "NIL_TLS_CONFIG" ClientWithSystemCertPool DialMethod = "CLIENT_WITH_SYSTEM_CERT_POOL" Server DialMethod = "SERVER" ) @@ -104,7 +104,7 @@ func (c ConnectionSecureConfig) GetGrpcTransportCredentials() (grpc.DialOption, return grpc.WithTransportCredentials(insecure.NewCredentials()), nil } - if c.Method == NilTlsConfig { + if c.Method == NilTLSConfig { return grpc.WithTransportCredentials(credentials.NewTLS(nil)), nil } diff --git a/internal/events/ordersEvents.go b/internal/events/ordersEvents.go index 61f5556..a3f39d6 100644 --- a/internal/events/ordersEvents.go +++ b/internal/events/ordersEvents.go @@ -45,7 +45,7 @@ func (e *ordersEvents) OrderCreated(ctx context.Context, email string, order mod } return e.eventsWriter.WriteMessages(ctx, kafka.Message{ Topic: orderCreatedTopic, - Key: []byte(fmt.Sprint("order_", order.Id)), + Key: []byte(fmt.Sprint("order_", order.ID)), Value: body, }) } diff --git a/internal/handler/handler.go b/internal/handler/handler.go index f440523..68d7382 100644 --- a/internal/handler/handler.go +++ b/internal/handler/handler.go @@ -22,19 +22,19 @@ import ( type CinemaOrdersHandler struct { cinema_orders_service.UnimplementedCinemaOrdersServiceV1Server - logger *logrus.Logger - service service.CinemaOrdersService + logger *logrus.Logger + s service.CinemaOrdersService } -func NewCinemaOrdersHandler(logger *logrus.Logger, service service.CinemaOrdersService) *CinemaOrdersHandler { - return &CinemaOrdersHandler{logger: logger, service: service} +func NewCinemaOrdersHandler(logger *logrus.Logger, s service.CinemaOrdersService) *CinemaOrdersHandler { + return &CinemaOrdersHandler{logger: logger, s: s} } func (h *CinemaOrdersHandler) GetOccupiedPlaces(ctx context.Context, in *cinema_orders_service.GetOccupiedPlacesRequest) (res *cinema_orders_service.Places, err error) { defer h.handleError(&err) - places, err := h.service.GetOccupiedPlaces(ctx, in.ScreeningId) + places, err := h.s.GetOccupiedPlaces(ctx, in.ScreeningID) if err != nil { return } @@ -53,33 +53,33 @@ func (h *CinemaOrdersHandler) ReservePlaces(ctx context.Context, return } - id, timeToPay, err := h.service.ReservePlaces(ctx, - in.ScreeningId, convertGrpcPlacesToModels(in.Places)) + id, timeToPay, err := h.s.ReservePlaces(ctx, + in.ScreeningID, convertGrpcPlacesToModels(in.Places)) if err != nil { return } timeToPayInMinutes := int32(math.Floor(timeToPay.Minutes())) return &cinema_orders_service.ReservePlacesResponse{ - ReserveId: id, + ReserveID: id, TimeToPay: timeToPayInMinutes}, nil } const ( - AccountIdContext = "X-Account-Id" + AccountIDContext = "X-Account-Id" ) func (h *CinemaOrdersHandler) ProcessOrder(ctx context.Context, in *cinema_orders_service.ProcessOrderRequest) (res *cinema_orders_service.ProcessOrderResponse, err error) { defer h.handleError(&err) - accountId, ok := getAccountIdFromCtx(ctx) + accountID, ok := getAccountIDFromCtx(ctx) if !ok { err = status.Error(codes.Unauthenticated, "X-Account-Id header not specified") return } - url, err := h.service.ProcessOrder(ctx, in.ReserveId, accountId) + url, err := h.s.ProcessOrder(ctx, in.ReserveID, accountID) if err != nil { return } @@ -91,7 +91,7 @@ func (h *CinemaOrdersHandler) CancelReservation(ctx context.Context, in *cinema_orders_service.CancelReservationRequest) (res *emptypb.Empty, err error) { defer h.handleError(&err) - err = h.service.CancelReservation(ctx, in.ReserveId) + err = h.s.CancelReservation(ctx, in.ReserveID) if err != nil { return } @@ -102,16 +102,16 @@ func (h *CinemaOrdersHandler) CancelReservation(ctx context.Context, func (h *CinemaOrdersHandler) RefundOrder(ctx context.Context, in *cinema_orders_service.RefundOrderRequest) (res *emptypb.Empty, err error) { defer h.handleError(&err) - accountId, ok := getAccountIdFromCtx(ctx) + accountID, ok := getAccountIDFromCtx(ctx) if !ok { err = status.Error(codes.Unauthenticated, "X-Account-Id header not specified") return } - if len(in.ItemsIds) == 0 { - err = h.service.RefundOrder(ctx, accountId, in.OrderId) + if len(in.ItemsIDs) == 0 { + err = h.s.RefundOrder(ctx, accountID, in.OrderID) } else { - err = h.service.RefundOrderItems(ctx, accountId, in.OrderId, in.ItemsIds) + err = h.s.RefundOrderItems(ctx, accountID, in.OrderID, in.ItemsIDs) } if err != nil { @@ -126,13 +126,13 @@ func (h *CinemaOrdersHandler) GetOrder(ctx context.Context, res *cinema_orders_service.Order, err error) { defer h.handleError(&err) - accountId, ok := getAccountIdFromCtx(ctx) + accountID, ok := getAccountIDFromCtx(ctx) if !ok { err = status.Error(codes.Unauthenticated, "X-Account-Id header not specified") return } - order, err := h.service.GetOrder(ctx, in.OrderId, accountId) + order, err := h.s.GetOrder(ctx, in.OrderID, accountID) if err != nil { return } @@ -140,11 +140,11 @@ func (h *CinemaOrdersHandler) GetOrder(ctx context.Context, res = &cinema_orders_service.Order{ OrderDate: &cinema_orders_service.Timestamp{FormattedTimestamp: order.Date.Format(time.RFC3339)}, Tickets: make([]*cinema_orders_service.Ticket, 0, len(order.Tickets)), - ScreeningId: order.ScreeningId, + ScreeningID: order.ScreeningID, } for i := range order.Tickets { res.Tickets = append(res.Tickets, &cinema_orders_service.Ticket{ - TicketId: order.Tickets[i].Id, + TicketID: order.Tickets[i].ID, Place: &cinema_orders_service.Place{ Row: order.Tickets[i].Place.Row, Seat: order.Tickets[i].Place.Seat, @@ -162,15 +162,15 @@ func (h *CinemaOrdersHandler) GetScreeningsOccupiedPlacesCounts(ctx context.Cont res *cinema_orders_service.ScreeningsOccupiedPlacesCount, err error) { defer h.handleError(&err) - in.ScreeningsIds = strings.TrimSpace(strings.ReplaceAll(in.ScreeningsIds, `"`, "")) - if ok := checkIds(in.ScreeningsIds); !ok { + in.ScreeningsIDs = strings.TrimSpace(strings.ReplaceAll(in.ScreeningsIDs, `"`, "")) + if ok := checkIds(in.ScreeningsIDs); !ok { err = status.Error(codes.InvalidArgument, "screenings_ids mustn't be empty and screenings_ids ids must contains only digits and commas") return } - ids := convertStringToInt64Slice(strings.Split(in.ScreeningsIds, ",")) - places, err := h.service.GetScreeningsOccupiedPlacesCounts(ctx, ids) + ids := convertStringToInt64Slice(strings.Split(in.ScreeningsIDs, ",")) + places, err := h.s.GetScreeningsOccupiedPlacesCounts(ctx, ids) if err != nil { return } @@ -185,7 +185,7 @@ func (h *CinemaOrdersHandler) GetOrders(ctx context.Context, in *cinema_orders_service.GetOrdersRequest) (res *cinema_orders_service.OrdersPreviews, err error) { defer h.handleError(&err) - accountId, ok := getAccountIdFromCtx(ctx) + accountID, ok := getAccountIDFromCtx(ctx) if !ok { err = status.Error(codes.Unauthenticated, "X-Account-Id header not specified") return @@ -202,8 +202,8 @@ func (h *CinemaOrdersHandler) GetOrders(ctx context.Context, return } - preview, err := h.service.GetOrders(ctx, - accountId, in.Page, in.Limit, getOrdersPreviewSort(in.Sort)) + preview, err := h.s.GetOrders(ctx, + accountID, in.Page, in.Limit, getOrdersPreviewSort(in.Sort)) if err != nil { return } @@ -246,20 +246,20 @@ func convertStringToInt64Slice(str []string) []int64 { } func checkIds(val string) bool { - return regexp.MustCompile("^[!-&!,0-9]+$").Match([]byte(val)) + return regexp.MustCompile(`^\d+(,\d+)*$`).MatchString(val) } -func getAccountIdFromCtx(ctx context.Context) (string, bool) { +func getAccountIDFromCtx(ctx context.Context) (string, bool) { md, ok := metadata.FromIncomingContext(ctx) if !ok { return "", false } - accountId := md.Get(AccountIdContext) - if len(accountId) == 0 { + accountID := md.Get(AccountIDContext) + if len(accountID) == 0 { return "", false } - return accountId[0], true + return accountID[0], true } func convertServiceErrCodeToGrpc(code models.ErrorCode) codes.Code { @@ -329,29 +329,29 @@ func convertModelsOrdersPreviewsToGrpc(pr []models.OrderPreview) []*cinema_order var res = make([]*cinema_orders_service.OrderPreview, len(pr)) for i := range pr { res[i] = &cinema_orders_service.OrderPreview{ - OrderId: pr[i].OrderId, + OrderID: pr[i].OrderID, OrderDate: &cinema_orders_service.Timestamp{FormattedTimestamp: pr[i].OrderDate.Format(time.RFC3339)}, TotalPrice: &cinema_orders_service.Price{Value: int32(pr[i].TotalPrice)}, - ScreeningId: pr[i].ScreeningId, + ScreeningID: pr[i].ScreeningID, } } return res } -func OrderStatusFromModels(st models.OrderItemStatus) (status cinema_orders_service.Status) { +func OrderStatusFromModels(st models.OrderItemStatus) (res cinema_orders_service.Status) { switch st { - case models.ORDER_ITEM_STATUS_PAID: - status = cinema_orders_service.Status_PAID - case models.ORDER_ITEM_STATUS_PAYMENT_REQUIRED: - status = cinema_orders_service.Status_PAYMENT_REQUIRED - case models.ORDER_ITEM_STATUS_REFUND_AWAITING: - status = cinema_orders_service.Status_REFUND_AWAITING - case models.ORDER_ITEM_STATUS_CANCELLED: - status = cinema_orders_service.Status_CANCELLED - case models.ORDER_ITEM_STATUS_USED: - status = cinema_orders_service.Status_USED - case models.ORDER_ITEM_STATUS_REFUNDED: - status = cinema_orders_service.Status_REFUNDED + case models.OrderItemStatusPaid: + res = cinema_orders_service.Status_PAID + case models.OrderItemStatusPaymentRequired: + res = cinema_orders_service.Status_PAYMENT_REQUIRED + case models.OrderItemStatusRefundAwaiting: + res = cinema_orders_service.Status_REFUND_AWAITING + case models.OrderItemStatusCanceled: + res = cinema_orders_service.Status_CANCELED + case models.OrderItemStatusUsed: + res = cinema_orders_service.Status_USED + case models.OrderItemStatusRefunded: + res = cinema_orders_service.Status_REFUNDED } return } diff --git a/internal/models/order.go b/internal/models/order.go index f5715a8..1fc1c3d 100644 --- a/internal/models/order.go +++ b/internal/models/order.go @@ -9,35 +9,35 @@ import ( type OrderItemStatus string const ( - ORDER_ITEM_STATUS_PAID OrderItemStatus = "PAID" - ORDER_ITEM_STATUS_PAYMENT_REQUIRED OrderItemStatus = "PAYMENT_REQUIRED" - ORDER_ITEM_STATUS_REFUND_AWAITING OrderItemStatus = "REFUND_AWAITING" - ORDER_ITEM_STATUS_CANCELLED OrderItemStatus = "CANCELLED" - ORDER_ITEM_STATUS_USED OrderItemStatus = "USED" - ORDER_ITEM_STATUS_REFUNDED OrderItemStatus = "REFUNDED" + OrderItemStatusPaid OrderItemStatus = "PAID" + OrderItemStatusPaymentRequired OrderItemStatus = "PAYMENT_REQUIRED" + OrderItemStatusRefundAwaiting OrderItemStatus = "REFUND_AWAITING" + OrderItemStatusCanceled OrderItemStatus = "CANCELED" + OrderItemStatusUsed OrderItemStatus = "USED" + OrderItemStatusRefunded OrderItemStatus = "REFUNDED" ) type Order struct { - Id string `json:"id"` + ID string `json:"id"` Tickets []Ticket `json:"tickets"` - ScreeningId int64 `json:"screening_id"` + ScreeningID int64 `json:"screening_id"` Date time.Time `json:"order_date"` } func OrderItemStatusFromString(str string) (status OrderItemStatus, err error) { switch { case strings.EqualFold(str, "PAID"): - status = ORDER_ITEM_STATUS_PAID + status = OrderItemStatusPaid case strings.EqualFold(str, "PAYMENT_REQUIRED") || strings.EqualFold(str, "PAYMENTREQUIRED"): - status = ORDER_ITEM_STATUS_PAYMENT_REQUIRED + status = OrderItemStatusPaymentRequired case strings.EqualFold(str, "REFUND_AWAITING") || strings.EqualFold(str, "REFUNDAWAITING"): - status = ORDER_ITEM_STATUS_REFUND_AWAITING - case strings.EqualFold(str, "CANCELLED"): - status = ORDER_ITEM_STATUS_CANCELLED + status = OrderItemStatusRefundAwaiting + case strings.EqualFold(str, "CANCELED"): + status = OrderItemStatusCanceled case strings.EqualFold(str, "USED"): - status = ORDER_ITEM_STATUS_USED + status = OrderItemStatusUsed case strings.EqualFold(str, "REFUNDED"): - status = ORDER_ITEM_STATUS_REFUNDED + status = OrderItemStatusRefunded default: err = errors.New("unknown status") } @@ -46,16 +46,16 @@ func OrderItemStatusFromString(str string) (status OrderItemStatus, err error) { func GetAllowedPreviousOrderStatuses(status OrderItemStatus) (allowed []OrderItemStatus) { switch status { - case ORDER_ITEM_STATUS_CANCELLED: - return []OrderItemStatus{ORDER_ITEM_STATUS_PAYMENT_REQUIRED} - case ORDER_ITEM_STATUS_PAID: - return []OrderItemStatus{ORDER_ITEM_STATUS_PAYMENT_REQUIRED} - case ORDER_ITEM_STATUS_USED: - return []OrderItemStatus{ORDER_ITEM_STATUS_PAID} - case ORDER_ITEM_STATUS_REFUND_AWAITING: - return []OrderItemStatus{ORDER_ITEM_STATUS_PAID, ORDER_ITEM_STATUS_USED} - case ORDER_ITEM_STATUS_REFUNDED: - return []OrderItemStatus{ORDER_ITEM_STATUS_REFUND_AWAITING} + case OrderItemStatusCanceled: + return []OrderItemStatus{OrderItemStatusPaymentRequired} + case OrderItemStatusPaid: + return []OrderItemStatus{OrderItemStatusPaymentRequired} + case OrderItemStatusUsed: + return []OrderItemStatus{OrderItemStatusPaid} + case OrderItemStatusRefundAwaiting: + return []OrderItemStatus{OrderItemStatusPaid, OrderItemStatusUsed} + case OrderItemStatusRefunded: + return []OrderItemStatus{OrderItemStatusRefundAwaiting} } return []OrderItemStatus{} } diff --git a/internal/models/orderItem.go b/internal/models/orderItem.go index ec6f078..34ccef2 100644 --- a/internal/models/orderItem.go +++ b/internal/models/orderItem.go @@ -1,6 +1,6 @@ package models type OrderItem struct { - Id string `bson:"_id"` + ID string `bson:"_id"` Status OrderItemStatus `bson:"status"` } diff --git a/internal/models/orderPreview.go b/internal/models/orderPreview.go index bdc91aa..159bc38 100644 --- a/internal/models/orderPreview.go +++ b/internal/models/orderPreview.go @@ -3,8 +3,8 @@ package models import "time" type OrderPreview struct { - OrderId string `bson:"_id"` + OrderID string `bson:"_id"` OrderDate time.Time `bson:"order_date"` TotalPrice uint32 `bson:"total_price"` - ScreeningId int64 `bson:"screening_id"` + ScreeningID int64 `bson:"screening_id"` } diff --git a/internal/models/processOrderDTO.go b/internal/models/processOrderDTO.go index b384d7d..10d0e64 100644 --- a/internal/models/processOrderDTO.go +++ b/internal/models/processOrderDTO.go @@ -7,7 +7,7 @@ type ProcessOrderPlace struct { type ProcessOrderDTO struct { Places []ProcessOrderPlace - Id string - OwnerId string - ScreeningId int64 + ID string + OwnerID string + ScreeningID int64 } diff --git a/internal/models/ticket.go b/internal/models/ticket.go index ab52a69..8cb12e9 100644 --- a/internal/models/ticket.go +++ b/internal/models/ticket.go @@ -1,7 +1,7 @@ package models type Ticket struct { - Id string `json:"id"` + ID string `json:"id"` Place Place `json:"place"` Price uint32 `json:"price"` Status OrderItemStatus `json:"-"` diff --git a/internal/paymentservice/paymentServiceStub.go b/internal/paymentservice/paymentServiceStub.go index 24f27e3..8d33ce3 100644 --- a/internal/paymentservice/paymentServiceStub.go +++ b/internal/paymentservice/paymentServiceStub.go @@ -9,11 +9,11 @@ import ( ) type OrdersRepository interface { - ChangeOrderStatus(ctx context.Context, orderId string, newStatus models.OrderItemStatus) error - ChangeOrderItemsStatus(ctx context.Context, orderId string, + ChangeOrderStatus(ctx context.Context, orderID string, newStatus models.OrderItemStatus) error + ChangeOrderItemsStatus(ctx context.Context, orderID string, itemsIds []string, newStatus models.OrderItemStatus) error - GetOrderTotalPrice(ctx context.Context, orderId string) (uint32, error) - GetOrderItemsTotalPrice(ctx context.Context, orderId string, itemsIds []string) (uint32, error) + GetOrderTotalPrice(ctx context.Context, orderID string) (uint32, error) + GetOrderItemsTotalPrice(ctx context.Context, orderID string, itemsIds []string) (uint32, error) } type PaymentServiceStub struct { @@ -24,14 +24,14 @@ type PaymentServiceStub struct { logger *logrus.Logger } -func NewPaymentServiceStub(paymentStubUrl string, +func NewPaymentServiceStub(paymentStubURL string, paymentSleepTime time.Duration, refundSleepTime time.Duration, repo OrdersRepository, logger *logrus.Logger, ) *PaymentServiceStub { return &PaymentServiceStub{ - paymenturl: paymentStubUrl, + paymenturl: paymentStubURL, paymentSleepTime: paymentSleepTime, refundSleepTime: refundSleepTime, repo: repo, @@ -39,44 +39,52 @@ func NewPaymentServiceStub(paymentStubUrl string, } } -func (s *PaymentServiceStub) ChangeOrderStatus(ctx context.Context, orderId string, newStatus models.OrderItemStatus) (err error) { +const errorSleepDuration = time.Millisecond * 200 + +func (s *PaymentServiceStub) ChangeOrderStatus(ctx context.Context, orderID string, newStatus models.OrderItemStatus) (err error) { retry := 0 for retry <= 2 { - err = s.repo.ChangeOrderStatus(ctx, orderId, newStatus) + err = s.repo.ChangeOrderStatus(ctx, orderID, newStatus) if err == nil { return nil } s.logger.Errorf("error while changing order status %v", err) retry++ - time.Sleep(time.Millisecond * 200) + time.Sleep(errorSleepDuration) } return } -func (s *PaymentServiceStub) ChangeOrderItemsStatus(ctx context.Context, orderId string, +func (s *PaymentServiceStub) ChangeOrderItemsStatus(ctx context.Context, orderID string, itemsIds []string, newStatus models.OrderItemStatus) (err error) { retry := 0 for retry <= 2 { - err = s.repo.ChangeOrderItemsStatus(ctx, orderId, itemsIds, newStatus) + err = s.repo.ChangeOrderItemsStatus(ctx, orderID, itemsIds, newStatus) if err == nil { return nil } s.logger.Errorf("error while changing order items status %v", err) retry++ - time.Sleep(time.Millisecond * 200) + time.Sleep(errorSleepDuration) } return } -func (s *PaymentServiceStub) PreparePaymentUrl(ctx context.Context, email string, total uint32, orderId string) (paymenturl string, err error) { +func (s *PaymentServiceStub) PreparePaymentURL(_ context.Context, + _ string, + total uint32, + orderID string) (paymenturl string, err error) { go func() { time.Sleep(s.paymentSleepTime) - err := s.ChangeOrderStatus(context.Background(), orderId, models.ORDER_ITEM_STATUS_PAID) + err := s.ChangeOrderStatus(context.Background(), orderID, models.OrderItemStatusPaid) if err != nil { - s.orderRefundRequest(context.Background(), float64(total), orderId) + err := s.orderRefundRequest(context.Background(), float64(total), orderID) + if err != nil { + s.logger.Error(err) + } } }() @@ -84,51 +92,59 @@ func (s *PaymentServiceStub) PreparePaymentUrl(ctx context.Context, email string return } -func (s *PaymentServiceStub) RequestOrderRefund(ctx context.Context, percent uint32, orderId string) (err error) { - total, err := s.repo.GetOrderTotalPrice(ctx, orderId) +func (s *PaymentServiceStub) RequestOrderRefund(ctx context.Context, percent uint32, orderID string) (err error) { + total, err := s.repo.GetOrderTotalPrice(ctx, orderID) if err != nil { return } go func() { - s.orderRefundRequest(ctx, float64(total)*float64(percent)/100.0, orderId) + err := s.orderRefundRequest(context.Background(), float64(total)*float64(percent)/percentBase, orderID) + if err != nil { + s.logger.Error(err) + } }() return } +const percentBase = 100.0 + func (s *PaymentServiceStub) RequestOrderItemsRefund(ctx context.Context, - percent uint32, orderId string, itemsIds []string) (err error) { - total, err := s.repo.GetOrderItemsTotalPrice(ctx, orderId, itemsIds) + percent uint32, orderID string, itemsIds []string) (err error) { + total, err := s.repo.GetOrderItemsTotalPrice(ctx, orderID, itemsIds) if err != nil { return } go func() { - s.orderItemsRefundRequest(ctx, float64(total)*float64(percent)/100.0, orderId, itemsIds) + err := s.orderItemsRefundRequest(context.Background(), float64(total)*float64(percent)/percentBase, orderID, itemsIds) + if err != nil { + s.logger.Error(err) + } }() return } func (s *PaymentServiceStub) orderItemsRefundRequest(ctx context.Context, - total float64, orderId string, itemsIds []string) (err error) { - err = s.ChangeOrderItemsStatus(context.Background(), orderId, itemsIds, models.ORDER_ITEM_STATUS_REFUND_AWAITING) + _ float64, orderID string, itemsIds []string) (err error) { + err = s.ChangeOrderItemsStatus(ctx, orderID, itemsIds, models.OrderItemStatusRefundAwaiting) if err != nil { return } time.Sleep(s.refundSleepTime) - err = s.ChangeOrderItemsStatus(context.Background(), orderId, itemsIds, models.ORDER_ITEM_STATUS_REFUNDED) + err = s.ChangeOrderItemsStatus(ctx, orderID, itemsIds, models.OrderItemStatusRefunded) return } -func (s *PaymentServiceStub) orderRefundRequest(ctx context.Context, total float64, orderId string) (err error) { - err = s.ChangeOrderStatus(context.Background(), orderId, models.ORDER_ITEM_STATUS_REFUND_AWAITING) +func (s *PaymentServiceStub) orderRefundRequest(ctx context.Context, _ float64, orderID string) (err error) { + err = s.ChangeOrderStatus(ctx, orderID, models.OrderItemStatusRefundAwaiting) if err != nil { return } time.Sleep(s.refundSleepTime) - err = s.ChangeOrderStatus(context.Background(), orderId, models.ORDER_ITEM_STATUS_REFUNDED) + err = s.ChangeOrderStatus(ctx, orderID, models.OrderItemStatusRefunded) return } diff --git a/internal/profilesservice/profilesservice.go b/internal/profilesservice/profilesservice.go index 26ac89e..4fdb3b4 100644 --- a/internal/profilesservice/profilesservice.go +++ b/internal/profilesservice/profilesservice.go @@ -45,12 +45,14 @@ func NewProfilesService(addr string, cfg config.ConnectionSecureConfig, logger * }, nil } -func (s *ProfilesService) Shutdown() error { +func (s *ProfilesService) Shutdown() { if s.conn == nil { - return nil + return } - return s.conn.Close() + if err := s.conn.Close(); err != nil { + s.logger.Error("profiles service error while closing connection", err.Error()) + } } // in metadata must be header X-Account-Id @@ -121,9 +123,8 @@ func (s *ProfilesService) handleError(ctx context.Context, err *error, functionN case codes.Internal: *err = models.Error(models.Internal, "profiles service internal error") case codes.NotFound: - *err = models.Error(models.NotFound, "account not found") + *err = models.Error(models.NotFound, "profile not found") default: *err = models.Error(models.Unknown, e.Error()) } - } diff --git a/internal/repository/mongorepository/cinemaOrdersRepository.go b/internal/repository/mongorepository/cinemaOrdersRepository.go index d5aecea..c9705ca 100644 --- a/internal/repository/mongorepository/cinemaOrdersRepository.go +++ b/internal/repository/mongorepository/cinemaOrdersRepository.go @@ -1,4 +1,4 @@ -package mongo_repository +package mongorepository import ( "context" @@ -42,19 +42,19 @@ const ( ticketType = "ticket" ) -func (r *CinemaOrdersRepository) GetOccupiedPlaces(ctx context.Context, screeningId int64) (places []models.Place, err error) { +func (r *CinemaOrdersRepository) GetOccupiedPlaces(ctx context.Context, screeningID int64) (places []models.Place, err error) { defer r.handleError(ctx, &err, "GetOccupiedPlaces") collection := r.db.Database(r.databaseName).Collection(ordersCollectionName) filter := bson.D{ - {Key: "screening_id", Value: screeningId}, + {Key: "screening_id", Value: screeningID}, {Key: "type", Value: ticketType}, {Key: "status", Value: bson.D{ {Key: "$nin", Value: bson.A{ - models.ORDER_ITEM_STATUS_CANCELLED, - models.ORDER_ITEM_STATUS_REFUNDED, + models.OrderItemStatusCanceled, + models.OrderItemStatusRefunded, }, }, }, @@ -80,13 +80,13 @@ func (r *CinemaOrdersRepository) GetOccupiedPlaces(ctx context.Context, screenin return } -func (r *CinemaOrdersRepository) ChangeOrderStatus(ctx context.Context, orderId string, newStatus models.OrderItemStatus) (err error) { +func (r *CinemaOrdersRepository) ChangeOrderStatus(ctx context.Context, orderID string, newStatus models.OrderItemStatus) (err error) { defer r.handleError(ctx, &err, "ChangeOrderStatus") allowedPreviousStatuses := models.GetAllowedPreviousOrderStatuses(newStatus) collection := r.db.Database(r.databaseName).Collection(ordersCollectionName) _, err = collection.UpdateMany(ctx, bson.D{ - {Key: "order_id", Value: orderId}, + {Key: "order_id", Value: orderID}, {Key: "status", Value: bson.D{ {Key: "$in", Value: allowedPreviousStatuses}, @@ -106,12 +106,12 @@ func (r *CinemaOrdersRepository) ChangeOrderStatus(ctx context.Context, orderId } func (r *CinemaOrdersRepository) GetOrderItemsStatuses(ctx context.Context, - orderId string) (statuses []models.OrderItemStatus, err error) { + orderID string) (statuses []models.OrderItemStatus, err error) { defer r.handleError(ctx, &err, "GetOrderItemsStatuses") collection := r.db.Database(r.databaseName).Collection(ordersCollectionName) pipe := bson.A{ - bson.D{{Key: "$match", Value: bson.D{{Key: "order_id", Value: orderId}}}}, + bson.D{{Key: "$match", Value: bson.D{{Key: "order_id", Value: orderID}}}}, bson.D{ { Key: "$group", @@ -149,10 +149,10 @@ func (r *CinemaOrdersRepository) GetOrderItemsStatuses(ctx context.Context, return } -func (r *CinemaOrdersRepository) CancelOrder(ctx context.Context, orderId string) (err error) { +func (r *CinemaOrdersRepository) CancelOrder(ctx context.Context, orderID string) (err error) { defer r.handleError(ctx, &err, "CancelOrder") - allowedPreviousStatuses := models.GetAllowedPreviousOrderStatuses(models.ORDER_ITEM_STATUS_CANCELLED) + allowedPreviousStatuses := models.GetAllowedPreviousOrderStatuses(models.OrderItemStatusCanceled) session, err := r.db.StartSession() if err != nil { @@ -166,13 +166,13 @@ func (r *CinemaOrdersRepository) CancelOrder(ctx context.Context, orderId string err = mongo.WithSession(ctx, session, func(sc mongo.SessionContext) (err error) { collection := r.db.Database(r.databaseName).Collection(ordersCollectionName) filter := bson.D{ - {Key: "order_id", Value: orderId}, + {Key: "order_id", Value: orderID}, {Key: "status", Value: bson.E{Key: "$in", Value: allowedPreviousStatuses}}, } _, err = collection.UpdateMany(ctx, filter, bson.D{{Key: "$set", Value: bson.D{ - {Key: "status", Value: string(models.ORDER_ITEM_STATUS_CANCELLED)}, + {Key: "status", Value: string(models.OrderItemStatusCanceled)}, }, }, }) @@ -184,12 +184,10 @@ func (r *CinemaOrdersRepository) CancelOrder(ctx context.Context, orderId string } return nil }) - return - } -func (r *CinemaOrdersRepository) ChangeOrderItemsStatus(ctx context.Context, orderId string, - itemsIds []string, newStatus models.OrderItemStatus) (err error) { +func (r *CinemaOrdersRepository) ChangeOrderItemsStatus(ctx context.Context, orderID string, + itemsIDs []string, newStatus models.OrderItemStatus) (err error) { defer r.handleError(ctx, &err, "ChangeOrderItemsStatus") allowedPreviousStatuses := models.GetAllowedPreviousOrderStatuses(newStatus) @@ -205,8 +203,8 @@ func (r *CinemaOrdersRepository) ChangeOrderItemsStatus(ctx context.Context, ord err = mongo.WithSession(ctx, session, func(sc mongo.SessionContext) (err error) { collection := r.db.Database(r.databaseName).Collection(ordersCollectionName) filter := bson.D{ - {Key: "order_id", Value: orderId}, - {Key: "_id", Value: bson.E{Key: "$in", Value: itemsIds}}, + {Key: "order_id", Value: orderID}, + {Key: "_id", Value: bson.E{Key: "$in", Value: itemsIDs}}, {Key: "status", Value: bson.E{Key: "$in", Value: allowedPreviousStatuses}}, } res, err := collection.UpdateMany(ctx, filter, @@ -219,7 +217,7 @@ func (r *CinemaOrdersRepository) ChangeOrderItemsStatus(ctx context.Context, ord if err != nil { return } - if res.ModifiedCount != int64(len(itemsIds)) { + if res.ModifiedCount != int64(len(itemsIDs)) { return models.Error(models.NotFound, "error while changing order items status") } if err = sc.CommitTransaction(ctx); err != nil { @@ -250,8 +248,8 @@ func (r *CinemaOrdersRepository) GetScreeningsOccupiedPlaces(ctx context.Context Value: bson.D{ {Key: "$nin", Value: bson.A{ - models.ORDER_ITEM_STATUS_CANCELLED, - models.ORDER_ITEM_STATUS_REFUNDED, + models.OrderItemStatusCanceled, + models.OrderItemStatusRefunded, }, }, }, @@ -276,7 +274,7 @@ func (r *CinemaOrdersRepository) GetScreeningsOccupiedPlaces(ctx context.Context } type screeningOccupiedPlaces struct { - ScreeningId int64 `bson:"_id"` + ScreeningID int64 `bson:"_id"` Places []models.Place `bson:"places"` } var places []screeningOccupiedPlaces @@ -287,7 +285,7 @@ func (r *CinemaOrdersRepository) GetScreeningsOccupiedPlaces(ctx context.Context res = make(map[int64][]models.Place, len(places)) for i := range places { - res[places[i].ScreeningId] = places[i].Places + res[places[i].ScreeningID] = places[i].Places } return res, nil @@ -296,30 +294,30 @@ func (r *CinemaOrdersRepository) GetScreeningsOccupiedPlaces(ctx context.Context func (r *CinemaOrdersRepository) ProcessOrder(ctx context.Context, order models.ProcessOrderDTO) (err error) { defer r.handleError(ctx, &err, "ProcessOrder") - tickets := make([]interface{}, len(order.Places)) + tickets := make([]any, len(order.Places)) date := time.Now() for i := range order.Places { tickets[i] = struct { - TempId string `bson:"_id"` - OrderId string `bson:"order_id"` - OwnerId string `bson:"owner_id"` + TempID string `bson:"_id"` + OrderID string `bson:"order_id"` + OwnerID string `bson:"owner_id"` // Always be ticket Type string `bson:"type"` Status string `bson:"status"` Date time.Time `bson:"order_date"` - ScreeningId int64 `bson:"screening_id"` + ScreeningID int64 `bson:"screening_id"` Place models.Place `bson:"place"` Price uint32 `bson:"price"` }{ - TempId: uuid.NewString(), - OrderId: order.Id, - OwnerId: order.OwnerId, + TempID: uuid.NewString(), + OrderID: order.ID, + OwnerID: order.OwnerID, Place: order.Places[i].Place, Price: order.Places[i].Price, - ScreeningId: order.ScreeningId, + ScreeningID: order.ScreeningID, Date: date, Type: ticketType, - Status: string(models.ORDER_ITEM_STATUS_PAYMENT_REQUIRED), + Status: string(models.OrderItemStatusPaymentRequired), } } @@ -339,16 +337,13 @@ func (r *CinemaOrdersRepository) ProcessOrder(ctx context.Context, order models. return err } - if err = sc.CommitTransaction(ctx); err != nil { - return err - } - return nil + return sc.CommitTransaction(ctx) }) - return err + return } -func (r *CinemaOrdersRepository) GetOrders(ctx context.Context, accountId string, +func (r *CinemaOrdersRepository) GetOrders(ctx context.Context, accountID string, page, limit uint32, sort models.SortDTO) (orders []models.OrderPreview, err error) { defer r.handleError(ctx, &err, "GetOrders") @@ -362,7 +357,7 @@ func (r *CinemaOrdersRepository) GetOrders(ctx context.Context, accountId string bson.D{ {Key: "$match", Value: bson.D{ - {Key: "owner_id", Value: accountId}, + {Key: "owner_id", Value: accountID}, }, }, }, @@ -397,7 +392,7 @@ func (r *CinemaOrdersRepository) GetOrders(ctx context.Context, accountId string return } -func (r *CinemaOrdersRepository) GetOrderTotalPrice(ctx context.Context, orderId string) (price uint32, err error) { +func (r *CinemaOrdersRepository) GetOrderTotalPrice(ctx context.Context, orderID string) (price uint32, err error) { defer r.handleError(ctx, &err, "GetOrderTotalPrice") collection := r.db.Database(r.databaseName).Collection(ordersCollectionName) @@ -406,7 +401,7 @@ func (r *CinemaOrdersRepository) GetOrderTotalPrice(ctx context.Context, orderId bson.D{ {Key: "$match", Value: bson.D{ - {Key: "order_id", Value: orderId}, + {Key: "order_id", Value: orderID}, }, }, }, @@ -425,11 +420,11 @@ func (r *CinemaOrdersRepository) GetOrderTotalPrice(ctx context.Context, orderId return } order := []struct { - Id string `bson:"_id"` + ID string `bson:"_id"` TotalPrice uint32 `bson:"total_price"` }{} - cur.All(ctx, &order) + err = cur.All(ctx, &order) if errors.Is(err, mongo.ErrNoDocuments) { return } @@ -445,13 +440,13 @@ func (r *CinemaOrdersRepository) GetOrderTotalPrice(ctx context.Context, orderId } func (r *CinemaOrdersRepository) GetOrderItemsTotalPrice(ctx context.Context, - orderId string, itemsIds []string) (total uint32, err error) { + orderID string, itemsIDs []string) (total uint32, err error) { defer r.handleError(ctx, &err, "GetOrderItemsTotalPrice") collection := r.db.Database(r.databaseName).Collection(ordersCollectionName) var filter = bson.D{ - {Key: "order_id", Value: orderId}, + {Key: "order_id", Value: orderID}, } cur, err := collection.Find(ctx, filter, options.Find().SetProjection(bson.D{ @@ -464,7 +459,7 @@ func (r *CinemaOrdersRepository) GetOrderItemsTotalPrice(ctx context.Context, } type orderItem struct { - Id string `bson:"_id"` + ID string `bson:"_id"` Price uint32 `bson:"price"` } @@ -474,7 +469,7 @@ func (r *CinemaOrdersRepository) GetOrderItemsTotalPrice(ctx context.Context, return } - if len(items) != len(itemsIds) { + if len(items) != len(itemsIDs) { err = models.Error(models.NotFound, "items not found") return } @@ -486,15 +481,15 @@ func (r *CinemaOrdersRepository) GetOrderItemsTotalPrice(ctx context.Context, return } -func (r *CinemaOrdersRepository) GetOrderScreeningId(ctx context.Context, accountId, orderId string) (id int64, err error) { - defer r.handleError(ctx, &err, "GetOrderScreeningId") +func (r *CinemaOrdersRepository) GetOrderScreeningID(ctx context.Context, accountID, orderID string) (id int64, err error) { + defer r.handleError(ctx, &err, "GetOrderScreeningID") pipe := bson.A{ bson.D{ {Key: "$match", Value: bson.D{ - {Key: "order_id", Value: orderId}, - {Key: "owner_id", Value: accountId}, + {Key: "order_id", Value: orderID}, + {Key: "owner_id", Value: accountID}, }, }, }, @@ -510,31 +505,34 @@ func (r *CinemaOrdersRepository) GetOrderScreeningId(ctx context.Context, accoun collection := r.db.Database(r.databaseName).Collection(ordersCollectionName) cur, err := collection.Aggregate(ctx, pipe) + if err != nil { + return + } order := []struct { - Id string `bson:"_id"` - ScreeningId int64 `bson:"screening_id"` + ID string `bson:"_id"` + ScreeningID int64 `bson:"screening_id"` }{} - cur.All(ctx, &order) + err = cur.All(ctx, &order) if err != nil { return } if len(order) == 0 { - err = models.Error(models.NotFound, fmt.Sprintf("order with id %v not found", orderId)) + err = models.Error(models.NotFound, fmt.Sprintf("order with id %v not found", orderID)) return } - id = order[0].ScreeningId + id = order[0].ScreeningID return } -func (r *CinemaOrdersRepository) getOrderTickets(ctx context.Context, accountId string, - orderId string) (tickets []models.Ticket, err error) { +func (r *CinemaOrdersRepository) getOrderTickets(ctx context.Context, accountID string, + orderID string) (tickets []models.Ticket, err error) { defer r.handleError(ctx, &err, "getOrderTickets") filter := bson.D{ - {Key: "owner_id", Value: accountId}, - {Key: "order_id", Value: orderId}, + {Key: "owner_id", Value: accountID}, + {Key: "order_id", Value: orderID}, {Key: "type", Value: ticketType}, } @@ -550,13 +548,13 @@ func (r *CinemaOrdersRepository) getOrderTickets(ctx context.Context, accountId } orderTickets := []struct { - Id string `bson:"_id"` + ID string `bson:"_id"` Status string `bson:"status"` Place models.Place `bson:"place"` Price uint32 `bson:"price"` }{} - cur.All(ctx, &orderTickets) + err = cur.All(ctx, &orderTickets) if err != nil { return } @@ -570,7 +568,7 @@ func (r *CinemaOrdersRepository) getOrderTickets(ctx context.Context, accountId continue } tickets = append(tickets, models.Ticket{ - Id: orderTickets[i].Id, + ID: orderTickets[i].ID, Place: orderTickets[i].Place, Price: orderTickets[i].Price, Status: status, @@ -578,16 +576,15 @@ func (r *CinemaOrdersRepository) getOrderTickets(ctx context.Context, accountId } return - } func (r *CinemaOrdersRepository) getOrderInfo(ctx context.Context, - orderId, accountId string) (orderDate time.Time, ScreeningId int64, err error) { + orderID, accountID string) (orderDate time.Time, screeningID int64, err error) { defer r.handleError(ctx, &err, "getOrderInfo") filter := bson.D{ - {Key: "owner_id", Value: accountId}, - {Key: "order_id", Value: orderId}, + {Key: "owner_id", Value: accountID}, + {Key: "order_id", Value: orderID}, {Key: "type", Value: ticketType}, } collection := r.db.Database(r.databaseName).Collection(ordersCollectionName) @@ -603,7 +600,7 @@ func (r *CinemaOrdersRepository) getOrderInfo(ctx context.Context, type order struct { Date time.Time `bson:"order_date"` - ScreeningId int64 `bson:"screening_id"` + ScreeningID int64 `bson:"screening_id"` } ord := order{} @@ -612,15 +609,15 @@ func (r *CinemaOrdersRepository) getOrderInfo(ctx context.Context, return } - return ord.Date, ord.ScreeningId, nil + return ord.Date, ord.ScreeningID, nil } -func (r *CinemaOrdersRepository) GetOrder(ctx context.Context, orderId, accountId string) (res models.Order, err error) { +func (r *CinemaOrdersRepository) GetOrder(ctx context.Context, orderID, accountID string) (res models.Order, err error) { defer r.handleError(ctx, &err, "GetOrder") - r.logger.Info("order_id=", orderId, " account_id=", accountId) + r.logger.Info("order_id=", orderID, " account_id=", accountID) type orderInfoResp struct { orderDate time.Time - ScreeningId int64 + ScreeningID int64 err error } var orderInfoCh = make(chan orderInfoResp, 1) @@ -636,20 +633,20 @@ func (r *CinemaOrdersRepository) GetOrder(ctx context.Context, orderId, accountI go func() { defer close(orderTicketsCh) - res, err := r.getOrderTickets(ctx, accountId, orderId) + res, terr := r.getOrderTickets(ctx, accountID, orderID) orderTicketsCh <- orderTicketsResp{ tickets: res, - err: err, + err: terr, } }() go func() { defer close(orderInfoCh) - date, screeningId, err := r.getOrderInfo(ctx, orderId, accountId) + date, screeningID, ierr := r.getOrderInfo(ctx, orderID, accountID) orderInfoCh <- orderInfoResp{ orderDate: date, - ScreeningId: screeningId, - err: err, + ScreeningID: screeningID, + err: ierr, } }() @@ -667,8 +664,8 @@ func (r *CinemaOrdersRepository) GetOrder(ctx context.Context, orderId, accountI return } res.Date = info.orderDate - res.Id = orderId - res.ScreeningId = info.ScreeningId + res.ID = orderID + res.ScreeningID = info.ScreeningID infoReseived = true case ticketsRes, ok := <-orderTicketsCh: if !ok { @@ -729,16 +726,12 @@ func (r *CinemaOrdersRepository) handleError(ctx context.Context, err *error, fu r.logError(*err, functionName) var repoErr = &models.ServiceError{} if !errors.As(*err, &repoErr) { - var code models.ErrorCode switch { case errors.Is(*err, mongo.ErrNoDocuments): - code = models.NotFound - *err = models.Error(code, "") + *err = models.Error(models.NotFound, "") case *err != nil: - code = models.Internal - *err = models.Error(code, "repository iternal error") + *err = models.Error(models.Internal, "repository iternal error") } - } } diff --git a/internal/repository/mongorepository/mongo.go b/internal/repository/mongorepository/mongo.go index d69f56e..da68a37 100644 --- a/internal/repository/mongorepository/mongo.go +++ b/internal/repository/mongorepository/mongo.go @@ -1,4 +1,4 @@ -package mongo_repository +package mongorepository import ( "context" @@ -8,15 +8,17 @@ import ( "go.mongodb.org/mongo-driver/mongo/options" ) +const timeoutPingDuration = 10 * time.Second + func NewMongoDB(connStr string) (*mongo.Client, error) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), timeoutPingDuration) client, err := mongo.Connect(ctx, options.Client().ApplyURI(connStr)) if err != nil { return nil, err } cancel() - ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel = context.WithTimeout(context.Background(), timeoutPingDuration) defer cancel() err = client.Ping(ctx, nil) if err != nil { diff --git a/internal/repository/rediscache/reserveCache.go b/internal/repository/rediscache/reserveCache.go index bdcc8de..5045f9c 100644 --- a/internal/repository/rediscache/reserveCache.go +++ b/internal/repository/rediscache/reserveCache.go @@ -32,17 +32,17 @@ func (c *ReserveCache) PingContext(ctx context.Context) error { return nil } -func getKeyForPlace(screeningId int64, row, seat int32) string { - return fmt.Sprintf("%d_%d_%d", screeningId, row, seat) +func getKeyForPlace(screeningID int64, row, seat int32) string { + return fmt.Sprintf("%d_%d_%d", screeningID, row, seat) } -func parseKeyForPlace(key string) (screeningId int64, row, seat int32, err error) { +func parseKeyForPlace(key string) (screeningID int64, row, seat int32, err error) { parts := strings.Split(key, "_") if len(parts) != 3 { err = errors.New("invalid key") return } - screeningId, err = strconv.ParseInt(parts[0], 10, 64) + screeningID, err = strconv.ParseInt(parts[0], 10, 64) if err != nil { return } @@ -64,28 +64,28 @@ func parseKeyForPlace(key string) (screeningId int64, row, seat int32, err error type reservation struct { Places []models.Place `json:"places"` - ScreeningId int64 `json:"screening_id"` + ScreeningID int64 `json:"screening_id"` } func (c *ReserveCache) ReservePlaces(ctx context.Context, - screeningId int64, places []models.Place, ttl time.Duration) (reservationId string, err error) { + screeningID int64, places []models.Place, ttl time.Duration) (reservationID string, err error) { defer c.handleError(ctx, &err, "ReservePlaces") tx := c.rdb.Pipeline() - toCache, err := json.Marshal(reservation{Places: places, ScreeningId: screeningId}) + toCache, err := json.Marshal(reservation{Places: places, ScreeningID: screeningID}) if err != nil { return } - reservationId = uuid.NewString() - err = tx.Set(ctx, reservationId, toCache, ttl).Err() + reservationID = uuid.NewString() + err = tx.Set(ctx, reservationID, toCache, ttl).Err() if err != nil { return } var keys = make([]string, len(places)) for i, place := range places { - key := getKeyForPlace(screeningId, place.Row, place.Seat) + key := getKeyForPlace(screeningID, place.Row, place.Seat) keys[i] = key err = tx.Set(ctx, key, key, ttl).Err() @@ -94,7 +94,7 @@ func (c *ReserveCache) ReservePlaces(ctx context.Context, } } - err = tx.SAdd(ctx, fmt.Sprint(screeningId), keys).Err() + err = tx.SAdd(ctx, fmt.Sprint(screeningID), keys).Err() if err != nil { return } @@ -108,10 +108,10 @@ func (c *ReserveCache) ReservePlaces(ctx context.Context, } func (c *ReserveCache) GetReservation(ctx context.Context, - reservationId string) (places []models.Place, screeningId int64, err error) { + reservationID string) (places []models.Place, screeningID int64, err error) { defer c.handleError(ctx, &err, "GetReservation") - cached, err := c.rdb.Get(ctx, reservationId).Bytes() + cached, err := c.rdb.Get(ctx, reservationID).Bytes() if err != nil { return } @@ -122,13 +122,13 @@ func (c *ReserveCache) GetReservation(ctx context.Context, return } - return reserv.Places, reserv.ScreeningId, nil + return reserv.Places, reserv.ScreeningID, nil } -func (c *ReserveCache) DeletePlacesReservation(ctx context.Context, reservationId string) (err error) { +func (c *ReserveCache) DeletePlacesReservation(ctx context.Context, reservationID string) (err error) { defer c.handleError(ctx, &err, "DeletePlacesReservation") - reservBody, err := c.rdb.Get(ctx, reservationId).Bytes() + reservBody, err := c.rdb.Get(ctx, reservationID).Bytes() if err != nil { return } @@ -141,16 +141,16 @@ func (c *ReserveCache) DeletePlacesReservation(ctx context.Context, reservationI keys := make([]string, len(reserv.Places)+1) for i := range reserv.Places { - keys[i] = getKeyForPlace(reserv.ScreeningId, reserv.Places[i].Row, reserv.Places[i].Seat) + keys[i] = getKeyForPlace(reserv.ScreeningID, reserv.Places[i].Row, reserv.Places[i].Seat) } - keys[len(keys)-1] = reservationId + keys[len(keys)-1] = reservationID tx := c.rdb.Pipeline() err = tx.Del(ctx, keys...).Err() if err != nil { return } - err = c.rdb.SRem(ctx, fmt.Sprint(reserv.ScreeningId), keys[:len(keys)-1]).Err() + err = c.rdb.SRem(ctx, fmt.Sprint(reserv.ScreeningID), keys[:len(keys)-1]).Err() if err != nil { return } @@ -159,7 +159,7 @@ func (c *ReserveCache) DeletePlacesReservation(ctx context.Context, reservationI } func (c *ReserveCache) removeNonexistantKeys(ctx context.Context, - screeningId int64, keys []string) (existsKeys []string, err error) { + screeningID int64, keys []string) (existsKeys []string, err error) { defer c.handleError(ctx, &err, "removeNonexistantKeys") if len(keys) == 0 { @@ -191,7 +191,7 @@ func (c *ReserveCache) removeNonexistantKeys(ctx context.Context, } } - err = c.rdb.SRem(ctx, fmt.Sprint(screeningId), toRemove).Err() + err = c.rdb.SRem(ctx, fmt.Sprint(screeningID), toRemove).Err() if err != nil { return } @@ -200,10 +200,10 @@ func (c *ReserveCache) removeNonexistantKeys(ctx context.Context, return } -func (c *ReserveCache) GetReservedPlacesForScreening(ctx context.Context, screeningId int64) (places []models.Place, err error) { +func (c *ReserveCache) GetReservedPlacesForScreening(ctx context.Context, screeningID int64) (places []models.Place, err error) { defer c.handleError(ctx, &err, "GetReservedPlacesForScreening") - keys, err := c.rdb.SMembers(ctx, fmt.Sprint(screeningId)).Result() + keys, err := c.rdb.SMembers(ctx, fmt.Sprint(screeningID)).Result() if err != nil { return } @@ -211,7 +211,7 @@ func (c *ReserveCache) GetReservedPlacesForScreening(ctx context.Context, screen return } - keys, err = c.removeNonexistantKeys(ctx, screeningId, keys) + keys, err = c.removeNonexistantKeys(ctx, screeningID, keys) if err != nil { return } @@ -241,7 +241,7 @@ func (c *ReserveCache) GetScreeningsReservedPlaces(ctx context.Context, return } -func (с *ReserveCache) handleError(ctx context.Context, err *error, functionName string) { +func (c *ReserveCache) handleError(ctx context.Context, err *error, functionName string) { if ctx.Err() != nil { var code models.ErrorCode switch { @@ -258,7 +258,7 @@ func (с *ReserveCache) handleError(ctx context.Context, err *error, functionNam return } - с.logError(*err, functionName) + c.logError(*err, functionName) var repoErr = &models.ServiceError{} if !errors.As(*err, &repoErr) { var code models.ErrorCode @@ -266,7 +266,7 @@ func (с *ReserveCache) handleError(ctx context.Context, err *error, functionNam case errors.Is(*err, redis.Nil): code = models.NotFound *err = models.Error(code, "enity not found") - case err != nil: + default: code = models.Internal *err = models.Error(code, "cache internal error") } @@ -292,7 +292,6 @@ func (c *ReserveCache) logError(err error, functionName string) { logrus.Fields{ "error.function.name": functionName, "error.msg": err.Error(), - "error.code": models.Unknown, }, ).Error("reserve cache error occurred") } diff --git a/internal/repository/repository.go b/internal/repository/repository.go index d13e4c5..6c5ea83 100644 --- a/internal/repository/repository.go +++ b/internal/repository/repository.go @@ -17,20 +17,20 @@ type DBConfig struct { } type CinemaOrdersRepository interface { - GetOccupiedPlaces(ctx context.Context, screeningId int64) ([]models.Place, error) + GetOccupiedPlaces(ctx context.Context, screeningID int64) ([]models.Place, error) ProcessOrder(ctx context.Context, order models.ProcessOrderDTO) error GetScreeningsOccupiedPlaces(ctx context.Context, ids []int64) (map[int64][]models.Place, error) - GetOrders(ctx context.Context, accountId string, page, limit uint32, sort models.SortDTO) ([]models.OrderPreview, error) - GetOrder(ctx context.Context, orderId, accountId string) (models.Order, error) - GetOrderScreeningId(ctx context.Context, accountId, orderId string) (int64, error) - GetOrderItemsStatuses(ctx context.Context, orderId string) ([]models.OrderItemStatus, error) - CancelOrder(ctx context.Context, orderId string) error + GetOrders(ctx context.Context, accountID string, page, limit uint32, sort models.SortDTO) ([]models.OrderPreview, error) + GetOrder(ctx context.Context, orderID, accountID string) (models.Order, error) + GetOrderScreeningID(ctx context.Context, accountID, orderID string) (int64, error) + GetOrderItemsStatuses(ctx context.Context, orderID string) ([]models.OrderItemStatus, error) + CancelOrder(ctx context.Context, orderID string) error } type ReserveCache interface { - ReservePlaces(ctx context.Context, screeningId int64, seats []models.Place, ttl time.Duration) (string, error) - GetReservation(ctx context.Context, reservationId string) (seats []models.Place, screeningId int64, err error) - DeletePlacesReservation(ctx context.Context, reservationId string) error - GetReservedPlacesForScreening(ctx context.Context, screeningId int64) ([]models.Place, error) + ReservePlaces(ctx context.Context, screeningID int64, seats []models.Place, ttl time.Duration) (string, error) + GetReservation(ctx context.Context, reservationID string) (seats []models.Place, screeningID int64, err error) + DeletePlacesReservation(ctx context.Context, reservationID string) error + GetReservedPlacesForScreening(ctx context.Context, screeningID int64) ([]models.Place, error) GetScreeningsReservedPlaces(ctx context.Context, ids []int64) (map[int64][]models.Place, error) } diff --git a/internal/service/service.go b/internal/service/service.go index d4a9e7c..1764c77 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -2,15 +2,12 @@ package service import ( "context" - "errors" - "strings" "sync" "time" "github.com/Falokut/cinema_orders_service/internal/events" "github.com/Falokut/cinema_orders_service/internal/models" "github.com/Falokut/cinema_orders_service/internal/repository" - cinema_orders_service "github.com/Falokut/cinema_orders_service/pkg/cinema_orders_service/v1/protos" "github.com/Falokut/cinema_orders_service/pkg/sliceutils" "github.com/google/uuid" "github.com/sirupsen/logrus" @@ -19,31 +16,31 @@ import ( ) type CinemaOrdersService interface { - GetOccupiedPlaces(ctx context.Context, screeningId int64) ([]models.Place, error) - ReservePlaces(ctx context.Context, screeningId int64, places []models.Place) (string, time.Duration, error) - ProcessOrder(ctx context.Context, reservationId, accountId string) (string, error) - CancelReservation(ctx context.Context, reservationId string) error + GetOccupiedPlaces(ctx context.Context, screeningID int64) ([]models.Place, error) + ReservePlaces(ctx context.Context, screeningID int64, places []models.Place) (string, time.Duration, error) + ProcessOrder(ctx context.Context, reservationID, accountID string) (string, error) + CancelReservation(ctx context.Context, reservationID string) error GetScreeningsOccupiedPlacesCounts(ctx context.Context, ids []int64) (map[int64]uint32, error) - GetOrders(ctx context.Context, accountId string, + GetOrders(ctx context.Context, accountID string, page, limit uint32, sort models.SortDTO) ([]models.OrderPreview, error) - GetOrder(ctx context.Context, orderId, accountId string) (models.Order, error) - RefundOrder(ctx context.Context, accountId, ordererId string) error - RefundOrderItems(ctx context.Context, accountId, ordererId string, itemsIds []string) error + GetOrder(ctx context.Context, orderID, accountID string) (models.Order, error) + RefundOrder(ctx context.Context, accountID, ordererID string) error + RefundOrderItems(ctx context.Context, accountID, ordererID string, itemsIDs []string) error } type PaymentService interface { - PreparePaymentUrl(ctx context.Context, email string, amount uint32, orderId string) (string, error) - RequestOrderRefund(ctx context.Context, percent uint32, orderId string) error - RequestOrderItemsRefund(ctx context.Context, percent uint32, orderId string, itemsIds []string) error + PreparePaymentURL(ctx context.Context, email string, amount uint32, orderID string) (string, error) + RequestOrderRefund(ctx context.Context, percent uint32, orderID string) error + RequestOrderItemsRefund(ctx context.Context, percent uint32, orderID string, itemsIDs []string) error } type ProfilesService interface { GetEmail(ctx context.Context) (string, error) } type CinemaService interface { - GetScreeningTicketPrice(ctx context.Context, screeningId int64) (uint32, error) - GetScreening(ctx context.Context, screeningId int64) (Screening, error) - GetScreeningStartTime(ctx context.Context, screeningId int64) (time.Time, error) + GetScreeningTicketPrice(ctx context.Context, screeningID int64) (uint32, error) + GetScreening(ctx context.Context, screeningID int64) (Screening, error) + GetScreeningStartTime(ctx context.Context, screeningID int64) (time.Time, error) } type cinemaOrdersService struct { @@ -84,7 +81,7 @@ func NewCinemaOrdersService(logger *logrus.Logger, } func (s *cinemaOrdersService) GetOccupiedPlaces(ctx context.Context, - screeningId int64) (places []models.Place, err error) { + screeningID int64) (places []models.Place, err error) { type chanResp struct { seats []models.Place err error @@ -96,20 +93,20 @@ func (s *cinemaOrdersService) GetOccupiedPlaces(ctx context.Context, wg.Add(1) go func() { defer wg.Done() - places, err := s.repo.GetOccupiedPlaces(ctx, screeningId) + oplaces, oerr := s.repo.GetOccupiedPlaces(ctx, screeningID) resCh <- chanResp{ - seats: places, - err: err, + seats: oplaces, + err: oerr, } }() wg.Add(1) go func() { defer wg.Done() - places, err := s.cache.GetReservedPlacesForScreening(ctx, screeningId) + rplaces, rerr := s.cache.GetReservedPlacesForScreening(ctx, screeningID) resCh <- chanResp{ - seats: places, - err: err, + seats: rplaces, + err: rerr, } }() @@ -154,20 +151,20 @@ func (s *cinemaOrdersService) GetScreeningsOccupiedPlacesCounts(ctx context.Cont wg.Add(1) go func() { defer wg.Done() - seats, err := s.repo.GetScreeningsOccupiedPlaces(ctx, ids) + seats, perr := s.repo.GetScreeningsOccupiedPlaces(ctx, ids) resCh <- chanResp{ seats: seats, - err: err, + err: perr, } }() wg.Add(1) go func() { defer wg.Done() - seats, err := s.cache.GetScreeningsReservedPlaces(ctx, ids) + seats, perr := s.cache.GetScreeningsReservedPlaces(ctx, ids) resCh <- chanResp{ seats: seats, - err: err, + err: perr, } }() @@ -205,16 +202,16 @@ LOOP: } } placesCounts = make(map[int64]uint32, len(places)) - for screeningId, places := range places { - placesCounts[screeningId] = uint32(len(places)) + for screeningID, places := range places { + placesCounts[screeningID] = uint32(len(places)) } return placesCounts, nil } func (s *cinemaOrdersService) ReservePlaces(ctx context.Context, - screeningId int64, toReserve []models.Place) (reserveId string, paymentTime time.Duration, err error) { - occupied, err := s.GetOccupiedPlaces(ctx, screeningId) + screeningID int64, toReserve []models.Place) (reserveID string, paymentTime time.Duration, err error) { + occupied, err := s.GetOccupiedPlaces(ctx, screeningID) if err != nil { return } @@ -226,7 +223,7 @@ func (s *cinemaOrdersService) ReservePlaces(ctx context.Context, } } - screening, err := s.getScreening(ctx, screeningId) + screening, err := s.getScreening(ctx, screeningID) if err != nil { return } @@ -251,7 +248,7 @@ func (s *cinemaOrdersService) ReservePlaces(ctx context.Context, } } - id, err := s.cache.ReservePlaces(ctx, screeningId, toReserve, s.seatReservationTime) + id, err := s.cache.ReservePlaces(ctx, screeningID, toReserve, s.seatReservationTime) if err != nil { return } @@ -259,8 +256,8 @@ func (s *cinemaOrdersService) ReservePlaces(ctx context.Context, return id, s.seatReservationTime, nil } -func (s *cinemaOrdersService) getScreening(ctx context.Context, screeningId int64) (screening Screening, err error) { - screening, err = s.cinemaService.GetScreening(ctx, screeningId) +func (s *cinemaOrdersService) getScreening(ctx context.Context, screeningID int64) (screening Screening, err error) { + screening, err = s.cinemaService.GetScreening(ctx, screeningID) if err != nil { return } @@ -268,19 +265,18 @@ func (s *cinemaOrdersService) getScreening(ctx context.Context, screeningId int6 return } -func (s *cinemaOrdersService) GetOrder(ctx context.Context, orderId, accountId string) (order models.Order, err error) { - return s.repo.GetOrder(ctx, orderId, accountId) +func (s *cinemaOrdersService) GetOrder(ctx context.Context, orderID, accountID string) (order models.Order, err error) { + return s.repo.GetOrder(ctx, orderID, accountID) } func (s *cinemaOrdersService) ProcessOrder(ctx context.Context, - reservationId, accountId string) (orderId string, err error) { - + reservationID, accountID string) (orderID string, err error) { email, err := s.profilesService.GetEmail(ctx) if err != nil { return } - reservedPlaces, screeningId, err := s.cache.GetReservation(ctx, reservationId) + reservedPlaces, screeningID, err := s.cache.GetReservation(ctx, reservationID) if err != nil { return } @@ -289,12 +285,12 @@ func (s *cinemaOrdersService) ProcessOrder(ctx context.Context, return } - price, err := s.cinemaService.GetScreeningTicketPrice(ctx, screeningId) + price, err := s.cinemaService.GetScreeningTicketPrice(ctx, screeningID) if err != nil { return } - orderId = uuid.NewString() + orderID = uuid.NewString() var convertedPlaces = make([]models.ProcessOrderPlace, len(reservedPlaces)) for i := range reservedPlaces { convertedPlaces[i] = models.ProcessOrderPlace{ @@ -304,36 +300,37 @@ func (s *cinemaOrdersService) ProcessOrder(ctx context.Context, } err = s.repo.ProcessOrder(ctx, models.ProcessOrderDTO{ - Id: orderId, + ID: orderID, Places: convertedPlaces, - ScreeningId: screeningId, - OwnerId: accountId, + ScreeningID: screeningID, + OwnerID: accountID, }) if err != nil { return } - url, err := s.paymentService.PreparePaymentUrl(ctx, email, price*uint32(len(reservedPlaces)), orderId) + url, err := s.paymentService.PreparePaymentURL(ctx, email, price*uint32(len(reservedPlaces)), orderID) if err != nil { return } go func() { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) + const deleteReservationTimeout = time.Second * 30 + ctx, cancel := context.WithTimeout(context.Background(), deleteReservationTimeout) defer cancel() - err = s.cache.DeletePlacesReservation(ctx, reservationId) + err = s.cache.DeletePlacesReservation(ctx, reservationID) if err != nil { s.logger.Errorf("error while deleting reservation %v", err) } }() - go s.sendOrderCreatedNotification(context.Background(), accountId, email, orderId) + go s.sendOrderCreatedNotification(context.Background(), accountID, email, orderID) return url, nil } -func (s *cinemaOrdersService) sendOrderCreatedNotification(ctx context.Context, accountId, email, orderId string) { - order, err := s.GetOrder(ctx, orderId, accountId) +func (s *cinemaOrdersService) sendOrderCreatedNotification(ctx context.Context, accountID, email, orderID string) { + order, err := s.GetOrder(ctx, orderID, accountID) if err != nil { s.logger.Error("error while getting order err=", err) return @@ -345,7 +342,7 @@ func (s *cinemaOrdersService) sendOrderCreatedNotification(ctx context.Context, } s.logger.Errorf("error while sending order in mq err=%v trying cancel order", err) - statuses, err := s.repo.GetOrderItemsStatuses(ctx, orderId) + statuses, err := s.repo.GetOrderItemsStatuses(ctx, orderID) if err != nil { s.logger.Error("error while getting order items err=", err) return @@ -356,39 +353,47 @@ func (s *cinemaOrdersService) sendOrderCreatedNotification(ctx context.Context, return } - //It is expected that when paying, all the statuses of the items in 1 transaction will change - if statuses[0] == models.ORDER_ITEM_STATUS_PAID { - err = s.paymentService.RequestOrderRefund(ctx, 100, orderId) + // Expecting that when paying, all the statuses of the items in 1 transaction will change + if statuses[0] == models.OrderItemStatusPaid { + err = s.paymentService.RequestOrderRefund(ctx, uint32(Full), orderID) if err != nil { s.logger.Error("error while requesting order items refund err=", err) } - } else if statuses[0] == models.ORDER_ITEM_STATUS_PAYMENT_REQUIRED { - err = s.repo.CancelOrder(ctx, orderId) + } else if statuses[0] == models.OrderItemStatusPaymentRequired { + err = s.repo.CancelOrder(ctx, orderID) if err != nil { s.logger.Error("error while requesting order items cancelation err=", err) } } } -func (s *cinemaOrdersService) CancelReservation(ctx context.Context, reservationId string) error { - return s.cache.DeletePlacesReservation(ctx, reservationId) +func (s *cinemaOrdersService) CancelReservation(ctx context.Context, reservationID string) error { + return s.cache.DeletePlacesReservation(ctx, reservationID) } -func (s *cinemaOrdersService) GetOrders(ctx context.Context, accountId string, page, limit uint32, +func (s *cinemaOrdersService) GetOrders(ctx context.Context, accountID string, page, limit uint32, sort models.SortDTO) ([]models.OrderPreview, error) { - return s.repo.GetOrders(ctx, accountId, page, limit, sort) + return s.repo.GetOrders(ctx, accountID, page, limit, sort) } -func (s *cinemaOrdersService) getOrderScreeningId(ctx context.Context, accountId, orderId string) (int64, error) { - return s.repo.GetOrderScreeningId(ctx, accountId, orderId) +func (s *cinemaOrdersService) getOrderScreeningID(ctx context.Context, accountID, orderID string) (int64, error) { + return s.repo.GetOrderScreeningID(ctx, accountID, orderID) } const ( day = time.Hour * 24 ) -func (s *cinemaOrdersService) getRefundPercent(ctx context.Context, accountId, orderId string) (percent uint32, err error) { - id, err := s.getOrderScreeningId(ctx, accountId, orderId) +type RefundPercent uint32 + +const ( + Full RefundPercent = 100 + Half RefundPercent = 50 + OneThird RefundPercent = 30 +) + +func (s *cinemaOrdersService) getRefundPercent(ctx context.Context, accountID, orderID string) (percent uint32, err error) { + id, err := s.getOrderScreeningID(ctx, accountID, orderID) if err != nil { return } @@ -406,49 +411,30 @@ func (s *cinemaOrdersService) getRefundPercent(ctx context.Context, accountId, o switch { case timeBeforeScreening >= 10*day: - return 100, nil + return uint32(Full), nil case timeBeforeScreening <= 5*day && timeBeforeScreening > 3*day: - return 50, nil + return uint32(Half), nil default: - return 30, nil + return uint32(OneThird), nil } } -func (s *cinemaOrdersService) RefundOrder(ctx context.Context, accountId, orderId string) (err error) { - percent, err := s.getRefundPercent(ctx, accountId, orderId) +func (s *cinemaOrdersService) RefundOrder(ctx context.Context, accountID, orderID string) (err error) { + percent, err := s.getRefundPercent(ctx, accountID, orderID) if err != nil { return } - err = s.paymentService.RequestOrderRefund(ctx, percent, orderId) + err = s.paymentService.RequestOrderRefund(ctx, percent, orderID) return } func (s *cinemaOrdersService) RefundOrderItems(ctx context.Context, - accountId, orderId string, itemsIds []string) (err error) { - percent, err := s.getRefundPercent(ctx, accountId, orderId) + accountID, orderID string, itemsIDs []string) (err error) { + percent, err := s.getRefundPercent(ctx, accountID, orderID) if err != nil { return } - return s.paymentService.RequestOrderItemsRefund(ctx, percent, orderId, itemsIds) -} - -func OrderStatusFromString(str string) (cinema_orders_service.Status, error) { - switch { - default: - return cinema_orders_service.Status(-1), errors.New("unknown status") - case strings.EqualFold(str, cinema_orders_service.Status_PAYMENT_REQUIRED.String()): - return cinema_orders_service.Status_PAYMENT_REQUIRED, nil - case strings.EqualFold(str, cinema_orders_service.Status_PAID.String()): - return cinema_orders_service.Status_PAID, nil - case strings.EqualFold(str, cinema_orders_service.Status_CANCELLED.String()): - return cinema_orders_service.Status_CANCELLED, nil - case strings.EqualFold(str, cinema_orders_service.Status_REFUNDED.String()): - return cinema_orders_service.Status_REFUNDED, nil - case strings.EqualFold(str, cinema_orders_service.Status_REFUND_AWAITING.String()): - return cinema_orders_service.Status_REFUND_AWAITING, nil - case strings.EqualFold(str, cinema_orders_service.Status_USED.String()): - return cinema_orders_service.Status_USED, nil - } + return s.paymentService.RequestOrderItemsRefund(ctx, percent, orderID, itemsIDs) } diff --git a/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1.pb.go b/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1.pb.go index aecccf8..24faa29 100644 --- a/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1.pb.go +++ b/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.32.0 // protoc v4.25.3 // source: cinema_orders_service_v1.proto @@ -37,7 +37,7 @@ var file_cinema_orders_service_v1_proto_rawDesc = []byte{ 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xf6, 0x16, 0x0a, 0x15, + 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xe1, 0x14, 0x0a, 0x15, 0x43, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x31, 0x12, 0x8a, 0x02, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x27, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, @@ -62,187 +62,170 @@ var file_cinema_orders_service_v1_proto_rawDesc = []byte{ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x93, 0x02, 0x92, 0x41, 0xf4, 0x01, 0x4a, 0x5c, 0x0a, 0x03, - 0x34, 0x30, 0x34, 0x12, 0x55, 0x0a, 0x30, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, - 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, - 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, + 0x34, 0x30, 0x31, 0x12, 0x55, 0x0a, 0x30, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, + 0x77, 0x68, 0x65, 0x6e, 0x20, 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x49, + 0x64, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x5c, 0x0a, 0x03, 0x34, 0x30, - 0x31, 0x12, 0x55, 0x0a, 0x30, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, - 0x65, 0x6e, 0x20, 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x49, 0x64, 0x20, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, + 0x34, 0x12, 0x55, 0x0a, 0x30, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, + 0x65, 0x6e, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, + 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x72, 0x36, 0x0a, 0x34, 0x0a, 0x0c, 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x49, 0x64, 0x12, 0x20, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x28, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x64, 0x65, - 0x72, 0x2f, 0x7b, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x7d, 0x12, 0xee, 0x04, 0x0a, 0x0b, + 0x72, 0x2f, 0x7b, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x44, 0x7d, 0x12, 0x90, 0x04, 0x0a, 0x0b, 0x52, 0x65, 0x66, 0x75, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x29, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x66, 0x75, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x9b, - 0x04, 0x92, 0x41, 0xf2, 0x03, 0x4a, 0x5c, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x55, 0x0a, 0x30, - 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x6f, 0x72, - 0x64, 0x65, 0x72, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, - 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x4a, 0x85, 0x01, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x7e, 0x0a, 0x59, 0x52, - 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x5f, 0x69, 0x64, 0x73, 0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x6e, 0x79, - 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x69, 0x74, 0x65, 0x6d, 0x20, 0x77, 0x69, 0x74, 0x68, - 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, - 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xbd, + 0x03, 0x92, 0x41, 0x94, 0x03, 0x4a, 0x74, 0x0a, 0x03, 0x34, 0x30, 0x30, 0x12, 0x6d, 0x0a, 0x48, + 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, + 0x65, 0x72, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6c, 0x65, 0x73, 0x73, 0x20, 0x74, 0x68, 0x61, + 0x6e, 0x20, 0x33, 0x20, 0x64, 0x61, 0x79, 0x73, 0x20, 0x72, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, + 0x6e, 0x67, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x63, + 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x74, 0x0a, 0x03, 0x34, - 0x30, 0x30, 0x12, 0x6d, 0x0a, 0x48, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, - 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x6c, 0x65, - 0x73, 0x73, 0x20, 0x74, 0x68, 0x61, 0x6e, 0x20, 0x33, 0x20, 0x64, 0x61, 0x79, 0x73, 0x20, 0x72, - 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x12, 0x21, + 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x5c, 0x0a, 0x03, 0x34, + 0x30, 0x31, 0x12, 0x55, 0x0a, 0x30, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, + 0x68, 0x65, 0x6e, 0x20, 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x49, 0x64, + 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, + 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x85, 0x01, 0x0a, 0x03, 0x34, 0x30, + 0x34, 0x12, 0x7e, 0x0a, 0x59, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, + 0x65, 0x6e, 0x20, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x5f, 0x69, 0x64, 0x73, 0x20, 0x69, 0x73, 0x20, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x77, 0x68, + 0x65, 0x6e, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x20, 0x69, 0x74, 0x65, + 0x6d, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x4a, 0x5c, 0x0a, 0x03, 0x34, 0x30, 0x31, 0x12, 0x55, 0x0a, 0x30, 0x52, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x2d, 0x49, 0x64, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x6e, 0x6f, - 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, - 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x72, - 0x36, 0x0a, 0x34, 0x0a, 0x0c, 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x49, - 0x64, 0x12, 0x20, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x01, 0x28, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x1a, 0x2f, - 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2f, 0x7b, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, - 0x64, 0x7d, 0x2f, 0x72, 0x65, 0x66, 0x75, 0x6e, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x98, 0x01, 0x0a, - 0x11, 0x47, 0x65, 0x74, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x63, - 0x65, 0x73, 0x12, 0x2f, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, - 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x63, - 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, - 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x63, - 0x65, 0x73, 0x22, 0x33, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x76, 0x31, 0x2f, - 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x73, 0x63, 0x72, 0x65, 0x65, - 0x6e, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x7d, 0x2f, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, - 0x2d, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x12, 0xdc, 0x02, 0x0a, 0x21, 0x47, 0x65, 0x74, 0x53, - 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, - 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x3f, 0x2e, - 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, + 0x73, 0x72, 0x36, 0x0a, 0x34, 0x0a, 0x0c, 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x2d, 0x49, 0x64, 0x12, 0x20, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x63, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x28, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, + 0x01, 0x2a, 0x22, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x2f, 0x7b, 0x6f, + 0x72, 0x64, 0x65, 0x72, 0x49, 0x44, 0x7d, 0x2f, 0x72, 0x65, 0x66, 0x75, 0x6e, 0x64, 0x12, 0x98, + 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, + 0x61, 0x63, 0x65, 0x73, 0x12, 0x2f, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, + 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, + 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x6c, + 0x61, 0x63, 0x65, 0x73, 0x22, 0x33, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x76, + 0x31, 0x2f, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x73, 0x63, 0x72, + 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x49, 0x44, 0x7d, 0x2f, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, + 0x65, 0x64, 0x2d, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x12, 0xdc, 0x02, 0x0a, 0x21, 0x47, 0x65, + 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x4f, 0x63, 0x63, 0x75, 0x70, + 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, + 0x3f, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, + 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, + 0x63, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x34, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, - 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, - 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, - 0x73, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xbf, 0x01, 0x92, 0x41, 0x8e, 0x01, 0x4a, 0x8b, 0x01, 0x0a, 0x03, - 0x34, 0x30, 0x30, 0x12, 0x83, 0x01, 0x0a, 0x5e, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, - 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, - 0x5f, 0x69, 0x64, 0x73, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, 0x6f, 0x72, - 0x20, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x63, 0x68, 0x61, - 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x61, 0x72, 0x65, - 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x20, 0x6f, 0x72, 0x20, 0x63, - 0x6f, 0x6d, 0x6d, 0x61, 0x73, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, - 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, - 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x2f, - 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x2d, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x2f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0xc5, 0x03, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x12, 0x2b, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, - 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, - 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0xd8, 0x02, 0x92, 0x41, 0xa6, 0x02, 0x4a, 0x51, 0x0a, 0x03, 0x34, 0x30, - 0x30, 0x12, 0x4a, 0x0a, 0x25, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, - 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x20, 0x61, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x3e, 0x20, 0x35, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, - 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x64, 0x0a, - 0x03, 0x34, 0x30, 0x30, 0x12, 0x5d, 0x0a, 0x38, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, - 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, - 0x69, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, - 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x4a, 0x6b, 0x0a, 0x03, 0x34, 0x30, 0x39, 0x12, 0x64, 0x0a, 0x3f, 0x52, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x6e, 0x79, 0x20, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x20, - 0x61, 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x20, 0x6f, 0x72, 0x20, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x2e, 0x12, 0x21, 0x0a, - 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x72, 0x65, - 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, - 0x49, 0x64, 0x7d, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0xf3, - 0x01, 0x0a, 0x11, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, - 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x61, 0x6e, - 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x94, 0x01, - 0x92, 0x41, 0x64, 0x4a, 0x62, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x5b, 0x0a, 0x36, 0x52, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, - 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, - 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, - 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x22, 0x22, 0x2f, - 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x7b, - 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x49, 0x64, 0x7d, 0x2f, 0x63, 0x61, 0x6e, 0x63, 0x65, - 0x6c, 0x3a, 0x01, 0x2a, 0x12, 0xbd, 0x03, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, - 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x2a, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, - 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x72, - 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, - 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, - 0x73, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd3, - 0x02, 0x92, 0x41, 0xa1, 0x02, 0x4a, 0x62, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x5b, 0x0a, 0x36, - 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, - 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, - 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x83, 0x01, 0x0a, 0x03, 0x34, 0x30, - 0x34, 0x12, 0x7c, 0x0a, 0x57, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, - 0x65, 0x6e, 0x20, 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x49, 0x64, 0x20, - 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x65, 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, - 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, - 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, - 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x72, - 0x35, 0x0a, 0x33, 0x0a, 0x0c, 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x49, - 0x64, 0x12, 0x21, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x2e, 0x18, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, 0x76, - 0x31, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x7b, 0x72, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x49, 0x64, 0x7d, 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, - 0x73, 0x3a, 0x01, 0x2a, 0x42, 0xc7, 0x02, 0x5a, 0x1f, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, - 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x76, - 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x92, 0x41, 0xa2, 0x02, 0x12, 0x5d, 0x0a, 0x15, - 0x43, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x20, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x3f, 0x0a, 0x07, 0x46, 0x61, 0x6c, 0x6f, 0x6b, 0x75, 0x74, - 0x12, 0x1a, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x46, 0x61, 0x6c, 0x6f, 0x6b, 0x75, 0x74, 0x1a, 0x18, 0x74, 0x69, - 0x6d, 0x75, 0x72, 0x2e, 0x73, 0x69, 0x6e, 0x65, 0x6c, 0x6e, 0x69, 0x6b, 0x40, 0x79, 0x61, 0x6e, - 0x64, 0x65, 0x78, 0x2e, 0x72, 0x75, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x2a, 0x02, 0x01, 0x02, 0x32, - 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, - 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, - 0x73, 0x6f, 0x6e, 0x52, 0x56, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x4f, 0x0a, 0x2a, 0x52, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, - 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, 0x74, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xbf, 0x01, 0x92, 0x41, 0x8e, 0x01, 0x4a, 0x8b, 0x01, + 0x0a, 0x03, 0x34, 0x30, 0x30, 0x12, 0x83, 0x01, 0x0a, 0x5e, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, + 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, + 0x67, 0x73, 0x5f, 0x69, 0x64, 0x73, 0x20, 0x69, 0x73, 0x20, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x20, + 0x6f, 0x72, 0x20, 0x6f, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x73, 0x20, 0x63, + 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x61, + 0x72, 0x65, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x20, 0x6f, 0x72, + 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x73, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x41, 0x0a, 0x03, 0x35, - 0x30, 0x30, 0x12, 0x3a, 0x0a, 0x15, 0x53, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, - 0x77, 0x65, 0x6e, 0x74, 0x20, 0x77, 0x72, 0x6f, 0x6e, 0x67, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, - 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x27, 0x12, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, + 0x73, 0x2f, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x2d, 0x70, 0x6c, 0x61, 0x63, 0x65, + 0x73, 0x2f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0xf2, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x12, 0x2b, 0x2e, 0x63, 0x69, 0x6e, + 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, + 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, 0x02, 0x92, 0x41, 0xd3, 0x01, 0x4a, 0x64, 0x0a, 0x03, + 0x34, 0x30, 0x30, 0x12, 0x5d, 0x0a, 0x38, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, + 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, + 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, + 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x4a, 0x6b, 0x0a, 0x03, 0x34, 0x30, 0x39, 0x12, 0x64, 0x0a, 0x3f, 0x52, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x73, + 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x20, 0x61, + 0x6c, 0x72, 0x65, 0x61, 0x64, 0x79, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, + 0x6f, 0x72, 0x20, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, + 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x3a, 0x01, 0x2a, 0x22, 0x23, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x63, + 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, + 0x6e, 0x67, 0x49, 0x44, 0x7d, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x12, 0xf3, 0x01, + 0x0a, 0x11, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, + 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x61, 0x6e, 0x63, + 0x65, 0x6c, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x94, 0x01, 0x92, + 0x41, 0x64, 0x4a, 0x62, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x5b, 0x0a, 0x36, 0x52, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, + 0x6e, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22, + 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2f, 0x7b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x49, 0x44, 0x7d, 0x2f, 0x63, 0x61, 0x6e, + 0x63, 0x65, 0x6c, 0x12, 0xd9, 0x02, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4f, + 0x72, 0x64, 0x65, 0x72, 0x12, 0x2a, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x72, 0x6f, + 0x63, 0x65, 0x73, 0x73, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x2b, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, + 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, + 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xef, 0x01, + 0x92, 0x41, 0xbd, 0x01, 0x4a, 0x83, 0x01, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x7c, 0x0a, 0x57, + 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x58, 0x2d, + 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x49, 0x64, 0x20, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x61, + 0x6e, 0x64, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x64, 0x20, 0x6e, 0x6f, 0x74, + 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, + 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x72, 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x72, 0x35, 0x0a, 0x33, 0x0a, 0x0c, + 0x58, 0x2d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2d, 0x49, 0x64, 0x12, 0x21, 0x55, 0x6e, + 0x69, 0x71, 0x75, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, + 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x18, + 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x3a, 0x01, 0x2a, 0x22, 0x23, 0x2f, 0x76, 0x31, 0x2f, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x7b, 0x72, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x49, 0x44, 0x7d, 0x2f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x42, + 0xc7, 0x02, 0x92, 0x41, 0xa2, 0x02, 0x12, 0x5d, 0x0a, 0x15, 0x43, 0x69, 0x6e, 0x65, 0x6d, 0x61, + 0x20, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, + 0x3f, 0x0a, 0x07, 0x46, 0x61, 0x6c, 0x6f, 0x6b, 0x75, 0x74, 0x12, 0x1a, 0x68, 0x74, 0x74, 0x70, + 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x46, + 0x61, 0x6c, 0x6f, 0x6b, 0x75, 0x74, 0x1a, 0x18, 0x74, 0x69, 0x6d, 0x75, 0x72, 0x2e, 0x73, 0x69, + 0x6e, 0x65, 0x6c, 0x6e, 0x69, 0x6b, 0x40, 0x79, 0x61, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x72, 0x75, + 0x32, 0x03, 0x31, 0x2e, 0x30, 0x2a, 0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x52, 0x56, 0x0a, + 0x03, 0x34, 0x30, 0x34, 0x12, 0x4f, 0x0a, 0x2a, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x65, 0x64, + 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x20, 0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x65, 0x78, 0x69, 0x73, + 0x74, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, 0x70, 0x63, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x41, 0x0a, 0x03, 0x35, 0x30, 0x30, 0x12, 0x3a, 0x0a, 0x15, + 0x53, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x65, 0x6e, 0x74, 0x20, 0x77, + 0x72, 0x6f, 0x6e, 0x67, 0x2e, 0x12, 0x21, 0x0a, 0x1f, 0x1a, 0x1d, 0x23, 0x2f, 0x64, 0x65, 0x66, + 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x72, + 0x70, 0x63, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5a, 0x1f, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, + 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, + 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var file_cinema_orders_service_v1_proto_goTypes = []interface{}{ diff --git a/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1.pb.gw.go b/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1.pb.gw.go index d163aec..a88296f 100644 --- a/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1.pb.gw.go +++ b/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1.pb.gw.go @@ -78,14 +78,14 @@ func request_CinemaOrdersServiceV1_GetOrder_0(ctx context.Context, marshaler run _ = err ) - val, ok = pathParams["orderId"] + val, ok = pathParams["orderID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "orderId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "orderID") } - protoReq.OrderId, err = runtime.String(val) + protoReq.OrderID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "orderId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "orderID", err) } msg, err := client.GetOrder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -104,14 +104,14 @@ func local_request_CinemaOrdersServiceV1_GetOrder_0(ctx context.Context, marshal _ = err ) - val, ok = pathParams["orderId"] + val, ok = pathParams["orderID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "orderId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "orderID") } - protoReq.OrderId, err = runtime.String(val) + protoReq.OrderID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "orderId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "orderID", err) } msg, err := server.GetOrder(ctx, &protoReq) @@ -138,14 +138,14 @@ func request_CinemaOrdersServiceV1_RefundOrder_0(ctx context.Context, marshaler _ = err ) - val, ok = pathParams["orderId"] + val, ok = pathParams["orderID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "orderId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "orderID") } - protoReq.OrderId, err = runtime.String(val) + protoReq.OrderID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "orderId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "orderID", err) } msg, err := client.RefundOrder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -172,14 +172,14 @@ func local_request_CinemaOrdersServiceV1_RefundOrder_0(ctx context.Context, mars _ = err ) - val, ok = pathParams["orderId"] + val, ok = pathParams["orderID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "orderId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "orderID") } - protoReq.OrderId, err = runtime.String(val) + protoReq.OrderID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "orderId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "orderID", err) } msg, err := server.RefundOrder(ctx, &protoReq) @@ -198,14 +198,14 @@ func request_CinemaOrdersServiceV1_GetOccupiedPlaces_0(ctx context.Context, mars _ = err ) - val, ok = pathParams["screeningId"] + val, ok = pathParams["screeningID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "screeningId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "screeningID") } - protoReq.ScreeningId, err = runtime.Int64(val) + protoReq.ScreeningID, err = runtime.Int64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "screeningId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "screeningID", err) } msg, err := client.GetOccupiedPlaces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -224,14 +224,14 @@ func local_request_CinemaOrdersServiceV1_GetOccupiedPlaces_0(ctx context.Context _ = err ) - val, ok = pathParams["screeningId"] + val, ok = pathParams["screeningID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "screeningId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "screeningID") } - protoReq.ScreeningId, err = runtime.Int64(val) + protoReq.ScreeningID, err = runtime.Int64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "screeningId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "screeningID", err) } msg, err := server.GetOccupiedPlaces(ctx, &protoReq) @@ -294,14 +294,14 @@ func request_CinemaOrdersServiceV1_ReservePlaces_0(ctx context.Context, marshale _ = err ) - val, ok = pathParams["screeningId"] + val, ok = pathParams["screeningID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "screeningId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "screeningID") } - protoReq.ScreeningId, err = runtime.Int64(val) + protoReq.ScreeningID, err = runtime.Int64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "screeningId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "screeningID", err) } msg, err := client.ReservePlaces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -328,14 +328,14 @@ func local_request_CinemaOrdersServiceV1_ReservePlaces_0(ctx context.Context, ma _ = err ) - val, ok = pathParams["screeningId"] + val, ok = pathParams["screeningID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "screeningId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "screeningID") } - protoReq.ScreeningId, err = runtime.Int64(val) + protoReq.ScreeningID, err = runtime.Int64(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "screeningId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "screeningID", err) } msg, err := server.ReservePlaces(ctx, &protoReq) @@ -362,14 +362,14 @@ func request_CinemaOrdersServiceV1_CancelReservation_0(ctx context.Context, mars _ = err ) - val, ok = pathParams["reserveId"] + val, ok = pathParams["reserveID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reserveId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reserveID") } - protoReq.ReserveId, err = runtime.String(val) + protoReq.ReserveID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reserveId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reserveID", err) } msg, err := client.CancelReservation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -396,14 +396,14 @@ func local_request_CinemaOrdersServiceV1_CancelReservation_0(ctx context.Context _ = err ) - val, ok = pathParams["reserveId"] + val, ok = pathParams["reserveID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reserveId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reserveID") } - protoReq.ReserveId, err = runtime.String(val) + protoReq.ReserveID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reserveId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reserveID", err) } msg, err := server.CancelReservation(ctx, &protoReq) @@ -430,14 +430,14 @@ func request_CinemaOrdersServiceV1_ProcessOrder_0(ctx context.Context, marshaler _ = err ) - val, ok = pathParams["reserveId"] + val, ok = pathParams["reserveID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reserveId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reserveID") } - protoReq.ReserveId, err = runtime.String(val) + protoReq.ReserveID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reserveId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reserveID", err) } msg, err := client.ProcessOrder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -464,14 +464,14 @@ func local_request_CinemaOrdersServiceV1_ProcessOrder_0(ctx context.Context, mar _ = err ) - val, ok = pathParams["reserveId"] + val, ok = pathParams["reserveID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reserveId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reserveID") } - protoReq.ReserveId, err = runtime.String(val) + protoReq.ReserveID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reserveId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reserveID", err) } msg, err := server.ProcessOrder(ctx, &protoReq) @@ -518,7 +518,7 @@ func RegisterCinemaOrdersServiceV1HandlerServer(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/GetOrder", runtime.WithHTTPPathPattern("/v1/order/{orderId}")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/GetOrder", runtime.WithHTTPPathPattern("/v1/order/{orderID}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -543,7 +543,7 @@ func RegisterCinemaOrdersServiceV1HandlerServer(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/RefundOrder", runtime.WithHTTPPathPattern("/v1/order/{orderId}/refund")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/RefundOrder", runtime.WithHTTPPathPattern("/v1/order/{orderID}/refund")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -568,7 +568,7 @@ func RegisterCinemaOrdersServiceV1HandlerServer(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/GetOccupiedPlaces", runtime.WithHTTPPathPattern("/v1/screening/{screeningId}/occupied-places")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/GetOccupiedPlaces", runtime.WithHTTPPathPattern("/v1/screening/{screeningID}/occupied-places")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -618,7 +618,7 @@ func RegisterCinemaOrdersServiceV1HandlerServer(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/ReservePlaces", runtime.WithHTTPPathPattern("/v1/screening/{screeningId}/reserve")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/ReservePlaces", runtime.WithHTTPPathPattern("/v1/screening/{screeningID}/reserve")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -643,7 +643,7 @@ func RegisterCinemaOrdersServiceV1HandlerServer(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/CancelReservation", runtime.WithHTTPPathPattern("/v1/reservation/{reserveId}/cancel")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/CancelReservation", runtime.WithHTTPPathPattern("/v1/reservation/{reserveID}/cancel")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -668,7 +668,7 @@ func RegisterCinemaOrdersServiceV1HandlerServer(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/ProcessOrder", runtime.WithHTTPPathPattern("/v1/reservation/{reserveId}/process")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/ProcessOrder", runtime.WithHTTPPathPattern("/v1/reservation/{reserveID}/process")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -754,7 +754,7 @@ func RegisterCinemaOrdersServiceV1HandlerClient(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/GetOrder", runtime.WithHTTPPathPattern("/v1/order/{orderId}")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/GetOrder", runtime.WithHTTPPathPattern("/v1/order/{orderID}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -776,7 +776,7 @@ func RegisterCinemaOrdersServiceV1HandlerClient(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/RefundOrder", runtime.WithHTTPPathPattern("/v1/order/{orderId}/refund")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/RefundOrder", runtime.WithHTTPPathPattern("/v1/order/{orderID}/refund")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -798,7 +798,7 @@ func RegisterCinemaOrdersServiceV1HandlerClient(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/GetOccupiedPlaces", runtime.WithHTTPPathPattern("/v1/screening/{screeningId}/occupied-places")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/GetOccupiedPlaces", runtime.WithHTTPPathPattern("/v1/screening/{screeningID}/occupied-places")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -842,7 +842,7 @@ func RegisterCinemaOrdersServiceV1HandlerClient(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/ReservePlaces", runtime.WithHTTPPathPattern("/v1/screening/{screeningId}/reserve")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/ReservePlaces", runtime.WithHTTPPathPattern("/v1/screening/{screeningID}/reserve")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -864,7 +864,7 @@ func RegisterCinemaOrdersServiceV1HandlerClient(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/CancelReservation", runtime.WithHTTPPathPattern("/v1/reservation/{reserveId}/cancel")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/CancelReservation", runtime.WithHTTPPathPattern("/v1/reservation/{reserveID}/cancel")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -886,7 +886,7 @@ func RegisterCinemaOrdersServiceV1HandlerClient(ctx context.Context, mux *runtim inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/ProcessOrder", runtime.WithHTTPPathPattern("/v1/reservation/{reserveId}/process")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/cinema_orders_service.CinemaOrdersServiceV1/ProcessOrder", runtime.WithHTTPPathPattern("/v1/reservation/{reserveID}/process")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -908,19 +908,19 @@ func RegisterCinemaOrdersServiceV1HandlerClient(ctx context.Context, mux *runtim var ( pattern_CinemaOrdersServiceV1_GetOrders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "orders"}, "")) - pattern_CinemaOrdersServiceV1_GetOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "order", "orderId"}, "")) + pattern_CinemaOrdersServiceV1_GetOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "order", "orderID"}, "")) - pattern_CinemaOrdersServiceV1_RefundOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "order", "orderId", "refund"}, "")) + pattern_CinemaOrdersServiceV1_RefundOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "order", "orderID", "refund"}, "")) - pattern_CinemaOrdersServiceV1_GetOccupiedPlaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "screening", "screeningId", "occupied-places"}, "")) + pattern_CinemaOrdersServiceV1_GetOccupiedPlaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "screening", "screeningID", "occupied-places"}, "")) pattern_CinemaOrdersServiceV1_GetScreeningsOccupiedPlacesCounts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "screenings", "occupied-places", "counts"}, "")) - pattern_CinemaOrdersServiceV1_ReservePlaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "screening", "screeningId", "reserve"}, "")) + pattern_CinemaOrdersServiceV1_ReservePlaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "screening", "screeningID", "reserve"}, "")) - pattern_CinemaOrdersServiceV1_CancelReservation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "reservation", "reserveId", "cancel"}, "")) + pattern_CinemaOrdersServiceV1_CancelReservation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "reservation", "reserveID", "cancel"}, "")) - pattern_CinemaOrdersServiceV1_ProcessOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "reservation", "reserveId", "process"}, "")) + pattern_CinemaOrdersServiceV1_ProcessOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "reservation", "reserveID", "process"}, "")) ) var ( diff --git a/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1_messages.pb.go b/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1_messages.pb.go index 497ce0f..43115b7 100644 --- a/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1_messages.pb.go +++ b/pkg/cinema_orders_service/v1/protos/cinema_orders_service_v1_messages.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 +// protoc-gen-go v1.32.0 // protoc v4.25.3 // source: cinema_orders_service_v1_messages.proto @@ -25,7 +25,7 @@ type Status int32 const ( // Awaiting payment, the next status after payment is PAID - // or CANCELLED if the order was not paid within the specified period. + // or CANCELED if the order was not paid within the specified period. Status_PAYMENT_REQUIRED Status = 0 // The order is paid, after use, the status USED. // AFTER the buyer has requested a refund, the status switches to REFUND_AWAITING if the refund is approved @@ -33,8 +33,8 @@ const ( Status_PAID Status = 1 // The order is awaiting a refund, after a successful refund, the order is awarded the REFUNDED status. Status_REFUND_AWAITING Status = 2 - // The order has been cancelled. - Status_CANCELLED Status = 3 + // The order has been canceled. + Status_CANCELED Status = 3 // The order was fully completed, i.e. all the tickets was used and all the service was implemented. // After the buyer has requested a refund, the status switches to REFUND_AWAITING if the refund is approved // or remains USED if the refund request is rejected. @@ -49,7 +49,7 @@ var ( 0: "PAYMENT_REQUIRED", 1: "PAID", 2: "REFUND_AWAITING", - 3: "CANCELLED", + 3: "CANCELED", 4: "USED", 5: "REFUNDED", } @@ -57,7 +57,7 @@ var ( "PAYMENT_REQUIRED": 0, "PAID": 1, "REFUND_AWAITING": 2, - "CANCELLED": 3, + "CANCELED": 3, "USED": 4, "REFUNDED": 5, } @@ -238,7 +238,7 @@ type Ticket struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TicketId string `protobuf:"bytes,1,opt,name=ticketId,json=ticket_id,proto3" json:"ticketId,omitempty"` + TicketID string `protobuf:"bytes,1,opt,name=ticketID,json=ticket_id,proto3" json:"ticketID,omitempty"` Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=cinema_orders_service.Status" json:"status,omitempty"` Price *Price `protobuf:"bytes,3,opt,name=price,proto3" json:"price,omitempty"` Place *Place `protobuf:"bytes,4,opt,name=place,proto3" json:"place,omitempty"` @@ -276,9 +276,9 @@ func (*Ticket) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{2} } -func (x *Ticket) GetTicketId() string { +func (x *Ticket) GetTicketID() string { if x != nil { - return x.TicketId + return x.TicketID } return "" } @@ -429,10 +429,10 @@ type OrderPreview struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OrderId string `protobuf:"bytes,1,opt,name=orderId,json=order_id,proto3" json:"orderId,omitempty"` + OrderID string `protobuf:"bytes,1,opt,name=orderID,json=order_id,proto3" json:"orderID,omitempty"` OrderDate *Timestamp `protobuf:"bytes,2,opt,name=orderDate,json=order_date,proto3" json:"orderDate,omitempty"` TotalPrice *Price `protobuf:"bytes,3,opt,name=totalPrice,json=total_price,proto3" json:"totalPrice,omitempty"` - ScreeningId int64 `protobuf:"varint,4,opt,name=screeningId,json=screening_id,proto3" json:"screeningId,omitempty"` + ScreeningID int64 `protobuf:"varint,4,opt,name=screeningID,json=screening_id,proto3" json:"screeningID,omitempty"` } func (x *OrderPreview) Reset() { @@ -467,9 +467,9 @@ func (*OrderPreview) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{5} } -func (x *OrderPreview) GetOrderId() string { +func (x *OrderPreview) GetOrderID() string { if x != nil { - return x.OrderId + return x.OrderID } return "" } @@ -488,9 +488,9 @@ func (x *OrderPreview) GetTotalPrice() *Price { return nil } -func (x *OrderPreview) GetScreeningId() int64 { +func (x *OrderPreview) GetScreeningID() int64 { if x != nil { - return x.ScreeningId + return x.ScreeningID } return 0 } @@ -547,7 +547,7 @@ type GetOrderRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OrderId string `protobuf:"bytes,1,opt,name=orderId,json=order_id,proto3" json:"orderId,omitempty"` + OrderID string `protobuf:"bytes,1,opt,name=orderID,json=order_id,proto3" json:"orderID,omitempty"` } func (x *GetOrderRequest) Reset() { @@ -582,9 +582,9 @@ func (*GetOrderRequest) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{7} } -func (x *GetOrderRequest) GetOrderId() string { +func (x *GetOrderRequest) GetOrderID() string { if x != nil { - return x.OrderId + return x.OrderID } return "" } @@ -596,7 +596,7 @@ type Order struct { Tickets []*Ticket `protobuf:"bytes,1,rep,name=tickets,proto3" json:"tickets,omitempty"` OrderDate *Timestamp `protobuf:"bytes,2,opt,name=orderDate,json=order_date,proto3" json:"orderDate,omitempty"` - ScreeningId int64 `protobuf:"varint,3,opt,name=screeningId,json=screening_id,proto3" json:"screeningId,omitempty"` + ScreeningID int64 `protobuf:"varint,3,opt,name=screeningID,json=screening_id,proto3" json:"screeningID,omitempty"` } func (x *Order) Reset() { @@ -645,9 +645,9 @@ func (x *Order) GetOrderDate() *Timestamp { return nil } -func (x *Order) GetScreeningId() int64 { +func (x *Order) GetScreeningID() int64 { if x != nil { - return x.ScreeningId + return x.ScreeningID } return 0 } @@ -657,7 +657,7 @@ type ReservePlacesRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScreeningId int64 `protobuf:"varint,1,opt,name=screeningId,json=screening_id,proto3" json:"screeningId,omitempty"` + ScreeningID int64 `protobuf:"varint,1,opt,name=screeningID,json=screening_id,proto3" json:"screeningID,omitempty"` // The number of places must bigger than 0 and less than or equal to 5. Places []*Place `protobuf:"bytes,2,rep,name=places,proto3" json:"places,omitempty"` } @@ -694,9 +694,9 @@ func (*ReservePlacesRequest) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{9} } -func (x *ReservePlacesRequest) GetScreeningId() int64 { +func (x *ReservePlacesRequest) GetScreeningID() int64 { if x != nil { - return x.ScreeningId + return x.ScreeningID } return 0 } @@ -713,7 +713,7 @@ type ReservePlacesResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ReserveId string `protobuf:"bytes,1,opt,name=reserveId,json=reserve_id,proto3" json:"reserveId,omitempty"` + ReserveID string `protobuf:"bytes,1,opt,name=reserveID,json=reserve_id,proto3" json:"reserveID,omitempty"` // The payment time of the order is in minutes, after this time the reserve is canceled. TimeToPay int32 `protobuf:"varint,2,opt,name=timeToPay,json=time_to_pay,proto3" json:"timeToPay,omitempty"` } @@ -750,9 +750,9 @@ func (*ReservePlacesResponse) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{10} } -func (x *ReservePlacesResponse) GetReserveId() string { +func (x *ReservePlacesResponse) GetReserveID() string { if x != nil { - return x.ReserveId + return x.ReserveID } return "" } @@ -769,7 +769,7 @@ type ProcessOrderRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ReserveId string `protobuf:"bytes,1,opt,name=reserveId,json=reserve_id,proto3" json:"reserveId,omitempty"` + ReserveID string `protobuf:"bytes,1,opt,name=reserveID,json=reserve_id,proto3" json:"reserveID,omitempty"` } func (x *ProcessOrderRequest) Reset() { @@ -804,9 +804,9 @@ func (*ProcessOrderRequest) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{11} } -func (x *ProcessOrderRequest) GetReserveId() string { +func (x *ProcessOrderRequest) GetReserveID() string { if x != nil { - return x.ReserveId + return x.ReserveID } return "" } @@ -817,7 +817,7 @@ type GetScreeningsOccupiedPlacesCountsRequest struct { unknownFields protoimpl.UnknownFields // for multiple values use ',' separator - ScreeningsIds string `protobuf:"bytes,1,opt,name=screeningsIds,json=screenings_ids,proto3" json:"screeningsIds,omitempty"` + ScreeningsIDs string `protobuf:"bytes,1,opt,name=screeningsIDs,json=screenings_ids,proto3" json:"screeningsIDs,omitempty"` } func (x *GetScreeningsOccupiedPlacesCountsRequest) Reset() { @@ -852,9 +852,9 @@ func (*GetScreeningsOccupiedPlacesCountsRequest) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{12} } -func (x *GetScreeningsOccupiedPlacesCountsRequest) GetScreeningsIds() string { +func (x *GetScreeningsOccupiedPlacesCountsRequest) GetScreeningsIDs() string { if x != nil { - return x.ScreeningsIds + return x.ScreeningsIDs } return "" } @@ -958,7 +958,7 @@ type GetOccupiedPlacesRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ScreeningId int64 `protobuf:"varint,1,opt,name=screeningId,json=screening_id,proto3" json:"screeningId,omitempty"` + ScreeningID int64 `protobuf:"varint,1,opt,name=screeningID,json=screening_id,proto3" json:"screeningID,omitempty"` } func (x *GetOccupiedPlacesRequest) Reset() { @@ -993,9 +993,9 @@ func (*GetOccupiedPlacesRequest) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{15} } -func (x *GetOccupiedPlacesRequest) GetScreeningId() int64 { +func (x *GetOccupiedPlacesRequest) GetScreeningID() int64 { if x != nil { - return x.ScreeningId + return x.ScreeningID } return 0 } @@ -1005,7 +1005,7 @@ type CancelReservationRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ReserveId string `protobuf:"bytes,1,opt,name=reserveId,json=reserve_id,proto3" json:"reserveId,omitempty"` + ReserveID string `protobuf:"bytes,1,opt,name=reserveID,json=reserve_id,proto3" json:"reserveID,omitempty"` } func (x *CancelReservationRequest) Reset() { @@ -1040,9 +1040,9 @@ func (*CancelReservationRequest) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{16} } -func (x *CancelReservationRequest) GetReserveId() string { +func (x *CancelReservationRequest) GetReserveID() string { if x != nil { - return x.ReserveId + return x.ReserveID } return "" } @@ -1154,9 +1154,9 @@ type RefundOrderRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OrderId string `protobuf:"bytes,1,opt,name=orderId,json=order_id,proto3" json:"orderId,omitempty"` + OrderID string `protobuf:"bytes,1,opt,name=orderID,json=order_id,proto3" json:"orderID,omitempty"` // For a full refund, leave this field blank. - ItemsIds []string `protobuf:"bytes,2,rep,name=itemsIds,json=items_ids,proto3" json:"itemsIds,omitempty"` + ItemsIDs []string `protobuf:"bytes,2,rep,name=itemsIDs,json=items_ids,proto3" json:"itemsIDs,omitempty"` } func (x *RefundOrderRequest) Reset() { @@ -1191,16 +1191,16 @@ func (*RefundOrderRequest) Descriptor() ([]byte, []int) { return file_cinema_orders_service_v1_messages_proto_rawDescGZIP(), []int{19} } -func (x *RefundOrderRequest) GetOrderId() string { +func (x *RefundOrderRequest) GetOrderID() string { if x != nil { - return x.OrderId + return x.OrderID } return "" } -func (x *RefundOrderRequest) GetItemsIds() []string { +func (x *RefundOrderRequest) GetItemsIDs() []string { if x != nil { - return x.ItemsIds + return x.ItemsIDs } return nil } @@ -1219,7 +1219,7 @@ var file_cinema_orders_service_v1_messages_proto_rawDesc = []byte{ 0x0a, 0x05, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc4, 0x01, 0x0a, 0x06, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1b, 0x0a, 0x08, 0x74, 0x69, 0x63, 0x6b, - 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x63, 0x6b, + 0x65, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, @@ -1248,7 +1248,7 @@ var file_cinema_orders_service_v1_messages_proto_rawDesc = []byte{ 0x65, 0x2e, 0x53, 0x6f, 0x72, 0x74, 0x48, 0x00, 0x52, 0x04, 0x73, 0x6f, 0x72, 0x74, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x6f, 0x72, 0x74, 0x22, 0xcc, 0x01, 0x0a, 0x0c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x19, 0x0a, 0x07, 0x6f, - 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x72, + 0x72, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x12, 0x3f, 0x0a, 0x09, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x44, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, @@ -1258,7 +1258,7 @@ var file_cinema_orders_service_v1_messages_proto_rawDesc = []byte{ 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, - 0x69, 0x6e, 0x67, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, 0x63, 0x72, + 0x69, 0x6e, 0x67, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x22, 0x4d, 0x0a, 0x0e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x69, @@ -1266,7 +1266,7 @@ var file_cinema_orders_service_v1_messages_proto_rawDesc = []byte{ 0x69, 0x63, 0x65, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x52, 0x06, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x22, 0x2c, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x07, 0x6f, - 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x72, + 0x72, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0xa4, 0x01, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x07, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, @@ -1276,28 +1276,28 @@ var file_cinema_orders_service_v1_messages_proto_rawDesc = []byte{ 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x73, 0x63, - 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x22, 0x6f, 0x0a, 0x14, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0b, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, - 0x6e, 0x67, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, 0x63, 0x72, 0x65, + 0x6e, 0x67, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x12, 0x34, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x22, 0x56, 0x0a, 0x15, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x65, + 0x76, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x50, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x74, 0x6f, 0x5f, 0x70, 0x61, 0x79, 0x22, 0x34, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, - 0x09, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x09, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x69, 0x64, 0x22, 0x51, 0x0a, 0x28, 0x47, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0d, 0x73, 0x63, 0x72, 0x65, - 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x5f, 0x69, 0x64, 0x73, 0x22, 0x94, 0x02, 0x0a, 0x1d, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, @@ -1322,11 +1322,11 @@ var file_cinema_orders_service_v1_messages_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x22, 0x3d, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0b, 0x73, - 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x22, 0x39, 0x0a, 0x18, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x09, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x69, 0x64, 0x22, 0x2d, 0x0a, 0x05, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x6f, 0x77, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, @@ -1336,19 +1336,19 @@ var file_cinema_orders_service_v1_messages_proto_rawDesc = []byte{ 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x73, 0x22, 0x4c, 0x0a, 0x12, 0x52, 0x65, 0x66, 0x75, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, - 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x08, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x5f, 0x69, 0x64, 0x73, 0x2a, 0x64, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x6d, 0x73, 0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x5f, 0x69, 0x64, 0x73, 0x2a, 0x63, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x41, 0x59, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x49, 0x52, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x41, 0x49, 0x44, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x52, 0x45, 0x46, 0x55, 0x4e, 0x44, 0x5f, 0x41, 0x57, 0x41, 0x49, 0x54, - 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, - 0x45, 0x44, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x44, 0x10, 0x04, 0x12, 0x0c, - 0x0a, 0x08, 0x52, 0x45, 0x46, 0x55, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x05, 0x42, 0x21, 0x5a, 0x1f, - 0x63, 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x45, + 0x44, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x44, 0x10, 0x04, 0x12, 0x0c, 0x0a, + 0x08, 0x52, 0x45, 0x46, 0x55, 0x4e, 0x44, 0x45, 0x44, 0x10, 0x05, 0x42, 0x21, 0x5a, 0x1f, 0x63, + 0x69, 0x6e, 0x65, 0x6d, 0x61, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x5f, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/logging/logging.go b/pkg/logging/logging.go index 64f3d60..e4dccc2 100644 --- a/pkg/logging/logging.go +++ b/pkg/logging/logging.go @@ -34,9 +34,11 @@ func GetNullLogger() Logger { l, _ := test.NewNullLogger() return Logger{logrus.NewEntry(l)} } -func (l *Logger) GetLoggerWithField(k string, v interface{}) Logger { - return Logger{l.WithField(k, v)} -} + +const ( + logsDirMode = 0755 + logsFileMode = 0660 +) func NewEntry(mode Mode) { l := logrus.New() @@ -53,38 +55,28 @@ func NewEntry(mode Mode) { switch mode { case Test, ConsoleOutput: - { - l.SetOutput(os.Stdout) - } + l.SetOutput(os.Stdout) case FileAndConsoleOutput: - { - err := os.MkdirAll("logs", 0755) - - if err != nil || os.IsExist(err) { - panic("can't create log dir. no configured logging to files") - } - - logfile, err := os.OpenFile("logs/all_logs.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0660) - if err != nil { - panic(fmt.Sprintf("[Error]: %s", err)) - } - - l.SetOutput(io.MultiWriter(logfile, os.Stdout)) + err := os.MkdirAll("logs", logsFileMode) + if err != nil || os.IsExist(err) { + panic("can't create log dir. no configured logging to files") + } + logfile, err := os.OpenFile("logs/all_logs.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, logsFileMode) + if err != nil { + panic(fmt.Sprintf("[Error]: %s", err)) } + l.SetOutput(io.MultiWriter(logfile, os.Stdout)) case FileOutput: - { - err := os.MkdirAll("logs", 0755) - - if err != nil || os.IsExist(err) { - panic("can't create log dir. no configured logging to files") - } + err := os.MkdirAll("logs", logsDirMode) + if err != nil || os.IsExist(err) { + panic("can't create log dir. no configured logging to files") + } - logfile, err := os.OpenFile("logs/all_logs.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0660) - if err != nil { - panic(fmt.Sprintf("[Error]: %s", err)) - } - l.SetOutput(logfile) + logfile, err := os.OpenFile("logs/all_logs.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, logsFileMode) + if err != nil { + panic(fmt.Sprintf("[Error]: %s", err)) } + l.SetOutput(logfile) } entry = logrus.NewEntry(l) diff --git a/pkg/sliceutils/sliceutils_test.go b/pkg/sliceutils/sliceutils_test.go index 5938f0c..14c5b0b 100644 --- a/pkg/sliceutils/sliceutils_test.go +++ b/pkg/sliceutils/sliceutils_test.go @@ -85,17 +85,23 @@ func genRandomStringSlice(n int32) []string { func BenchmarkUniqueMergeSlices_String100(b *testing.B) { s1 := genRandomStringSlice(50) s2 := genRandomStringSlice(50) + b.StartTimer() sliceutils.UniqueMergeSlices(s1, s2...) + b.StopTimer() } func BenchmarkUniqueMergeSlices_String1000(b *testing.B) { s1 := genRandomStringSlice(500) s2 := genRandomStringSlice(500) + b.StartTimer() sliceutils.UniqueMergeSlices(s1, s2...) + b.StopTimer() } func BenchmarkUniqueMergeSlices_String10000(b *testing.B) { s1 := genRandomStringSlice(5000) s2 := genRandomStringSlice(5000) + b.StartTimer() sliceutils.UniqueMergeSlices(s1, s2...) + b.StopTimer() } func TestUniqueMergeSlices_MyStruct(t *testing.T) { type S struct { diff --git a/proto/cinema_orders_service/v1/cinema_orders_service_v1.proto b/proto/cinema_orders_service/v1/cinema_orders_service_v1.proto index 0464b31..e78c2b9 100644 --- a/proto/cinema_orders_service/v1/cinema_orders_service_v1.proto +++ b/proto/cinema_orders_service/v1/cinema_orders_service_v1.proto @@ -84,7 +84,7 @@ service CinemaOrdersServiceV1 { rpc GetOrder(GetOrderRequest) returns(Order) { option (google.api.http) = { - get: "/v1/order/{orderId}" + get: "/v1/order/{orderID}" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { responses: { @@ -127,7 +127,7 @@ service CinemaOrdersServiceV1 { // if less than 3 days remaining before screening, the order is non-refundable rpc RefundOrder(RefundOrderRequest) returns(google.protobuf.Empty) { option (google.api.http) = { - post: "/v1/order/{orderId}/refund" + post: "/v1/order/{orderID}/refund" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { @@ -188,7 +188,7 @@ service CinemaOrdersServiceV1 { rpc GetOccupiedPlaces(GetOccupiedPlacesRequest) returns(Places) { option (google.api.http) = { - get: "/v1/screening/{screeningId}/occupied-places" + get: "/v1/screening/{screeningID}/occupied-places" }; } @@ -213,7 +213,7 @@ service CinemaOrdersServiceV1 { rpc ReservePlaces(ReservePlacesRequest) returns(ReservePlacesResponse) { option (google.api.http) = { - post: "/v1/screening/{screeningId}/reserve" + post: "/v1/screening/{screeningID}/reserve" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { @@ -255,7 +255,7 @@ service CinemaOrdersServiceV1 { rpc CancelReservation(CancelReservationRequest) returns(google.protobuf.Empty) { option (google.api.http) = { - post: "/v1/reservation/{reserveId}/cancel" + post: "/v1/reservation/{reserveID}/cancel" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { @@ -275,7 +275,7 @@ service CinemaOrdersServiceV1 { rpc ProcessOrder(ProcessOrderRequest) returns(ProcessOrderResponse) { option (google.api.http) = { - post: "/v1/reservation/{reserveId}/process" + post: "/v1/reservation/{reserveID}/process" body: "*" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { diff --git a/proto/cinema_orders_service/v1/cinema_orders_service_v1_messages.proto b/proto/cinema_orders_service/v1/cinema_orders_service_v1_messages.proto index 9e8af62..6ee0fdd 100644 --- a/proto/cinema_orders_service/v1/cinema_orders_service_v1_messages.proto +++ b/proto/cinema_orders_service/v1/cinema_orders_service_v1_messages.proto @@ -12,7 +12,7 @@ message Timestamp { // Status of the order item like ticket enum Status { // Awaiting payment, the next status after payment is PAID - // or CANCELLED if the order was not paid within the specified period. + // or CANCELED if the order was not paid within the specified period. PAYMENT_REQUIRED = 0; // The order is paid, after use, the status USED. @@ -23,8 +23,8 @@ enum Status { // The order is awaiting a refund, after a successful refund, the order is awarded the REFUNDED status. REFUND_AWAITING = 2; - // The order has been cancelled. - CANCELLED = 3; + // The order has been canceled. + CANCELED = 3; // The order was fully completed, i.e. all the tickets was used and all the service was implemented. // After the buyer has requested a refund, the status switches to REFUND_AWAITING if the refund is approved @@ -41,7 +41,7 @@ message Price { } message Ticket { - string ticketId = 1[json_name="ticket_id"]; + string ticketID = 1[json_name="ticket_id"]; Status status = 2; Price price = 3; Place place =4; @@ -65,45 +65,45 @@ message GetOrdersRequest { } message OrderPreview { - string orderId = 1[json_name="order_id"]; + string orderID = 1[json_name="order_id"]; Timestamp orderDate = 2[json_name="order_date"]; Price totalPrice = 3[json_name="total_price"]; - int64 screeningId = 4[json_name="screening_id"]; + int64 screeningID = 4[json_name="screening_id"]; } message OrdersPreviews { repeated OrderPreview orders = 1; } message GetOrderRequest { - string orderId = 1[json_name="order_id"]; + string orderID = 1[json_name="order_id"]; } message Order { repeated Ticket tickets = 1; Timestamp orderDate = 2[json_name="order_date"]; - int64 screeningId=3[json_name="screening_id"]; + int64 screeningID=3[json_name="screening_id"]; } message ReservePlacesRequest { - int64 screeningId = 1[json_name="screening_id"]; + int64 screeningID = 1[json_name="screening_id"]; // The number of places must bigger than 0 and less than or equal to 5. repeated Place places = 2; } message ReservePlacesResponse { - string reserveId = 1[json_name="reserve_id"]; + string reserveID = 1[json_name="reserve_id"]; // The payment time of the order is in minutes, after this time the reserve is canceled. int32 timeToPay = 2[json_name="time_to_pay"]; } message ProcessOrderRequest { - string reserveId = 1[json_name="reserve_id"]; + string reserveID = 1[json_name="reserve_id"]; } message GetScreeningsOccupiedPlacesCountsRequest { // for multiple values use ',' separator - string screeningsIds=1[json_name="screenings_ids"]; + string screeningsIDs=1[json_name="screenings_ids"]; } message ScreeningsOccupiedPlacesCount{ @@ -115,11 +115,11 @@ message ProcessOrderResponse { } message GetOccupiedPlacesRequest { - int64 screeningId= 1[json_name="screening_id"]; + int64 screeningID= 1[json_name="screening_id"]; } message CancelReservationRequest { - string reserveId = 1[json_name="reserve_id"]; + string reserveID = 1[json_name="reserve_id"]; } message Place { @@ -132,7 +132,7 @@ message Places { } message RefundOrderRequest { - string orderId = 1[json_name="order_id"]; + string orderID = 1[json_name="order_id"]; // For a full refund, leave this field blank. - repeated string itemsIds = 2[json_name="items_ids"]; + repeated string itemsIDs = 2[json_name="items_ids"]; } diff --git a/swagger/docs/cinema_orders_service_v1.swagger.json b/swagger/docs/cinema_orders_service_v1.swagger.json index ca36ec8..5a6cf7d 100644 --- a/swagger/docs/cinema_orders_service_v1.swagger.json +++ b/swagger/docs/cinema_orders_service_v1.swagger.json @@ -657,12 +657,12 @@ "PAYMENT_REQUIRED", "PAID", "REFUND_AWAITING", - "CANCELLED", + "CANCELED", "USED", "REFUNDED" ], "default": "PAYMENT_REQUIRED", - "description": "- PAYMENT_REQUIRED: Awaiting payment, the next status after payment is PAID\nor CANCELLED if the order was not paid within the specified period.\n - PAID: The order is paid, after use, the status USED.\nAFTER the buyer has requested a refund, the status switches to REFUND_AWAITING if the refund is approved\nor remains PAID if the refund request is rejected.\n - REFUND_AWAITING: The order is awaiting a refund, after a successful refund, the order is awarded the REFUNDED status.\n - CANCELLED: The order has been cancelled.\n - USED: The order was fully completed, i.e. all the tickets was used and all the service was implemented.\nAfter the buyer has requested a refund, the status switches to REFUND_AWAITING if the refund is approved\nor remains USED if the refund request is rejected.\n - REFUNDED: The funds for the order have been refunded.", + "description": "- PAYMENT_REQUIRED: Awaiting payment, the next status after payment is PAID\nor CANCELED if the order was not paid within the specified period.\n - PAID: The order is paid, after use, the status USED.\nAFTER the buyer has requested a refund, the status switches to REFUND_AWAITING if the refund is approved\nor remains PAID if the refund request is rejected.\n - REFUND_AWAITING: The order is awaiting a refund, after a successful refund, the order is awarded the REFUNDED status.\n - CANCELED: The order has been canceled.\n - USED: The order was fully completed, i.e. all the tickets was used and all the service was implemented.\nAfter the buyer has requested a refund, the status switches to REFUND_AWAITING if the refund is approved\nor remains USED if the refund request is rejected.\n - REFUNDED: The funds for the order have been refunded.", "title": "Status of the order item like ticket" }, "cinema_orders_serviceTicket": {