From 4aa5cd6dfc6a8fc6a1ebc53e2ae7debb2442b425 Mon Sep 17 00:00:00 2001 From: Declan Date: Wed, 27 Sep 2023 17:19:25 +0100 Subject: [PATCH] init gateway-service --- services/gateway-service/.env.example | 7 + services/gateway-service/Dockerfile | 16 + services/gateway-service/Makefile | 6 + services/gateway-service/README.md | 33 + .../cmd/gateway-service/main.go | 19 + .../cmd/gateway-service/tools.go | 8 + services/gateway-service/go.mod | 30 + services/gateway-service/go.sum | 51 + services/gateway-service/internal/api/api.go | 41 + .../internal/api/handlers/auth.go | 59 + .../internal/api/handlers/error.go | 55 + .../gateway-service/internal/api/router.go | 66 + .../gateway-service/internal/api/v1/auth.go | 70 + .../internal/api/v1/comment.go | 143 ++ .../gateway-service/internal/api/v1/panel.go | 186 +++ .../gateway-service/internal/api/v1/post.go | 284 ++++ .../gateway-service/internal/api/v1/user.go | 196 +++ services/gateway-service/internal/config.go | 50 + .../internal/rpc/authv1/auth.pb.go | 408 ++++++ .../internal/rpc/authv1/auth_grpc.pb.go | 178 +++ .../internal/rpc/commentv1/comment.pb.go | 794 ++++++++++++ .../internal/rpc/commentv1/comment_grpc.pb.go | 250 ++++ .../internal/rpc/panelv1/panel.pb.go | 861 +++++++++++++ .../internal/rpc/panelv1/panel_grpc.pb.go | 322 +++++ .../internal/rpc/postv1/post.pb.go | 1145 +++++++++++++++++ .../internal/rpc/postv1/post_grpc.pb.go | 358 ++++++ services/gateway-service/internal/rpc/rpc.go | 64 + .../internal/rpc/userv1/user.pb.go | 849 ++++++++++++ .../internal/rpc/userv1/user_grpc.pb.go | 322 +++++ 29 files changed, 6871 insertions(+) create mode 100644 services/gateway-service/.env.example create mode 100644 services/gateway-service/Dockerfile create mode 100644 services/gateway-service/Makefile create mode 100644 services/gateway-service/README.md create mode 100644 services/gateway-service/cmd/gateway-service/main.go create mode 100644 services/gateway-service/cmd/gateway-service/tools.go create mode 100644 services/gateway-service/go.mod create mode 100644 services/gateway-service/go.sum create mode 100644 services/gateway-service/internal/api/api.go create mode 100644 services/gateway-service/internal/api/handlers/auth.go create mode 100644 services/gateway-service/internal/api/handlers/error.go create mode 100644 services/gateway-service/internal/api/router.go create mode 100644 services/gateway-service/internal/api/v1/auth.go create mode 100644 services/gateway-service/internal/api/v1/comment.go create mode 100644 services/gateway-service/internal/api/v1/panel.go create mode 100644 services/gateway-service/internal/api/v1/post.go create mode 100644 services/gateway-service/internal/api/v1/user.go create mode 100644 services/gateway-service/internal/config.go create mode 100644 services/gateway-service/internal/rpc/authv1/auth.pb.go create mode 100644 services/gateway-service/internal/rpc/authv1/auth_grpc.pb.go create mode 100644 services/gateway-service/internal/rpc/commentv1/comment.pb.go create mode 100644 services/gateway-service/internal/rpc/commentv1/comment_grpc.pb.go create mode 100644 services/gateway-service/internal/rpc/panelv1/panel.pb.go create mode 100644 services/gateway-service/internal/rpc/panelv1/panel_grpc.pb.go create mode 100644 services/gateway-service/internal/rpc/postv1/post.pb.go create mode 100644 services/gateway-service/internal/rpc/postv1/post_grpc.pb.go create mode 100644 services/gateway-service/internal/rpc/rpc.go create mode 100644 services/gateway-service/internal/rpc/userv1/user.pb.go create mode 100644 services/gateway-service/internal/rpc/userv1/user_grpc.pb.go diff --git a/services/gateway-service/.env.example b/services/gateway-service/.env.example new file mode 100644 index 0000000..bdbd5b5 --- /dev/null +++ b/services/gateway-service/.env.example @@ -0,0 +1,7 @@ +PANEL_SVC_ADDR=panel-service:9090 +POST_SVC_ADDR=post-service:9090 +USER_SVC_ADDR=user-service:9090 +AUTH_SVC_ADDR=auth-service:9090 +COMMENT_SVC_ADDR=comment-service:9090 + +JWT_PUBLIC_KEY=LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUE3TGhQekc1cmNVMkE1NXFlazRmSwpFN1QwWXlYTFRrRVhqVVh2ZDdmLzdVWTIxQmVsZ0hWVFMyTDcxUW1zL3NPakhFWHdSOGx3dlA5VnhXRFRBMGJ4Cm45cnBYVFYwVXVGRWFtOEpGZTcwTzdaOSs0M1d1ampiYWdNT04vMTVZa3dGOTR4aVpQcllyWjE4TEUyZVZIaUMKZVFtdFczVzhBSzVxWnpydkREd0FkYlRMdm1LRWtEcGVKYTgyQXkwTy9jcW1JUTdDdHU0R1djendSSk1iTTJUbQo1UFkzWUNWZ0V0WE1WY1AwZWVhd2NJQXRZNVdyWXJ0T1VkTUFodFl0RlhYVWlObWliQVI4bFM4TXUyMGp1Rnc5CmJnb2FQUXZSN2FXLzhLL2hwaUdmbXN5V1lmbGpHM0xOYlJCMEpiclU5cTZ6NlcvckQzRlVCQmVDeW9WelA4TjMKU3dJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg== \ No newline at end of file diff --git a/services/gateway-service/Dockerfile b/services/gateway-service/Dockerfile new file mode 100644 index 0000000..67b27a6 --- /dev/null +++ b/services/gateway-service/Dockerfile @@ -0,0 +1,16 @@ +FROM golang:1.20 AS build +WORKDIR /app + +# Install required modules +COPY go.mod go.sum ./ +RUN go mod download + +# Build the service +COPY . . +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/gateway-service ./cmd/gateway-service + +# Runtime environment (for minifying image size) +FROM gcr.io/distroless/static-debian12 +COPY --from=build /bin/gateway-service . +EXPOSE 3000 +CMD ["./gateway-service"] \ No newline at end of file diff --git a/services/gateway-service/Makefile b/services/gateway-service/Makefile new file mode 100644 index 0000000..fc8f289 --- /dev/null +++ b/services/gateway-service/Makefile @@ -0,0 +1,6 @@ +protobufs-compile: + protoc --proto_path=../../protobufs/ --go_out=. --go_opt=Mpanel.proto=./internal/rpc/panelv1 --go-grpc_out=. --go-grpc_opt=Mpanel.proto=./internal/rpc/panelv1 panel.proto + protoc --proto_path=../../protobufs/ --go_out=. --go_opt=Mpost.proto=./internal/rpc/postv1 --go-grpc_out=. --go-grpc_opt=Mpost.proto=./internal/rpc/postv1 post.proto + protoc --proto_path=../../protobufs/ --go_out=. --go_opt=Muser.proto=./internal/rpc/userv1 --go-grpc_out=. --go-grpc_opt=Muser.proto=./internal/rpc/userv1 user.proto + protoc --proto_path=../../protobufs/ --go_out=. --go_opt=Mauth.proto=./internal/rpc/authv1 --go-grpc_out=. --go-grpc_opt=Mauth.proto=./internal/rpc/authv1 auth.proto + protoc --proto_path=../../protobufs/ --go_out=. --go_opt=Mcomment.proto=./internal/rpc/commentv1 --go-grpc_out=. --go-grpc_opt=Mcomment.proto=./internal/rpc/commentv1 comment.proto \ No newline at end of file diff --git a/services/gateway-service/README.md b/services/gateway-service/README.md new file mode 100644 index 0000000..d788aba --- /dev/null +++ b/services/gateway-service/README.md @@ -0,0 +1,33 @@ +# Gateway Service + +## Configuration + +### Environment Variables + +**RPC Service Addresses:** + +``PANEL_SVC_ADDR`` (Required) + +* e.g. "panel-service:9090" + +``POST_SVC_ADDR`` (Required) + +* e.g. "post-service:9090" + +``USER_SVC_ADDR`` (Required) + +* e.g. "user-service:9090" + +``AUTH_SVC_ADDR`` (Required) + +* e.g. "auth-service:9090" + +``COMMENT_SVC_ADDR`` (Required) + +* e.g. "comment-service:9090" + +**Auth:** + +``JWT_PUBLIC_KEY`` (Required) + +* RSA Public Key encoded in base64 (used to verify JWT tokens created by the ``auth-service``) diff --git a/services/gateway-service/cmd/gateway-service/main.go b/services/gateway-service/cmd/gateway-service/main.go new file mode 100644 index 0000000..0cb2ed7 --- /dev/null +++ b/services/gateway-service/cmd/gateway-service/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "github.com/hexolan/panels/gateway-service/internal" + "github.com/hexolan/panels/gateway-service/internal/api" + "github.com/hexolan/panels/gateway-service/internal/rpc" +) + +func main() { + // Load the configuration + cfg := internal.NewConfig() + + // Connect to the RPC services + rpc.DialRPCServices(cfg) + + // Serve the api. + app := api.NewAPIApp(cfg) + api.ServeAPIApp(app) +} \ No newline at end of file diff --git a/services/gateway-service/cmd/gateway-service/tools.go b/services/gateway-service/cmd/gateway-service/tools.go new file mode 100644 index 0000000..47af5e6 --- /dev/null +++ b/services/gateway-service/cmd/gateway-service/tools.go @@ -0,0 +1,8 @@ +//go:build tools +package main + +import ( + // Protobuf Generation + _ "google.golang.org/protobuf/cmd/protoc-gen-go" + _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" +) \ No newline at end of file diff --git a/services/gateway-service/go.mod b/services/gateway-service/go.mod new file mode 100644 index 0000000..a6e770e --- /dev/null +++ b/services/gateway-service/go.mod @@ -0,0 +1,30 @@ +module github.com/hexolan/panels/gateway-service + +go 1.20 + +require ( + github.com/goccy/go-json v0.10.2 + github.com/gofiber/fiber/v2 v2.48.0 + github.com/golang-jwt/jwt/v5 v5.0.0 + google.golang.org/grpc v1.57.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 + google.golang.org/protobuf v1.31.0 +) + +require ( + github.com/andybalholm/brotli v1.0.5 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/klauspost/compress v1.16.3 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasthttp v1.48.0 // indirect + github.com/valyala/tcplisten v1.0.0 // indirect + golang.org/x/net v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect +) diff --git a/services/gateway-service/go.sum b/services/gateway-service/go.sum new file mode 100644 index 0000000..94981c8 --- /dev/null +++ b/services/gateway-service/go.sum @@ -0,0 +1,51 @@ +github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= +github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/gofiber/fiber/v2 v2.48.0 h1:cRVMCb9aUJDsyHxGFLwz/sGzDggdailZZyptU9F9cU0= +github.com/gofiber/fiber/v2 v2.48.0/go.mod h1:xqJgfqrc23FJuqGOW6DVgi3HyZEm2Mn9pRqUb2kHSX8= +github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= +github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= +github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +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/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.48.0 h1:oJWvHb9BIZToTQS3MuQ2R3bJZiNSa2KiNdeI8A+79Tc= +github.com/valyala/fasthttp v1.48.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA= +github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= +github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +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.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/services/gateway-service/internal/api/api.go b/services/gateway-service/internal/api/api.go new file mode 100644 index 0000000..1fe937c --- /dev/null +++ b/services/gateway-service/internal/api/api.go @@ -0,0 +1,41 @@ +package api + +import ( + "fmt" + + "github.com/goccy/go-json" + "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/middleware/cors" + "github.com/gofiber/fiber/v2/middleware/logger" + + "github.com/hexolan/panels/gateway-service/internal" + "github.com/hexolan/panels/gateway-service/internal/api/handlers" +) + +func NewAPIApp(cfg internal.Config) *fiber.App { + app := fiber.New(fiber.Config{ + AppName: "Panels REST Gateway", + ErrorHandler: handlers.ErrorHandler, + + // Swap out the JSON encoder for faster marshaling + JSONEncoder: json.Marshal, + JSONDecoder: json.Unmarshal, + }) + + // Middleware + handlers.NewAuthMiddleware(cfg) + app.Use(cors.New()) + app.Use(logger.New()) + + // Register the routes + RegisterRoutes(app) + + return app +} + +func ServeAPIApp(app *fiber.App) { + err := app.Listen(":3000") + if err != nil { + panic(fmt.Sprintf("failed to serve API: %v", err)) + } +} \ No newline at end of file diff --git a/services/gateway-service/internal/api/handlers/auth.go b/services/gateway-service/internal/api/handlers/auth.go new file mode 100644 index 0000000..eb8e31d --- /dev/null +++ b/services/gateway-service/internal/api/handlers/auth.go @@ -0,0 +1,59 @@ +package handlers + +import ( + "crypto/rsa" + + "github.com/golang-jwt/jwt/v5" + "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/middleware/keyauth" + + "github.com/hexolan/panels/gateway-service/internal" +) + +var AuthMiddleware fiber.Handler + +type TokenClaims struct { + jwt.RegisteredClaims +} + +type tokenValidator struct { + pubKey *rsa.PublicKey +} + +func NewAuthMiddleware(cfg internal.Config) { + tokenValidator := tokenValidator{pubKey: cfg.JWTPubKey} + AuthMiddleware = keyauth.New(keyauth.Config{ + AuthScheme: "Bearer", + Validator: tokenValidator.ValidateToken, + }) +} + +func GetTokenClaims(c *fiber.Ctx) (TokenClaims, error) { + var tokenClaims TokenClaims + tokenClaims, ok := c.Locals("tokenClaims").(TokenClaims) + if !ok { + return TokenClaims{}, fiber.NewError(fiber.StatusUnauthorized, "unable to access token claims") + } + return tokenClaims, nil +} + +func (tv tokenValidator) validateToken(token *jwt.Token) (interface{}, error) { + // Ensure token is signed with RSA + if _, ok := token.Method.(*jwt.SigningMethodRSA); !ok { + return nil, keyauth.ErrMissingOrMalformedAPIKey + } + + // Validate token with public key + return tv.pubKey, nil +} + +func (tv tokenValidator) ValidateToken(c *fiber.Ctx, userToken string) (bool, error) { + claims := TokenClaims{} + _, err := jwt.ParseWithClaims(userToken, &claims, tv.validateToken) + if err != nil { + return false, err + } + + c.Locals("tokenClaims", claims) + return true, nil +} \ No newline at end of file diff --git a/services/gateway-service/internal/api/handlers/error.go b/services/gateway-service/internal/api/handlers/error.go new file mode 100644 index 0000000..c8c7588 --- /dev/null +++ b/services/gateway-service/internal/api/handlers/error.go @@ -0,0 +1,55 @@ +package handlers + +import ( + "errors" + + "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/log" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func ErrorHandler(c *fiber.Ctx, err error) error { + c.Set(fiber.HeaderContentType, fiber.MIMEApplicationJSONCharsetUTF8) + code := fiber.StatusInternalServerError + msg := err.Error() + + // Retrieval of codes from fiber.Errors + var e *fiber.Error + if errors.As(err, &e) { + code = e.Code + } else { + // Retrival of codes from gRPC errors. + status, ok := status.FromError(err) + if ok { + msg = status.Message() + + switch status.Code() { + case codes.NotFound: + code = fiber.StatusNotFound + case codes.InvalidArgument: + code = fiber.StatusUnprocessableEntity + case codes.AlreadyExists: + code = fiber.StatusConflict + case codes.PermissionDenied: + code = fiber.StatusForbidden + case codes.Unauthenticated: + code = fiber.StatusUnauthorized + case codes.Internal: + code = fiber.StatusInternalServerError + case codes.Unavailable: + code = fiber.StatusBadGateway + msg = "Service unavaliable for request." + default: + code = fiber.StatusInternalServerError + msg = "Something went wrong." + log.Error(err) + } + } else { + msg = "Something unexpected went wrong." + log.Error(err) + } + } + + return c.Status(code).JSON(fiber.Map{"status": "failure", "msg": msg}) +} \ No newline at end of file diff --git a/services/gateway-service/internal/api/router.go b/services/gateway-service/internal/api/router.go new file mode 100644 index 0000000..0be3c35 --- /dev/null +++ b/services/gateway-service/internal/api/router.go @@ -0,0 +1,66 @@ +package api + +import ( + "github.com/gofiber/fiber/v2" + + "github.com/hexolan/panels/gateway-service/internal/api/v1" + "github.com/hexolan/panels/gateway-service/internal/api/handlers" +) + +func RegisterRoutes(app *fiber.App) { + apiV1 := app.Group("/v1") + panelV1 := apiV1.Group("/panels") + postV1 := apiV1.Group("/posts") + userV1 := apiV1.Group("/users") + authV1 := apiV1.Group("/auth") + commentV1 := postV1.Group("/:post_id/comments") + + // Panel Service Routes + panelV1.Post("/", handlers.AuthMiddleware, v1.CreatePanel) + + panelV1.Get("/id/:id", v1.GetPanelById) + panelV1.Patch("/id/:id", handlers.AuthMiddleware, v1.UpdatePanelById) + panelV1.Delete("/id/:id", handlers.AuthMiddleware, v1.DeletePanelById) + + panelV1.Get("/name/:name", v1.GetPanelByName) + panelV1.Patch("/name/:name", handlers.AuthMiddleware, v1.UpdatePanelByName) + panelV1.Delete("/name/:name", handlers.AuthMiddleware, v1.DeletePanelByName) + + // Post Service Routes + postV1.Get("/feed", v1.GetFeedPosts) + postV1.Patch("/:id", handlers.AuthMiddleware, v1.UpdatePost) + postV1.Delete("/:id", handlers.AuthMiddleware, v1.DeletePost) + + userV1.Get("/id/:user_id/posts", v1.GetUserPostsFromId) + userV1.Get("/username/:username/posts", v1.GetUserPostsFromUsername) + + panelV1.Get("/id/:panel_id/posts", v1.GetPanelPostsFromId) + panelV1.Get("/name/:panel_name/posts", v1.GetPanelPostsFromName) + + panelV1.Get("/id/:panel_id/posts/:id", v1.GetPanelPostFromId) + panelV1.Get("/name/:panel_name/posts/:id", v1.GetPanelPostFromName) + + panelV1.Post("/id/:panel_id", handlers.AuthMiddleware, v1.CreatePanelPostFromId) + panelV1.Post("/name/:panel_name", handlers.AuthMiddleware, v1.CreatePanelPostFromName) + + // User Service Routes + userV1.Post("/", v1.UserSignup) + + userV1.Get("/id/:id", v1.GetUserById) + userV1.Delete("/id/:id", handlers.AuthMiddleware, v1.DeleteUserById) + + userV1.Get("/username/:username", v1.GetUserByUsername) + userV1.Delete("/username/:username", handlers.AuthMiddleware, v1.DeleteUserByUsername) + + userV1.Get("/me", handlers.AuthMiddleware, v1.GetCurrentUser) + userV1.Delete("/me", handlers.AuthMiddleware, v1.DeleteCurrentUser) + + // Auth Service Routes + authV1.Post("/login", v1.LoginWithPassword) + + // Comment Service Routes + commentV1.Get("/", v1.GetPostComments) + commentV1.Post("/", handlers.AuthMiddleware, v1.CreateComment) + commentV1.Patch("/:id", handlers.AuthMiddleware, v1.UpdateComment) + commentV1.Delete("/:id", handlers.AuthMiddleware, v1.DeleteComment) +} \ No newline at end of file diff --git a/services/gateway-service/internal/api/v1/auth.go b/services/gateway-service/internal/api/v1/auth.go new file mode 100644 index 0000000..afbdd87 --- /dev/null +++ b/services/gateway-service/internal/api/v1/auth.go @@ -0,0 +1,70 @@ +package v1 + +import ( + "time" + "context" + + "github.com/gofiber/fiber/v2" + + "github.com/hexolan/panels/gateway-service/internal/rpc" + "github.com/hexolan/panels/gateway-service/internal/rpc/authv1" +) + +type userLoginForm struct { + Username string + Password string +} + +func setAuthMethod(userId string, password string) error { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + _, err := rpc.Svcs.GetAuthSvc().SetPasswordAuth( + ctx, + &authv1.SetPasswordAuthMethod{ + UserId: userId, + Password: password, + }, + ) + return err +} + +func authWithPassword(userId string, password string) (*authv1.AuthToken, error) { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + token, err := rpc.Svcs.GetAuthSvc().AuthWithPassword( + ctx, + &authv1.PasswordAuthRequest{ + UserId: userId, + Password: password, + }, + ) + return token, err +} + +func LoginWithPassword(c *fiber.Ctx) error { + // Parse the body data + form := new(userLoginForm) + if err := c.BodyParser(form); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + // username -> user ID + user, err := getUserByUsername(form.Username) + if err != nil { + return err + } + + // attempt to auth + token, err := authWithPassword(user.Id, form.Password) + if err != nil { + return err + } + + return c.JSON(fiber.Map{ + "status": "success", + "data": fiber.Map{ + "user": user, + "token": token, + }, + }) +} \ No newline at end of file diff --git a/services/gateway-service/internal/api/v1/comment.go b/services/gateway-service/internal/api/v1/comment.go new file mode 100644 index 0000000..971d3d4 --- /dev/null +++ b/services/gateway-service/internal/api/v1/comment.go @@ -0,0 +1,143 @@ +package v1 + +import ( + "context" + "time" + + "github.com/gofiber/fiber/v2" + + "github.com/hexolan/panels/gateway-service/internal/api/handlers" + "github.com/hexolan/panels/gateway-service/internal/rpc" + "github.com/hexolan/panels/gateway-service/internal/rpc/commentv1" +) + +func getComment(id string) (*commentv1.Comment, error) { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + comment, err := rpc.Svcs.GetCommentSvc().GetComment( + ctx, + &commentv1.GetCommentRequest{Id: id}, + ) + + return comment, err +} + +func GetPostComments(c *fiber.Ctx) error { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + comments, err := rpc.Svcs.GetCommentSvc().GetPostComments( + ctx, + &commentv1.GetPostCommentsRequest{PostId: c.Params("post_id")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": comments}) +} + +func UpdateComment(c *fiber.Ctx) error { + // check if user has permissions to update the comment + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + comment, err := getComment(c.Params("id")) + if err != nil { + return err + } + + if (comment.AuthorId != currentUser.Id) { + return fiber.NewError(fiber.StatusForbidden, "no permissions to update that comment") + } + + // Parse the body data + updatedComment := new(commentv1.CommentMutable) + if err := c.BodyParser(updatedComment); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + // Update the comment + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + comment, err = rpc.Svcs.GetCommentSvc().UpdateComment( + ctx, + &commentv1.UpdateCommentRequest{ + Id: c.Params("id"), + Data: updatedComment, + }, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": comment}) +} + +func DeleteComment(c *fiber.Ctx) error { + // check if user has permissions to delete the comment + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + comment, err := getComment(c.Params("id")) + if err != nil { + return err + } + + if (comment.AuthorId != currentUser.Id && !currentUser.IsAdmin) { + return fiber.NewError(fiber.StatusForbidden, "no permissions to delete that comment") + } + + // Delete the comment + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + _, err = rpc.Svcs.GetCommentSvc().DeleteComment( + ctx, + &commentv1.DeleteCommentRequest{Id: c.Params("id")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "msg": "comment deleted"}) +} + +func CreateComment(c *fiber.Ctx) error { + // Parse the body data + newComment := new(commentv1.CommentMutable) + if err := c.BodyParser(newComment); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + // check post is real + post, err := getPostById(c.Params("post_id")) + if err != nil { + return err + } + + // access token claims + tokenClaims, err := handlers.GetTokenClaims(c) + if err != nil { + return err + } + + // Create the comment + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + comment, err := rpc.Svcs.GetCommentSvc().CreateComment( + ctx, + &commentv1.CreateCommentRequest{ + PostId: post.Id, + AuthorId: tokenClaims.Subject, + Data: newComment, + }, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": comment}) +} \ No newline at end of file diff --git a/services/gateway-service/internal/api/v1/panel.go b/services/gateway-service/internal/api/v1/panel.go new file mode 100644 index 0000000..846c862 --- /dev/null +++ b/services/gateway-service/internal/api/v1/panel.go @@ -0,0 +1,186 @@ +package v1 + +import ( + "time" + "context" + + "github.com/gofiber/fiber/v2" + + "github.com/hexolan/panels/gateway-service/internal/rpc" + "github.com/hexolan/panels/gateway-service/internal/rpc/panelv1" +) + +func getPanelById(id string) (*panelv1.Panel, error) { + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + return rpc.Svcs.GetPanelSvc().GetPanel( + ctx, + &panelv1.GetPanelByIdRequest{Id: id}, + ) +} + +func getPanelIDFromName(name string) (string, error) { + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + panel, err := rpc.Svcs.GetPanelSvc().GetPanelByName( + ctx, + &panelv1.GetPanelByNameRequest{Name: name}, + ) + if err != nil { + return "", err + } + + return panel.GetId(), nil +} + +func GetPanelById(c *fiber.Ctx) error { + panel, err := getPanelById(c.Params("id")) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": panel}) +} + +func GetPanelByName(c *fiber.Ctx) error { + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + panel, err := rpc.Svcs.GetPanelSvc().GetPanelByName( + ctx, + &panelv1.GetPanelByNameRequest{Name: c.Params("name")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": panel}) +} + +func UpdatePanelById(c *fiber.Ctx) error { + // check user can update panels + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + if !currentUser.IsAdmin { + return fiber.NewError(fiber.StatusForbidden, "no permissions to update that panel") + } + + // update the panel + patchData := new(panelv1.PanelMutable) + if err := c.BodyParser(patchData); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + panel, err := rpc.Svcs.GetPanelSvc().UpdatePanel( + ctx, + &panelv1.UpdatePanelByIdRequest{Id: c.Params("id"), Data: patchData}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": panel}) +} + +func UpdatePanelByName(c *fiber.Ctx) error { + // check user can update panels + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + if !currentUser.IsAdmin { + return fiber.NewError(fiber.StatusForbidden, "no permissions to update that panel") + } + + // update the panel + patchData := new(panelv1.PanelMutable) + if err := c.BodyParser(patchData); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + panel, err := rpc.Svcs.GetPanelSvc().UpdatePanelByName( + ctx, + &panelv1.UpdatePanelByNameRequest{Name: c.Params("name"), Data: patchData}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": panel}) +} + +func DeletePanelById(c *fiber.Ctx) error { + // check user can delete panels + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + if !currentUser.IsAdmin { + return fiber.NewError(fiber.StatusForbidden, "no permissions to delete that panel") + } + + // delete the panel + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + _, err = rpc.Svcs.GetPanelSvc().DeletePanel( + ctx, + &panelv1.DeletePanelByIdRequest{Id: c.Params("id")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "msg": "panel deleted"}) +} + +func DeletePanelByName(c *fiber.Ctx) error { + // check user can delete panels + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + if !currentUser.IsAdmin { + return fiber.NewError(fiber.StatusForbidden, "no permissions to update that panel") + } + + // delete the panel + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + _, err = rpc.Svcs.GetPanelSvc().DeletePanelByName( + ctx, + &panelv1.DeletePanelByNameRequest{Name: c.Params("name")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "msg": "panel deleted"}) +} + +func CreatePanel(c *fiber.Ctx) error { + newPanel := new(panelv1.PanelMutable) + if err := c.BodyParser(newPanel); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + panel, err := rpc.Svcs.GetPanelSvc().CreatePanel( + ctx, + &panelv1.CreatePanelRequest{Data: newPanel}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": panel}) +} \ No newline at end of file diff --git a/services/gateway-service/internal/api/v1/post.go b/services/gateway-service/internal/api/v1/post.go new file mode 100644 index 0000000..8186ff3 --- /dev/null +++ b/services/gateway-service/internal/api/v1/post.go @@ -0,0 +1,284 @@ +package v1 + +import ( + "time" + "context" + + "github.com/gofiber/fiber/v2" + + "github.com/hexolan/panels/gateway-service/internal/rpc" + "github.com/hexolan/panels/gateway-service/internal/rpc/postv1" + "github.com/hexolan/panels/gateway-service/internal/api/handlers" +) + +func getPostById(postId string) (*postv1.Post, error) { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + return rpc.Svcs.GetPostSvc().GetPost( + ctx, + &postv1.GetPostRequest{Id: postId}, + ) +} + +func GetFeedPosts(c *fiber.Ctx) error { + // Make the request for feed posts + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + posts, err := rpc.Svcs.GetPostSvc().GetFeedPosts( + ctx, + &postv1.GetFeedPostsRequest{}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": posts}) +} + +func GetPanelPostFromId(c *fiber.Ctx) error { + // Make the request for the panel post + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + post, err := rpc.Svcs.GetPostSvc().GetPanelPost( + ctx, + &postv1.GetPanelPostRequest{Id: c.Params("id"), PanelId: c.Params("panel_id")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": post}) +} + +func GetPanelPostFromName(c *fiber.Ctx) error { + // Get the panel ID from name. + panelId, err := getPanelIDFromName(c.Params("panel_name")) + if err != nil { + return err + } + + // Make the request for the panel post + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + post, err := rpc.Svcs.GetPostSvc().GetPanelPost( + ctx, + &postv1.GetPanelPostRequest{Id: c.Params("id"), PanelId: panelId}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": post}) +} + +func GetUserPostsFromId(c *fiber.Ctx) error { + // Make the request for user posts + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + posts, err := rpc.Svcs.GetPostSvc().GetUserPosts( + ctx, + &postv1.GetUserPostsRequest{UserId: c.Params("user_id")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": posts}) +} + +func GetUserPostsFromUsername(c *fiber.Ctx) error { + // Get the user ID from username. + user, err := getUserByUsername(c.Params("username")) + if err != nil { + return err + } + + // Make the request for user posts + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + posts, err := rpc.Svcs.GetPostSvc().GetUserPosts( + ctx, + &postv1.GetUserPostsRequest{UserId: user.Id}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": posts}) +} + +func GetPanelPostsFromId(c *fiber.Ctx) error { + // Make the request for panel posts + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + posts, err := rpc.Svcs.GetPostSvc().GetPanelPosts( + ctx, + &postv1.GetPanelPostsRequest{PanelId: c.Params("panel_id")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": posts}) +} + +func GetPanelPostsFromName(c *fiber.Ctx) error { + // Get the panel ID from name. + panelId, err := getPanelIDFromName(c.Params("panel_name")) + if err != nil { + return err + } + + // Make the request for panel posts + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + posts, err := rpc.Svcs.GetPostSvc().GetPanelPosts( + ctx, + &postv1.GetPanelPostsRequest{PanelId: panelId}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": posts}) +} + +func UpdatePost(c *fiber.Ctx) error { + // check if user has permissions to update the post + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + post, err := getPostById(c.Params("id")) + if err != nil { + return err + } + + if (post.AuthorId != currentUser.Id) { + return fiber.NewError(fiber.StatusForbidden, "no permissions to update that post") + } + + // form patch data for update request + patchData := new(postv1.PostMutable) + if err := c.BodyParser(patchData); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + // update the post + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + post, err = rpc.Svcs.GetPostSvc().UpdatePost( + ctx, + &postv1.UpdatePostRequest{Id: c.Params("id"), Data: patchData}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": post}) +} + +func DeletePost(c *fiber.Ctx) error { + // check if user has permissions to delete the post + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + post, err := getPostById(c.Params("id")) + if err != nil { + return err + } + + if (post.AuthorId != currentUser.Id && !currentUser.IsAdmin) { + return fiber.NewError(fiber.StatusForbidden, "no permissions to delete that post") + } + + // delete the post + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + _, err = rpc.Svcs.GetPostSvc().DeletePost( + ctx, + &postv1.DeletePostRequest{Id: c.Params("id")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "msg": "post deleted"}) +} + +func CreatePanelPostFromId(c *fiber.Ctx) error { + // Parse the body data + newPost := new(postv1.PostMutable) + if err := c.BodyParser(newPost); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + // Get the panel ID from provided panel name + panel, err := getPanelById(c.Params("panel_id")) + if err != nil { + return err + } + + // access token claims + tokenClaims, err := handlers.GetTokenClaims(c) + if err != nil { + return err + } + + // make rpc call + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + post, err := rpc.Svcs.GetPostSvc().CreatePost( + ctx, + &postv1.CreatePostRequest{ + PanelId: panel.Id, + UserId: tokenClaims.Subject, + Data: newPost, + }, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": post}) +} + +func CreatePanelPostFromName(c *fiber.Ctx) error { + // Parse the body data + newPost := new(postv1.PostMutable) + if err := c.BodyParser(newPost); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + // Get the panel ID from provided panel name + panelId, err := getPanelIDFromName(c.Params("panel_name")) + if err != nil { + return err + } + + // access token claims + tokenClaims, err := handlers.GetTokenClaims(c) + if err != nil { + return err + } + + // make rpc call + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + post, err := rpc.Svcs.GetPostSvc().CreatePost( + ctx, + &postv1.CreatePostRequest{ + PanelId: panelId, + UserId: tokenClaims.Subject, + Data: newPost, + }, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": post}) +} \ No newline at end of file diff --git a/services/gateway-service/internal/api/v1/user.go b/services/gateway-service/internal/api/v1/user.go new file mode 100644 index 0000000..fbf5600 --- /dev/null +++ b/services/gateway-service/internal/api/v1/user.go @@ -0,0 +1,196 @@ +package v1 + +import ( + "time" + "context" + + "github.com/gofiber/fiber/v2" + + "github.com/hexolan/panels/gateway-service/internal/rpc" + "github.com/hexolan/panels/gateway-service/internal/rpc/userv1" + "github.com/hexolan/panels/gateway-service/internal/api/handlers" +) + +type userSignupForm struct { + Username string + Password string +} + +func getCurrentUser(c *fiber.Ctx) (*userv1.User, error) { + // access token claims + tokenClaims, err := handlers.GetTokenClaims(c) + if err != nil { + return nil, err + } + + // fetch current user + return getUserById(tokenClaims.Subject) +} + +func getUserById(id string) (*userv1.User, error) { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + user, err := rpc.Svcs.GetUserSvc().GetUser( + ctx, + &userv1.GetUserByIdRequest{Id: id}, + ) + + return user, err +} + +func getUserByUsername(username string) (*userv1.User, error) { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + user, err := rpc.Svcs.GetUserSvc().GetUserByName( + ctx, + &userv1.GetUserByNameRequest{Username: username}, + ) + + return user, err +} + +func GetUserById(c *fiber.Ctx) error { + user, err := getUserById(c.Params("id")) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": user}) +} + +func GetUserByUsername(c *fiber.Ctx) error { + user, err := getUserByUsername(c.Params("username")) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": user}) +} + +func GetCurrentUser(c *fiber.Ctx) error { + user, err := getCurrentUser(c) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "data": user}) +} + +func DeleteUserById(c *fiber.Ctx) error { + // get current user info + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + // check current user has permission to delete user + if currentUser.Id != c.Params("id") && !currentUser.IsAdmin { + return fiber.NewError(fiber.StatusForbidden, "no permissions to delete that user") + } + + // delete the user + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + _, err = rpc.Svcs.GetUserSvc().DeleteUser( + ctx, + &userv1.DeleteUserByIdRequest{Id: c.Params("id")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "msg": "user deleted"}) +} + +func DeleteUserByUsername(c *fiber.Ctx) error { + // get current user info + currentUser, err := getCurrentUser(c) + if err != nil { + return err + } + + // check current user has permission to delete user + if currentUser.Id != c.Params("id") && !currentUser.IsAdmin { + return fiber.NewError(fiber.StatusForbidden, "no permissions to delete that user") + } + + // delete the user + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + _, err = rpc.Svcs.GetUserSvc().DeleteUserByName( + ctx, + &userv1.DeleteUserByNameRequest{Username: c.Params("username")}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "msg": "user deleted"}) +} + +func DeleteCurrentUser(c *fiber.Ctx) error { + // View access token claims + tokenClaims, err := handlers.GetTokenClaims(c) + if err != nil { + return err + } + + // RPC call + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + _, err = rpc.Svcs.GetUserSvc().DeleteUser( + ctx, + &userv1.DeleteUserByIdRequest{Id: tokenClaims.Subject}, + ) + if err != nil { + return err + } + + return c.JSON(fiber.Map{"status": "success", "msg": "user deleted"}) +} + +func UserSignup(c *fiber.Ctx) error { + // Parse the body data + form := new(userSignupForm) + if err := c.BodyParser(form); err != nil { + fiber.NewError(fiber.StatusBadRequest, "malformed request") + } + + // Attempt to create the user + // todo: defer this logic away from gateway-service in future (potentially into seperate registration-service) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + user, err := rpc.Svcs.GetUserSvc().CreateUser( + ctx, + &userv1.CreateUserRequest{ + Data: &userv1.UserMutable{ + Username: &form.Username, + }, + }, + ) + if err != nil { + return err + } + + // Attempt to set password auth method for the user + err = setAuthMethod(user.Id, form.Password) + if err != nil { + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + _, _ = rpc.Svcs.GetUserSvc().DeleteUser( + ctx, + &userv1.DeleteUserByIdRequest{Id: user.Id}, + ) + return err + } + + // Signup success - attempt to get auth token + token, _ := authWithPassword(user.Id, form.Password) + return c.JSON(fiber.Map{ + "status": "success", + "data": fiber.Map{ + "user": user, + "token": token, + }, + }) +} \ No newline at end of file diff --git a/services/gateway-service/internal/config.go b/services/gateway-service/internal/config.go new file mode 100644 index 0000000..10a58b2 --- /dev/null +++ b/services/gateway-service/internal/config.go @@ -0,0 +1,50 @@ +package internal + +import ( + "os" + "crypto/rsa" + "encoding/base64" + + "github.com/golang-jwt/jwt/v5" + "github.com/gofiber/fiber/v2/log" +) + +func NewConfig() Config { + pubKeyBytes, err := base64.StdEncoding.DecodeString(optFromEnvRequire("JWT_PUBLIC_KEY")) + if err != nil { + log.Fatal("jwt public key not in base64 format") + } + + jwtPubKey, err := jwt.ParseRSAPublicKeyFromPEM(pubKeyBytes) + if err != nil { + log.Panic("invalid jwt public key provided (must be RSA)") + } + + return Config{ + PanelSvcAddr: optFromEnvRequire("PANEL_SVC_ADDR"), + PostSvcAddr: optFromEnvRequire("POST_SVC_ADDR"), + UserSvcAddr: optFromEnvRequire("USER_SVC_ADDR"), + AuthSvcAddr: optFromEnvRequire("AUTH_SVC_ADDR"), + CommentSvcAddr: optFromEnvRequire("COMMENT_SVC_ADDR"), + + JWTPubKey: jwtPubKey, + } +} + +func optFromEnvRequire(opt string) string { + optValue, exists := os.LookupEnv(opt) + if !exists || optValue == "" { + log.Fatalf("failed to load required config option ('%s')", opt) + } + return optValue +} + +type Config struct { + PostSvcAddr string + PanelSvcAddr string + UserSvcAddr string + AuthSvcAddr string + CommentSvcAddr string + + JWTPubKey *rsa.PublicKey +} \ No newline at end of file diff --git a/services/gateway-service/internal/rpc/authv1/auth.pb.go b/services/gateway-service/internal/rpc/authv1/auth.pb.go new file mode 100644 index 0000000..8c35cdc --- /dev/null +++ b/services/gateway-service/internal/rpc/authv1/auth.pb.go @@ -0,0 +1,408 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.23.4 +// source: auth.proto + +package authv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SetPasswordAuthMethod struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // External Ref: User Id + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *SetPasswordAuthMethod) Reset() { + *x = SetPasswordAuthMethod{} + if protoimpl.UnsafeEnabled { + mi := &file_auth_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetPasswordAuthMethod) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetPasswordAuthMethod) ProtoMessage() {} + +func (x *SetPasswordAuthMethod) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[0] + 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 SetPasswordAuthMethod.ProtoReflect.Descriptor instead. +func (*SetPasswordAuthMethod) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{0} +} + +func (x *SetPasswordAuthMethod) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *SetPasswordAuthMethod) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type DeletePasswordAuthMethod struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // External Ref: User Id +} + +func (x *DeletePasswordAuthMethod) Reset() { + *x = DeletePasswordAuthMethod{} + if protoimpl.UnsafeEnabled { + mi := &file_auth_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePasswordAuthMethod) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePasswordAuthMethod) ProtoMessage() {} + +func (x *DeletePasswordAuthMethod) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[1] + 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 DeletePasswordAuthMethod.ProtoReflect.Descriptor instead. +func (*DeletePasswordAuthMethod) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{1} +} + +func (x *DeletePasswordAuthMethod) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type PasswordAuthRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // External Ref: User Id + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *PasswordAuthRequest) Reset() { + *x = PasswordAuthRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_auth_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PasswordAuthRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PasswordAuthRequest) ProtoMessage() {} + +func (x *PasswordAuthRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[2] + 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 PasswordAuthRequest.ProtoReflect.Descriptor instead. +func (*PasswordAuthRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{2} +} + +func (x *PasswordAuthRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *PasswordAuthRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type AuthToken struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TokenType string `protobuf:"bytes,1,opt,name=token_type,json=tokenType,proto3" json:"token_type,omitempty"` + AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + RefreshToken string `protobuf:"bytes,3,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` + ExpiresIn int64 `protobuf:"varint,4,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"` +} + +func (x *AuthToken) Reset() { + *x = AuthToken{} + if protoimpl.UnsafeEnabled { + mi := &file_auth_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthToken) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthToken) ProtoMessage() {} + +func (x *AuthToken) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[3] + 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 AuthToken.ProtoReflect.Descriptor instead. +func (*AuthToken) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{3} +} + +func (x *AuthToken) GetTokenType() string { + if x != nil { + return x.TokenType + } + return "" +} + +func (x *AuthToken) GetAccessToken() string { + if x != nil { + return x.AccessToken + } + return "" +} + +func (x *AuthToken) GetRefreshToken() string { + if x != nil { + return x.RefreshToken + } + return "" +} + +func (x *AuthToken) GetExpiresIn() int64 { + if x != nil { + return x.ExpiresIn + } + return 0 +} + +var File_auth_proto protoreflect.FileDescriptor + +var file_auth_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 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, 0x22, 0x4c, 0x0a, 0x15, 0x53, 0x65, 0x74, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x33, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x4a, 0x0a, 0x13, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x91, 0x01, 0x0a, 0x09, 0x41, 0x75, 0x74, + 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x72, + 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1d, 0x0a, + 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x49, 0x6e, 0x32, 0x91, 0x02, 0x0a, + 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x10, + 0x41, 0x75, 0x74, 0x68, 0x57, 0x69, 0x74, 0x68, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, + 0x12, 0x23, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, + 0x31, 0x2e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0f, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x41, 0x75, 0x74, 0x68, 0x12, 0x25, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x61, + 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x00, 0x12, 0x58, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, 0x12, 0x28, 0x2e, 0x70, + 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 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, 0x00, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_auth_proto_rawDescOnce sync.Once + file_auth_proto_rawDescData = file_auth_proto_rawDesc +) + +func file_auth_proto_rawDescGZIP() []byte { + file_auth_proto_rawDescOnce.Do(func() { + file_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_auth_proto_rawDescData) + }) + return file_auth_proto_rawDescData +} + +var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_auth_proto_goTypes = []interface{}{ + (*SetPasswordAuthMethod)(nil), // 0: panels.auth.v1.SetPasswordAuthMethod + (*DeletePasswordAuthMethod)(nil), // 1: panels.auth.v1.DeletePasswordAuthMethod + (*PasswordAuthRequest)(nil), // 2: panels.auth.v1.PasswordAuthRequest + (*AuthToken)(nil), // 3: panels.auth.v1.AuthToken + (*emptypb.Empty)(nil), // 4: google.protobuf.Empty +} +var file_auth_proto_depIdxs = []int32{ + 2, // 0: panels.auth.v1.AuthService.AuthWithPassword:input_type -> panels.auth.v1.PasswordAuthRequest + 0, // 1: panels.auth.v1.AuthService.SetPasswordAuth:input_type -> panels.auth.v1.SetPasswordAuthMethod + 1, // 2: panels.auth.v1.AuthService.DeletePasswordAuth:input_type -> panels.auth.v1.DeletePasswordAuthMethod + 3, // 3: panels.auth.v1.AuthService.AuthWithPassword:output_type -> panels.auth.v1.AuthToken + 4, // 4: panels.auth.v1.AuthService.SetPasswordAuth:output_type -> google.protobuf.Empty + 4, // 5: panels.auth.v1.AuthService.DeletePasswordAuth:output_type -> google.protobuf.Empty + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_auth_proto_init() } +func file_auth_proto_init() { + if File_auth_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetPasswordAuthMethod); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePasswordAuthMethod); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PasswordAuthRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AuthToken); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_auth_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_auth_proto_goTypes, + DependencyIndexes: file_auth_proto_depIdxs, + MessageInfos: file_auth_proto_msgTypes, + }.Build() + File_auth_proto = out.File + file_auth_proto_rawDesc = nil + file_auth_proto_goTypes = nil + file_auth_proto_depIdxs = nil +} diff --git a/services/gateway-service/internal/rpc/authv1/auth_grpc.pb.go b/services/gateway-service/internal/rpc/authv1/auth_grpc.pb.go new file mode 100644 index 0000000..68ed22d --- /dev/null +++ b/services/gateway-service/internal/rpc/authv1/auth_grpc.pb.go @@ -0,0 +1,178 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.23.4 +// source: auth.proto + +package authv1 + +import ( + context "context" + 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 +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// AuthServiceClient is the client API for AuthService service. +// +// 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 AuthServiceClient interface { + AuthWithPassword(ctx context.Context, in *PasswordAuthRequest, opts ...grpc.CallOption) (*AuthToken, error) + SetPasswordAuth(ctx context.Context, in *SetPasswordAuthMethod, opts ...grpc.CallOption) (*emptypb.Empty, error) + DeletePasswordAuth(ctx context.Context, in *DeletePasswordAuthMethod, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type authServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient { + return &authServiceClient{cc} +} + +func (c *authServiceClient) AuthWithPassword(ctx context.Context, in *PasswordAuthRequest, opts ...grpc.CallOption) (*AuthToken, error) { + out := new(AuthToken) + err := c.cc.Invoke(ctx, "/panels.auth.v1.AuthService/AuthWithPassword", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) SetPasswordAuth(ctx context.Context, in *SetPasswordAuthMethod, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/panels.auth.v1.AuthService/SetPasswordAuth", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *authServiceClient) DeletePasswordAuth(ctx context.Context, in *DeletePasswordAuthMethod, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/panels.auth.v1.AuthService/DeletePasswordAuth", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuthServiceServer is the server API for AuthService service. +// All implementations must embed UnimplementedAuthServiceServer +// for forward compatibility +type AuthServiceServer interface { + AuthWithPassword(context.Context, *PasswordAuthRequest) (*AuthToken, error) + SetPasswordAuth(context.Context, *SetPasswordAuthMethod) (*emptypb.Empty, error) + DeletePasswordAuth(context.Context, *DeletePasswordAuthMethod) (*emptypb.Empty, error) + mustEmbedUnimplementedAuthServiceServer() +} + +// UnimplementedAuthServiceServer must be embedded to have forward compatible implementations. +type UnimplementedAuthServiceServer struct { +} + +func (UnimplementedAuthServiceServer) AuthWithPassword(context.Context, *PasswordAuthRequest) (*AuthToken, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthWithPassword not implemented") +} +func (UnimplementedAuthServiceServer) SetPasswordAuth(context.Context, *SetPasswordAuthMethod) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetPasswordAuth not implemented") +} +func (UnimplementedAuthServiceServer) DeletePasswordAuth(context.Context, *DeletePasswordAuthMethod) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePasswordAuth not implemented") +} +func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {} + +// UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuthServiceServer will +// result in compilation errors. +type UnsafeAuthServiceServer interface { + mustEmbedUnimplementedAuthServiceServer() +} + +func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) { + s.RegisterService(&AuthService_ServiceDesc, srv) +} + +func _AuthService_AuthWithPassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PasswordAuthRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).AuthWithPassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.auth.v1.AuthService/AuthWithPassword", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).AuthWithPassword(ctx, req.(*PasswordAuthRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_SetPasswordAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetPasswordAuthMethod) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).SetPasswordAuth(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.auth.v1.AuthService/SetPasswordAuth", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).SetPasswordAuth(ctx, req.(*SetPasswordAuthMethod)) + } + return interceptor(ctx, in, info, handler) +} + +func _AuthService_DeletePasswordAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePasswordAuthMethod) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuthServiceServer).DeletePasswordAuth(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.auth.v1.AuthService/DeletePasswordAuth", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuthServiceServer).DeletePasswordAuth(ctx, req.(*DeletePasswordAuthMethod)) + } + return interceptor(ctx, in, info, handler) +} + +// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AuthService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "panels.auth.v1.AuthService", + HandlerType: (*AuthServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AuthWithPassword", + Handler: _AuthService_AuthWithPassword_Handler, + }, + { + MethodName: "SetPasswordAuth", + Handler: _AuthService_SetPasswordAuth_Handler, + }, + { + MethodName: "DeletePasswordAuth", + Handler: _AuthService_DeletePasswordAuth_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "auth.proto", +} diff --git a/services/gateway-service/internal/rpc/commentv1/comment.pb.go b/services/gateway-service/internal/rpc/commentv1/comment.pb.go new file mode 100644 index 0000000..98218cd --- /dev/null +++ b/services/gateway-service/internal/rpc/commentv1/comment.pb.go @@ -0,0 +1,794 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.23.4 +// source: comment.proto + +package commentv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Comment struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + PostId string `protobuf:"bytes,2,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"` // External Ref: Post Id + AuthorId string `protobuf:"bytes,3,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"` // External Ref: User Id + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *Comment) Reset() { + *x = Comment{} + if protoimpl.UnsafeEnabled { + mi := &file_comment_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Comment) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Comment) ProtoMessage() {} + +func (x *Comment) ProtoReflect() protoreflect.Message { + mi := &file_comment_proto_msgTypes[0] + 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 Comment.ProtoReflect.Descriptor instead. +func (*Comment) Descriptor() ([]byte, []int) { + return file_comment_proto_rawDescGZIP(), []int{0} +} + +func (x *Comment) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Comment) GetPostId() string { + if x != nil { + return x.PostId + } + return "" +} + +func (x *Comment) GetAuthorId() string { + if x != nil { + return x.AuthorId + } + return "" +} + +func (x *Comment) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *Comment) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *Comment) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +type CommentMutable struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *CommentMutable) Reset() { + *x = CommentMutable{} + if protoimpl.UnsafeEnabled { + mi := &file_comment_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommentMutable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentMutable) ProtoMessage() {} + +func (x *CommentMutable) ProtoReflect() protoreflect.Message { + mi := &file_comment_proto_msgTypes[1] + 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 CommentMutable.ProtoReflect.Descriptor instead. +func (*CommentMutable) Descriptor() ([]byte, []int) { + return file_comment_proto_rawDescGZIP(), []int{1} +} + +func (x *CommentMutable) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type CreateCommentRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PostId string `protobuf:"bytes,1,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"` // External Ref: Post Id + AuthorId string `protobuf:"bytes,2,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"` // External Ref: User Id + Data *CommentMutable `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *CreateCommentRequest) Reset() { + *x = CreateCommentRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_comment_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateCommentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateCommentRequest) ProtoMessage() {} + +func (x *CreateCommentRequest) ProtoReflect() protoreflect.Message { + mi := &file_comment_proto_msgTypes[2] + 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 CreateCommentRequest.ProtoReflect.Descriptor instead. +func (*CreateCommentRequest) Descriptor() ([]byte, []int) { + return file_comment_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateCommentRequest) GetPostId() string { + if x != nil { + return x.PostId + } + return "" +} + +func (x *CreateCommentRequest) GetAuthorId() string { + if x != nil { + return x.AuthorId + } + return "" +} + +func (x *CreateCommentRequest) GetData() *CommentMutable { + if x != nil { + return x.Data + } + return nil +} + +type UpdateCommentRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Data *CommentMutable `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *UpdateCommentRequest) Reset() { + *x = UpdateCommentRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_comment_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateCommentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateCommentRequest) ProtoMessage() {} + +func (x *UpdateCommentRequest) ProtoReflect() protoreflect.Message { + mi := &file_comment_proto_msgTypes[3] + 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 UpdateCommentRequest.ProtoReflect.Descriptor instead. +func (*UpdateCommentRequest) Descriptor() ([]byte, []int) { + return file_comment_proto_rawDescGZIP(), []int{3} +} + +func (x *UpdateCommentRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateCommentRequest) GetData() *CommentMutable { + if x != nil { + return x.Data + } + return nil +} + +type DeleteCommentRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteCommentRequest) Reset() { + *x = DeleteCommentRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_comment_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteCommentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteCommentRequest) ProtoMessage() {} + +func (x *DeleteCommentRequest) ProtoReflect() protoreflect.Message { + mi := &file_comment_proto_msgTypes[4] + 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 DeleteCommentRequest.ProtoReflect.Descriptor instead. +func (*DeleteCommentRequest) Descriptor() ([]byte, []int) { + return file_comment_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteCommentRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetCommentRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetCommentRequest) Reset() { + *x = GetCommentRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_comment_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCommentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCommentRequest) ProtoMessage() {} + +func (x *GetCommentRequest) ProtoReflect() protoreflect.Message { + mi := &file_comment_proto_msgTypes[5] + 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 GetCommentRequest.ProtoReflect.Descriptor instead. +func (*GetCommentRequest) Descriptor() ([]byte, []int) { + return file_comment_proto_rawDescGZIP(), []int{5} +} + +func (x *GetCommentRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetPostCommentsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PostId string `protobuf:"bytes,1,opt,name=post_id,json=postId,proto3" json:"post_id,omitempty"` +} + +func (x *GetPostCommentsRequest) Reset() { + *x = GetPostCommentsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_comment_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPostCommentsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPostCommentsRequest) ProtoMessage() {} + +func (x *GetPostCommentsRequest) ProtoReflect() protoreflect.Message { + mi := &file_comment_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 GetPostCommentsRequest.ProtoReflect.Descriptor instead. +func (*GetPostCommentsRequest) Descriptor() ([]byte, []int) { + return file_comment_proto_rawDescGZIP(), []int{6} +} + +func (x *GetPostCommentsRequest) GetPostId() string { + if x != nil { + return x.PostId + } + return "" +} + +type PostComments struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Comments []*Comment `protobuf:"bytes,1,rep,name=comments,proto3" json:"comments,omitempty"` +} + +func (x *PostComments) Reset() { + *x = PostComments{} + if protoimpl.UnsafeEnabled { + mi := &file_comment_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostComments) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostComments) ProtoMessage() {} + +func (x *PostComments) ProtoReflect() protoreflect.Message { + mi := &file_comment_proto_msgTypes[7] + 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 PostComments.ProtoReflect.Descriptor instead. +func (*PostComments) Descriptor() ([]byte, []int) { + return file_comment_proto_rawDescGZIP(), []int{7} +} + +func (x *PostComments) GetComments() []*Comment { + if x != nil { + return x.Comments + } + return nil +} + +// Kafka Event Schema +type CommentEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Data *Comment `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *CommentEvent) Reset() { + *x = CommentEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_comment_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommentEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommentEvent) ProtoMessage() {} + +func (x *CommentEvent) ProtoReflect() protoreflect.Message { + mi := &file_comment_proto_msgTypes[8] + 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 CommentEvent.ProtoReflect.Descriptor instead. +func (*CommentEvent) Descriptor() ([]byte, []int) { + return file_comment_proto_rawDescGZIP(), []int{8} +} + +func (x *CommentEvent) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CommentEvent) GetData() *Comment { + if x != nil { + return x.Data + } + return nil +} + +var File_comment_proto protoreflect.FileDescriptor + +var file_comment_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x11, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, + 0x76, 0x31, 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, + 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, + 0x22, 0xdf, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, + 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, + 0x6f, 0x73, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 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, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 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, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x41, 0x74, 0x22, 0x2a, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x75, 0x74, + 0x61, 0x62, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x83, + 0x01, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x73, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x73, 0x74, 0x49, 0x64, + 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x35, 0x0a, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x22, 0x5d, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x61, 0x6e, + 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x22, 0x26, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x23, 0x0a, 0x11, 0x47, + 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x31, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, + 0x73, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x73, + 0x74, 0x49, 0x64, 0x22, 0x46, 0x0a, 0x0c, 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x73, 0x12, 0x36, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x52, 0x0a, 0x0c, 0x43, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x2e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, + 0xc7, 0x03, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x56, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x27, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, + 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x56, 0x0a, 0x0d, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x27, 0x2e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x27, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 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, 0x00, 0x12, 0x50, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x24, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x61, 0x6e, + 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x00, 0x12, 0x5f, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, + 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x29, 0x2e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x43, + 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_comment_proto_rawDescOnce sync.Once + file_comment_proto_rawDescData = file_comment_proto_rawDesc +) + +func file_comment_proto_rawDescGZIP() []byte { + file_comment_proto_rawDescOnce.Do(func() { + file_comment_proto_rawDescData = protoimpl.X.CompressGZIP(file_comment_proto_rawDescData) + }) + return file_comment_proto_rawDescData +} + +var file_comment_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_comment_proto_goTypes = []interface{}{ + (*Comment)(nil), // 0: panels.comment.v1.Comment + (*CommentMutable)(nil), // 1: panels.comment.v1.CommentMutable + (*CreateCommentRequest)(nil), // 2: panels.comment.v1.CreateCommentRequest + (*UpdateCommentRequest)(nil), // 3: panels.comment.v1.UpdateCommentRequest + (*DeleteCommentRequest)(nil), // 4: panels.comment.v1.DeleteCommentRequest + (*GetCommentRequest)(nil), // 5: panels.comment.v1.GetCommentRequest + (*GetPostCommentsRequest)(nil), // 6: panels.comment.v1.GetPostCommentsRequest + (*PostComments)(nil), // 7: panels.comment.v1.PostComments + (*CommentEvent)(nil), // 8: panels.comment.v1.CommentEvent + (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 10: google.protobuf.Empty +} +var file_comment_proto_depIdxs = []int32{ + 9, // 0: panels.comment.v1.Comment.created_at:type_name -> google.protobuf.Timestamp + 9, // 1: panels.comment.v1.Comment.updated_at:type_name -> google.protobuf.Timestamp + 1, // 2: panels.comment.v1.CreateCommentRequest.data:type_name -> panels.comment.v1.CommentMutable + 1, // 3: panels.comment.v1.UpdateCommentRequest.data:type_name -> panels.comment.v1.CommentMutable + 0, // 4: panels.comment.v1.PostComments.comments:type_name -> panels.comment.v1.Comment + 0, // 5: panels.comment.v1.CommentEvent.data:type_name -> panels.comment.v1.Comment + 2, // 6: panels.comment.v1.CommentService.CreateComment:input_type -> panels.comment.v1.CreateCommentRequest + 3, // 7: panels.comment.v1.CommentService.UpdateComment:input_type -> panels.comment.v1.UpdateCommentRequest + 4, // 8: panels.comment.v1.CommentService.DeleteComment:input_type -> panels.comment.v1.DeleteCommentRequest + 5, // 9: panels.comment.v1.CommentService.GetComment:input_type -> panels.comment.v1.GetCommentRequest + 6, // 10: panels.comment.v1.CommentService.GetPostComments:input_type -> panels.comment.v1.GetPostCommentsRequest + 0, // 11: panels.comment.v1.CommentService.CreateComment:output_type -> panels.comment.v1.Comment + 0, // 12: panels.comment.v1.CommentService.UpdateComment:output_type -> panels.comment.v1.Comment + 10, // 13: panels.comment.v1.CommentService.DeleteComment:output_type -> google.protobuf.Empty + 0, // 14: panels.comment.v1.CommentService.GetComment:output_type -> panels.comment.v1.Comment + 7, // 15: panels.comment.v1.CommentService.GetPostComments:output_type -> panels.comment.v1.PostComments + 11, // [11:16] is the sub-list for method output_type + 6, // [6:11] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_comment_proto_init() } +func file_comment_proto_init() { + if File_comment_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_comment_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Comment); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comment_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommentMutable); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comment_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateCommentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comment_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateCommentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comment_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteCommentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comment_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCommentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comment_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPostCommentsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comment_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostComments); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_comment_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CommentEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_comment_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_comment_proto_goTypes, + DependencyIndexes: file_comment_proto_depIdxs, + MessageInfos: file_comment_proto_msgTypes, + }.Build() + File_comment_proto = out.File + file_comment_proto_rawDesc = nil + file_comment_proto_goTypes = nil + file_comment_proto_depIdxs = nil +} diff --git a/services/gateway-service/internal/rpc/commentv1/comment_grpc.pb.go b/services/gateway-service/internal/rpc/commentv1/comment_grpc.pb.go new file mode 100644 index 0000000..2924d9c --- /dev/null +++ b/services/gateway-service/internal/rpc/commentv1/comment_grpc.pb.go @@ -0,0 +1,250 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.23.4 +// source: comment.proto + +package commentv1 + +import ( + context "context" + 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 +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// CommentServiceClient is the client API for CommentService service. +// +// 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 CommentServiceClient interface { + CreateComment(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*Comment, error) + UpdateComment(ctx context.Context, in *UpdateCommentRequest, opts ...grpc.CallOption) (*Comment, error) + DeleteComment(ctx context.Context, in *DeleteCommentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + GetComment(ctx context.Context, in *GetCommentRequest, opts ...grpc.CallOption) (*Comment, error) + GetPostComments(ctx context.Context, in *GetPostCommentsRequest, opts ...grpc.CallOption) (*PostComments, error) +} + +type commentServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCommentServiceClient(cc grpc.ClientConnInterface) CommentServiceClient { + return &commentServiceClient{cc} +} + +func (c *commentServiceClient) CreateComment(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*Comment, error) { + out := new(Comment) + err := c.cc.Invoke(ctx, "/panels.comment.v1.CommentService/CreateComment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commentServiceClient) UpdateComment(ctx context.Context, in *UpdateCommentRequest, opts ...grpc.CallOption) (*Comment, error) { + out := new(Comment) + err := c.cc.Invoke(ctx, "/panels.comment.v1.CommentService/UpdateComment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commentServiceClient) DeleteComment(ctx context.Context, in *DeleteCommentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/panels.comment.v1.CommentService/DeleteComment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commentServiceClient) GetComment(ctx context.Context, in *GetCommentRequest, opts ...grpc.CallOption) (*Comment, error) { + out := new(Comment) + err := c.cc.Invoke(ctx, "/panels.comment.v1.CommentService/GetComment", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *commentServiceClient) GetPostComments(ctx context.Context, in *GetPostCommentsRequest, opts ...grpc.CallOption) (*PostComments, error) { + out := new(PostComments) + err := c.cc.Invoke(ctx, "/panels.comment.v1.CommentService/GetPostComments", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CommentServiceServer is the server API for CommentService service. +// All implementations must embed UnimplementedCommentServiceServer +// for forward compatibility +type CommentServiceServer interface { + CreateComment(context.Context, *CreateCommentRequest) (*Comment, error) + UpdateComment(context.Context, *UpdateCommentRequest) (*Comment, error) + DeleteComment(context.Context, *DeleteCommentRequest) (*emptypb.Empty, error) + GetComment(context.Context, *GetCommentRequest) (*Comment, error) + GetPostComments(context.Context, *GetPostCommentsRequest) (*PostComments, error) + mustEmbedUnimplementedCommentServiceServer() +} + +// UnimplementedCommentServiceServer must be embedded to have forward compatible implementations. +type UnimplementedCommentServiceServer struct { +} + +func (UnimplementedCommentServiceServer) CreateComment(context.Context, *CreateCommentRequest) (*Comment, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateComment not implemented") +} +func (UnimplementedCommentServiceServer) UpdateComment(context.Context, *UpdateCommentRequest) (*Comment, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateComment not implemented") +} +func (UnimplementedCommentServiceServer) DeleteComment(context.Context, *DeleteCommentRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteComment not implemented") +} +func (UnimplementedCommentServiceServer) GetComment(context.Context, *GetCommentRequest) (*Comment, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetComment not implemented") +} +func (UnimplementedCommentServiceServer) GetPostComments(context.Context, *GetPostCommentsRequest) (*PostComments, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPostComments not implemented") +} +func (UnimplementedCommentServiceServer) mustEmbedUnimplementedCommentServiceServer() {} + +// UnsafeCommentServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CommentServiceServer will +// result in compilation errors. +type UnsafeCommentServiceServer interface { + mustEmbedUnimplementedCommentServiceServer() +} + +func RegisterCommentServiceServer(s grpc.ServiceRegistrar, srv CommentServiceServer) { + s.RegisterService(&CommentService_ServiceDesc, srv) +} + +func _CommentService_CreateComment_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.(CommentServiceServer).CreateComment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.comment.v1.CommentService/CreateComment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommentServiceServer).CreateComment(ctx, req.(*CreateCommentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommentService_UpdateComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateCommentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommentServiceServer).UpdateComment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.comment.v1.CommentService/UpdateComment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommentServiceServer).UpdateComment(ctx, req.(*UpdateCommentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommentService_DeleteComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteCommentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommentServiceServer).DeleteComment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.comment.v1.CommentService/DeleteComment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommentServiceServer).DeleteComment(ctx, req.(*DeleteCommentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommentService_GetComment_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.(CommentServiceServer).GetComment(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.comment.v1.CommentService/GetComment", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommentServiceServer).GetComment(ctx, req.(*GetCommentRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CommentService_GetPostComments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPostCommentsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CommentServiceServer).GetPostComments(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.comment.v1.CommentService/GetPostComments", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CommentServiceServer).GetPostComments(ctx, req.(*GetPostCommentsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CommentService_ServiceDesc is the grpc.ServiceDesc for CommentService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CommentService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "panels.comment.v1.CommentService", + HandlerType: (*CommentServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateComment", + Handler: _CommentService_CreateComment_Handler, + }, + { + MethodName: "UpdateComment", + Handler: _CommentService_UpdateComment_Handler, + }, + { + MethodName: "DeleteComment", + Handler: _CommentService_DeleteComment_Handler, + }, + { + MethodName: "GetComment", + Handler: _CommentService_GetComment_Handler, + }, + { + MethodName: "GetPostComments", + Handler: _CommentService_GetPostComments_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "comment.proto", +} diff --git a/services/gateway-service/internal/rpc/panelv1/panel.pb.go b/services/gateway-service/internal/rpc/panelv1/panel.pb.go new file mode 100644 index 0000000..aab4723 --- /dev/null +++ b/services/gateway-service/internal/rpc/panelv1/panel.pb.go @@ -0,0 +1,861 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.23.4 +// source: panel.proto + +package panelv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Panel struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *Panel) Reset() { + *x = Panel{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Panel) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Panel) ProtoMessage() {} + +func (x *Panel) ProtoReflect() protoreflect.Message { + mi := &file_panel_proto_msgTypes[0] + 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 Panel.ProtoReflect.Descriptor instead. +func (*Panel) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{0} +} + +func (x *Panel) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Panel) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Panel) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Panel) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *Panel) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +type PanelMutable struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name,proto3,oneof" json:"name,omitempty"` + Description *string `protobuf:"bytes,2,opt,name=description,proto3,oneof" json:"description,omitempty"` +} + +func (x *PanelMutable) Reset() { + *x = PanelMutable{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PanelMutable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PanelMutable) ProtoMessage() {} + +func (x *PanelMutable) ProtoReflect() protoreflect.Message { + mi := &file_panel_proto_msgTypes[1] + 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 PanelMutable.ProtoReflect.Descriptor instead. +func (*PanelMutable) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{1} +} + +func (x *PanelMutable) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *PanelMutable) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +type CreatePanelRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *PanelMutable `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *CreatePanelRequest) Reset() { + *x = CreatePanelRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreatePanelRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePanelRequest) ProtoMessage() {} + +func (x *CreatePanelRequest) ProtoReflect() protoreflect.Message { + mi := &file_panel_proto_msgTypes[2] + 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 CreatePanelRequest.ProtoReflect.Descriptor instead. +func (*CreatePanelRequest) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{2} +} + +func (x *CreatePanelRequest) GetData() *PanelMutable { + if x != nil { + return x.Data + } + return nil +} + +type GetPanelByIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetPanelByIdRequest) Reset() { + *x = GetPanelByIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPanelByIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPanelByIdRequest) ProtoMessage() {} + +func (x *GetPanelByIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_panel_proto_msgTypes[3] + 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 GetPanelByIdRequest.ProtoReflect.Descriptor instead. +func (*GetPanelByIdRequest) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{3} +} + +func (x *GetPanelByIdRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetPanelByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetPanelByNameRequest) Reset() { + *x = GetPanelByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPanelByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPanelByNameRequest) ProtoMessage() {} + +func (x *GetPanelByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_panel_proto_msgTypes[4] + 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 GetPanelByNameRequest.ProtoReflect.Descriptor instead. +func (*GetPanelByNameRequest) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{4} +} + +func (x *GetPanelByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type UpdatePanelByIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Data *PanelMutable `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *UpdatePanelByIdRequest) Reset() { + *x = UpdatePanelByIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePanelByIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePanelByIdRequest) ProtoMessage() {} + +func (x *UpdatePanelByIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_panel_proto_msgTypes[5] + 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 UpdatePanelByIdRequest.ProtoReflect.Descriptor instead. +func (*UpdatePanelByIdRequest) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdatePanelByIdRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdatePanelByIdRequest) GetData() *PanelMutable { + if x != nil { + return x.Data + } + return nil +} + +type UpdatePanelByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Data *PanelMutable `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *UpdatePanelByNameRequest) Reset() { + *x = UpdatePanelByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePanelByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePanelByNameRequest) ProtoMessage() {} + +func (x *UpdatePanelByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_panel_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 UpdatePanelByNameRequest.ProtoReflect.Descriptor instead. +func (*UpdatePanelByNameRequest) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdatePanelByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdatePanelByNameRequest) GetData() *PanelMutable { + if x != nil { + return x.Data + } + return nil +} + +type DeletePanelByIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeletePanelByIdRequest) Reset() { + *x = DeletePanelByIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePanelByIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePanelByIdRequest) ProtoMessage() {} + +func (x *DeletePanelByIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_panel_proto_msgTypes[7] + 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 DeletePanelByIdRequest.ProtoReflect.Descriptor instead. +func (*DeletePanelByIdRequest) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{7} +} + +func (x *DeletePanelByIdRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeletePanelByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *DeletePanelByNameRequest) Reset() { + *x = DeletePanelByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePanelByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePanelByNameRequest) ProtoMessage() {} + +func (x *DeletePanelByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_panel_proto_msgTypes[8] + 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 DeletePanelByNameRequest.ProtoReflect.Descriptor instead. +func (*DeletePanelByNameRequest) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{8} +} + +func (x *DeletePanelByNameRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// Kafka Event Schema +type PanelEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Data *Panel `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *PanelEvent) Reset() { + *x = PanelEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_panel_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PanelEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PanelEvent) ProtoMessage() {} + +func (x *PanelEvent) ProtoReflect() protoreflect.Message { + mi := &file_panel_proto_msgTypes[9] + 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 PanelEvent.ProtoReflect.Descriptor instead. +func (*PanelEvent) Descriptor() ([]byte, []int) { + return file_panel_proto_rawDescGZIP(), []int{9} +} + +func (x *PanelEvent) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *PanelEvent) GetData() *Panel { + if x != nil { + return x.Data + } + return nil +} + +var File_panel_proto protoreflect.FileDescriptor + +var file_panel_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x70, + 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 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, 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, 0x22, 0xc3, 0x01, 0x0a, + 0x05, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0a, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 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, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 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, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x41, 0x74, 0x22, 0x67, 0x0a, 0x0c, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x4d, 0x75, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x01, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x47, 0x0a, 0x12, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x31, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1d, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, + 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x22, 0x25, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, + 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x15, 0x47, + 0x65, 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x5b, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x31, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1d, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, + 0x76, 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x61, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, + 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x4d, 0x75, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x28, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x22, 0x2e, 0x0a, 0x18, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, + 0x6c, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x22, 0x4c, 0x0a, 0x0a, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, + 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x32, 0xd4, 0x04, 0x0a, 0x0c, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x4c, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, + 0x12, 0x23, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, + 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x22, 0x00, 0x12, + 0x4a, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x12, 0x24, 0x2e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0e, 0x47, + 0x65, 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x2e, + 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, + 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x22, 0x00, 0x12, + 0x50, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x12, 0x27, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x49, 0x64, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x22, + 0x00, 0x12, 0x58, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, + 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, + 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x0b, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x12, 0x27, 0x2e, 0x70, 0x61, 0x6e, + 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x49, 0x64, 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, 0x00, 0x12, 0x58, 0x0a, + 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x42, 0x79, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x29, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x61, 0x6e, 0x65, + 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x6e, 0x65, 0x6c, + 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 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, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_panel_proto_rawDescOnce sync.Once + file_panel_proto_rawDescData = file_panel_proto_rawDesc +) + +func file_panel_proto_rawDescGZIP() []byte { + file_panel_proto_rawDescOnce.Do(func() { + file_panel_proto_rawDescData = protoimpl.X.CompressGZIP(file_panel_proto_rawDescData) + }) + return file_panel_proto_rawDescData +} + +var file_panel_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_panel_proto_goTypes = []interface{}{ + (*Panel)(nil), // 0: panels.panel.v1.Panel + (*PanelMutable)(nil), // 1: panels.panel.v1.PanelMutable + (*CreatePanelRequest)(nil), // 2: panels.panel.v1.CreatePanelRequest + (*GetPanelByIdRequest)(nil), // 3: panels.panel.v1.GetPanelByIdRequest + (*GetPanelByNameRequest)(nil), // 4: panels.panel.v1.GetPanelByNameRequest + (*UpdatePanelByIdRequest)(nil), // 5: panels.panel.v1.UpdatePanelByIdRequest + (*UpdatePanelByNameRequest)(nil), // 6: panels.panel.v1.UpdatePanelByNameRequest + (*DeletePanelByIdRequest)(nil), // 7: panels.panel.v1.DeletePanelByIdRequest + (*DeletePanelByNameRequest)(nil), // 8: panels.panel.v1.DeletePanelByNameRequest + (*PanelEvent)(nil), // 9: panels.panel.v1.PanelEvent + (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 11: google.protobuf.Empty +} +var file_panel_proto_depIdxs = []int32{ + 10, // 0: panels.panel.v1.Panel.created_at:type_name -> google.protobuf.Timestamp + 10, // 1: panels.panel.v1.Panel.updated_at:type_name -> google.protobuf.Timestamp + 1, // 2: panels.panel.v1.CreatePanelRequest.data:type_name -> panels.panel.v1.PanelMutable + 1, // 3: panels.panel.v1.UpdatePanelByIdRequest.data:type_name -> panels.panel.v1.PanelMutable + 1, // 4: panels.panel.v1.UpdatePanelByNameRequest.data:type_name -> panels.panel.v1.PanelMutable + 0, // 5: panels.panel.v1.PanelEvent.data:type_name -> panels.panel.v1.Panel + 2, // 6: panels.panel.v1.PanelService.CreatePanel:input_type -> panels.panel.v1.CreatePanelRequest + 3, // 7: panels.panel.v1.PanelService.GetPanel:input_type -> panels.panel.v1.GetPanelByIdRequest + 4, // 8: panels.panel.v1.PanelService.GetPanelByName:input_type -> panels.panel.v1.GetPanelByNameRequest + 5, // 9: panels.panel.v1.PanelService.UpdatePanel:input_type -> panels.panel.v1.UpdatePanelByIdRequest + 6, // 10: panels.panel.v1.PanelService.UpdatePanelByName:input_type -> panels.panel.v1.UpdatePanelByNameRequest + 7, // 11: panels.panel.v1.PanelService.DeletePanel:input_type -> panels.panel.v1.DeletePanelByIdRequest + 8, // 12: panels.panel.v1.PanelService.DeletePanelByName:input_type -> panels.panel.v1.DeletePanelByNameRequest + 0, // 13: panels.panel.v1.PanelService.CreatePanel:output_type -> panels.panel.v1.Panel + 0, // 14: panels.panel.v1.PanelService.GetPanel:output_type -> panels.panel.v1.Panel + 0, // 15: panels.panel.v1.PanelService.GetPanelByName:output_type -> panels.panel.v1.Panel + 0, // 16: panels.panel.v1.PanelService.UpdatePanel:output_type -> panels.panel.v1.Panel + 0, // 17: panels.panel.v1.PanelService.UpdatePanelByName:output_type -> panels.panel.v1.Panel + 11, // 18: panels.panel.v1.PanelService.DeletePanel:output_type -> google.protobuf.Empty + 11, // 19: panels.panel.v1.PanelService.DeletePanelByName:output_type -> google.protobuf.Empty + 13, // [13:20] is the sub-list for method output_type + 6, // [6:13] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_panel_proto_init() } +func file_panel_proto_init() { + if File_panel_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_panel_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Panel); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_panel_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PanelMutable); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_panel_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePanelRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_panel_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPanelByIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_panel_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPanelByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_panel_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePanelByIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_panel_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePanelByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_panel_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePanelByIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_panel_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePanelByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_panel_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PanelEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_panel_proto_msgTypes[1].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_panel_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_panel_proto_goTypes, + DependencyIndexes: file_panel_proto_depIdxs, + MessageInfos: file_panel_proto_msgTypes, + }.Build() + File_panel_proto = out.File + file_panel_proto_rawDesc = nil + file_panel_proto_goTypes = nil + file_panel_proto_depIdxs = nil +} diff --git a/services/gateway-service/internal/rpc/panelv1/panel_grpc.pb.go b/services/gateway-service/internal/rpc/panelv1/panel_grpc.pb.go new file mode 100644 index 0000000..74a0694 --- /dev/null +++ b/services/gateway-service/internal/rpc/panelv1/panel_grpc.pb.go @@ -0,0 +1,322 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.23.4 +// source: panel.proto + +package panelv1 + +import ( + context "context" + 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 +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// PanelServiceClient is the client API for PanelService service. +// +// 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 PanelServiceClient interface { + CreatePanel(ctx context.Context, in *CreatePanelRequest, opts ...grpc.CallOption) (*Panel, error) + GetPanel(ctx context.Context, in *GetPanelByIdRequest, opts ...grpc.CallOption) (*Panel, error) + GetPanelByName(ctx context.Context, in *GetPanelByNameRequest, opts ...grpc.CallOption) (*Panel, error) + UpdatePanel(ctx context.Context, in *UpdatePanelByIdRequest, opts ...grpc.CallOption) (*Panel, error) + UpdatePanelByName(ctx context.Context, in *UpdatePanelByNameRequest, opts ...grpc.CallOption) (*Panel, error) + DeletePanel(ctx context.Context, in *DeletePanelByIdRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + DeletePanelByName(ctx context.Context, in *DeletePanelByNameRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type panelServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPanelServiceClient(cc grpc.ClientConnInterface) PanelServiceClient { + return &panelServiceClient{cc} +} + +func (c *panelServiceClient) CreatePanel(ctx context.Context, in *CreatePanelRequest, opts ...grpc.CallOption) (*Panel, error) { + out := new(Panel) + err := c.cc.Invoke(ctx, "/panels.panel.v1.PanelService/CreatePanel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *panelServiceClient) GetPanel(ctx context.Context, in *GetPanelByIdRequest, opts ...grpc.CallOption) (*Panel, error) { + out := new(Panel) + err := c.cc.Invoke(ctx, "/panels.panel.v1.PanelService/GetPanel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *panelServiceClient) GetPanelByName(ctx context.Context, in *GetPanelByNameRequest, opts ...grpc.CallOption) (*Panel, error) { + out := new(Panel) + err := c.cc.Invoke(ctx, "/panels.panel.v1.PanelService/GetPanelByName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *panelServiceClient) UpdatePanel(ctx context.Context, in *UpdatePanelByIdRequest, opts ...grpc.CallOption) (*Panel, error) { + out := new(Panel) + err := c.cc.Invoke(ctx, "/panels.panel.v1.PanelService/UpdatePanel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *panelServiceClient) UpdatePanelByName(ctx context.Context, in *UpdatePanelByNameRequest, opts ...grpc.CallOption) (*Panel, error) { + out := new(Panel) + err := c.cc.Invoke(ctx, "/panels.panel.v1.PanelService/UpdatePanelByName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *panelServiceClient) DeletePanel(ctx context.Context, in *DeletePanelByIdRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/panels.panel.v1.PanelService/DeletePanel", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *panelServiceClient) DeletePanelByName(ctx context.Context, in *DeletePanelByNameRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/panels.panel.v1.PanelService/DeletePanelByName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PanelServiceServer is the server API for PanelService service. +// All implementations must embed UnimplementedPanelServiceServer +// for forward compatibility +type PanelServiceServer interface { + CreatePanel(context.Context, *CreatePanelRequest) (*Panel, error) + GetPanel(context.Context, *GetPanelByIdRequest) (*Panel, error) + GetPanelByName(context.Context, *GetPanelByNameRequest) (*Panel, error) + UpdatePanel(context.Context, *UpdatePanelByIdRequest) (*Panel, error) + UpdatePanelByName(context.Context, *UpdatePanelByNameRequest) (*Panel, error) + DeletePanel(context.Context, *DeletePanelByIdRequest) (*emptypb.Empty, error) + DeletePanelByName(context.Context, *DeletePanelByNameRequest) (*emptypb.Empty, error) + mustEmbedUnimplementedPanelServiceServer() +} + +// UnimplementedPanelServiceServer must be embedded to have forward compatible implementations. +type UnimplementedPanelServiceServer struct { +} + +func (UnimplementedPanelServiceServer) CreatePanel(context.Context, *CreatePanelRequest) (*Panel, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreatePanel not implemented") +} +func (UnimplementedPanelServiceServer) GetPanel(context.Context, *GetPanelByIdRequest) (*Panel, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPanel not implemented") +} +func (UnimplementedPanelServiceServer) GetPanelByName(context.Context, *GetPanelByNameRequest) (*Panel, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPanelByName not implemented") +} +func (UnimplementedPanelServiceServer) UpdatePanel(context.Context, *UpdatePanelByIdRequest) (*Panel, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatePanel not implemented") +} +func (UnimplementedPanelServiceServer) UpdatePanelByName(context.Context, *UpdatePanelByNameRequest) (*Panel, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatePanelByName not implemented") +} +func (UnimplementedPanelServiceServer) DeletePanel(context.Context, *DeletePanelByIdRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePanel not implemented") +} +func (UnimplementedPanelServiceServer) DeletePanelByName(context.Context, *DeletePanelByNameRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePanelByName not implemented") +} +func (UnimplementedPanelServiceServer) mustEmbedUnimplementedPanelServiceServer() {} + +// UnsafePanelServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PanelServiceServer will +// result in compilation errors. +type UnsafePanelServiceServer interface { + mustEmbedUnimplementedPanelServiceServer() +} + +func RegisterPanelServiceServer(s grpc.ServiceRegistrar, srv PanelServiceServer) { + s.RegisterService(&PanelService_ServiceDesc, srv) +} + +func _PanelService_CreatePanel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePanelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PanelServiceServer).CreatePanel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.panel.v1.PanelService/CreatePanel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PanelServiceServer).CreatePanel(ctx, req.(*CreatePanelRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PanelService_GetPanel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPanelByIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PanelServiceServer).GetPanel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.panel.v1.PanelService/GetPanel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PanelServiceServer).GetPanel(ctx, req.(*GetPanelByIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PanelService_GetPanelByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPanelByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PanelServiceServer).GetPanelByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.panel.v1.PanelService/GetPanelByName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PanelServiceServer).GetPanelByName(ctx, req.(*GetPanelByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PanelService_UpdatePanel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdatePanelByIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PanelServiceServer).UpdatePanel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.panel.v1.PanelService/UpdatePanel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PanelServiceServer).UpdatePanel(ctx, req.(*UpdatePanelByIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PanelService_UpdatePanelByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdatePanelByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PanelServiceServer).UpdatePanelByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.panel.v1.PanelService/UpdatePanelByName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PanelServiceServer).UpdatePanelByName(ctx, req.(*UpdatePanelByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PanelService_DeletePanel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePanelByIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PanelServiceServer).DeletePanel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.panel.v1.PanelService/DeletePanel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PanelServiceServer).DeletePanel(ctx, req.(*DeletePanelByIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PanelService_DeletePanelByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePanelByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PanelServiceServer).DeletePanelByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.panel.v1.PanelService/DeletePanelByName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PanelServiceServer).DeletePanelByName(ctx, req.(*DeletePanelByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PanelService_ServiceDesc is the grpc.ServiceDesc for PanelService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PanelService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "panels.panel.v1.PanelService", + HandlerType: (*PanelServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreatePanel", + Handler: _PanelService_CreatePanel_Handler, + }, + { + MethodName: "GetPanel", + Handler: _PanelService_GetPanel_Handler, + }, + { + MethodName: "GetPanelByName", + Handler: _PanelService_GetPanelByName_Handler, + }, + { + MethodName: "UpdatePanel", + Handler: _PanelService_UpdatePanel_Handler, + }, + { + MethodName: "UpdatePanelByName", + Handler: _PanelService_UpdatePanelByName_Handler, + }, + { + MethodName: "DeletePanel", + Handler: _PanelService_DeletePanel_Handler, + }, + { + MethodName: "DeletePanelByName", + Handler: _PanelService_DeletePanelByName_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "panel.proto", +} diff --git a/services/gateway-service/internal/rpc/postv1/post.pb.go b/services/gateway-service/internal/rpc/postv1/post.pb.go new file mode 100644 index 0000000..0477e8d --- /dev/null +++ b/services/gateway-service/internal/rpc/postv1/post.pb.go @@ -0,0 +1,1145 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.23.4 +// source: post.proto + +package postv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Post struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + PanelId string `protobuf:"bytes,2,opt,name=panel_id,json=panelId,proto3" json:"panel_id,omitempty"` // External Ref: Panel Id + AuthorId string `protobuf:"bytes,3,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"` // External Ref: User Id + Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"` + Content string `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *Post) Reset() { + *x = Post{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Post) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Post) ProtoMessage() {} + +func (x *Post) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[0] + 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 Post.ProtoReflect.Descriptor instead. +func (*Post) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{0} +} + +func (x *Post) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Post) GetPanelId() string { + if x != nil { + return x.PanelId + } + return "" +} + +func (x *Post) GetAuthorId() string { + if x != nil { + return x.AuthorId + } + return "" +} + +func (x *Post) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Post) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *Post) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *Post) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +type PostMutable struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title *string `protobuf:"bytes,1,opt,name=title,proto3,oneof" json:"title,omitempty"` + Content *string `protobuf:"bytes,2,opt,name=content,proto3,oneof" json:"content,omitempty"` +} + +func (x *PostMutable) Reset() { + *x = PostMutable{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostMutable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostMutable) ProtoMessage() {} + +func (x *PostMutable) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[1] + 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 PostMutable.ProtoReflect.Descriptor instead. +func (*PostMutable) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{1} +} + +func (x *PostMutable) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *PostMutable) GetContent() string { + if x != nil && x.Content != nil { + return *x.Content + } + return "" +} + +type CreatePostRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PanelId string `protobuf:"bytes,1,opt,name=panel_id,json=panelId,proto3" json:"panel_id,omitempty"` // External Ref: Panel Id + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // External Ref: User Id + Data *PostMutable `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *CreatePostRequest) Reset() { + *x = CreatePostRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreatePostRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePostRequest) ProtoMessage() {} + +func (x *CreatePostRequest) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[2] + 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 CreatePostRequest.ProtoReflect.Descriptor instead. +func (*CreatePostRequest) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{2} +} + +func (x *CreatePostRequest) GetPanelId() string { + if x != nil { + return x.PanelId + } + return "" +} + +func (x *CreatePostRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *CreatePostRequest) GetData() *PostMutable { + if x != nil { + return x.Data + } + return nil +} + +type GetPostRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetPostRequest) Reset() { + *x = GetPostRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPostRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPostRequest) ProtoMessage() {} + +func (x *GetPostRequest) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[3] + 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 GetPostRequest.ProtoReflect.Descriptor instead. +func (*GetPostRequest) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{3} +} + +func (x *GetPostRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetPanelPostRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PanelId string `protobuf:"bytes,1,opt,name=panel_id,json=panelId,proto3" json:"panel_id,omitempty"` // External Ref: Panel Id + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetPanelPostRequest) Reset() { + *x = GetPanelPostRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPanelPostRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPanelPostRequest) ProtoMessage() {} + +func (x *GetPanelPostRequest) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[4] + 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 GetPanelPostRequest.ProtoReflect.Descriptor instead. +func (*GetPanelPostRequest) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{4} +} + +func (x *GetPanelPostRequest) GetPanelId() string { + if x != nil { + return x.PanelId + } + return "" +} + +func (x *GetPanelPostRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type UpdatePostRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Data *PostMutable `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *UpdatePostRequest) Reset() { + *x = UpdatePostRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePostRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePostRequest) ProtoMessage() {} + +func (x *UpdatePostRequest) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[5] + 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 UpdatePostRequest.ProtoReflect.Descriptor instead. +func (*UpdatePostRequest) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdatePostRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdatePostRequest) GetData() *PostMutable { + if x != nil { + return x.Data + } + return nil +} + +type DeletePostRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeletePostRequest) Reset() { + *x = DeletePostRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePostRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePostRequest) ProtoMessage() {} + +func (x *DeletePostRequest) ProtoReflect() protoreflect.Message { + mi := &file_post_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 DeletePostRequest.ProtoReflect.Descriptor instead. +func (*DeletePostRequest) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{6} +} + +func (x *DeletePostRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetFeedPostsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetFeedPostsRequest) Reset() { + *x = GetFeedPostsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFeedPostsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFeedPostsRequest) ProtoMessage() {} + +func (x *GetFeedPostsRequest) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[7] + 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 GetFeedPostsRequest.ProtoReflect.Descriptor instead. +func (*GetFeedPostsRequest) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{7} +} + +type FeedPosts struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Posts []*Post `protobuf:"bytes,1,rep,name=posts,proto3" json:"posts,omitempty"` +} + +func (x *FeedPosts) Reset() { + *x = FeedPosts{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FeedPosts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FeedPosts) ProtoMessage() {} + +func (x *FeedPosts) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[8] + 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 FeedPosts.ProtoReflect.Descriptor instead. +func (*FeedPosts) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{8} +} + +func (x *FeedPosts) GetPosts() []*Post { + if x != nil { + return x.Posts + } + return nil +} + +type GetUserPostsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // External Ref: User Id +} + +func (x *GetUserPostsRequest) Reset() { + *x = GetUserPostsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserPostsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserPostsRequest) ProtoMessage() {} + +func (x *GetUserPostsRequest) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[9] + 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 GetUserPostsRequest.ProtoReflect.Descriptor instead. +func (*GetUserPostsRequest) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{9} +} + +func (x *GetUserPostsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type UserPosts struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Posts []*Post `protobuf:"bytes,1,rep,name=posts,proto3" json:"posts,omitempty"` +} + +func (x *UserPosts) Reset() { + *x = UserPosts{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserPosts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserPosts) ProtoMessage() {} + +func (x *UserPosts) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[10] + 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 UserPosts.ProtoReflect.Descriptor instead. +func (*UserPosts) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{10} +} + +func (x *UserPosts) GetPosts() []*Post { + if x != nil { + return x.Posts + } + return nil +} + +type GetPanelPostsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PanelId string `protobuf:"bytes,1,opt,name=panel_id,json=panelId,proto3" json:"panel_id,omitempty"` // External Ref: Panel Id +} + +func (x *GetPanelPostsRequest) Reset() { + *x = GetPanelPostsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPanelPostsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPanelPostsRequest) ProtoMessage() {} + +func (x *GetPanelPostsRequest) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[11] + 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 GetPanelPostsRequest.ProtoReflect.Descriptor instead. +func (*GetPanelPostsRequest) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{11} +} + +func (x *GetPanelPostsRequest) GetPanelId() string { + if x != nil { + return x.PanelId + } + return "" +} + +type PanelPosts struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Posts []*Post `protobuf:"bytes,1,rep,name=posts,proto3" json:"posts,omitempty"` +} + +func (x *PanelPosts) Reset() { + *x = PanelPosts{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PanelPosts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PanelPosts) ProtoMessage() {} + +func (x *PanelPosts) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[12] + 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 PanelPosts.ProtoReflect.Descriptor instead. +func (*PanelPosts) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{12} +} + +func (x *PanelPosts) GetPosts() []*Post { + if x != nil { + return x.Posts + } + return nil +} + +// Kafka Event Schema +type PostEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Data *Post `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *PostEvent) Reset() { + *x = PostEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_post_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PostEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PostEvent) ProtoMessage() {} + +func (x *PostEvent) ProtoReflect() protoreflect.Message { + mi := &file_post_proto_msgTypes[13] + 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 PostEvent.ProtoReflect.Descriptor instead. +func (*PostEvent) Descriptor() ([]byte, []int) { + return file_post_proto_rawDescGZIP(), []int{13} +} + +func (x *PostEvent) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *PostEvent) GetData() *Post { + if x != nil { + return x.Data + } + return nil +} + +var File_post_proto protoreflect.FileDescriptor + +var file_post_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 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, 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, 0x22, 0xf4, 0x01, 0x0a, 0x04, 0x50, + 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x1b, + 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, + 0x69, 0x74, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 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, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07, 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, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, + 0x74, 0x22, 0x5d, 0x0a, 0x0b, 0x50, 0x6f, 0x73, 0x74, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, + 0x12, 0x19, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x07, + 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x74, + 0x69, 0x74, 0x6c, 0x65, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x22, 0x78, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x49, 0x64, + 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, + 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x4d, 0x75, 0x74, + 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, 0x0a, 0x0e, 0x47, 0x65, + 0x74, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x40, 0x0a, 0x13, + 0x47, 0x65, 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x54, + 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x2f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, + 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x22, 0x23, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x15, 0x0a, 0x13, 0x47, 0x65, 0x74, + 0x46, 0x65, 0x65, 0x64, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x37, 0x0a, 0x09, 0x46, 0x65, 0x65, 0x64, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x2a, 0x0a, + 0x05, 0x70, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, + 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, + 0x73, 0x74, 0x52, 0x05, 0x70, 0x6f, 0x73, 0x74, 0x73, 0x22, 0x2e, 0x0a, 0x13, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x37, 0x0a, 0x09, 0x55, 0x73, 0x65, + 0x72, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x70, 0x6f, 0x73, 0x74, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, + 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x05, 0x70, 0x6f, 0x73, + 0x74, 0x73, 0x22, 0x31, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x50, 0x6f, + 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x0a, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x50, 0x6f, + 0x73, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x70, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x05, 0x70, 0x6f, 0x73, 0x74, 0x73, 0x22, + 0x49, 0x0a, 0x09, 0x50, 0x6f, 0x73, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, + 0x50, 0x6f, 0x73, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xf3, 0x04, 0x0a, 0x0b, 0x50, + 0x6f, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x21, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, + 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x73, + 0x74, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x1e, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, + 0x50, 0x6f, 0x73, 0x74, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x61, 0x6e, + 0x65, 0x6c, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x23, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, + 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, + 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x73, + 0x74, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x73, + 0x74, 0x12, 0x21, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, + 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, + 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x0a, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6f, 0x73, 0x74, 0x12, 0x21, 0x2e, 0x70, 0x61, 0x6e, + 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x50, 0x6f, 0x73, 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, 0x00, 0x12, 0x50, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x46, 0x65, + 0x65, 0x64, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x23, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, + 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x65, 0x65, 0x64, + 0x50, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, + 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x65, + 0x65, 0x64, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x0c, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x23, 0x2e, 0x70, 0x61, 0x6e, 0x65, + 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x0d, 0x47, + 0x65, 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x24, 0x2e, 0x70, + 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x6f, 0x73, 0x74, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x6e, 0x65, 0x6c, 0x50, 0x6f, 0x73, 0x74, 0x73, 0x22, 0x00, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_post_proto_rawDescOnce sync.Once + file_post_proto_rawDescData = file_post_proto_rawDesc +) + +func file_post_proto_rawDescGZIP() []byte { + file_post_proto_rawDescOnce.Do(func() { + file_post_proto_rawDescData = protoimpl.X.CompressGZIP(file_post_proto_rawDescData) + }) + return file_post_proto_rawDescData +} + +var file_post_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_post_proto_goTypes = []interface{}{ + (*Post)(nil), // 0: panels.post.v1.Post + (*PostMutable)(nil), // 1: panels.post.v1.PostMutable + (*CreatePostRequest)(nil), // 2: panels.post.v1.CreatePostRequest + (*GetPostRequest)(nil), // 3: panels.post.v1.GetPostRequest + (*GetPanelPostRequest)(nil), // 4: panels.post.v1.GetPanelPostRequest + (*UpdatePostRequest)(nil), // 5: panels.post.v1.UpdatePostRequest + (*DeletePostRequest)(nil), // 6: panels.post.v1.DeletePostRequest + (*GetFeedPostsRequest)(nil), // 7: panels.post.v1.GetFeedPostsRequest + (*FeedPosts)(nil), // 8: panels.post.v1.FeedPosts + (*GetUserPostsRequest)(nil), // 9: panels.post.v1.GetUserPostsRequest + (*UserPosts)(nil), // 10: panels.post.v1.UserPosts + (*GetPanelPostsRequest)(nil), // 11: panels.post.v1.GetPanelPostsRequest + (*PanelPosts)(nil), // 12: panels.post.v1.PanelPosts + (*PostEvent)(nil), // 13: panels.post.v1.PostEvent + (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 15: google.protobuf.Empty +} +var file_post_proto_depIdxs = []int32{ + 14, // 0: panels.post.v1.Post.created_at:type_name -> google.protobuf.Timestamp + 14, // 1: panels.post.v1.Post.updated_at:type_name -> google.protobuf.Timestamp + 1, // 2: panels.post.v1.CreatePostRequest.data:type_name -> panels.post.v1.PostMutable + 1, // 3: panels.post.v1.UpdatePostRequest.data:type_name -> panels.post.v1.PostMutable + 0, // 4: panels.post.v1.FeedPosts.posts:type_name -> panels.post.v1.Post + 0, // 5: panels.post.v1.UserPosts.posts:type_name -> panels.post.v1.Post + 0, // 6: panels.post.v1.PanelPosts.posts:type_name -> panels.post.v1.Post + 0, // 7: panels.post.v1.PostEvent.data:type_name -> panels.post.v1.Post + 2, // 8: panels.post.v1.PostService.CreatePost:input_type -> panels.post.v1.CreatePostRequest + 3, // 9: panels.post.v1.PostService.GetPost:input_type -> panels.post.v1.GetPostRequest + 4, // 10: panels.post.v1.PostService.GetPanelPost:input_type -> panels.post.v1.GetPanelPostRequest + 5, // 11: panels.post.v1.PostService.UpdatePost:input_type -> panels.post.v1.UpdatePostRequest + 6, // 12: panels.post.v1.PostService.DeletePost:input_type -> panels.post.v1.DeletePostRequest + 7, // 13: panels.post.v1.PostService.GetFeedPosts:input_type -> panels.post.v1.GetFeedPostsRequest + 9, // 14: panels.post.v1.PostService.GetUserPosts:input_type -> panels.post.v1.GetUserPostsRequest + 11, // 15: panels.post.v1.PostService.GetPanelPosts:input_type -> panels.post.v1.GetPanelPostsRequest + 0, // 16: panels.post.v1.PostService.CreatePost:output_type -> panels.post.v1.Post + 0, // 17: panels.post.v1.PostService.GetPost:output_type -> panels.post.v1.Post + 0, // 18: panels.post.v1.PostService.GetPanelPost:output_type -> panels.post.v1.Post + 0, // 19: panels.post.v1.PostService.UpdatePost:output_type -> panels.post.v1.Post + 15, // 20: panels.post.v1.PostService.DeletePost:output_type -> google.protobuf.Empty + 8, // 21: panels.post.v1.PostService.GetFeedPosts:output_type -> panels.post.v1.FeedPosts + 10, // 22: panels.post.v1.PostService.GetUserPosts:output_type -> panels.post.v1.UserPosts + 12, // 23: panels.post.v1.PostService.GetPanelPosts:output_type -> panels.post.v1.PanelPosts + 16, // [16:24] is the sub-list for method output_type + 8, // [8:16] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_post_proto_init() } +func file_post_proto_init() { + if File_post_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_post_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Post); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostMutable); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePostRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPostRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPanelPostRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePostRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePostRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetFeedPostsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FeedPosts); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserPostsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserPosts); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPanelPostsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PanelPosts); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_post_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PostEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_post_proto_msgTypes[1].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_post_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_post_proto_goTypes, + DependencyIndexes: file_post_proto_depIdxs, + MessageInfos: file_post_proto_msgTypes, + }.Build() + File_post_proto = out.File + file_post_proto_rawDesc = nil + file_post_proto_goTypes = nil + file_post_proto_depIdxs = nil +} diff --git a/services/gateway-service/internal/rpc/postv1/post_grpc.pb.go b/services/gateway-service/internal/rpc/postv1/post_grpc.pb.go new file mode 100644 index 0000000..b004ca4 --- /dev/null +++ b/services/gateway-service/internal/rpc/postv1/post_grpc.pb.go @@ -0,0 +1,358 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.23.4 +// source: post.proto + +package postv1 + +import ( + context "context" + 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 +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// PostServiceClient is the client API for PostService service. +// +// 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 PostServiceClient interface { + CreatePost(ctx context.Context, in *CreatePostRequest, opts ...grpc.CallOption) (*Post, error) + GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*Post, error) + GetPanelPost(ctx context.Context, in *GetPanelPostRequest, opts ...grpc.CallOption) (*Post, error) + UpdatePost(ctx context.Context, in *UpdatePostRequest, opts ...grpc.CallOption) (*Post, error) + DeletePost(ctx context.Context, in *DeletePostRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + GetFeedPosts(ctx context.Context, in *GetFeedPostsRequest, opts ...grpc.CallOption) (*FeedPosts, error) + GetUserPosts(ctx context.Context, in *GetUserPostsRequest, opts ...grpc.CallOption) (*UserPosts, error) + GetPanelPosts(ctx context.Context, in *GetPanelPostsRequest, opts ...grpc.CallOption) (*PanelPosts, error) +} + +type postServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPostServiceClient(cc grpc.ClientConnInterface) PostServiceClient { + return &postServiceClient{cc} +} + +func (c *postServiceClient) CreatePost(ctx context.Context, in *CreatePostRequest, opts ...grpc.CallOption) (*Post, error) { + out := new(Post) + err := c.cc.Invoke(ctx, "/panels.post.v1.PostService/CreatePost", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *postServiceClient) GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*Post, error) { + out := new(Post) + err := c.cc.Invoke(ctx, "/panels.post.v1.PostService/GetPost", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *postServiceClient) GetPanelPost(ctx context.Context, in *GetPanelPostRequest, opts ...grpc.CallOption) (*Post, error) { + out := new(Post) + err := c.cc.Invoke(ctx, "/panels.post.v1.PostService/GetPanelPost", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *postServiceClient) UpdatePost(ctx context.Context, in *UpdatePostRequest, opts ...grpc.CallOption) (*Post, error) { + out := new(Post) + err := c.cc.Invoke(ctx, "/panels.post.v1.PostService/UpdatePost", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *postServiceClient) DeletePost(ctx context.Context, in *DeletePostRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/panels.post.v1.PostService/DeletePost", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *postServiceClient) GetFeedPosts(ctx context.Context, in *GetFeedPostsRequest, opts ...grpc.CallOption) (*FeedPosts, error) { + out := new(FeedPosts) + err := c.cc.Invoke(ctx, "/panels.post.v1.PostService/GetFeedPosts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *postServiceClient) GetUserPosts(ctx context.Context, in *GetUserPostsRequest, opts ...grpc.CallOption) (*UserPosts, error) { + out := new(UserPosts) + err := c.cc.Invoke(ctx, "/panels.post.v1.PostService/GetUserPosts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *postServiceClient) GetPanelPosts(ctx context.Context, in *GetPanelPostsRequest, opts ...grpc.CallOption) (*PanelPosts, error) { + out := new(PanelPosts) + err := c.cc.Invoke(ctx, "/panels.post.v1.PostService/GetPanelPosts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PostServiceServer is the server API for PostService service. +// All implementations must embed UnimplementedPostServiceServer +// for forward compatibility +type PostServiceServer interface { + CreatePost(context.Context, *CreatePostRequest) (*Post, error) + GetPost(context.Context, *GetPostRequest) (*Post, error) + GetPanelPost(context.Context, *GetPanelPostRequest) (*Post, error) + UpdatePost(context.Context, *UpdatePostRequest) (*Post, error) + DeletePost(context.Context, *DeletePostRequest) (*emptypb.Empty, error) + GetFeedPosts(context.Context, *GetFeedPostsRequest) (*FeedPosts, error) + GetUserPosts(context.Context, *GetUserPostsRequest) (*UserPosts, error) + GetPanelPosts(context.Context, *GetPanelPostsRequest) (*PanelPosts, error) + mustEmbedUnimplementedPostServiceServer() +} + +// UnimplementedPostServiceServer must be embedded to have forward compatible implementations. +type UnimplementedPostServiceServer struct { +} + +func (UnimplementedPostServiceServer) CreatePost(context.Context, *CreatePostRequest) (*Post, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreatePost not implemented") +} +func (UnimplementedPostServiceServer) GetPost(context.Context, *GetPostRequest) (*Post, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPost not implemented") +} +func (UnimplementedPostServiceServer) GetPanelPost(context.Context, *GetPanelPostRequest) (*Post, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPanelPost not implemented") +} +func (UnimplementedPostServiceServer) UpdatePost(context.Context, *UpdatePostRequest) (*Post, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatePost not implemented") +} +func (UnimplementedPostServiceServer) DeletePost(context.Context, *DeletePostRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePost not implemented") +} +func (UnimplementedPostServiceServer) GetFeedPosts(context.Context, *GetFeedPostsRequest) (*FeedPosts, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFeedPosts not implemented") +} +func (UnimplementedPostServiceServer) GetUserPosts(context.Context, *GetUserPostsRequest) (*UserPosts, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUserPosts not implemented") +} +func (UnimplementedPostServiceServer) GetPanelPosts(context.Context, *GetPanelPostsRequest) (*PanelPosts, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPanelPosts not implemented") +} +func (UnimplementedPostServiceServer) mustEmbedUnimplementedPostServiceServer() {} + +// UnsafePostServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PostServiceServer will +// result in compilation errors. +type UnsafePostServiceServer interface { + mustEmbedUnimplementedPostServiceServer() +} + +func RegisterPostServiceServer(s grpc.ServiceRegistrar, srv PostServiceServer) { + s.RegisterService(&PostService_ServiceDesc, srv) +} + +func _PostService_CreatePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePostRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PostServiceServer).CreatePost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.post.v1.PostService/CreatePost", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PostServiceServer).CreatePost(ctx, req.(*CreatePostRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PostService_GetPost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPostRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PostServiceServer).GetPost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.post.v1.PostService/GetPost", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PostServiceServer).GetPost(ctx, req.(*GetPostRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PostService_GetPanelPost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPanelPostRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PostServiceServer).GetPanelPost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.post.v1.PostService/GetPanelPost", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PostServiceServer).GetPanelPost(ctx, req.(*GetPanelPostRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PostService_UpdatePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdatePostRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PostServiceServer).UpdatePost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.post.v1.PostService/UpdatePost", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PostServiceServer).UpdatePost(ctx, req.(*UpdatePostRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PostService_DeletePost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePostRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PostServiceServer).DeletePost(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.post.v1.PostService/DeletePost", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PostServiceServer).DeletePost(ctx, req.(*DeletePostRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PostService_GetFeedPosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFeedPostsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PostServiceServer).GetFeedPosts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.post.v1.PostService/GetFeedPosts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PostServiceServer).GetFeedPosts(ctx, req.(*GetFeedPostsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PostService_GetUserPosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserPostsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PostServiceServer).GetUserPosts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.post.v1.PostService/GetUserPosts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PostServiceServer).GetUserPosts(ctx, req.(*GetUserPostsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PostService_GetPanelPosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPanelPostsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PostServiceServer).GetPanelPosts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.post.v1.PostService/GetPanelPosts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PostServiceServer).GetPanelPosts(ctx, req.(*GetPanelPostsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PostService_ServiceDesc is the grpc.ServiceDesc for PostService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PostService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "panels.post.v1.PostService", + HandlerType: (*PostServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreatePost", + Handler: _PostService_CreatePost_Handler, + }, + { + MethodName: "GetPost", + Handler: _PostService_GetPost_Handler, + }, + { + MethodName: "GetPanelPost", + Handler: _PostService_GetPanelPost_Handler, + }, + { + MethodName: "UpdatePost", + Handler: _PostService_UpdatePost_Handler, + }, + { + MethodName: "DeletePost", + Handler: _PostService_DeletePost_Handler, + }, + { + MethodName: "GetFeedPosts", + Handler: _PostService_GetFeedPosts_Handler, + }, + { + MethodName: "GetUserPosts", + Handler: _PostService_GetUserPosts_Handler, + }, + { + MethodName: "GetPanelPosts", + Handler: _PostService_GetPanelPosts_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "post.proto", +} diff --git a/services/gateway-service/internal/rpc/rpc.go b/services/gateway-service/internal/rpc/rpc.go new file mode 100644 index 0000000..aebe6b1 --- /dev/null +++ b/services/gateway-service/internal/rpc/rpc.go @@ -0,0 +1,64 @@ +package rpc + +import ( + "fmt" + + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + + "github.com/hexolan/panels/gateway-service/internal" + "github.com/hexolan/panels/gateway-service/internal/rpc/panelv1" + "github.com/hexolan/panels/gateway-service/internal/rpc/postv1" + "github.com/hexolan/panels/gateway-service/internal/rpc/userv1" + "github.com/hexolan/panels/gateway-service/internal/rpc/authv1" + "github.com/hexolan/panels/gateway-service/internal/rpc/commentv1" +) + +var Svcs RPCServices + +type RPCServices struct { + panelSvcConn *grpc.ClientConn + postSvcConn *grpc.ClientConn + userSvcConn *grpc.ClientConn + authSvcConn *grpc.ClientConn + commentSvcConn *grpc.ClientConn +} + +func (rpcSvcs RPCServices) GetPanelSvc() panelv1.PanelServiceClient { + return panelv1.NewPanelServiceClient(rpcSvcs.panelSvcConn) +} + +func (rpcSvcs RPCServices) GetPostSvc() postv1.PostServiceClient { + return postv1.NewPostServiceClient(rpcSvcs.postSvcConn) +} + +func (rpcSvcs RPCServices) GetUserSvc() userv1.UserServiceClient { + return userv1.NewUserServiceClient(rpcSvcs.userSvcConn) +} + +func (rpcSvcs RPCServices) GetAuthSvc() authv1.AuthServiceClient { + return authv1.NewAuthServiceClient(rpcSvcs.authSvcConn) +} + +func (rpcSvcs RPCServices) GetCommentSvc() commentv1.CommentServiceClient { + return commentv1.NewCommentServiceClient(rpcSvcs.commentSvcConn) +} + +func DialRPCServices(cfg internal.Config) { + Svcs = RPCServices{ + panelSvcConn: dialRPC(cfg.PanelSvcAddr), + postSvcConn: dialRPC(cfg.PostSvcAddr), + userSvcConn: dialRPC(cfg.UserSvcAddr), + authSvcConn: dialRPC(cfg.AuthSvcAddr), + commentSvcConn: dialRPC(cfg.CommentSvcAddr), + } +} + +func dialRPC(addr string) *grpc.ClientConn { + conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + panic(fmt.Sprintf("failed to connect to rpc: %s", addr)) + } + + return conn +} \ No newline at end of file diff --git a/services/gateway-service/internal/rpc/userv1/user.pb.go b/services/gateway-service/internal/rpc/userv1/user.pb.go new file mode 100644 index 0000000..bb9c12a --- /dev/null +++ b/services/gateway-service/internal/rpc/userv1/user.pb.go @@ -0,0 +1,849 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.23.4 +// source: user.proto + +package userv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type User struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + IsAdmin bool `protobuf:"varint,3,opt,name=is_admin,json=isAdmin,proto3" json:"is_admin,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *User) Reset() { + *x = User{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[0] + 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 User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{0} +} + +func (x *User) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *User) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *User) GetIsAdmin() bool { + if x != nil { + return x.IsAdmin + } + return false +} + +func (x *User) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *User) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +type UserMutable struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username *string `protobuf:"bytes,1,opt,name=username,proto3,oneof" json:"username,omitempty"` +} + +func (x *UserMutable) Reset() { + *x = UserMutable{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserMutable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserMutable) ProtoMessage() {} + +func (x *UserMutable) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[1] + 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 UserMutable.ProtoReflect.Descriptor instead. +func (*UserMutable) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{1} +} + +func (x *UserMutable) GetUsername() string { + if x != nil && x.Username != nil { + return *x.Username + } + return "" +} + +type CreateUserRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *UserMutable `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *CreateUserRequest) Reset() { + *x = CreateUserRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserRequest) ProtoMessage() {} + +func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[2] + 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 CreateUserRequest.ProtoReflect.Descriptor instead. +func (*CreateUserRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateUserRequest) GetData() *UserMutable { + if x != nil { + return x.Data + } + return nil +} + +type GetUserByIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetUserByIdRequest) Reset() { + *x = GetUserByIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserByIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByIdRequest) ProtoMessage() {} + +func (x *GetUserByIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[3] + 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 GetUserByIdRequest.ProtoReflect.Descriptor instead. +func (*GetUserByIdRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{3} +} + +func (x *GetUserByIdRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetUserByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` +} + +func (x *GetUserByNameRequest) Reset() { + *x = GetUserByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserByNameRequest) ProtoMessage() {} + +func (x *GetUserByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[4] + 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 GetUserByNameRequest.ProtoReflect.Descriptor instead. +func (*GetUserByNameRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{4} +} + +func (x *GetUserByNameRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +type UpdateUserByIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Data *UserMutable `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *UpdateUserByIdRequest) Reset() { + *x = UpdateUserByIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserByIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserByIdRequest) ProtoMessage() {} + +func (x *UpdateUserByIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[5] + 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 UpdateUserByIdRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserByIdRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateUserByIdRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateUserByIdRequest) GetData() *UserMutable { + if x != nil { + return x.Data + } + return nil +} + +type UpdateUserByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Data *UserMutable `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *UpdateUserByNameRequest) Reset() { + *x = UpdateUserByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateUserByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserByNameRequest) ProtoMessage() {} + +func (x *UpdateUserByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_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 UpdateUserByNameRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserByNameRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateUserByNameRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *UpdateUserByNameRequest) GetData() *UserMutable { + if x != nil { + return x.Data + } + return nil +} + +type DeleteUserByIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteUserByIdRequest) Reset() { + *x = DeleteUserByIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteUserByIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserByIdRequest) ProtoMessage() {} + +func (x *DeleteUserByIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[7] + 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 DeleteUserByIdRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserByIdRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{7} +} + +func (x *DeleteUserByIdRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeleteUserByNameRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` +} + +func (x *DeleteUserByNameRequest) Reset() { + *x = DeleteUserByNameRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteUserByNameRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserByNameRequest) ProtoMessage() {} + +func (x *DeleteUserByNameRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[8] + 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 DeleteUserByNameRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserByNameRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{8} +} + +func (x *DeleteUserByNameRequest) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +// Kafka Event Schema +type UserEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Data *User `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *UserEvent) Reset() { + *x = UserEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserEvent) ProtoMessage() {} + +func (x *UserEvent) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[9] + 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 UserEvent.ProtoReflect.Descriptor instead. +func (*UserEvent) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{9} +} + +func (x *UserEvent) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *UserEvent) GetData() *User { + if x != nil { + return x.Data + } + return nil +} + +var File_user_proto protoreflect.FileDescriptor + +var file_user_proto_rawDesc = []byte{ + 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 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, 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, 0x22, 0xc3, 0x01, 0x0a, 0x04, 0x55, + 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 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, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 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, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x22, 0x3b, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, + 0x1f, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x44, 0x0a, + 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, + 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x22, 0x24, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, + 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x32, 0x0a, 0x14, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x58, 0x0a, + 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, + 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x66, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2f, + 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, + 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x4d, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, + 0x27, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x49, + 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x35, 0x0a, 0x17, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0x49, 0x0a, 0x09, 0x55, 0x73, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xb4, 0x04, 0x0a, 0x0b, 0x55, + 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, + 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x22, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, + 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0d, 0x47, 0x65, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x2e, 0x70, 0x61, + 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, + 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0a, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, + 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x22, 0x00, 0x12, 0x53, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x2e, 0x70, 0x61, 0x6e, + 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, + 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0a, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x61, 0x6e, 0x65, + 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 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, 0x00, 0x12, 0x55, 0x0a, 0x10, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, + 0x2e, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 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, + 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_user_proto_rawDescOnce sync.Once + file_user_proto_rawDescData = file_user_proto_rawDesc +) + +func file_user_proto_rawDescGZIP() []byte { + file_user_proto_rawDescOnce.Do(func() { + file_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_proto_rawDescData) + }) + return file_user_proto_rawDescData +} + +var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_user_proto_goTypes = []interface{}{ + (*User)(nil), // 0: panels.user.v1.User + (*UserMutable)(nil), // 1: panels.user.v1.UserMutable + (*CreateUserRequest)(nil), // 2: panels.user.v1.CreateUserRequest + (*GetUserByIdRequest)(nil), // 3: panels.user.v1.GetUserByIdRequest + (*GetUserByNameRequest)(nil), // 4: panels.user.v1.GetUserByNameRequest + (*UpdateUserByIdRequest)(nil), // 5: panels.user.v1.UpdateUserByIdRequest + (*UpdateUserByNameRequest)(nil), // 6: panels.user.v1.UpdateUserByNameRequest + (*DeleteUserByIdRequest)(nil), // 7: panels.user.v1.DeleteUserByIdRequest + (*DeleteUserByNameRequest)(nil), // 8: panels.user.v1.DeleteUserByNameRequest + (*UserEvent)(nil), // 9: panels.user.v1.UserEvent + (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 11: google.protobuf.Empty +} +var file_user_proto_depIdxs = []int32{ + 10, // 0: panels.user.v1.User.created_at:type_name -> google.protobuf.Timestamp + 10, // 1: panels.user.v1.User.updated_at:type_name -> google.protobuf.Timestamp + 1, // 2: panels.user.v1.CreateUserRequest.data:type_name -> panels.user.v1.UserMutable + 1, // 3: panels.user.v1.UpdateUserByIdRequest.data:type_name -> panels.user.v1.UserMutable + 1, // 4: panels.user.v1.UpdateUserByNameRequest.data:type_name -> panels.user.v1.UserMutable + 0, // 5: panels.user.v1.UserEvent.data:type_name -> panels.user.v1.User + 2, // 6: panels.user.v1.UserService.CreateUser:input_type -> panels.user.v1.CreateUserRequest + 3, // 7: panels.user.v1.UserService.GetUser:input_type -> panels.user.v1.GetUserByIdRequest + 4, // 8: panels.user.v1.UserService.GetUserByName:input_type -> panels.user.v1.GetUserByNameRequest + 5, // 9: panels.user.v1.UserService.UpdateUser:input_type -> panels.user.v1.UpdateUserByIdRequest + 6, // 10: panels.user.v1.UserService.UpdateUserByName:input_type -> panels.user.v1.UpdateUserByNameRequest + 7, // 11: panels.user.v1.UserService.DeleteUser:input_type -> panels.user.v1.DeleteUserByIdRequest + 8, // 12: panels.user.v1.UserService.DeleteUserByName:input_type -> panels.user.v1.DeleteUserByNameRequest + 0, // 13: panels.user.v1.UserService.CreateUser:output_type -> panels.user.v1.User + 0, // 14: panels.user.v1.UserService.GetUser:output_type -> panels.user.v1.User + 0, // 15: panels.user.v1.UserService.GetUserByName:output_type -> panels.user.v1.User + 0, // 16: panels.user.v1.UserService.UpdateUser:output_type -> panels.user.v1.User + 0, // 17: panels.user.v1.UserService.UpdateUserByName:output_type -> panels.user.v1.User + 11, // 18: panels.user.v1.UserService.DeleteUser:output_type -> google.protobuf.Empty + 11, // 19: panels.user.v1.UserService.DeleteUserByName:output_type -> google.protobuf.Empty + 13, // [13:20] is the sub-list for method output_type + 6, // [6:13] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_user_proto_init() } +func file_user_proto_init() { + if File_user_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*User); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserMutable); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateUserRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserByIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetUserByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserByIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateUserByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteUserByIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteUserByNameRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_user_proto_msgTypes[1].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_user_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_user_proto_goTypes, + DependencyIndexes: file_user_proto_depIdxs, + MessageInfos: file_user_proto_msgTypes, + }.Build() + File_user_proto = out.File + file_user_proto_rawDesc = nil + file_user_proto_goTypes = nil + file_user_proto_depIdxs = nil +} diff --git a/services/gateway-service/internal/rpc/userv1/user_grpc.pb.go b/services/gateway-service/internal/rpc/userv1/user_grpc.pb.go new file mode 100644 index 0000000..a2cfefa --- /dev/null +++ b/services/gateway-service/internal/rpc/userv1/user_grpc.pb.go @@ -0,0 +1,322 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.23.4 +// source: user.proto + +package userv1 + +import ( + context "context" + 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 +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// UserServiceClient is the client API for UserService service. +// +// 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 UserServiceClient interface { + CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) + GetUser(ctx context.Context, in *GetUserByIdRequest, opts ...grpc.CallOption) (*User, error) + GetUserByName(ctx context.Context, in *GetUserByNameRequest, opts ...grpc.CallOption) (*User, error) + UpdateUser(ctx context.Context, in *UpdateUserByIdRequest, opts ...grpc.CallOption) (*User, error) + UpdateUserByName(ctx context.Context, in *UpdateUserByNameRequest, opts ...grpc.CallOption) (*User, error) + DeleteUser(ctx context.Context, in *DeleteUserByIdRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + DeleteUserByName(ctx context.Context, in *DeleteUserByNameRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type userServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient { + return &userServiceClient{cc} +} + +func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) { + out := new(User) + err := c.cc.Invoke(ctx, "/panels.user.v1.UserService/CreateUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserByIdRequest, opts ...grpc.CallOption) (*User, error) { + out := new(User) + err := c.cc.Invoke(ctx, "/panels.user.v1.UserService/GetUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) GetUserByName(ctx context.Context, in *GetUserByNameRequest, opts ...grpc.CallOption) (*User, error) { + out := new(User) + err := c.cc.Invoke(ctx, "/panels.user.v1.UserService/GetUserByName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserByIdRequest, opts ...grpc.CallOption) (*User, error) { + out := new(User) + err := c.cc.Invoke(ctx, "/panels.user.v1.UserService/UpdateUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) UpdateUserByName(ctx context.Context, in *UpdateUserByNameRequest, opts ...grpc.CallOption) (*User, error) { + out := new(User) + err := c.cc.Invoke(ctx, "/panels.user.v1.UserService/UpdateUserByName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserByIdRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/panels.user.v1.UserService/DeleteUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) DeleteUserByName(ctx context.Context, in *DeleteUserByNameRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, "/panels.user.v1.UserService/DeleteUserByName", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserServiceServer is the server API for UserService service. +// All implementations must embed UnimplementedUserServiceServer +// for forward compatibility +type UserServiceServer interface { + CreateUser(context.Context, *CreateUserRequest) (*User, error) + GetUser(context.Context, *GetUserByIdRequest) (*User, error) + GetUserByName(context.Context, *GetUserByNameRequest) (*User, error) + UpdateUser(context.Context, *UpdateUserByIdRequest) (*User, error) + UpdateUserByName(context.Context, *UpdateUserByNameRequest) (*User, error) + DeleteUser(context.Context, *DeleteUserByIdRequest) (*emptypb.Empty, error) + DeleteUserByName(context.Context, *DeleteUserByNameRequest) (*emptypb.Empty, error) + mustEmbedUnimplementedUserServiceServer() +} + +// UnimplementedUserServiceServer must be embedded to have forward compatible implementations. +type UnimplementedUserServiceServer struct { +} + +func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*User, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented") +} +func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserByIdRequest) (*User, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented") +} +func (UnimplementedUserServiceServer) GetUserByName(context.Context, *GetUserByNameRequest) (*User, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUserByName not implemented") +} +func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserByIdRequest) (*User, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUser not implemented") +} +func (UnimplementedUserServiceServer) UpdateUserByName(context.Context, *UpdateUserByNameRequest) (*User, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateUserByName not implemented") +} +func (UnimplementedUserServiceServer) DeleteUser(context.Context, *DeleteUserByIdRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteUser not implemented") +} +func (UnimplementedUserServiceServer) DeleteUserByName(context.Context, *DeleteUserByNameRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteUserByName not implemented") +} +func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} + +// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to UserServiceServer will +// result in compilation errors. +type UnsafeUserServiceServer interface { + mustEmbedUnimplementedUserServiceServer() +} + +func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { + s.RegisterService(&UserService_ServiceDesc, srv) +} + +func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).CreateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.user.v1.UserService/CreateUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserByIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).GetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.user.v1.UserService/GetUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserByIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_GetUserByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).GetUserByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.user.v1.UserService/GetUserByName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).GetUserByName(ctx, req.(*GetUserByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserByIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).UpdateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.user.v1.UserService/UpdateUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserByIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_UpdateUserByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).UpdateUserByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.user.v1.UserService/UpdateUserByName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).UpdateUserByName(ctx, req.(*UpdateUserByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserByIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).DeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.user.v1.UserService/DeleteUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).DeleteUser(ctx, req.(*DeleteUserByIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_DeleteUserByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserByNameRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).DeleteUserByName(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panels.user.v1.UserService/DeleteUserByName", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).DeleteUserByName(ctx, req.(*DeleteUserByNameRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var UserService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "panels.user.v1.UserService", + HandlerType: (*UserServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateUser", + Handler: _UserService_CreateUser_Handler, + }, + { + MethodName: "GetUser", + Handler: _UserService_GetUser_Handler, + }, + { + MethodName: "GetUserByName", + Handler: _UserService_GetUserByName_Handler, + }, + { + MethodName: "UpdateUser", + Handler: _UserService_UpdateUser_Handler, + }, + { + MethodName: "UpdateUserByName", + Handler: _UserService_UpdateUserByName_Handler, + }, + { + MethodName: "DeleteUser", + Handler: _UserService_DeleteUser_Handler, + }, + { + MethodName: "DeleteUserByName", + Handler: _UserService_DeleteUserByName_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "user.proto", +}