diff --git a/api/comments/v1/comments.proto b/api/comments/v1/comments.proto index 5d47c3d..0dc1745 100644 --- a/api/comments/v1/comments.proto +++ b/api/comments/v1/comments.proto @@ -1,6 +1,7 @@ syntax = "proto3"; import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; import "validate/validate.proto"; import "google/api/annotations.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; @@ -24,27 +25,28 @@ message Comment { int64 user_id = 2 [(validate.rules).int64 = {gt: 0}]; int64 sku = 3 [(validate.rules).int64 = {gt: 0}]; string text = 4 [(validate.rules).string = {min_len:1, max_len:255}]; - string created_at = 5; // RFC3339 with ms + google.protobuf.Timestamp created_at = 5; } message CreateCommentRequest { - int64 user_id = 1 [(validate.rules).int64 = {gt: 0}]; - int64 sku = 2 [(validate.rules).int64 = {gt: 0}]; - string text = 3 [(validate.rules).string = {min_len:1, max_len:255}]; + int64 user_id = 1 [(validate.rules).int64 = {gt: 0}]; + int64 sku = 2 [(validate.rules).int64 = {gt: 0}]; + string comment = 3 [(validate.rules).string = {min_len:1, max_len:255}]; +} +message CreateCommentResponse { + int64 id = 1; } -message CreateCommentResponse { Comment comment = 1; } message GetCommentRequest { int64 id = 1 [(validate.rules).int64 = {gt:0}]; } message GetCommentResponse { Comment comment = 1; } -message UpdateCommentRequest { - int64 id = 1 [(validate.rules).int64 = {gt:0}]; - int64 user_id = 2 [(validate.rules).int64 = {gt: 0}]; - string text = 3 [(validate.rules).string = {min_len:1, max_len:255}]; +message EditCommentRequest { + int64 user_id = 1 [(validate.rules).int64 = {gt:0}]; + int64 comment_id = 2 [(validate.rules).int64 = {gt: 0}]; + string new_comment = 3 [(validate.rules).string = {min_len:1, max_len:255}]; } -message UpdateCommentResponse { Comment comment = 1; } message ListBySkuRequest { int64 sku = 1 [(validate.rules).int64 = {gt:0}]; @@ -65,35 +67,35 @@ service Comments { } }; - rpc Add(CreateCommentRequest) returns (CreateCommentResponse) { + rpc CommentAdd(CreateCommentRequest) returns (CreateCommentResponse) { option (google.api.http) = { post: "/comment/add" body: "*" }; } - rpc GetById(GetCommentRequest) returns (GetCommentResponse) { + rpc CommentGetByID(GetCommentRequest) returns (GetCommentResponse) { option (google.api.http) = { post: "/comment/get-by-id" body: "*" }; } - rpc Edit(UpdateCommentRequest) returns (UpdateCommentResponse) { + rpc CommentEdit(EditCommentRequest) returns (google.protobuf.Empty) { option (google.api.http) = { post: "/comment/edit" body: "*" }; } - rpc ListBySku(ListBySkuRequest) returns (ListBySkuResponse) { + rpc CommentListBySKU(ListBySkuRequest) returns (ListBySkuResponse) { option (google.api.http) = { post: "/comment/list-by-sku" body: "*" }; } - rpc ListByUser(ListByUserRequest) returns (ListByUserResponse) { + rpc CommentListByUser(ListByUserRequest) returns (ListByUserResponse) { option (google.api.http) = { post: "/comment/list-by-user" body: "*" diff --git a/api/openapiv2/comments/v1/comments.swagger.json b/api/openapiv2/comments/v1/comments.swagger.json index 6db66c9..2af1fa5 100644 --- a/api/openapiv2/comments/v1/comments.swagger.json +++ b/api/openapiv2/comments/v1/comments.swagger.json @@ -27,7 +27,7 @@ "paths": { "/comment/add": { "post": { - "operationId": "Comments_Add", + "operationId": "Comments_CommentAdd", "responses": { "200": { "description": "A successful response.", @@ -59,12 +59,13 @@ }, "/comment/edit": { "post": { - "operationId": "Comments_Edit", + "operationId": "Comments_CommentEdit", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/UpdateCommentResponse" + "type": "object", + "properties": {} } }, "default": { @@ -80,7 +81,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/UpdateCommentRequest" + "$ref": "#/definitions/EditCommentRequest" } } ], @@ -91,7 +92,7 @@ }, "/comment/get-by-id": { "post": { - "operationId": "Comments_GetById", + "operationId": "Comments_CommentGetByID", "responses": { "200": { "description": "A successful response.", @@ -123,7 +124,7 @@ }, "/comment/list-by-sku": { "post": { - "operationId": "Comments_ListBySku", + "operationId": "Comments_CommentListBySKU", "responses": { "200": { "description": "A successful response.", @@ -155,7 +156,7 @@ }, "/comment/list-by-user": { "post": { - "operationId": "Comments_ListByUser", + "operationId": "Comments_CommentListByUser", "responses": { "200": { "description": "A successful response.", @@ -207,7 +208,7 @@ }, "createdAt": { "type": "string", - "title": "RFC3339 with ms" + "format": "date-time" } } }, @@ -222,7 +223,7 @@ "type": "string", "format": "int64" }, - "text": { + "comment": { "type": "string" } } @@ -230,8 +231,25 @@ "CreateCommentResponse": { "type": "object", "properties": { - "comment": { - "$ref": "#/definitions/Comment" + "id": { + "type": "string", + "format": "int64" + } + } + }, + "EditCommentRequest": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "format": "int64" + }, + "commentId": { + "type": "string", + "format": "int64" + }, + "newComment": { + "type": "string" } } }, @@ -294,30 +312,6 @@ } } }, - "UpdateCommentRequest": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "int64" - }, - "userId": { - "type": "string", - "format": "int64" - }, - "text": { - "type": "string" - } - } - }, - "UpdateCommentResponse": { - "type": "object", - "properties": { - "comment": { - "$ref": "#/definitions/Comment" - } - } - }, "protobufAny": { "type": "object", "properties": { diff --git a/comments/Dockerfile b/comments/Dockerfile new file mode 100644 index 0000000..1282c4e --- /dev/null +++ b/comments/Dockerfile @@ -0,0 +1,22 @@ +FROM golang:1.23.9-alpine as builder + +WORKDIR /build + +COPY comments/go.mod go.mod +COPY comments/go.sum go.sum + +RUN go mod download + +COPY . . + +WORKDIR comments + +RUN CGO_ENABLED=0 GOOS=linux go build -o /server ./cmd/server/main.go + +FROM scratch +COPY --from=builder server /bin/server +COPY comments/configs/values_local.yaml /bin/config/values_local.yaml + +ENV CONFIG_FILE=/bin/config/values_local.yaml + +ENTRYPOINT ["/bin/server"] diff --git a/comments/Makefile b/comments/Makefile index f661621..e288495 100644 --- a/comments/Makefile +++ b/comments/Makefile @@ -5,9 +5,9 @@ MIGRATIONS_FOLDER := ./db/migrations/ LOCAL_DB_NAME := route256 LOCAL_DB_DSN := postgresql://user:password@localhost:5433/route256?sslmode=disable -PROD_USER := loms-user -PROD_PASS := loms-password -PROD_DB := postgres-master +PROD_USER := comments-user +PROD_PASS := comments-password +PROD_DB := postgres-comments-shard PROD_MIGRATIONS := ./comments/db/migrations/ @@ -20,7 +20,8 @@ bindir: # Used for CI run-migrations: - $(GOOSE) -dir $(PROD_MIGRATIONS) postgres "postgresql://$(PROD_USER):$(PROD_PASS)@$(PROD_DB):5432/comments_db?sslmode=disable" up + $(GOOSE) -dir $(PROD_MIGRATIONS) postgres "postgresql://$(PROD_USER)-1:$(PROD_PASS)-1@$(PROD_DB)-1:5432/comments_db?sslmode=disable" up + $(GOOSE) -dir $(PROD_MIGRATIONS) postgres "postgresql://$(PROD_USER)-2:$(PROD_PASS)-2@$(PROD_DB)-2:5432/comments_db?sslmode=disable" up db-create-migration: $(BINDIR)/goose -dir $(MIGRATIONS_FOLDER) create -s $(n) sql diff --git a/comments/cmd/server/main.go b/comments/cmd/server/main.go new file mode 100644 index 0000000..0962cc1 --- /dev/null +++ b/comments/cmd/server/main.go @@ -0,0 +1,42 @@ +package main + +import ( + "context" + "net/http" + "os" + "os/signal" + "syscall" + "time" + + "github.com/rs/zerolog/log" + + "route256/comments/internal/app" +) + +func main() { + srv, err := app.NewApp(os.Getenv("CONFIG_FILE")) + if err != nil { + log.Fatal().Err(err).Msg("failed creating app") + } + + ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) + defer stop() + + go func() { + if err := srv.ListenAndServe(ctx); err != nil && err != http.ErrServerClosed { + log.Fatal().Err(err).Msg("serving error") + } + }() + + <-ctx.Done() + log.Info().Msg("shutdown signal received") + + shutdownCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + + if err := srv.Shutdown(shutdownCtx); err != nil { + log.Error().Err(err).Msg("graceful shutdown failed") + } else { + log.Info().Msg("server stopped gracefully") + } +} diff --git a/comments/db/migrations/00001_create_comments.sql b/comments/db/migrations/00001_create_comments.sql index ba74046..5113b4a 100644 --- a/comments/db/migrations/00001_create_comments.sql +++ b/comments/db/migrations/00001_create_comments.sql @@ -1,3 +1,4 @@ +-- +goose Up CREATE TABLE comments ( id BIGSERIAL PRIMARY KEY, user_id BIGINT NOT NULL, @@ -6,5 +7,10 @@ CREATE TABLE comments ( created_at TIMESTAMP(3) NOT NULL DEFAULT now() ); -CREATE INDEX ON comments(sku, created_at DESC, user_id ASC); -CREATE INDEX ON comments(user_id, created_at DESC); +CREATE INDEX sku_idx ON comments(sku, created_at DESC, user_id ASC); +CREATE INDEX user_id_idx ON comments(user_id, created_at DESC); + +-- +goose Down +DROP TABLE comments; +DROP INDEX sku_idx; +DROP INDEX user_id_idx; \ No newline at end of file diff --git a/comments/go.mod b/comments/go.mod index 36d7edb..ed62fd2 100644 --- a/comments/go.mod +++ b/comments/go.mod @@ -2,15 +2,29 @@ module route256/comments go 1.23.1 -require github.com/go-playground/validator/v10 v10.27.0 +require ( + github.com/go-playground/validator/v10 v10.27.0 + github.com/jackc/pgx/v5 v5.7.5 + github.com/opentracing/opentracing-go v1.2.0 + github.com/rs/zerolog v1.34.0 + google.golang.org/grpc v1.74.2 + google.golang.org/protobuf v1.36.6 +) require ( github.com/gabriel-vasile/mimetype v1.4.8 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/leodido/go-urn v1.4.0 // indirect - golang.org/x/crypto v0.33.0 // indirect - golang.org/x/net v0.34.0 // indirect - golang.org/x/sys v0.30.0 // indirect - golang.org/x/text v0.22.0 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + golang.org/x/crypto v0.38.0 // indirect + golang.org/x/net v0.40.0 // indirect + golang.org/x/sync v0.14.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/text v0.25.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect ) diff --git a/comments/go.sum b/comments/go.sum index 21426e3..31bf112 100644 --- a/comments/go.sum +++ b/comments/go.sum @@ -1,3 +1,5 @@ +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= @@ -10,19 +12,57 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4= github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.7.5 h1:JHGfMnQY+IEtGM63d+NGMjoRpysB2JBwDr5fsngwmJs= +github.com/jackc/pgx/v5 v5.7.5/go.mod h1:aruU7o91Tc2q2cFp5h4uP3f6ztExVpyVv88Xl/8Vl8M= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= +github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= +github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= -golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= -golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= -golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= -golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a h1:v2PbRU4K3llS09c7zodFpNePeamkAwG3mPrAery9VeE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4= +google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comments/infra/config/config.go b/comments/infra/config/config.go new file mode 100644 index 0000000..12d3393 --- /dev/null +++ b/comments/infra/config/config.go @@ -0,0 +1,59 @@ +package config + +import ( + "fmt" + "os" + "path/filepath" + "strings" + "time" + + "gopkg.in/yaml.v3" +) + +type Config struct { + App struct { + EditInterval time.Duration `yaml:"edit_interval"` + } + + Service struct { + Host string `yaml:"host"` + GRPCPort string `yaml:"grpc_port"` + HTTPPort string `yaml:"http_port"` + LogLevel string `yaml:"log_level"` + } `yaml:"service"` + + DbShards []struct { + Host string `yaml:"host"` + Port string `yaml:"port"` + User string `yaml:"user"` + Password string `yaml:"password"` + DBName string `yaml:"db_name"` + } `yaml:"db_shards"` +} + +func LoadConfig(filename string) (*Config, error) { + workDir, err := os.Getwd() + if err != nil { + return nil, err + } + cfgRoot := filepath.Join(workDir, "configs") + absCfgRoot, _ := filepath.Abs(cfgRoot) + + filePath := filepath.Join(absCfgRoot, filepath.Clean(filename)) + if !strings.HasPrefix(filePath, absCfgRoot) { + return nil, fmt.Errorf("invalid path") + } + + f, err := os.Open(filename) + if err != nil { + return nil, err + } + defer f.Close() + + config := &Config{} + if err := yaml.NewDecoder(f).Decode(config); err != nil { + return nil, err + } + + return config, nil +} diff --git a/comments/infra/db/postgres/postgres.go b/comments/infra/db/postgres/postgres.go new file mode 100644 index 0000000..3ed73b5 --- /dev/null +++ b/comments/infra/db/postgres/postgres.go @@ -0,0 +1,40 @@ +package postgres + +import ( + "context" + + "github.com/jackc/pgx/v5/pgxpool" + "github.com/pkg/errors" +) + +func NewPools(ctx context.Context, DSNs ...string) ([]*pgxpool.Pool, error) { + pools := make([]*pgxpool.Pool, len(DSNs)) + + for i, dsn := range DSNs { + cfg, err := pgxpool.ParseConfig(dsn) + if err != nil { + closeOpened(pools[:i]) + + return nil, errors.Wrap(err, "pgxpool.ParseConfig") + } + + pool, err := pgxpool.NewWithConfig(ctx, cfg) + if err != nil { + closeOpened(pools[:i]) + + return nil, errors.Wrap(err, "pgxpool.NewWithConfig") + } + + pools[i] = pool + } + + return pools, nil +} + +func closeOpened(pools []*pgxpool.Pool) { + for _, p := range pools { + if p != nil { + p.Close() + } + } +} diff --git a/comments/infra/grpc/middleware/logging.go b/comments/infra/grpc/middleware/logging.go new file mode 100644 index 0000000..23da530 --- /dev/null +++ b/comments/infra/grpc/middleware/logging.go @@ -0,0 +1,24 @@ +package mw + +import ( + "context" + + "github.com/rs/zerolog/log" + "google.golang.org/grpc" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" +) + +func Logging(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { + raw, _ := protojson.Marshal((req).(proto.Message)) + log.Debug().Msgf("request: method: %v, req: %s", info.FullMethod, string(raw)) + + if resp, err = handler(ctx, req); err != nil { + log.Debug().Msgf("response: method: %v, err: %s", info.FullMethod, err.Error()) + return + } + rawResp, _ := protojson.Marshal((resp).(proto.Message)) + log.Debug().Msgf("response: method: %v, resp: %s", info.FullMethod, string(rawResp)) + + return +} diff --git a/comments/infra/grpc/middleware/validate.go b/comments/infra/grpc/middleware/validate.go new file mode 100644 index 0000000..9aad15a --- /dev/null +++ b/comments/infra/grpc/middleware/validate.go @@ -0,0 +1,18 @@ +package mw + +import ( + "context" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func Validate(ctx context.Context, req any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) { + if v, ok := req.(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + } + return handler(ctx, req) +} diff --git a/comments/infra/repository/sqlc/repository.go b/comments/infra/repository/sqlc/repository.go index e6fb2d7..c4266d2 100644 --- a/comments/infra/repository/sqlc/repository.go +++ b/comments/infra/repository/sqlc/repository.go @@ -3,14 +3,13 @@ package sqlc import ( "context" "errors" - "sort" - - "route256/comments/internal/domain/entity" - "route256/comments/internal/domain/model" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgxpool" "github.com/rs/zerolog/log" + + "route256/comments/internal/domain/entity" + "route256/comments/internal/domain/model" ) type commentsRepo struct { @@ -33,12 +32,22 @@ func (r *commentsRepo) pickShard(sku int64) *pgxpool.Pool { return r.shard2 } -func (r *commentsRepo) GetCommentByID(ctx context.Context, id int64) (*Comment, error) { +func mapComment(c *Comment) *entity.Comment { + return &entity.Comment{ + ID: c.ID, + UserID: c.UserID, + SKU: c.Sku, + CreatedAt: c.CreatedAt.Time, + Text: c.Text, + } +} + +func (r *commentsRepo) GetCommentByID(ctx context.Context, id int64) (*entity.Comment, error) { q1 := New(r.shard1) c, err := q1.GetCommentByID(ctx, id) switch { case err == nil: - return c, nil + return mapComment(c), nil case errors.Is(err, pgx.ErrNoRows): log.Trace().Msgf("comment with id %d not found in shard 1", id) default: @@ -49,7 +58,7 @@ func (r *commentsRepo) GetCommentByID(ctx context.Context, id int64) (*Comment, c2, err2 := q2.GetCommentByID(ctx, id) switch { case err2 == nil: - return c2, nil + return mapComment(c2), nil case errors.Is(err2, pgx.ErrNoRows): return nil, model.ErrCommentNotFound default: @@ -57,7 +66,7 @@ func (r *commentsRepo) GetCommentByID(ctx context.Context, id int64) (*Comment, } } -func (r *commentsRepo) InsertComment(ctx context.Context, comment *entity.Comment) (*Comment, error) { +func (r *commentsRepo) InsertComment(ctx context.Context, comment *entity.Comment) (*entity.Comment, error) { shard := r.pickShard(comment.SKU) q := New(shard) @@ -72,10 +81,10 @@ func (r *commentsRepo) InsertComment(ctx context.Context, comment *entity.Commen return nil, err } - return c, nil + return mapComment(c), nil } -func (r *commentsRepo) ListCommentsBySku(ctx context.Context, sku int64) ([]*Comment, error) { +func (r *commentsRepo) ListCommentsBySku(ctx context.Context, sku int64) ([]*entity.Comment, error) { shard := r.pickShard(sku) q := New(shard) @@ -84,13 +93,15 @@ func (r *commentsRepo) ListCommentsBySku(ctx context.Context, sku int64) ([]*Com return nil, err } - out := make([]*Comment, len(list)) - copy(out, list) + out := make([]*entity.Comment, 0, len(list)) + for _, com := range list { + out = append(out, mapComment(com)) + } return out, nil } -func (r *commentsRepo) ListCommentsByUser(ctx context.Context, userID int64) ([]*Comment, error) { +func (r *commentsRepo) ListCommentsByUser(ctx context.Context, userID int64) ([]*entity.Comment, error) { q1 := New(r.shard1) l1, err1 := q1.ListCommentsByUser(ctx, userID) if err1 != nil { @@ -103,22 +114,18 @@ func (r *commentsRepo) ListCommentsByUser(ctx context.Context, userID int64) ([] return nil, err2 } - merged := make([]*Comment, 0, len(l1)+len(l2)) - merged = append(merged, l1...) - merged = append(merged, l2...) - - sort.Slice(merged, func(i, j int) bool { - if merged[i].CreatedAt.Time.Equal(merged[j].CreatedAt.Time) { - return merged[i].UserID < merged[j].UserID - } - - return merged[i].CreatedAt.Time.After(merged[j].CreatedAt.Time) - }) + merged := make([]*entity.Comment, 0, len(l1)+len(l2)) + for _, com := range l1 { + merged = append(merged, mapComment(com)) + } + for _, com := range l2 { + merged = append(merged, mapComment(com)) + } return merged, nil } -func (r *commentsRepo) UpdateComment(ctx context.Context, comment *entity.Comment) (*Comment, error) { +func (r *commentsRepo) UpdateComment(ctx context.Context, comment *entity.Comment) (*entity.Comment, error) { req := &UpdateCommentParams{ ID: comment.ID, Text: comment.Text, @@ -128,7 +135,7 @@ func (r *commentsRepo) UpdateComment(ctx context.Context, comment *entity.Commen c, err := q1.UpdateComment(ctx, req) switch { case err == nil: - return c, nil + return mapComment(c), nil case errors.Is(err, pgx.ErrNoRows): log.Trace().Msgf("comment with id %d not found in shard 1", req.ID) default: @@ -139,7 +146,7 @@ func (r *commentsRepo) UpdateComment(ctx context.Context, comment *entity.Commen c2, err2 := q2.UpdateComment(ctx, req) switch { case err2 == nil: - return c2, nil + return mapComment(c2), nil case errors.Is(err2, pgx.ErrNoRows): return nil, model.ErrCommentNotFound default: diff --git a/comments/internal/app/app.go b/comments/internal/app/app.go new file mode 100644 index 0000000..71da95e --- /dev/null +++ b/comments/internal/app/app.go @@ -0,0 +1,190 @@ +package app + +import ( + "context" + "fmt" + "net" + "net/http" + "os" + "route256/comments/infra/config" + "route256/comments/infra/db/postgres" + "route256/comments/internal/app/server" + "route256/comments/internal/domain/service" + "time" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/jackc/pgx/v5/pgxpool" + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/reflection" + + mw "route256/comments/infra/grpc/middleware" + repository "route256/comments/infra/repository/sqlc" + + pb "route256/pkg/api/comments/v1" +) + +type App struct { + config *config.Config + controller *server.Server + + grpcServer *grpc.Server + httpServer *http.Server + gwConn *grpc.ClientConn +} + +func NewApp(configPath string) (*App, error) { + c, err := config.LoadConfig(configPath) + if err != nil { + return nil, fmt.Errorf("unable to load config: %w", err) + } + + log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) + zerolog.SetGlobalLevel(zerolog.InfoLevel) + + if c.Service.LogLevel != "" { + level, logErr := zerolog.ParseLevel(c.Service.LogLevel) + if logErr != nil { + return nil, fmt.Errorf("unknown log level `%s` provided: %w", c.Service.LogLevel, logErr) + } + + zerolog.SetGlobalLevel(level) + } + + log.WithLevel(zerolog.GlobalLevel()).Msgf("using logging level=`%s`", zerolog.GlobalLevel().String()) + + shards, err := getPostgresPools(c) + if err != nil { + return nil, err + } + + repo := repository.NewCommentsRepository(shards[0], shards[1]) + + service := service.NewCommentsService(repo, c.App.EditInterval) + controller := server.NewServer(service) + + app := &App{ + config: c, + controller: controller, + } + + return app, nil +} + +func (app *App) Shutdown(ctx context.Context) (err error) { + if app.httpServer != nil { + err = app.httpServer.Shutdown(ctx) + if err != nil { + log.Error().Err(err).Msgf("failed http gateway server shutdown") + } + } + + done := make(chan struct{}) + if app.grpcServer != nil { + go func() { + app.grpcServer.GracefulStop() + + close(done) + }() + } + + select { + case <-done: + case <-ctx.Done(): + if app.grpcServer != nil { + app.grpcServer.Stop() + } + } + + if app.gwConn != nil { + err2 := app.gwConn.Close() + + if err2 != nil { + err = err2 + + log.Error().Err(err).Msgf("failed gateway connection close") + } + } + + return err +} + +func (app *App) ListenAndServe(ctx context.Context) error { + grpcAddr := fmt.Sprintf("%s:%s", app.config.Service.Host, app.config.Service.GRPCPort) + l, err := net.Listen("tcp", grpcAddr) + if err != nil { + return err + } + + app.grpcServer = grpc.NewServer( + grpc.ChainUnaryInterceptor( + mw.Logging, + mw.Validate, + ), + ) + reflection.Register(app.grpcServer) + + pb.RegisterCommentsServer(app.grpcServer, app.controller) + + go func() { + if err = app.grpcServer.Serve(l); err != nil { + log.Fatal().Err(err).Msg("failed to serve") + } + }() + + log.Info().Msgf("Serving grpc loms at grpc://%s", l.Addr()) + + // Setup HTTP gateway + + conn, err := grpc.NewClient( + grpcAddr, + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + if err != nil { + return fmt.Errorf("grpc.NewClient: %w", err) + } + app.gwConn = conn + + gwmux := runtime.NewServeMux() + if err = pb.RegisterCommentsHandler(ctx, gwmux, conn); err != nil { + return fmt.Errorf("pb.RegisterLOMSHandler: %w", err) + } + + root := http.NewServeMux() + root.Handle("/metrics", promhttp.Handler()) + root.Handle("/", gwmux) + + app.httpServer = &http.Server{ + Addr: fmt.Sprintf("%s:%s", app.config.Service.Host, app.config.Service.HTTPPort), + Handler: root, + ReadTimeout: 10 * time.Second, + } + + log.Info().Msgf("Serving http loms at http://%s", app.httpServer.Addr) + + return app.httpServer.ListenAndServe() +} + +func getPostgresPools(c *config.Config) ([]*pgxpool.Pool, error) { + conns := make([]string, len(c.DbShards)) + for i, shard := range c.DbShards { + conns[i] = fmt.Sprintf( + "postgresql://%s:%s@%s:%s/%s?sslmode=disable", + shard.User, + shard.Password, + shard.Host, + shard.Port, + shard.DBName, + ) + } + + pools, err := postgres.NewPools(context.Background(), conns...) + if err != nil { + return nil, err + } + + return pools, nil +} diff --git a/comments/internal/app/server/server.go b/comments/internal/app/server/server.go new file mode 100644 index 0000000..118d1a8 --- /dev/null +++ b/comments/internal/app/server/server.go @@ -0,0 +1,133 @@ +package server + +import ( + "context" + "errors" + "fmt" + + "route256/comments/internal/domain/entity" + "route256/comments/internal/domain/model" + + pb "route256/pkg/api/comments/v1" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/timestamppb" +) + +var _ pb.CommentsServer = (*Server)(nil) + +type CommentsService interface { + CommentGetByID(ctx context.Context, id int64) (*entity.Comment, error) + CommentCreate(ctx context.Context, comment *entity.Comment) (int64, error) + CommentListBySKU(ctx context.Context, sku int64) ([]*entity.Comment, error) + CommentListByUser(ctx context.Context, userID int64) ([]*entity.Comment, error) + CommentEdit(ctx context.Context, comment *entity.Comment) error +} + +type Server struct { + pb.UnimplementedCommentsServer + + service CommentsService +} + +func NewServer(commentsService CommentsService) *Server { + return &Server{ + service: commentsService, + } +} + +func (s *Server) CommentAdd(ctx context.Context, req *pb.CreateCommentRequest) (*pb.CreateCommentResponse, error) { + id, err := s.service.CommentCreate(ctx, &entity.Comment{ + UserID: req.UserId, + SKU: req.Sku, + Text: req.Comment, + }) + if err != nil { + return nil, fmt.Errorf("service.InsertComment: %w", err) + } + + return &pb.CreateCommentResponse{ + Id: id, + }, nil +} + +func (s *Server) CommentEdit(ctx context.Context, req *pb.EditCommentRequest) (*emptypb.Empty, error) { + err := s.service.CommentEdit(ctx, &entity.Comment{ + ID: req.CommentId, + UserID: req.UserId, + Text: req.NewComment, + }) + switch { + case errors.Is(err, model.ErrCommentEditUserMismatch): + return &emptypb.Empty{}, status.Error(codes.PermissionDenied, err.Error()) + case errors.Is(err, model.ErrCommentEditTimeout): + return &emptypb.Empty{}, status.Error(codes.FailedPrecondition, err.Error()) + case err != nil: + return &emptypb.Empty{}, status.Error(codes.Internal, err.Error()) + } + + return &emptypb.Empty{}, nil +} + +func (s *Server) CommentGetByID(ctx context.Context, req *pb.GetCommentRequest) (*pb.GetCommentResponse, error) { + comm, err := s.service.CommentGetByID(ctx, req.Id) + if err != nil { + return nil, fmt.Errorf("service.GetCommentByID: %w", err) + } + + return &pb.GetCommentResponse{ + Comment: &pb.Comment{ + Id: comm.ID, + UserId: comm.UserID, + Sku: comm.SKU, + Text: comm.Text, + CreatedAt: timestamppb.New(comm.CreatedAt), + }, + }, nil +} + +func (s *Server) CommentListBySKU(ctx context.Context, req *pb.ListBySkuRequest) (*pb.ListBySkuResponse, error) { + comms, err := s.service.CommentListBySKU(ctx, req.Sku) + if err != nil { + return nil, fmt.Errorf("service.ListCommentsBySku: %w", err) + } + + comments := make([]*pb.Comment, len(comms)) + for i, comm := range comms { + comments[i] = &pb.Comment{ + Id: comm.ID, + UserId: comm.UserID, + Sku: comm.SKU, + Text: comm.Text, + CreatedAt: timestamppb.New(comm.CreatedAt), + } + } + + return &pb.ListBySkuResponse{ + Comments: comments, + }, nil +} + +func (s *Server) CommentListByUser(ctx context.Context, req *pb.ListByUserRequest) (*pb.ListByUserResponse, error) { + comms, err := s.service.CommentListByUser(ctx, req.UserId) + if err != nil { + return nil, fmt.Errorf("service.ListCommentsByUser: %w", err) + } + + comments := make([]*pb.Comment, len(comms)) + for i, comm := range comms { + comments[i] = &pb.Comment{ + Id: comm.ID, + UserId: comm.UserID, + Sku: comm.SKU, + Text: comm.Text, + CreatedAt: timestamppb.New(comm.CreatedAt), + } + } + + return &pb.ListByUserResponse{ + Comments: comments, + }, nil +} diff --git a/comments/internal/domain/entity/comment.go b/comments/internal/domain/entity/comment.go index 3928785..caef5aa 100644 --- a/comments/internal/domain/entity/comment.go +++ b/comments/internal/domain/entity/comment.go @@ -1,9 +1,11 @@ package entity +import "time" + type Comment struct { ID int64 UserID int64 SKU int64 - CreatedAt string + CreatedAt time.Time Text string } diff --git a/comments/internal/domain/model/comment.go b/comments/internal/domain/model/comment.go deleted file mode 100644 index f3d9fb6..0000000 --- a/comments/internal/domain/model/comment.go +++ /dev/null @@ -1,22 +0,0 @@ -package model - -import ( - "fmt" - "time" -) - -type Comment struct { - ID int64 `validate:"gt=0"` - UserID int64 `validate:"gt=0"` - SKU int64 `validate:"gt=0"` - CreatedAt time.Time - Text string `validate:"lte=255,gt=0"` -} - -func (c *Comment) Validate() error { - if err := validate.Struct(c); err != nil { - return fmt.Errorf("invalid requested values: %w", err) - } - - return nil -} diff --git a/comments/internal/domain/model/errors.go b/comments/internal/domain/model/errors.go index 682bb65..c67bfe5 100644 --- a/comments/internal/domain/model/errors.go +++ b/comments/internal/domain/model/errors.go @@ -3,3 +3,5 @@ package model import "errors" var ErrCommentNotFound = errors.New("comment not found") +var ErrCommentEditUserMismatch = errors.New("comment edit user mismatch") +var ErrCommentEditTimeout = errors.New("comment edit timeout") diff --git a/comments/internal/domain/model/validate.go b/comments/internal/domain/model/validate.go deleted file mode 100644 index 993e32c..0000000 --- a/comments/internal/domain/model/validate.go +++ /dev/null @@ -1,9 +0,0 @@ -package model - -import "github.com/go-playground/validator/v10" - -var validate *validator.Validate - -func init() { - validate = validator.New() -} diff --git a/comments/internal/domain/service/service.go b/comments/internal/domain/service/service.go index deb6ee1..bf88f01 100644 --- a/comments/internal/domain/service/service.go +++ b/comments/internal/domain/service/service.go @@ -1,3 +1,134 @@ package service -// TODO +import ( + "context" + "fmt" + "sort" + "time" + + "route256/comments/internal/domain/entity" + "route256/comments/internal/domain/model" +) + +type CommentRepository interface { + GetCommentByID(ctx context.Context, id int64) (*entity.Comment, error) + InsertComment(ctx context.Context, comment *entity.Comment) (*entity.Comment, error) + ListCommentsBySku(ctx context.Context, sku int64) ([]*entity.Comment, error) + ListCommentsByUser(ctx context.Context, userID int64) ([]*entity.Comment, error) + UpdateComment(ctx context.Context, comment *entity.Comment) (*entity.Comment, error) +} + +type CommentsService struct { + comments CommentRepository + + timeout time.Duration +} + +func NewCommentsService(commRepo CommentRepository, timeout time.Duration) *CommentsService { + return &CommentsService{ + comments: commRepo, + timeout: timeout, + } +} + +func (s *CommentsService) checkTimeout(newTime, oldTime time.Time) error { + if newTime.Sub(oldTime) >= s.timeout { + return model.ErrCommentEditTimeout + } + + return nil +} + +func (s *CommentsService) CommentCreate(ctx context.Context, comment *entity.Comment) (int64, error) { + comm, err := s.comments.InsertComment(ctx, &entity.Comment{ + UserID: comment.UserID, + SKU: comment.SKU, + CreatedAt: time.Now(), + Text: comment.Text, + }) + if err != nil { + return 0, fmt.Errorf("repository.InsertComment: %w", err) + } + + return comm.ID, nil +} + +func (s *CommentsService) CommentGetByID(ctx context.Context, id int64) (*entity.Comment, error) { + if id <= 0 { + return nil, fmt.Errorf("comment id must be greater than 0") + } + + comm, err := s.comments.GetCommentByID(ctx, id) + if err != nil { + return nil, fmt.Errorf("repository.InsertComment: %w", err) + } + + return comm, nil +} + +func (s *CommentsService) CommentEdit(ctx context.Context, newComment *entity.Comment) error { + if newComment.ID <= 0 { + return fmt.Errorf("comment id must be greater than 0") + } + + oldComment, err := s.comments.GetCommentByID(ctx, newComment.ID) + if err != nil { + return fmt.Errorf("repository.GetCommentByID: %w", err) + } + + if oldComment.UserID != newComment.UserID { + return model.ErrCommentEditUserMismatch + } + + comment := &entity.Comment{ + ID: newComment.ID, + UserID: newComment.UserID, + SKU: newComment.SKU, + CreatedAt: time.Now(), + Text: newComment.Text, + } + + if err := s.checkTimeout(comment.CreatedAt, oldComment.CreatedAt); err != nil { + return err + } + + if _, err := s.comments.UpdateComment(ctx, comment); err != nil { + return fmt.Errorf("repository.UpdateComment: %w", err) + } + + return nil +} + +func (s *CommentsService) CommentListBySKU(ctx context.Context, sku int64) ([]*entity.Comment, error) { + if sku <= 0 { + return nil, fmt.Errorf("sku must be greater than 0") + } + + comms, err := s.comments.ListCommentsBySku(ctx, sku) + if err != nil { + return nil, fmt.Errorf("repository.ListCommentsBySku: %w", err) + } + + return comms, nil +} + +func (s *CommentsService) CommentListByUser(ctx context.Context, userID int64) ([]*entity.Comment, error) { + if userID <= 0 { + return nil, fmt.Errorf("userID must be greater than 0") + } + + comms, err := s.comments.ListCommentsByUser(ctx, userID) + if err != nil { + return nil, fmt.Errorf("repository.ListCommentsByUser: %w", err) + } + + sort.Slice(comms, func(i, j int) bool { + if comms[i].CreatedAt.Equal(comms[j].CreatedAt) { + return comms[i].UserID < comms[j].UserID + } + + return comms[i].CreatedAt.After(comms[j].CreatedAt) + }) + + return comms, nil +} diff --git a/docker-compose.yaml b/docker-compose.yaml index dc1113a..036daf9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,8 @@ volumes: prometheus_data: {} grafana_data: {} + shard1-data: {} + shard2-data: {} services: cart: @@ -41,6 +43,20 @@ services: deploy: replicas: 3 + comments: + build: + context: . + dockerfile: comments/Dockerfile + depends_on: + postgres-comments-shard-1: + condition: service_started + postgres-comments-shard-2: + condition: service_started + ports: + - "8083:8083" + - "8084:8084" + - "8085:8085" + postgres-master: image: gitlab-registry.ozon.dev/go/classroom-18/students/base/postgres:16 container_name: postgres-master diff --git a/go.work.sum b/go.work.sum index dd56d29..0b47c2d 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,5 +1,7 @@ cel.dev/expr v0.23.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= +cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= +cloud.google.com/go/compute/metadata v0.7.0/go.mod h1:j5MvL9PprKL39t166CoB1uVHfQMs4tFQZZcKwksXUjo= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= github.com/ClickHouse/ch-go v0.65.1/go.mod h1:bsodgURwmrkvkBe5jw1qnGDgyITsYErfONKAHn05nv4= github.com/ClickHouse/clickhouse-go/v2 v2.34.0/go.mod h1:yioSINoRLVZkLyDzdMXPLRIqhDvel8iLBlwh6Iefso8= @@ -9,9 +11,8 @@ github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8V github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs= github.com/elastic/go-sysinfo v1.15.3/go.mod h1:K/cNrqYTDrSoMh2oDkYEMS2+a72GRxMvNP+GC+vRIlo= github.com/elastic/go-windows v1.0.2/go.mod h1:bGcDpBzXgYSqM0Gx3DM4+UxFj300SZLixie9u9ixLM8= @@ -27,6 +28,7 @@ github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -45,13 +47,6 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/paulmach/orb v0.11.1/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= -github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU= -github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= @@ -67,24 +62,30 @@ github.com/ydb-platform/ydb-go-sdk/v3 v3.108.1/go.mod h1:l5sSv153E18VvYcsmr51hok github.com/zeebo/errs v1.4.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= go.opentelemetry.io/contrib/detectors/gcp v1.35.0/go.mod h1:qGWP8/+ILwMRIUf9uIVLloR1uo5ZYAslM4O6OqUi1DA= +go.opentelemetry.io/contrib/detectors/gcp v1.36.0/go.mod h1:IbBN8uAIIx734PTonTPxAxnjc2pQTxWNkwfstZ+6H2k= go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= +go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4= +golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= +golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= diff --git a/make/generate.mk b/make/generate.mk index a83cf3c..87480cc 100644 --- a/make/generate.mk +++ b/make/generate.mk @@ -6,7 +6,6 @@ vendor-proto/google/protobuf: git clone -b main --single-branch -n --depth=1 \ https://github.com/protocolbuffers/protobuf vendor-proto/protobuf &&\ cd vendor-proto/protobuf &&\ - git sparse-checkout set --no-cone src/google/protobuf &&\ git checkout mkdir -p vendor-proto/google mv vendor-proto/protobuf/src/google/protobuf vendor-proto/google @@ -17,7 +16,6 @@ vendor-proto/validate: git clone -b main --single-branch --depth=2 \ https://github.com/bufbuild/protoc-gen-validate vendor-proto/tmp && \ cd vendor-proto/tmp && \ - git sparse-checkout set --no-cone validate &&\ git checkout mkdir -p vendor-proto/validate mv vendor-proto/tmp/validate vendor-proto/ @@ -28,7 +26,6 @@ vendor-proto/google/api: git clone -b master --single-branch -n --depth=1 \ https://github.com/googleapis/googleapis vendor-proto/googleapis && \ cd vendor-proto/googleapis && \ - git sparse-checkout set --no-cone google/api && \ git checkout mkdir -p vendor-proto/google mv vendor-proto/googleapis/google/api vendor-proto/google @@ -39,7 +36,6 @@ vendor-proto/protoc-gen-openapiv2/options: git clone -b main --single-branch -n --depth=1 \ https://github.com/grpc-ecosystem/grpc-gateway vendor-proto/grpc-ecosystem && \ cd vendor-proto/grpc-ecosystem && \ - git sparse-checkout set --no-cone protoc-gen-openapiv2/options && \ git checkout mkdir -p vendor-proto/protoc-gen-openapiv2 mv vendor-proto/grpc-ecosystem/protoc-gen-openapiv2/options vendor-proto/protoc-gen-openapiv2 diff --git a/pkg/api/comments/v1/comments.pb.go b/pkg/api/comments/v1/comments.pb.go index fbf8dc8..b8efada 100644 --- a/pkg/api/comments/v1/comments.pb.go +++ b/pkg/api/comments/v1/comments.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 -// protoc v6.30.0 +// protoc v6.31.1 // source: comments/v1/comments.proto package comments @@ -12,7 +12,8 @@ import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/known/emptypb" + emptypb "google.golang.org/protobuf/types/known/emptypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -29,11 +30,11 @@ type Comment struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - Sku int64 `protobuf:"varint,3,opt,name=sku,proto3" json:"sku,omitempty"` - Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"` - CreatedAt string `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // RFC3339 with ms + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Sku int64 `protobuf:"varint,3,opt,name=sku,proto3" json:"sku,omitempty"` + Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` } func (x *Comment) Reset() { @@ -96,11 +97,11 @@ func (x *Comment) GetText() string { return "" } -func (x *Comment) GetCreatedAt() string { +func (x *Comment) GetCreatedAt() *timestamppb.Timestamp { if x != nil { return x.CreatedAt } - return "" + return nil } type CreateCommentRequest struct { @@ -108,9 +109,9 @@ type CreateCommentRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - Sku int64 `protobuf:"varint,2,opt,name=sku,proto3" json:"sku,omitempty"` - Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` + UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Sku int64 `protobuf:"varint,2,opt,name=sku,proto3" json:"sku,omitempty"` + Comment string `protobuf:"bytes,3,opt,name=comment,proto3" json:"comment,omitempty"` } func (x *CreateCommentRequest) Reset() { @@ -159,9 +160,9 @@ func (x *CreateCommentRequest) GetSku() int64 { return 0 } -func (x *CreateCommentRequest) GetText() string { +func (x *CreateCommentRequest) GetComment() string { if x != nil { - return x.Text + return x.Comment } return "" } @@ -171,7 +172,7 @@ type CreateCommentResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Comment *Comment `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *CreateCommentResponse) Reset() { @@ -206,11 +207,11 @@ func (*CreateCommentResponse) Descriptor() ([]byte, []int) { return file_comments_v1_comments_proto_rawDescGZIP(), []int{2} } -func (x *CreateCommentResponse) GetComment() *Comment { +func (x *CreateCommentResponse) GetId() int64 { if x != nil { - return x.Comment + return x.Id } - return nil + return 0 } type GetCommentRequest struct { @@ -307,18 +308,18 @@ func (x *GetCommentResponse) GetComment() *Comment { return nil } -type UpdateCommentRequest struct { +type EditCommentRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` + UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + CommentId int64 `protobuf:"varint,2,opt,name=comment_id,json=commentId,proto3" json:"comment_id,omitempty"` + NewComment string `protobuf:"bytes,3,opt,name=new_comment,json=newComment,proto3" json:"new_comment,omitempty"` } -func (x *UpdateCommentRequest) Reset() { - *x = UpdateCommentRequest{} +func (x *EditCommentRequest) Reset() { + *x = EditCommentRequest{} if protoimpl.UnsafeEnabled { mi := &file_comments_v1_comments_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -326,13 +327,13 @@ func (x *UpdateCommentRequest) Reset() { } } -func (x *UpdateCommentRequest) String() string { +func (x *EditCommentRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*UpdateCommentRequest) ProtoMessage() {} +func (*EditCommentRequest) ProtoMessage() {} -func (x *UpdateCommentRequest) ProtoReflect() protoreflect.Message { +func (x *EditCommentRequest) ProtoReflect() protoreflect.Message { mi := &file_comments_v1_comments_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -344,79 +345,32 @@ func (x *UpdateCommentRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use UpdateCommentRequest.ProtoReflect.Descriptor instead. -func (*UpdateCommentRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use EditCommentRequest.ProtoReflect.Descriptor instead. +func (*EditCommentRequest) Descriptor() ([]byte, []int) { return file_comments_v1_comments_proto_rawDescGZIP(), []int{5} } -func (x *UpdateCommentRequest) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *UpdateCommentRequest) GetUserId() int64 { +func (x *EditCommentRequest) GetUserId() int64 { if x != nil { return x.UserId } return 0 } -func (x *UpdateCommentRequest) GetText() string { +func (x *EditCommentRequest) GetCommentId() int64 { if x != nil { - return x.Text + return x.CommentId + } + return 0 +} + +func (x *EditCommentRequest) GetNewComment() string { + if x != nil { + return x.NewComment } return "" } -type UpdateCommentResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Comment *Comment `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` -} - -func (x *UpdateCommentResponse) Reset() { - *x = UpdateCommentResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_comments_v1_comments_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateCommentResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateCommentResponse) ProtoMessage() {} - -func (x *UpdateCommentResponse) ProtoReflect() protoreflect.Message { - mi := &file_comments_v1_comments_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateCommentResponse.ProtoReflect.Descriptor instead. -func (*UpdateCommentResponse) Descriptor() ([]byte, []int) { - return file_comments_v1_comments_proto_rawDescGZIP(), []int{6} -} - -func (x *UpdateCommentResponse) GetComment() *Comment { - if x != nil { - return x.Comment - } - return nil -} - type ListBySkuRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -428,7 +382,7 @@ type ListBySkuRequest struct { func (x *ListBySkuRequest) Reset() { *x = ListBySkuRequest{} if protoimpl.UnsafeEnabled { - mi := &file_comments_v1_comments_proto_msgTypes[7] + mi := &file_comments_v1_comments_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -441,7 +395,7 @@ func (x *ListBySkuRequest) String() string { func (*ListBySkuRequest) ProtoMessage() {} func (x *ListBySkuRequest) ProtoReflect() protoreflect.Message { - mi := &file_comments_v1_comments_proto_msgTypes[7] + mi := &file_comments_v1_comments_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -454,7 +408,7 @@ func (x *ListBySkuRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListBySkuRequest.ProtoReflect.Descriptor instead. func (*ListBySkuRequest) Descriptor() ([]byte, []int) { - return file_comments_v1_comments_proto_rawDescGZIP(), []int{7} + return file_comments_v1_comments_proto_rawDescGZIP(), []int{6} } func (x *ListBySkuRequest) GetSku() int64 { @@ -475,7 +429,7 @@ type ListBySkuResponse struct { func (x *ListBySkuResponse) Reset() { *x = ListBySkuResponse{} if protoimpl.UnsafeEnabled { - mi := &file_comments_v1_comments_proto_msgTypes[8] + mi := &file_comments_v1_comments_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -488,7 +442,7 @@ func (x *ListBySkuResponse) String() string { func (*ListBySkuResponse) ProtoMessage() {} func (x *ListBySkuResponse) ProtoReflect() protoreflect.Message { - mi := &file_comments_v1_comments_proto_msgTypes[8] + mi := &file_comments_v1_comments_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -501,7 +455,7 @@ func (x *ListBySkuResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListBySkuResponse.ProtoReflect.Descriptor instead. func (*ListBySkuResponse) Descriptor() ([]byte, []int) { - return file_comments_v1_comments_proto_rawDescGZIP(), []int{8} + return file_comments_v1_comments_proto_rawDescGZIP(), []int{7} } func (x *ListBySkuResponse) GetComments() []*Comment { @@ -522,7 +476,7 @@ type ListByUserRequest struct { func (x *ListByUserRequest) Reset() { *x = ListByUserRequest{} if protoimpl.UnsafeEnabled { - mi := &file_comments_v1_comments_proto_msgTypes[9] + mi := &file_comments_v1_comments_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -535,7 +489,7 @@ func (x *ListByUserRequest) String() string { func (*ListByUserRequest) ProtoMessage() {} func (x *ListByUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_comments_v1_comments_proto_msgTypes[9] + mi := &file_comments_v1_comments_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -548,7 +502,7 @@ func (x *ListByUserRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListByUserRequest.ProtoReflect.Descriptor instead. func (*ListByUserRequest) Descriptor() ([]byte, []int) { - return file_comments_v1_comments_proto_rawDescGZIP(), []int{9} + return file_comments_v1_comments_proto_rawDescGZIP(), []int{8} } func (x *ListByUserRequest) GetUserId() int64 { @@ -569,7 +523,7 @@ type ListByUserResponse struct { func (x *ListByUserResponse) Reset() { *x = ListByUserResponse{} if protoimpl.UnsafeEnabled { - mi := &file_comments_v1_comments_proto_msgTypes[10] + mi := &file_comments_v1_comments_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -582,7 +536,7 @@ func (x *ListByUserResponse) String() string { func (*ListByUserResponse) ProtoMessage() {} func (x *ListByUserResponse) ProtoReflect() protoreflect.Message { - mi := &file_comments_v1_comments_proto_msgTypes[10] + mi := &file_comments_v1_comments_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -595,7 +549,7 @@ func (x *ListByUserResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListByUserResponse.ProtoReflect.Descriptor instead. func (*ListByUserResponse) Descriptor() ([]byte, []int) { - return file_comments_v1_comments_proto_rawDescGZIP(), []int{10} + return file_comments_v1_comments_proto_rawDescGZIP(), []int{9} } func (x *ListByUserResponse) GetComments() []*Comment { @@ -611,111 +565,114 @@ var file_comments_v1_comments_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 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, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, - 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, - 0x6e, 0x61, 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, - 0x22, 0x9e, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, - 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, - 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x03, 0x73, 0x6b, 0x75, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x03, 0x73, - 0x6b, 0x75, 0x12, 0x1e, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0xff, 0x01, 0x52, 0x04, 0x74, 0x65, - 0x78, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, - 0x74, 0x22, 0x73, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, - 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x75, 0x73, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, - 0x02, 0x20, 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x03, 0x73, - 0x6b, 0x75, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, - 0x00, 0x52, 0x03, 0x73, 0x6b, 0x75, 0x12, 0x1e, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, + 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 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, 0x22, 0xba, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, + 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, + 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x03, 0x73, 0x6b, 0x75, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x03, + 0x73, 0x6b, 0x75, 0x12, 0x1e, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0xff, 0x01, 0x52, 0x04, 0x74, + 0x65, 0x78, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x79, + 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, + 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x03, 0x73, 0x6b, 0x75, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x03, + 0x73, 0x6b, 0x75, 0x12, 0x24, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0xff, 0x01, - 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3b, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x22, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x08, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x22, 0x2c, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, - 0x64, 0x22, 0x38, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, - 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, 0x14, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x07, - 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, - 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xfa, 0x42, - 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0xff, 0x01, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3b, - 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, - 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x10, 0x4c, - 0x69, 0x73, 0x74, 0x42, 0x79, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x19, 0x0a, 0x03, 0x73, 0x6b, 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, - 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x03, 0x73, 0x6b, 0x75, 0x22, 0x39, 0x0a, 0x11, 0x4c, 0x69, - 0x73, 0x74, 0x42, 0x79, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x27, 0x0a, 0x15, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, + 0x69, 0x64, 0x22, 0x2c, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x38, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x8b, 0x01, 0x0a, 0x12, 0x45, + 0x64, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x20, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, + 0x72, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, + 0x52, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x0b, 0x6e, + 0x65, 0x77, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x0a, 0xfa, 0x42, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0xff, 0x01, 0x52, 0x0a, 0x6e, 0x65, + 0x77, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, + 0x42, 0x79, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x03, + 0x73, 0x6b, 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, + 0x20, 0x00, 0x52, 0x03, 0x73, 0x6b, 0x75, 0x22, 0x39, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x42, + 0x79, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x08, + 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, + 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x22, 0x35, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, + 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x12, 0x4c, 0x69, 0x73, + 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x63, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x35, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x75, 0x73, - 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, - 0x22, 0x02, 0x20, 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x12, - 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x24, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, - 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x32, 0xde, 0x04, 0x0a, 0x08, 0x43, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x4d, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x15, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x11, 0x22, 0x0c, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x64, - 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x51, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x42, 0x79, 0x49, 0x64, 0x12, - 0x12, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, - 0x22, 0x12, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x65, 0x74, 0x2d, 0x62, - 0x79, 0x2d, 0x69, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x4f, 0x0a, 0x04, 0x45, 0x64, 0x69, 0x74, 0x12, - 0x15, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x32, 0xff, 0x04, 0x0a, 0x08, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x12, 0x54, 0x0a, 0x0a, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, + 0x12, 0x15, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x22, 0x0c, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x2f, 0x61, 0x64, 0x64, 0x3a, 0x01, 0x2a, 0x12, 0x58, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x42, 0x79, 0x49, 0x44, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, + 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, + 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, 0x12, 0x2f, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x65, 0x74, 0x2d, 0x62, 0x79, 0x2d, 0x69, 0x64, 0x3a, + 0x01, 0x2a, 0x12, 0x54, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x64, 0x69, + 0x74, 0x12, 0x13, 0x2e, 0x45, 0x64, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 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, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x22, 0x0d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, - 0x2f, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x53, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, - 0x42, 0x79, 0x53, 0x6b, 0x75, 0x12, 0x11, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x53, 0x6b, - 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, - 0x79, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x6c, - 0x69, 0x73, 0x74, 0x2d, 0x62, 0x79, 0x2d, 0x73, 0x6b, 0x75, 0x3a, 0x01, 0x2a, 0x12, 0x57, 0x0a, - 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x13, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, 0x2f, 0x63, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x2d, 0x62, 0x79, 0x2d, 0x75, - 0x73, 0x65, 0x72, 0x3a, 0x01, 0x2a, 0x1a, 0xb0, 0x01, 0x92, 0x41, 0xac, 0x01, 0x12, 0x0f, 0x43, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x98, - 0x01, 0x0a, 0x20, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f, 0x72, 0x65, - 0x20, 0x61, 0x62, 0x6f, 0x75, 0x74, 0x20, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x12, 0x74, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, - 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x65, 0x78, - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, - 0x61, 0x5f, 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, - 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x6d, 0x5a, 0x25, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x32, 0x35, 0x36, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, - 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x92, 0x41, 0x43, 0x12, 0x19, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x32, 0x05, 0x31, 0x2e, 0x30, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2f, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x5a, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x53, 0x4b, 0x55, 0x12, 0x11, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x42, 0x79, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x12, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x2d, 0x62, 0x79, 0x2d, 0x73, 0x6b, + 0x75, 0x3a, 0x01, 0x2a, 0x12, 0x5e, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x4c, + 0x69, 0x73, 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, 0x2f, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x2d, 0x62, 0x79, 0x2d, 0x75, 0x73, 0x65, + 0x72, 0x3a, 0x01, 0x2a, 0x1a, 0xb0, 0x01, 0x92, 0x41, 0xac, 0x01, 0x12, 0x0f, 0x43, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x98, 0x01, 0x0a, + 0x20, 0x46, 0x69, 0x6e, 0x64, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6d, 0x6f, 0x72, 0x65, 0x20, 0x61, + 0x62, 0x6f, 0x75, 0x74, 0x20, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x12, 0x74, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x65, 0x63, 0x6f, 0x73, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x65, 0x78, 0x61, 0x6d, + 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x70, 0x62, 0x2f, 0x61, 0x5f, + 0x62, 0x69, 0x74, 0x5f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6e, + 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x6d, 0x5a, 0x25, 0x72, 0x6f, 0x75, 0x74, 0x65, + 0x32, 0x35, 0x36, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, + 0x92, 0x41, 0x43, 0x12, 0x19, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x20, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x32, 0x05, 0x31, 0x2e, 0x30, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -730,41 +687,41 @@ func file_comments_v1_comments_proto_rawDescGZIP() []byte { return file_comments_v1_comments_proto_rawDescData } -var file_comments_v1_comments_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_comments_v1_comments_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_comments_v1_comments_proto_goTypes = []interface{}{ (*Comment)(nil), // 0: Comment (*CreateCommentRequest)(nil), // 1: CreateCommentRequest (*CreateCommentResponse)(nil), // 2: CreateCommentResponse (*GetCommentRequest)(nil), // 3: GetCommentRequest (*GetCommentResponse)(nil), // 4: GetCommentResponse - (*UpdateCommentRequest)(nil), // 5: UpdateCommentRequest - (*UpdateCommentResponse)(nil), // 6: UpdateCommentResponse - (*ListBySkuRequest)(nil), // 7: ListBySkuRequest - (*ListBySkuResponse)(nil), // 8: ListBySkuResponse - (*ListByUserRequest)(nil), // 9: ListByUserRequest - (*ListByUserResponse)(nil), // 10: ListByUserResponse + (*EditCommentRequest)(nil), // 5: EditCommentRequest + (*ListBySkuRequest)(nil), // 6: ListBySkuRequest + (*ListBySkuResponse)(nil), // 7: ListBySkuResponse + (*ListByUserRequest)(nil), // 8: ListByUserRequest + (*ListByUserResponse)(nil), // 9: ListByUserResponse + (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 11: google.protobuf.Empty } var file_comments_v1_comments_proto_depIdxs = []int32{ - 0, // 0: CreateCommentResponse.comment:type_name -> Comment + 10, // 0: Comment.created_at:type_name -> google.protobuf.Timestamp 0, // 1: GetCommentResponse.comment:type_name -> Comment - 0, // 2: UpdateCommentResponse.comment:type_name -> Comment - 0, // 3: ListBySkuResponse.comments:type_name -> Comment - 0, // 4: ListByUserResponse.comments:type_name -> Comment - 1, // 5: Comments.Add:input_type -> CreateCommentRequest - 3, // 6: Comments.GetById:input_type -> GetCommentRequest - 5, // 7: Comments.Edit:input_type -> UpdateCommentRequest - 7, // 8: Comments.ListBySku:input_type -> ListBySkuRequest - 9, // 9: Comments.ListByUser:input_type -> ListByUserRequest - 2, // 10: Comments.Add:output_type -> CreateCommentResponse - 4, // 11: Comments.GetById:output_type -> GetCommentResponse - 6, // 12: Comments.Edit:output_type -> UpdateCommentResponse - 8, // 13: Comments.ListBySku:output_type -> ListBySkuResponse - 10, // 14: Comments.ListByUser:output_type -> ListByUserResponse - 10, // [10:15] is the sub-list for method output_type - 5, // [5:10] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 0, // 2: ListBySkuResponse.comments:type_name -> Comment + 0, // 3: ListByUserResponse.comments:type_name -> Comment + 1, // 4: Comments.CommentAdd:input_type -> CreateCommentRequest + 3, // 5: Comments.CommentGetByID:input_type -> GetCommentRequest + 5, // 6: Comments.CommentEdit:input_type -> EditCommentRequest + 6, // 7: Comments.CommentListBySKU:input_type -> ListBySkuRequest + 8, // 8: Comments.CommentListByUser:input_type -> ListByUserRequest + 2, // 9: Comments.CommentAdd:output_type -> CreateCommentResponse + 4, // 10: Comments.CommentGetByID:output_type -> GetCommentResponse + 11, // 11: Comments.CommentEdit:output_type -> google.protobuf.Empty + 7, // 12: Comments.CommentListBySKU:output_type -> ListBySkuResponse + 9, // 13: Comments.CommentListByUser:output_type -> ListByUserResponse + 9, // [9:14] is the sub-list for method output_type + 4, // [4:9] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_comments_v1_comments_proto_init() } @@ -834,7 +791,7 @@ func file_comments_v1_comments_proto_init() { } } file_comments_v1_comments_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateCommentRequest); i { + switch v := v.(*EditCommentRequest); i { case 0: return &v.state case 1: @@ -846,18 +803,6 @@ func file_comments_v1_comments_proto_init() { } } file_comments_v1_comments_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateCommentResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_comments_v1_comments_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListBySkuRequest); i { case 0: return &v.state @@ -869,7 +814,7 @@ func file_comments_v1_comments_proto_init() { return nil } } - file_comments_v1_comments_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_comments_v1_comments_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListBySkuResponse); i { case 0: return &v.state @@ -881,7 +826,7 @@ func file_comments_v1_comments_proto_init() { return nil } } - file_comments_v1_comments_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_comments_v1_comments_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListByUserRequest); i { case 0: return &v.state @@ -893,7 +838,7 @@ func file_comments_v1_comments_proto_init() { return nil } } - file_comments_v1_comments_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_comments_v1_comments_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListByUserResponse); i { case 0: return &v.state @@ -912,7 +857,7 @@ func file_comments_v1_comments_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_comments_v1_comments_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/api/comments/v1/comments.pb.gw.go b/pkg/api/comments/v1/comments.pb.gw.go index 10fb004..7f04090 100644 --- a/pkg/api/comments/v1/comments.pb.gw.go +++ b/pkg/api/comments/v1/comments.pb.gw.go @@ -31,7 +31,7 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join -func request_Comments_Add_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Comments_CommentAdd_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CreateCommentRequest var metadata runtime.ServerMetadata @@ -39,12 +39,12 @@ func request_Comments_Add_0(ctx context.Context, marshaler runtime.Marshaler, cl return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.Add(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CommentAdd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Comments_Add_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Comments_CommentAdd_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CreateCommentRequest var metadata runtime.ServerMetadata @@ -52,12 +52,12 @@ func local_request_Comments_Add_0(ctx context.Context, marshaler runtime.Marshal return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.Add(ctx, &protoReq) + msg, err := server.CommentAdd(ctx, &protoReq) return msg, metadata, err } -func request_Comments_GetById_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Comments_CommentGetByID_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetCommentRequest var metadata runtime.ServerMetadata @@ -65,12 +65,12 @@ func request_Comments_GetById_0(ctx context.Context, marshaler runtime.Marshaler return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetById(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CommentGetByID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Comments_GetById_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Comments_CommentGetByID_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetCommentRequest var metadata runtime.ServerMetadata @@ -78,38 +78,38 @@ func local_request_Comments_GetById_0(ctx context.Context, marshaler runtime.Mar return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetById(ctx, &protoReq) + msg, err := server.CommentGetByID(ctx, &protoReq) return msg, metadata, err } -func request_Comments_Edit_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateCommentRequest +func request_Comments_CommentEdit_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EditCommentRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.Edit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CommentEdit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Comments_Edit_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateCommentRequest +func local_request_Comments_CommentEdit_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq EditCommentRequest var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.Edit(ctx, &protoReq) + msg, err := server.CommentEdit(ctx, &protoReq) return msg, metadata, err } -func request_Comments_ListBySku_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Comments_CommentListBySKU_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ListBySkuRequest var metadata runtime.ServerMetadata @@ -117,12 +117,12 @@ func request_Comments_ListBySku_0(ctx context.Context, marshaler runtime.Marshal return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.ListBySku(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CommentListBySKU(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Comments_ListBySku_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Comments_CommentListBySKU_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ListBySkuRequest var metadata runtime.ServerMetadata @@ -130,12 +130,12 @@ func local_request_Comments_ListBySku_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.ListBySku(ctx, &protoReq) + msg, err := server.CommentListBySKU(ctx, &protoReq) return msg, metadata, err } -func request_Comments_ListByUser_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Comments_CommentListByUser_0(ctx context.Context, marshaler runtime.Marshaler, client CommentsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ListByUserRequest var metadata runtime.ServerMetadata @@ -143,12 +143,12 @@ func request_Comments_ListByUser_0(ctx context.Context, marshaler runtime.Marsha return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.ListByUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.CommentListByUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Comments_ListByUser_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Comments_CommentListByUser_0(ctx context.Context, marshaler runtime.Marshaler, server CommentsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ListByUserRequest var metadata runtime.ServerMetadata @@ -156,7 +156,7 @@ func local_request_Comments_ListByUser_0(ctx context.Context, marshaler runtime. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.ListByUser(ctx, &protoReq) + msg, err := server.CommentListByUser(ctx, &protoReq) return msg, metadata, err } @@ -167,7 +167,7 @@ func local_request_Comments_ListByUser_0(ctx context.Context, marshaler runtime. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCommentsHandlerFromEndpoint instead. func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CommentsServer) error { - mux.Handle("POST", pattern_Comments_Add_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -175,12 +175,12 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/Add", runtime.WithHTTPPathPattern("/comment/add")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/CommentAdd", runtime.WithHTTPPathPattern("/comment/add")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Comments_Add_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Comments_CommentAdd_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -188,11 +188,11 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s return } - forward_Comments_Add_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentAdd_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Comments_GetById_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentGetByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -200,12 +200,12 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/GetById", runtime.WithHTTPPathPattern("/comment/get-by-id")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/CommentGetByID", runtime.WithHTTPPathPattern("/comment/get-by-id")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Comments_GetById_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Comments_CommentGetByID_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -213,11 +213,11 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s return } - forward_Comments_GetById_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentGetByID_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Comments_Edit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentEdit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -225,12 +225,12 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/Edit", runtime.WithHTTPPathPattern("/comment/edit")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/CommentEdit", runtime.WithHTTPPathPattern("/comment/edit")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Comments_Edit_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Comments_CommentEdit_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -238,11 +238,11 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s return } - forward_Comments_Edit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentEdit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Comments_ListBySku_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentListBySKU_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -250,12 +250,12 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/ListBySku", runtime.WithHTTPPathPattern("/comment/list-by-sku")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/CommentListBySKU", runtime.WithHTTPPathPattern("/comment/list-by-sku")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Comments_ListBySku_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Comments_CommentListBySKU_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -263,11 +263,11 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s return } - forward_Comments_ListBySku_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentListBySKU_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Comments_ListByUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentListByUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -275,12 +275,12 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/ListByUser", runtime.WithHTTPPathPattern("/comment/list-by-user")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Comments/CommentListByUser", runtime.WithHTTPPathPattern("/comment/list-by-user")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Comments_ListByUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Comments_CommentListByUser_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -288,7 +288,7 @@ func RegisterCommentsHandlerServer(ctx context.Context, mux *runtime.ServeMux, s return } - forward_Comments_ListByUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentListByUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -333,113 +333,113 @@ func RegisterCommentsHandler(ctx context.Context, mux *runtime.ServeMux, conn *g // "CommentsClient" to call the correct interceptors. func RegisterCommentsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CommentsClient) error { - mux.Handle("POST", pattern_Comments_Add_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentAdd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/Add", runtime.WithHTTPPathPattern("/comment/add")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/CommentAdd", runtime.WithHTTPPathPattern("/comment/add")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Comments_Add_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Comments_CommentAdd_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Comments_Add_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentAdd_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Comments_GetById_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentGetByID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/GetById", runtime.WithHTTPPathPattern("/comment/get-by-id")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/CommentGetByID", runtime.WithHTTPPathPattern("/comment/get-by-id")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Comments_GetById_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Comments_CommentGetByID_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Comments_GetById_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentGetByID_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Comments_Edit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentEdit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/Edit", runtime.WithHTTPPathPattern("/comment/edit")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/CommentEdit", runtime.WithHTTPPathPattern("/comment/edit")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Comments_Edit_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Comments_CommentEdit_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Comments_Edit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentEdit_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Comments_ListBySku_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentListBySKU_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/ListBySku", runtime.WithHTTPPathPattern("/comment/list-by-sku")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/CommentListBySKU", runtime.WithHTTPPathPattern("/comment/list-by-sku")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Comments_ListBySku_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Comments_CommentListBySKU_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Comments_ListBySku_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentListBySKU_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_Comments_ListByUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Comments_CommentListByUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/ListByUser", runtime.WithHTTPPathPattern("/comment/list-by-user")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Comments/CommentListByUser", runtime.WithHTTPPathPattern("/comment/list-by-user")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Comments_ListByUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Comments_CommentListByUser_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Comments_ListByUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Comments_CommentListByUser_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -447,25 +447,25 @@ func RegisterCommentsHandlerClient(ctx context.Context, mux *runtime.ServeMux, c } var ( - pattern_Comments_Add_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "add"}, "")) + pattern_Comments_CommentAdd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "add"}, "")) - pattern_Comments_GetById_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "get-by-id"}, "")) + pattern_Comments_CommentGetByID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "get-by-id"}, "")) - pattern_Comments_Edit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "edit"}, "")) + pattern_Comments_CommentEdit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "edit"}, "")) - pattern_Comments_ListBySku_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "list-by-sku"}, "")) + pattern_Comments_CommentListBySKU_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "list-by-sku"}, "")) - pattern_Comments_ListByUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "list-by-user"}, "")) + pattern_Comments_CommentListByUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"comment", "list-by-user"}, "")) ) var ( - forward_Comments_Add_0 = runtime.ForwardResponseMessage + forward_Comments_CommentAdd_0 = runtime.ForwardResponseMessage - forward_Comments_GetById_0 = runtime.ForwardResponseMessage + forward_Comments_CommentGetByID_0 = runtime.ForwardResponseMessage - forward_Comments_Edit_0 = runtime.ForwardResponseMessage + forward_Comments_CommentEdit_0 = runtime.ForwardResponseMessage - forward_Comments_ListBySku_0 = runtime.ForwardResponseMessage + forward_Comments_CommentListBySKU_0 = runtime.ForwardResponseMessage - forward_Comments_ListByUser_0 = runtime.ForwardResponseMessage + forward_Comments_CommentListByUser_0 = runtime.ForwardResponseMessage ) diff --git a/pkg/api/comments/v1/comments.pb.validate.go b/pkg/api/comments/v1/comments.pb.validate.go index 8c0097c..dd672ec 100644 --- a/pkg/api/comments/v1/comments.pb.validate.go +++ b/pkg/api/comments/v1/comments.pb.validate.go @@ -100,7 +100,34 @@ func (m *Comment) validate(all bool) error { errors = append(errors, err) } - // no validation rules for CreatedAt + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CommentValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CommentValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CommentValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + } + } + } if len(errors) > 0 { return CommentMultiError(errors) @@ -223,9 +250,9 @@ func (m *CreateCommentRequest) validate(all bool) error { errors = append(errors, err) } - if l := utf8.RuneCountInString(m.GetText()); l < 1 || l > 255 { + if l := utf8.RuneCountInString(m.GetComment()); l < 1 || l > 255 { err := CreateCommentRequestValidationError{ - field: "Text", + field: "Comment", reason: "value length must be between 1 and 255 runes, inclusive", } if !all { @@ -336,34 +363,7 @@ func (m *CreateCommentResponse) validate(all bool) error { var errors []error - if all { - switch v := interface{}(m.GetComment()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CreateCommentResponseValidationError{ - field: "Comment", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CreateCommentResponseValidationError{ - field: "Comment", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetComment()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CreateCommentResponseValidationError{ - field: "Comment", - reason: "embedded message failed validation", - cause: err, - } - } - } + // no validation rules for Id if len(errors) > 0 { return CreateCommentResponseMultiError(errors) @@ -689,41 +689,30 @@ var _ interface { ErrorName() string } = GetCommentResponseValidationError{} -// Validate checks the field values on UpdateCommentRequest with the rules +// Validate checks the field values on EditCommentRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpdateCommentRequest) Validate() error { +func (m *EditCommentRequest) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on UpdateCommentRequest with the rules +// ValidateAll checks the field values on EditCommentRequest with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in -// UpdateCommentRequestMultiError, or nil if none found. -func (m *UpdateCommentRequest) ValidateAll() error { +// EditCommentRequestMultiError, or nil if none found. +func (m *EditCommentRequest) ValidateAll() error { return m.validate(true) } -func (m *UpdateCommentRequest) validate(all bool) error { +func (m *EditCommentRequest) validate(all bool) error { if m == nil { return nil } var errors []error - if m.GetId() <= 0 { - err := UpdateCommentRequestValidationError{ - field: "Id", - reason: "value must be greater than 0", - } - if !all { - return err - } - errors = append(errors, err) - } - if m.GetUserId() <= 0 { - err := UpdateCommentRequestValidationError{ + err := EditCommentRequestValidationError{ field: "UserId", reason: "value must be greater than 0", } @@ -733,9 +722,20 @@ func (m *UpdateCommentRequest) validate(all bool) error { errors = append(errors, err) } - if l := utf8.RuneCountInString(m.GetText()); l < 1 || l > 255 { - err := UpdateCommentRequestValidationError{ - field: "Text", + if m.GetCommentId() <= 0 { + err := EditCommentRequestValidationError{ + field: "CommentId", + reason: "value must be greater than 0", + } + if !all { + return err + } + errors = append(errors, err) + } + + if l := utf8.RuneCountInString(m.GetNewComment()); l < 1 || l > 255 { + err := EditCommentRequestValidationError{ + field: "NewComment", reason: "value length must be between 1 and 255 runes, inclusive", } if !all { @@ -745,19 +745,19 @@ func (m *UpdateCommentRequest) validate(all bool) error { } if len(errors) > 0 { - return UpdateCommentRequestMultiError(errors) + return EditCommentRequestMultiError(errors) } return nil } -// UpdateCommentRequestMultiError is an error wrapping multiple validation -// errors returned by UpdateCommentRequest.ValidateAll() if the designated -// constraints aren't met. -type UpdateCommentRequestMultiError []error +// EditCommentRequestMultiError is an error wrapping multiple validation errors +// returned by EditCommentRequest.ValidateAll() if the designated constraints +// aren't met. +type EditCommentRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m UpdateCommentRequestMultiError) Error() string { +func (m EditCommentRequestMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) @@ -766,11 +766,11 @@ func (m UpdateCommentRequestMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m UpdateCommentRequestMultiError) AllErrors() []error { return m } +func (m EditCommentRequestMultiError) AllErrors() []error { return m } -// UpdateCommentRequestValidationError is the validation error returned by -// UpdateCommentRequest.Validate if the designated constraints aren't met. -type UpdateCommentRequestValidationError struct { +// EditCommentRequestValidationError is the validation error returned by +// EditCommentRequest.Validate if the designated constraints aren't met. +type EditCommentRequestValidationError struct { field string reason string cause error @@ -778,24 +778,24 @@ type UpdateCommentRequestValidationError struct { } // Field function returns field value. -func (e UpdateCommentRequestValidationError) Field() string { return e.field } +func (e EditCommentRequestValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e UpdateCommentRequestValidationError) Reason() string { return e.reason } +func (e EditCommentRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e UpdateCommentRequestValidationError) Cause() error { return e.cause } +func (e EditCommentRequestValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e UpdateCommentRequestValidationError) Key() bool { return e.key } +func (e EditCommentRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e UpdateCommentRequestValidationError) ErrorName() string { - return "UpdateCommentRequestValidationError" +func (e EditCommentRequestValidationError) ErrorName() string { + return "EditCommentRequestValidationError" } // Error satisfies the builtin error interface -func (e UpdateCommentRequestValidationError) Error() string { +func (e EditCommentRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -807,14 +807,14 @@ func (e UpdateCommentRequestValidationError) Error() string { } return fmt.Sprintf( - "invalid %sUpdateCommentRequest.%s: %s%s", + "invalid %sEditCommentRequest.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = UpdateCommentRequestValidationError{} +var _ error = EditCommentRequestValidationError{} var _ interface { Field() string @@ -822,138 +822,7 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = UpdateCommentRequestValidationError{} - -// Validate checks the field values on UpdateCommentResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *UpdateCommentResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on UpdateCommentResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// UpdateCommentResponseMultiError, or nil if none found. -func (m *UpdateCommentResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *UpdateCommentResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetComment()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, UpdateCommentResponseValidationError{ - field: "Comment", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, UpdateCommentResponseValidationError{ - field: "Comment", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetComment()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return UpdateCommentResponseValidationError{ - field: "Comment", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return UpdateCommentResponseMultiError(errors) - } - - return nil -} - -// UpdateCommentResponseMultiError is an error wrapping multiple validation -// errors returned by UpdateCommentResponse.ValidateAll() if the designated -// constraints aren't met. -type UpdateCommentResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UpdateCommentResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UpdateCommentResponseMultiError) AllErrors() []error { return m } - -// UpdateCommentResponseValidationError is the validation error returned by -// UpdateCommentResponse.Validate if the designated constraints aren't met. -type UpdateCommentResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UpdateCommentResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UpdateCommentResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UpdateCommentResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UpdateCommentResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UpdateCommentResponseValidationError) ErrorName() string { - return "UpdateCommentResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e UpdateCommentResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUpdateCommentResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UpdateCommentResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UpdateCommentResponseValidationError{} +} = EditCommentRequestValidationError{} // Validate checks the field values on ListBySkuRequest with the rules defined // in the proto definition for this message. If any rules are violated, the diff --git a/pkg/api/comments/v1/comments_grpc.pb.go b/pkg/api/comments/v1/comments_grpc.pb.go index 664bb74..246447e 100644 --- a/pkg/api/comments/v1/comments_grpc.pb.go +++ b/pkg/api/comments/v1/comments_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v6.30.0 +// - protoc v6.31.1 // source: comments/v1/comments.proto package comments @@ -11,6 +11,7 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" ) // This is a compile-time assertion to ensure that this generated file @@ -22,11 +23,11 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type CommentsClient interface { - Add(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*CreateCommentResponse, error) - GetById(ctx context.Context, in *GetCommentRequest, opts ...grpc.CallOption) (*GetCommentResponse, error) - Edit(ctx context.Context, in *UpdateCommentRequest, opts ...grpc.CallOption) (*UpdateCommentResponse, error) - ListBySku(ctx context.Context, in *ListBySkuRequest, opts ...grpc.CallOption) (*ListBySkuResponse, error) - ListByUser(ctx context.Context, in *ListByUserRequest, opts ...grpc.CallOption) (*ListByUserResponse, error) + CommentAdd(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*CreateCommentResponse, error) + CommentGetByID(ctx context.Context, in *GetCommentRequest, opts ...grpc.CallOption) (*GetCommentResponse, error) + CommentEdit(ctx context.Context, in *EditCommentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + CommentListBySKU(ctx context.Context, in *ListBySkuRequest, opts ...grpc.CallOption) (*ListBySkuResponse, error) + CommentListByUser(ctx context.Context, in *ListByUserRequest, opts ...grpc.CallOption) (*ListByUserResponse, error) } type commentsClient struct { @@ -37,45 +38,45 @@ func NewCommentsClient(cc grpc.ClientConnInterface) CommentsClient { return &commentsClient{cc} } -func (c *commentsClient) Add(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*CreateCommentResponse, error) { +func (c *commentsClient) CommentAdd(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*CreateCommentResponse, error) { out := new(CreateCommentResponse) - err := c.cc.Invoke(ctx, "/Comments/Add", in, out, opts...) + err := c.cc.Invoke(ctx, "/Comments/CommentAdd", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *commentsClient) GetById(ctx context.Context, in *GetCommentRequest, opts ...grpc.CallOption) (*GetCommentResponse, error) { +func (c *commentsClient) CommentGetByID(ctx context.Context, in *GetCommentRequest, opts ...grpc.CallOption) (*GetCommentResponse, error) { out := new(GetCommentResponse) - err := c.cc.Invoke(ctx, "/Comments/GetById", in, out, opts...) + err := c.cc.Invoke(ctx, "/Comments/CommentGetByID", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *commentsClient) Edit(ctx context.Context, in *UpdateCommentRequest, opts ...grpc.CallOption) (*UpdateCommentResponse, error) { - out := new(UpdateCommentResponse) - err := c.cc.Invoke(ctx, "/Comments/Edit", in, out, opts...) +func (c *commentsClient) CommentEdit(ctx context.Context, in *EditCommentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/Comments/CommentEdit", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *commentsClient) ListBySku(ctx context.Context, in *ListBySkuRequest, opts ...grpc.CallOption) (*ListBySkuResponse, error) { +func (c *commentsClient) CommentListBySKU(ctx context.Context, in *ListBySkuRequest, opts ...grpc.CallOption) (*ListBySkuResponse, error) { out := new(ListBySkuResponse) - err := c.cc.Invoke(ctx, "/Comments/ListBySku", in, out, opts...) + err := c.cc.Invoke(ctx, "/Comments/CommentListBySKU", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *commentsClient) ListByUser(ctx context.Context, in *ListByUserRequest, opts ...grpc.CallOption) (*ListByUserResponse, error) { +func (c *commentsClient) CommentListByUser(ctx context.Context, in *ListByUserRequest, opts ...grpc.CallOption) (*ListByUserResponse, error) { out := new(ListByUserResponse) - err := c.cc.Invoke(ctx, "/Comments/ListByUser", in, out, opts...) + err := c.cc.Invoke(ctx, "/Comments/CommentListByUser", in, out, opts...) if err != nil { return nil, err } @@ -86,11 +87,11 @@ func (c *commentsClient) ListByUser(ctx context.Context, in *ListByUserRequest, // All implementations must embed UnimplementedCommentsServer // for forward compatibility type CommentsServer interface { - Add(context.Context, *CreateCommentRequest) (*CreateCommentResponse, error) - GetById(context.Context, *GetCommentRequest) (*GetCommentResponse, error) - Edit(context.Context, *UpdateCommentRequest) (*UpdateCommentResponse, error) - ListBySku(context.Context, *ListBySkuRequest) (*ListBySkuResponse, error) - ListByUser(context.Context, *ListByUserRequest) (*ListByUserResponse, error) + CommentAdd(context.Context, *CreateCommentRequest) (*CreateCommentResponse, error) + CommentGetByID(context.Context, *GetCommentRequest) (*GetCommentResponse, error) + CommentEdit(context.Context, *EditCommentRequest) (*emptypb.Empty, error) + CommentListBySKU(context.Context, *ListBySkuRequest) (*ListBySkuResponse, error) + CommentListByUser(context.Context, *ListByUserRequest) (*ListByUserResponse, error) mustEmbedUnimplementedCommentsServer() } @@ -98,20 +99,20 @@ type CommentsServer interface { type UnimplementedCommentsServer struct { } -func (UnimplementedCommentsServer) Add(context.Context, *CreateCommentRequest) (*CreateCommentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Add not implemented") +func (UnimplementedCommentsServer) CommentAdd(context.Context, *CreateCommentRequest) (*CreateCommentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CommentAdd not implemented") } -func (UnimplementedCommentsServer) GetById(context.Context, *GetCommentRequest) (*GetCommentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetById not implemented") +func (UnimplementedCommentsServer) CommentGetByID(context.Context, *GetCommentRequest) (*GetCommentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CommentGetByID not implemented") } -func (UnimplementedCommentsServer) Edit(context.Context, *UpdateCommentRequest) (*UpdateCommentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Edit not implemented") +func (UnimplementedCommentsServer) CommentEdit(context.Context, *EditCommentRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method CommentEdit not implemented") } -func (UnimplementedCommentsServer) ListBySku(context.Context, *ListBySkuRequest) (*ListBySkuResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListBySku not implemented") +func (UnimplementedCommentsServer) CommentListBySKU(context.Context, *ListBySkuRequest) (*ListBySkuResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CommentListBySKU not implemented") } -func (UnimplementedCommentsServer) ListByUser(context.Context, *ListByUserRequest) (*ListByUserResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListByUser not implemented") +func (UnimplementedCommentsServer) CommentListByUser(context.Context, *ListByUserRequest) (*ListByUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CommentListByUser not implemented") } func (UnimplementedCommentsServer) mustEmbedUnimplementedCommentsServer() {} @@ -126,92 +127,92 @@ func RegisterCommentsServer(s grpc.ServiceRegistrar, srv CommentsServer) { s.RegisterService(&Comments_ServiceDesc, srv) } -func _Comments_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Comments_CommentAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateCommentRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CommentsServer).Add(ctx, in) + return srv.(CommentsServer).CommentAdd(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Comments/Add", + FullMethod: "/Comments/CommentAdd", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommentsServer).Add(ctx, req.(*CreateCommentRequest)) + return srv.(CommentsServer).CommentAdd(ctx, req.(*CreateCommentRequest)) } return interceptor(ctx, in, info, handler) } -func _Comments_GetById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Comments_CommentGetByID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetCommentRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CommentsServer).GetById(ctx, in) + return srv.(CommentsServer).CommentGetByID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Comments/GetById", + FullMethod: "/Comments/CommentGetByID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommentsServer).GetById(ctx, req.(*GetCommentRequest)) + return srv.(CommentsServer).CommentGetByID(ctx, req.(*GetCommentRequest)) } return interceptor(ctx, in, info, handler) } -func _Comments_Edit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateCommentRequest) +func _Comments_CommentEdit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EditCommentRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CommentsServer).Edit(ctx, in) + return srv.(CommentsServer).CommentEdit(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Comments/Edit", + FullMethod: "/Comments/CommentEdit", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommentsServer).Edit(ctx, req.(*UpdateCommentRequest)) + return srv.(CommentsServer).CommentEdit(ctx, req.(*EditCommentRequest)) } return interceptor(ctx, in, info, handler) } -func _Comments_ListBySku_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Comments_CommentListBySKU_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListBySkuRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CommentsServer).ListBySku(ctx, in) + return srv.(CommentsServer).CommentListBySKU(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Comments/ListBySku", + FullMethod: "/Comments/CommentListBySKU", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommentsServer).ListBySku(ctx, req.(*ListBySkuRequest)) + return srv.(CommentsServer).CommentListBySKU(ctx, req.(*ListBySkuRequest)) } return interceptor(ctx, in, info, handler) } -func _Comments_ListByUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Comments_CommentListByUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListByUserRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CommentsServer).ListByUser(ctx, in) + return srv.(CommentsServer).CommentListByUser(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/Comments/ListByUser", + FullMethod: "/Comments/CommentListByUser", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CommentsServer).ListByUser(ctx, req.(*ListByUserRequest)) + return srv.(CommentsServer).CommentListByUser(ctx, req.(*ListByUserRequest)) } return interceptor(ctx, in, info, handler) } @@ -224,24 +225,24 @@ var Comments_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*CommentsServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "Add", - Handler: _Comments_Add_Handler, + MethodName: "CommentAdd", + Handler: _Comments_CommentAdd_Handler, }, { - MethodName: "GetById", - Handler: _Comments_GetById_Handler, + MethodName: "CommentGetByID", + Handler: _Comments_CommentGetByID_Handler, }, { - MethodName: "Edit", - Handler: _Comments_Edit_Handler, + MethodName: "CommentEdit", + Handler: _Comments_CommentEdit_Handler, }, { - MethodName: "ListBySku", - Handler: _Comments_ListBySku_Handler, + MethodName: "CommentListBySKU", + Handler: _Comments_CommentListBySKU_Handler, }, { - MethodName: "ListByUser", - Handler: _Comments_ListByUser_Handler, + MethodName: "CommentListByUser", + Handler: _Comments_CommentListByUser_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/pkg/api/loms/v1/loms.pb.go b/pkg/api/loms/v1/loms.pb.go index ba164c2..e76db7b 100644 --- a/pkg/api/loms/v1/loms.pb.go +++ b/pkg/api/loms/v1/loms.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 -// protoc v6.30.0 +// protoc v6.31.1 // source: loms/v1/loms.proto package loms diff --git a/pkg/api/loms/v1/loms_grpc.pb.go b/pkg/api/loms/v1/loms_grpc.pb.go index 5ca67d3..0959d22 100644 --- a/pkg/api/loms/v1/loms_grpc.pb.go +++ b/pkg/api/loms/v1/loms_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v6.30.0 +// - protoc v6.31.1 // source: loms/v1/loms.proto package loms