From 4d9a7a4856e72a43317d0774032a38b82e85b1ca Mon Sep 17 00:00:00 2001
From: Declan Teevan
Date: Wed, 27 Mar 2024 11:12:43 +0000
Subject: [PATCH] style: license headers + gofmt
---
protobufs/auth.proto | 14 +++
protobufs/comment.proto | 64 ++++++++------
protobufs/panel.proto | 68 +++++++++------
protobufs/post.proto | 86 +++++++++++--------
protobufs/user.proto | 64 ++++++++------
.../auth_service/events/base_consumer.py | 14 +++
.../auth_service/events/service.py | 14 +++
.../auth_service/events/user_consumer.py | 14 +++
services/auth-service/auth_service/main.py | 14 +++
.../auth_service/models/config.py | 14 +++
.../auth_service/models/exceptions.py | 14 +++
.../auth_service/models/service.py | 14 +++
.../auth_service/postgres/repository.py | 14 +++
.../auth_service/postgres/service.py | 14 +++
.../auth-service/auth_service/rpc/auth.py | 14 +++
.../auth-service/auth_service/rpc/service.py | 14 +++
services/auth-service/auth_service/service.py | 14 +++
services/auth-service/pyproject.toml | 2 +-
.../comment_service/events/base_consumer.py | 14 +++
.../comment_service/events/post_consumer.py | 14 +++
.../comment_service/events/producer.py | 14 +++
.../comment_service/events/service.py | 14 +++
.../comment_service/events/user_consumer.py | 14 +++
.../comment-service/comment_service/main.py | 14 +++
.../comment_service/models/config.py | 14 +++
.../comment_service/models/exceptions.py | 14 +++
.../comment_service/models/service.py | 14 +++
.../comment_service/postgres/repository.py | 14 +++
.../comment_service/postgres/service.py | 14 +++
.../comment_service/redis/repository.py | 14 +++
.../comment_service/redis/service.py | 14 +++
.../comment_service/rpc/comment.py | 14 +++
.../comment_service/rpc/service.py | 14 +++
.../comment_service/service.py | 14 +++
services/comment-service/pyproject.toml | 2 +-
services/frontend/package.json | 2 +-
.../cmd/gateway-service/main.go | 16 +++-
.../cmd/gateway-service/tools.go | 19 +++-
services/gateway-service/internal/api/api.go | 18 +++-
.../internal/api/handlers/auth.go | 20 ++++-
.../internal/api/handlers/error.go | 32 +++++--
.../gateway-service/internal/api/router.go | 26 ++++--
.../gateway-service/internal/api/v1/auth.go | 24 ++++--
.../internal/api/v1/comment.go | 28 ++++--
.../gateway-service/internal/api/v1/panel.go | 24 ++++--
.../gateway-service/internal/api/v1/post.go | 34 +++++---
.../gateway-service/internal/api/v1/user.go | 28 ++++--
services/gateway-service/internal/config.go | 36 +++++---
.../internal/rpc/authv1/auth.pb.go | 16 +++-
.../internal/rpc/authv1/auth_grpc.pb.go | 34 ++++++--
.../internal/rpc/commentv1/comment.pb.go | 16 +++-
.../internal/rpc/commentv1/comment_grpc.pb.go | 44 +++++++---
.../internal/rpc/panelv1/panel.pb.go | 16 +++-
.../internal/rpc/panelv1/panel_grpc.pb.go | 54 ++++++++----
.../internal/rpc/postv1/post.pb.go | 16 +++-
.../internal/rpc/postv1/post_grpc.pb.go | 59 +++++++++----
services/gateway-service/internal/rpc/rpc.go | 36 +++++---
.../internal/rpc/userv1/user.pb.go | 16 +++-
.../internal/rpc/userv1/user_grpc.pb.go | 54 ++++++++----
.../panel-service/cmd/panel-service/main.go | 18 +++-
.../panel-service/cmd/panel-service/tools.go | 23 ++++-
services/panel-service/internal/config.go | 26 ++++--
services/panel-service/internal/errors.go | 36 +++++---
.../panel-service/internal/kafka/panel.go | 20 ++++-
services/panel-service/internal/panel.go | 24 ++++--
.../panel-service/internal/postgres/panel.go | 24 ++++--
.../internal/postgres/postgres.go | 20 ++++-
.../panel-service/internal/redis/panel.go | 24 ++++--
.../panel-service/internal/redis/redis.go | 30 +++++--
services/panel-service/internal/rpc/panel.go | 20 ++++-
.../internal/rpc/panelv1/conversion.go | 12 +--
.../internal/rpc/panelv1/panel.pb.go | 16 +++-
.../internal/rpc/panelv1/panel_grpc.pb.go | 54 ++++++++----
services/panel-service/internal/rpc/rpc.go | 46 ++++++----
.../panel-service/internal/service/panel.go | 22 ++++-
.../post-service/cmd/post-service/main.go | 22 ++++-
.../post-service/cmd/post-service/tools.go | 23 ++++-
services/post-service/internal/config.go | 26 ++++--
services/post-service/internal/errors.go | 36 +++++---
.../internal/kafka/consumers/panel.go | 26 ++++--
.../kafka/consumers/panelv1/panel.pb.go | 16 +++-
.../kafka/consumers/panelv1/panel_grpc.pb.go | 54 ++++++++----
.../internal/kafka/consumers/user.go | 22 ++++-
.../kafka/consumers/userv1/user.pb.go | 16 +++-
.../kafka/consumers/userv1/user_grpc.pb.go | 54 ++++++++----
services/post-service/internal/kafka/kafka.go | 22 ++++-
.../internal/kafka/producer/post.go | 20 ++++-
services/post-service/internal/post.go | 52 +++++++----
.../post-service/internal/postgres/post.go | 32 +++++--
.../internal/postgres/postgres.go | 20 ++++-
services/post-service/internal/redis/post.go | 24 ++++--
services/post-service/internal/redis/redis.go | 30 +++++--
services/post-service/internal/rpc/post.go | 20 ++++-
.../internal/rpc/postv1/conversion.go | 12 +--
.../internal/rpc/postv1/post.pb.go | 16 +++-
.../internal/rpc/postv1/post_grpc.pb.go | 59 +++++++++----
services/post-service/internal/rpc/rpc.go | 46 ++++++----
.../post-service/internal/service/post.go | 24 ++++--
services/user-service/package.json | 2 +-
services/user-service/src/config.ts | 14 +++
services/user-service/src/kafka/producer.ts | 14 +++
services/user-service/src/main.ts | 14 +++
services/user-service/src/mongo/User.ts | 14 +++
services/user-service/src/proto/convert.ts | 14 +++
.../user-service/src/proto/user_connect.ts | 14 +++
services/user-service/src/proto/user_pb.ts | 14 +++
services/user-service/src/rpc/connect.ts | 14 +++
services/user-service/src/rpc/server.ts | 14 +++
services/user-service/src/service.ts | 14 +++
109 files changed, 2059 insertions(+), 530 deletions(-)
diff --git a/protobufs/auth.proto b/protobufs/auth.proto
index 104c473..66f2995 100644
--- a/protobufs/auth.proto
+++ b/protobufs/auth.proto
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
syntax = "proto3";
package panels.auth.v1;
diff --git a/protobufs/comment.proto b/protobufs/comment.proto
index 14ae49b..4db8449 100644
--- a/protobufs/comment.proto
+++ b/protobufs/comment.proto
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
syntax = "proto3";
package panels.comment.v1;
@@ -6,59 +20,59 @@ import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
service CommentService {
- rpc CreateComment(CreateCommentRequest) returns (Comment) {}
- rpc UpdateComment(UpdateCommentRequest) returns (Comment) {}
- rpc DeleteComment(DeleteCommentRequest) returns (google.protobuf.Empty) {}
-
- rpc GetComment(GetCommentRequest) returns (Comment) {}
- rpc GetPostComments(GetPostCommentsRequest) returns (PostComments) {}
+ rpc CreateComment(CreateCommentRequest) returns (Comment) {}
+ rpc UpdateComment(UpdateCommentRequest) returns (Comment) {}
+ rpc DeleteComment(DeleteCommentRequest) returns (google.protobuf.Empty) {}
+
+ rpc GetComment(GetCommentRequest) returns (Comment) {}
+ rpc GetPostComments(GetPostCommentsRequest) returns (PostComments) {}
}
message Comment {
- string id = 1;
+ string id = 1;
- string post_id = 2; // External Ref: Post Id
- string author_id = 3; // External Ref: User Id
+ string post_id = 2; // External Ref: Post Id
+ string author_id = 3; // External Ref: User Id
- string message = 4;
+ string message = 4;
- google.protobuf.Timestamp created_at = 5;
- google.protobuf.Timestamp updated_at = 6;
+ google.protobuf.Timestamp created_at = 5;
+ google.protobuf.Timestamp updated_at = 6;
}
message CommentMutable {
- string message = 1;
+ string message = 1;
}
message CreateCommentRequest {
- string post_id = 1; // External Ref: Post Id
- string author_id = 2; // External Ref: User Id
- CommentMutable data = 3;
+ string post_id = 1; // External Ref: Post Id
+ string author_id = 2; // External Ref: User Id
+ CommentMutable data = 3;
}
message UpdateCommentRequest {
- string id = 1;
- CommentMutable data = 2;
+ string id = 1;
+ CommentMutable data = 2;
}
message DeleteCommentRequest {
- string id = 1;
+ string id = 1;
}
message GetCommentRequest {
- string id = 1;
+ string id = 1;
}
message GetPostCommentsRequest {
- string post_id = 1;
+ string post_id = 1;
}
message PostComments {
- repeated Comment comments = 1;
+ repeated Comment comments = 1;
}
// Kafka Event Schema
message CommentEvent {
- string type = 1;
- Comment data = 2;
-}
\ No newline at end of file
+ string type = 1;
+ Comment data = 2;
+}
diff --git a/protobufs/panel.proto b/protobufs/panel.proto
index 33476f3..e352fb2 100644
--- a/protobufs/panel.proto
+++ b/protobufs/panel.proto
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
syntax = "proto3";
package panels.panel.v1;
@@ -6,64 +20,64 @@ import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
service PanelService {
- rpc CreatePanel(CreatePanelRequest) returns (Panel) {}
+ rpc CreatePanel(CreatePanelRequest) returns (Panel) {}
- rpc GetPanel(GetPanelByIdRequest) returns (Panel) {}
- rpc GetPanelByName(GetPanelByNameRequest) returns (Panel) {}
+ rpc GetPanel(GetPanelByIdRequest) returns (Panel) {}
+ rpc GetPanelByName(GetPanelByNameRequest) returns (Panel) {}
- rpc UpdatePanel(UpdatePanelByIdRequest) returns (Panel) {}
- rpc UpdatePanelByName(UpdatePanelByNameRequest) returns (Panel) {}
+ rpc UpdatePanel(UpdatePanelByIdRequest) returns (Panel) {}
+ rpc UpdatePanelByName(UpdatePanelByNameRequest) returns (Panel) {}
- rpc DeletePanel(DeletePanelByIdRequest) returns (google.protobuf.Empty) {}
- rpc DeletePanelByName(DeletePanelByNameRequest) returns (google.protobuf.Empty) {}
+ rpc DeletePanel(DeletePanelByIdRequest) returns (google.protobuf.Empty) {}
+ rpc DeletePanelByName(DeletePanelByNameRequest) returns (google.protobuf.Empty) {}
}
message Panel {
- string id = 1;
- string name = 2;
- string description = 3;
-
- google.protobuf.Timestamp created_at = 4;
- google.protobuf.Timestamp updated_at = 5;
+ string id = 1;
+ string name = 2;
+ string description = 3;
+
+ google.protobuf.Timestamp created_at = 4;
+ google.protobuf.Timestamp updated_at = 5;
}
message PanelMutable {
- optional string name = 1;
- optional string description = 2;
+ optional string name = 1;
+ optional string description = 2;
}
message CreatePanelRequest {
- PanelMutable data = 1;
+ PanelMutable data = 1;
}
message GetPanelByIdRequest {
- string id = 1;
+ string id = 1;
}
message GetPanelByNameRequest {
- string name = 1;
+ string name = 1;
}
message UpdatePanelByIdRequest {
- string id = 1;
- PanelMutable data = 2;
+ string id = 1;
+ PanelMutable data = 2;
}
message UpdatePanelByNameRequest {
- string name = 1;
- PanelMutable data = 2;
+ string name = 1;
+ PanelMutable data = 2;
}
message DeletePanelByIdRequest {
- string id = 1;
+ string id = 1;
}
message DeletePanelByNameRequest {
- string name = 1;
+ string name = 1;
}
// Kafka Event Schema
message PanelEvent {
- string type = 1;
- Panel data = 2;
-}
\ No newline at end of file
+ string type = 1;
+ Panel data = 2;
+}
diff --git a/protobufs/post.proto b/protobufs/post.proto
index 920d10f..920ac88 100644
--- a/protobufs/post.proto
+++ b/protobufs/post.proto
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
syntax = "proto3";
package panels.post.v1;
@@ -6,88 +20,86 @@ import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
service PostService {
- rpc CreatePost(CreatePostRequest) returns (Post) {}
+ rpc CreatePost(CreatePostRequest) returns (Post) {}
- rpc GetPost(GetPostRequest) returns (Post) {}
- rpc GetPanelPost(GetPanelPostRequest) returns (Post) {}
+ rpc GetPost(GetPostRequest) returns (Post) {}
+ rpc GetPanelPost(GetPanelPostRequest) returns (Post) {}
- rpc UpdatePost(UpdatePostRequest) returns (Post) {}
+ rpc UpdatePost(UpdatePostRequest) returns (Post) {}
- rpc DeletePost(DeletePostRequest) returns (google.protobuf.Empty) {}
+ rpc DeletePost(DeletePostRequest) returns (google.protobuf.Empty) {}
- rpc GetFeedPosts(GetFeedPostsRequest) returns (FeedPosts) {}
- rpc GetUserPosts(GetUserPostsRequest) returns (UserPosts) {}
- rpc GetPanelPosts(GetPanelPostsRequest) returns (PanelPosts) {}
+ rpc GetFeedPosts(GetFeedPostsRequest) returns (FeedPosts) {}
+ rpc GetUserPosts(GetUserPostsRequest) returns (UserPosts) {}
+ rpc GetPanelPosts(GetPanelPostsRequest) returns (PanelPosts) {}
}
message Post {
- string id = 1;
+ string id = 1;
- string panel_id = 2; // External Ref: Panel Id
- string author_id = 3; // External Ref: User Id
+ string panel_id = 2; // External Ref: Panel Id
+ string author_id = 3; // External Ref: User Id
- string title = 4;
- string content = 5;
+ string title = 4;
+ string content = 5;
- google.protobuf.Timestamp created_at = 6;
- google.protobuf.Timestamp updated_at = 7;
+ google.protobuf.Timestamp created_at = 6;
+ google.protobuf.Timestamp updated_at = 7;
}
message PostMutable {
- optional string title = 1;
- optional string content = 2;
+ optional string title = 1;
+ optional string content = 2;
}
message CreatePostRequest {
- string panel_id = 1; // External Ref: Panel Id
- string user_id = 2; // External Ref: User Id
- PostMutable data = 3;
+ string panel_id = 1; // External Ref: Panel Id
+ string user_id = 2; // External Ref: User Id
+ PostMutable data = 3;
}
message GetPostRequest {
- string id = 1;
+ string id = 1;
}
message GetPanelPostRequest {
- string panel_id = 1; // External Ref: Panel Id
- string id = 2;
+ string panel_id = 1; // External Ref: Panel Id
+ string id = 2;
}
message UpdatePostRequest {
- string id = 1;
- PostMutable data = 2;
+ string id = 1;
+ PostMutable data = 2;
}
message DeletePostRequest {
- string id = 1;
+ string id = 1;
}
-message GetFeedPostsRequest {
-
-}
+message GetFeedPostsRequest {}
message FeedPosts {
- repeated Post posts = 1;
+ repeated Post posts = 1;
}
message GetUserPostsRequest {
- string user_id = 1; // External Ref: User Id
+ string user_id = 1; // External Ref: User Id
}
message UserPosts {
- repeated Post posts = 1;
+ repeated Post posts = 1;
}
message GetPanelPostsRequest {
- string panel_id = 1; // External Ref: Panel Id
+ string panel_id = 1; // External Ref: Panel Id
}
message PanelPosts {
- repeated Post posts = 1;
+ repeated Post posts = 1;
}
// Kafka Event Schema
message PostEvent {
- string type = 1;
- Post data = 2;
-}
\ No newline at end of file
+ string type = 1;
+ Post data = 2;
+}
diff --git a/protobufs/user.proto b/protobufs/user.proto
index 89e92e5..3229bb2 100644
--- a/protobufs/user.proto
+++ b/protobufs/user.proto
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
syntax = "proto3";
package panels.user.v1;
@@ -6,63 +20,63 @@ import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
service UserService {
- rpc CreateUser(CreateUserRequest) returns (User) {}
+ rpc CreateUser(CreateUserRequest) returns (User) {}
- rpc GetUser(GetUserByIdRequest) returns (User) {}
- rpc GetUserByName(GetUserByNameRequest) returns (User) {}
+ rpc GetUser(GetUserByIdRequest) returns (User) {}
+ rpc GetUserByName(GetUserByNameRequest) returns (User) {}
- rpc UpdateUser(UpdateUserByIdRequest) returns (User) {}
- rpc UpdateUserByName(UpdateUserByNameRequest) returns (User) {}
+ rpc UpdateUser(UpdateUserByIdRequest) returns (User) {}
+ rpc UpdateUserByName(UpdateUserByNameRequest) returns (User) {}
- rpc DeleteUser(DeleteUserByIdRequest) returns (google.protobuf.Empty) {}
- rpc DeleteUserByName(DeleteUserByNameRequest) returns (google.protobuf.Empty) {}
+ rpc DeleteUser(DeleteUserByIdRequest) returns (google.protobuf.Empty) {}
+ rpc DeleteUserByName(DeleteUserByNameRequest) returns (google.protobuf.Empty) {}
}
message User {
- string id = 1;
- string username = 2;
- bool is_admin = 3;
+ string id = 1;
+ string username = 2;
+ bool is_admin = 3;
- google.protobuf.Timestamp created_at = 4;
- google.protobuf.Timestamp updated_at = 5;
+ google.protobuf.Timestamp created_at = 4;
+ google.protobuf.Timestamp updated_at = 5;
}
message UserMutable {
- optional string username = 1;
+ optional string username = 1;
}
message CreateUserRequest {
- UserMutable data = 1;
+ UserMutable data = 1;
}
message GetUserByIdRequest {
- string id = 1;
+ string id = 1;
}
message GetUserByNameRequest {
- string username = 1;
+ string username = 1;
}
message UpdateUserByIdRequest {
- string id = 1;
- UserMutable data = 2;
+ string id = 1;
+ UserMutable data = 2;
}
message UpdateUserByNameRequest {
- string username = 1;
- UserMutable data = 2;
+ string username = 1;
+ UserMutable data = 2;
}
message DeleteUserByIdRequest {
- string id = 1;
+ string id = 1;
}
message DeleteUserByNameRequest {
- string username = 1;
+ string username = 1;
}
// Kafka Event Schema
message UserEvent {
- string type = 1;
- User data = 2;
-}
\ No newline at end of file
+ string type = 1;
+ User data = 2;
+}
diff --git a/services/auth-service/auth_service/events/base_consumer.py b/services/auth-service/auth_service/events/base_consumer.py
index 89a881b..6240f21 100644
--- a/services/auth-service/auth_service/events/base_consumer.py
+++ b/services/auth-service/auth_service/events/base_consumer.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
from typing import Type
diff --git a/services/auth-service/auth_service/events/service.py b/services/auth-service/auth_service/events/service.py
index 4d9f6c3..65a0d51 100644
--- a/services/auth-service/auth_service/events/service.py
+++ b/services/auth-service/auth_service/events/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from typing import Type
from auth_service.models.config import Config
diff --git a/services/auth-service/auth_service/events/user_consumer.py b/services/auth-service/auth_service/events/user_consumer.py
index f933731..7eda138 100644
--- a/services/auth-service/auth_service/events/user_consumer.py
+++ b/services/auth-service/auth_service/events/user_consumer.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
from auth_service.models.proto import user_pb2
diff --git a/services/auth-service/auth_service/main.py b/services/auth-service/auth_service/main.py
index ccdc1d4..2936e74 100644
--- a/services/auth-service/auth_service/main.py
+++ b/services/auth-service/auth_service/main.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import asyncio
import logging
from sys import stdout
diff --git a/services/auth-service/auth_service/models/config.py b/services/auth-service/auth_service/models/config.py
index ab8f92a..93ea034 100644
--- a/services/auth-service/auth_service/models/config.py
+++ b/services/auth-service/auth_service/models/config.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import base64
from typing import Any, List
diff --git a/services/auth-service/auth_service/models/exceptions.py b/services/auth-service/auth_service/models/exceptions.py
index f781f53..d771607 100644
--- a/services/auth-service/auth_service/models/exceptions.py
+++ b/services/auth-service/auth_service/models/exceptions.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from enum import Enum, auto
from grpc import RpcContext, StatusCode
diff --git a/services/auth-service/auth_service/models/service.py b/services/auth-service/auth_service/models/service.py
index 0c88cc6..dbeffdf 100644
--- a/services/auth-service/auth_service/models/service.py
+++ b/services/auth-service/auth_service/models/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from time import time
from typing import Optional
from datetime import timedelta
diff --git a/services/auth-service/auth_service/postgres/repository.py b/services/auth-service/auth_service/postgres/repository.py
index 38dd7d1..fe0e741 100644
--- a/services/auth-service/auth_service/postgres/repository.py
+++ b/services/auth-service/auth_service/postgres/repository.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from typing import Optional
from databases import Database
diff --git a/services/auth-service/auth_service/postgres/service.py b/services/auth-service/auth_service/postgres/service.py
index 20bad48..b617624 100644
--- a/services/auth-service/auth_service/postgres/service.py
+++ b/services/auth-service/auth_service/postgres/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
from databases import Database
diff --git a/services/auth-service/auth_service/rpc/auth.py b/services/auth-service/auth_service/rpc/auth.py
index 348e16c..71097a5 100644
--- a/services/auth-service/auth_service/rpc/auth.py
+++ b/services/auth-service/auth_service/rpc/auth.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
import traceback
from typing import Type
diff --git a/services/auth-service/auth_service/rpc/service.py b/services/auth-service/auth_service/rpc/service.py
index bedf304..3c42810 100644
--- a/services/auth-service/auth_service/rpc/service.py
+++ b/services/auth-service/auth_service/rpc/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
from typing import Type
diff --git a/services/auth-service/auth_service/service.py b/services/auth-service/auth_service/service.py
index bcfa2a3..dd6d196 100644
--- a/services/auth-service/auth_service/service.py
+++ b/services/auth-service/auth_service/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import hmac
import hashlib
from typing import Type
diff --git a/services/auth-service/pyproject.toml b/services/auth-service/pyproject.toml
index d092f86..fc171ff 100644
--- a/services/auth-service/pyproject.toml
+++ b/services/auth-service/pyproject.toml
@@ -5,7 +5,7 @@ description = "Panels - Auth Service"
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/hexolan/panels"
-authors = ["Declan "]
+authors = ["Declan Teevan "]
[tool.poetry.dependencies]
python = "^3.9"
diff --git a/services/comment-service/comment_service/events/base_consumer.py b/services/comment-service/comment_service/events/base_consumer.py
index b44839e..9d52726 100644
--- a/services/comment-service/comment_service/events/base_consumer.py
+++ b/services/comment-service/comment_service/events/base_consumer.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
from typing import Type
diff --git a/services/comment-service/comment_service/events/post_consumer.py b/services/comment-service/comment_service/events/post_consumer.py
index ab65c88..465c3ec 100644
--- a/services/comment-service/comment_service/events/post_consumer.py
+++ b/services/comment-service/comment_service/events/post_consumer.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
from comment_service.models.proto import post_pb2
diff --git a/services/comment-service/comment_service/events/producer.py b/services/comment-service/comment_service/events/producer.py
index 5283ba4..e58edf6 100644
--- a/services/comment-service/comment_service/events/producer.py
+++ b/services/comment-service/comment_service/events/producer.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import asyncio
from aiokafka import AIOKafkaProducer
diff --git a/services/comment-service/comment_service/events/service.py b/services/comment-service/comment_service/events/service.py
index ff39d95..5b577bd 100644
--- a/services/comment-service/comment_service/events/service.py
+++ b/services/comment-service/comment_service/events/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import asyncio
from typing import Type
diff --git a/services/comment-service/comment_service/events/user_consumer.py b/services/comment-service/comment_service/events/user_consumer.py
index 4a690ba..7b57d51 100644
--- a/services/comment-service/comment_service/events/user_consumer.py
+++ b/services/comment-service/comment_service/events/user_consumer.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
from comment_service.models.proto import user_pb2
diff --git a/services/comment-service/comment_service/main.py b/services/comment-service/comment_service/main.py
index 09df56b..ec17614 100644
--- a/services/comment-service/comment_service/main.py
+++ b/services/comment-service/comment_service/main.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import asyncio
import logging
from sys import stdout
diff --git a/services/comment-service/comment_service/models/config.py b/services/comment-service/comment_service/models/config.py
index 41550e7..296d0aa 100644
--- a/services/comment-service/comment_service/models/config.py
+++ b/services/comment-service/comment_service/models/config.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from typing import Any, List
from pydantic import computed_field
diff --git a/services/comment-service/comment_service/models/exceptions.py b/services/comment-service/comment_service/models/exceptions.py
index 5959a32..99b0ad7 100644
--- a/services/comment-service/comment_service/models/exceptions.py
+++ b/services/comment-service/comment_service/models/exceptions.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from enum import Enum, auto
from grpc import RpcContext, StatusCode
diff --git a/services/comment-service/comment_service/models/service.py b/services/comment-service/comment_service/models/service.py
index 8756572..5e94011 100644
--- a/services/comment-service/comment_service/models/service.py
+++ b/services/comment-service/comment_service/models/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from datetime import datetime
from typing import List, Optional
diff --git a/services/comment-service/comment_service/postgres/repository.py b/services/comment-service/comment_service/postgres/repository.py
index d857ffa..82fa5e4 100644
--- a/services/comment-service/comment_service/postgres/repository.py
+++ b/services/comment-service/comment_service/postgres/repository.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from typing import List
from databases import Database
diff --git a/services/comment-service/comment_service/postgres/service.py b/services/comment-service/comment_service/postgres/service.py
index ec87930..b57e675 100644
--- a/services/comment-service/comment_service/postgres/service.py
+++ b/services/comment-service/comment_service/postgres/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
from databases import Database
diff --git a/services/comment-service/comment_service/redis/repository.py b/services/comment-service/comment_service/redis/repository.py
index 425ab71..5c94389 100644
--- a/services/comment-service/comment_service/redis/repository.py
+++ b/services/comment-service/comment_service/redis/repository.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import pickle
import logging
from typing import Type, List
diff --git a/services/comment-service/comment_service/redis/service.py b/services/comment-service/comment_service/redis/service.py
index 5f56d39..1b9e813 100644
--- a/services/comment-service/comment_service/redis/service.py
+++ b/services/comment-service/comment_service/redis/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from typing import Type
import redis.asyncio as redis
diff --git a/services/comment-service/comment_service/rpc/comment.py b/services/comment-service/comment_service/rpc/comment.py
index 5da3979..fec7a09 100644
--- a/services/comment-service/comment_service/rpc/comment.py
+++ b/services/comment-service/comment_service/rpc/comment.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
import traceback
from typing import Type
diff --git a/services/comment-service/comment_service/rpc/service.py b/services/comment-service/comment_service/rpc/service.py
index 7d32a45..93c6a20 100644
--- a/services/comment-service/comment_service/rpc/service.py
+++ b/services/comment-service/comment_service/rpc/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
import logging
from typing import Type
diff --git a/services/comment-service/comment_service/service.py b/services/comment-service/comment_service/service.py
index 168ffcf..9fa9495 100644
--- a/services/comment-service/comment_service/service.py
+++ b/services/comment-service/comment_service/service.py
@@ -1,3 +1,17 @@
+# Copyright 2023 Declan Teevan
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
from typing import Type, List
from comment_service.models.service import CommentRepository, Comment, CommentCreate, CommentUpdate
diff --git a/services/comment-service/pyproject.toml b/services/comment-service/pyproject.toml
index 7ab747b..ac74e9d 100644
--- a/services/comment-service/pyproject.toml
+++ b/services/comment-service/pyproject.toml
@@ -5,7 +5,7 @@ description = "Panels - Comment Service"
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/hexolan/panels"
-authors = ["Declan "]
+authors = ["Declan Teevan "]
[tool.poetry.dependencies]
python = "^3.9"
diff --git a/services/frontend/package.json b/services/frontend/package.json
index facf601..f163f2a 100644
--- a/services/frontend/package.json
+++ b/services/frontend/package.json
@@ -2,7 +2,7 @@
"name": "frontend",
"description": "Panels - Frontend Site",
"version": "1.0.0",
- "author": "Declan ",
+ "author": "Declan Teevan ",
"license": "Apache-2.0",
"type": "module",
"scripts": {
diff --git a/services/gateway-service/cmd/gateway-service/main.go b/services/gateway-service/cmd/gateway-service/main.go
index 0cb2ed7..03cedbf 100644
--- a/services/gateway-service/cmd/gateway-service/main.go
+++ b/services/gateway-service/cmd/gateway-service/main.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package main
import (
@@ -16,4 +30,4 @@ func main() {
// 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
index 47af5e6..9fbe78a 100644
--- a/services/gateway-service/cmd/gateway-service/tools.go
+++ b/services/gateway-service/cmd/gateway-service/tools.go
@@ -1,8 +1,23 @@
//go:build tools
+
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
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
+ _ "google.golang.org/protobuf/cmd/protoc-gen-go"
+)
diff --git a/services/gateway-service/internal/api/api.go b/services/gateway-service/internal/api/api.go
index 1fe937c..e518579 100644
--- a/services/gateway-service/internal/api/api.go
+++ b/services/gateway-service/internal/api/api.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package api
import (
@@ -14,7 +28,7 @@ import (
func NewAPIApp(cfg internal.Config) *fiber.App {
app := fiber.New(fiber.Config{
- AppName: "Panels REST Gateway",
+ AppName: "Panels REST Gateway",
ErrorHandler: handlers.ErrorHandler,
// Swap out the JSON encoder for faster marshaling
@@ -38,4 +52,4 @@ func ServeAPIApp(app *fiber.App) {
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
index eb8e31d..4d27b86 100644
--- a/services/gateway-service/internal/api/handlers/auth.go
+++ b/services/gateway-service/internal/api/handlers/auth.go
@@ -1,11 +1,25 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
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/golang-jwt/jwt/v5"
"github.com/hexolan/panels/gateway-service/internal"
)
@@ -24,7 +38,7 @@ func NewAuthMiddleware(cfg internal.Config) {
tokenValidator := tokenValidator{pubKey: cfg.JWTPubKey}
AuthMiddleware = keyauth.New(keyauth.Config{
AuthScheme: "Bearer",
- Validator: tokenValidator.ValidateToken,
+ Validator: tokenValidator.ValidateToken,
})
}
@@ -56,4 +70,4 @@ func (tv tokenValidator) ValidateToken(c *fiber.Ctx, userToken string) (bool, er
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
index c8c7588..1f7a75d 100644
--- a/services/gateway-service/internal/api/handlers/error.go
+++ b/services/gateway-service/internal/api/handlers/error.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package handlers
import (
@@ -10,15 +24,15 @@ import (
)
func ErrorHandler(c *fiber.Ctx, err error) error {
- c.Set(fiber.HeaderContentType, fiber.MIMEApplicationJSONCharsetUTF8)
- code := fiber.StatusInternalServerError
+ 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 {
+ // 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 {
@@ -51,5 +65,5 @@ func ErrorHandler(c *fiber.Ctx, err error) error {
}
}
- return c.Status(code).JSON(fiber.Map{"status": "failure", "msg": msg})
-}
\ No newline at end of file
+ return c.Status(code).JSON(fiber.Map{"status": "failure", "msg": msg})
+}
diff --git a/services/gateway-service/internal/api/router.go b/services/gateway-service/internal/api/router.go
index 0be3c35..5666e6a 100644
--- a/services/gateway-service/internal/api/router.go
+++ b/services/gateway-service/internal/api/router.go
@@ -1,10 +1,24 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
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"
+ "github.com/hexolan/panels/gateway-service/internal/api/v1"
)
func RegisterRoutes(app *fiber.App) {
@@ -36,10 +50,10 @@ func RegisterRoutes(app *fiber.App) {
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)
@@ -51,10 +65,10 @@ func RegisterRoutes(app *fiber.App) {
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)
@@ -63,4 +77,4 @@ func RegisterRoutes(app *fiber.App) {
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
index afbdd87..8cf0c90 100644
--- a/services/gateway-service/internal/api/v1/auth.go
+++ b/services/gateway-service/internal/api/v1/auth.go
@@ -1,8 +1,22 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package v1
import (
- "time"
"context"
+ "time"
"github.com/gofiber/fiber/v2"
@@ -21,7 +35,7 @@ func setAuthMethod(userId string, password string) error {
_, err := rpc.Svcs.GetAuthSvc().SetPasswordAuth(
ctx,
&authv1.SetPasswordAuthMethod{
- UserId: userId,
+ UserId: userId,
Password: password,
},
)
@@ -34,7 +48,7 @@ func authWithPassword(userId string, password string) (*authv1.AuthToken, error)
token, err := rpc.Svcs.GetAuthSvc().AuthWithPassword(
ctx,
&authv1.PasswordAuthRequest{
- UserId: userId,
+ UserId: userId,
Password: password,
},
)
@@ -63,8 +77,8 @@ func LoginWithPassword(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"status": "success",
"data": fiber.Map{
- "user": user,
+ "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
index 971d3d4..bff83ec 100644
--- a/services/gateway-service/internal/api/v1/comment.go
+++ b/services/gateway-service/internal/api/v1/comment.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package v1
import (
@@ -48,7 +62,7 @@ func UpdateComment(c *fiber.Ctx) error {
return err
}
- if (comment.AuthorId != currentUser.Id) {
+ if comment.AuthorId != currentUser.Id {
return fiber.NewError(fiber.StatusForbidden, "no permissions to update that comment")
}
@@ -64,7 +78,7 @@ func UpdateComment(c *fiber.Ctx) error {
comment, err = rpc.Svcs.GetCommentSvc().UpdateComment(
ctx,
&commentv1.UpdateCommentRequest{
- Id: c.Params("id"),
+ Id: c.Params("id"),
Data: updatedComment,
},
)
@@ -87,7 +101,7 @@ func DeleteComment(c *fiber.Ctx) error {
return err
}
- if (comment.AuthorId != currentUser.Id && !currentUser.IsAdmin) {
+ if comment.AuthorId != currentUser.Id && !currentUser.IsAdmin {
return fiber.NewError(fiber.StatusForbidden, "no permissions to delete that comment")
}
@@ -123,16 +137,16 @@ func CreateComment(c *fiber.Ctx) error {
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,
+ PostId: post.Id,
AuthorId: tokenClaims.Subject,
- Data: newComment,
+ Data: newComment,
},
)
if err != nil {
@@ -140,4 +154,4 @@ func CreateComment(c *fiber.Ctx) error {
}
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
index 846c862..3055691 100644
--- a/services/gateway-service/internal/api/v1/panel.go
+++ b/services/gateway-service/internal/api/v1/panel.go
@@ -1,8 +1,22 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package v1
import (
- "time"
"context"
+ "time"
"github.com/gofiber/fiber/v2"
@@ -29,7 +43,7 @@ func getPanelIDFromName(name string) (string, error) {
if err != nil {
return "", err
}
-
+
return panel.GetId(), nil
}
@@ -76,7 +90,7 @@ func UpdatePanelById(c *fiber.Ctx) error {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
panel, err := rpc.Svcs.GetPanelSvc().UpdatePanel(
- ctx,
+ ctx,
&panelv1.UpdatePanelByIdRequest{Id: c.Params("id"), Data: patchData},
)
if err != nil {
@@ -106,7 +120,7 @@ func UpdatePanelByName(c *fiber.Ctx) error {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
panel, err := rpc.Svcs.GetPanelSvc().UpdatePanelByName(
- ctx,
+ ctx,
&panelv1.UpdatePanelByNameRequest{Name: c.Params("name"), Data: patchData},
)
if err != nil {
@@ -183,4 +197,4 @@ func CreatePanel(c *fiber.Ctx) error {
}
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
index 8186ff3..4919e94 100644
--- a/services/gateway-service/internal/api/v1/post.go
+++ b/services/gateway-service/internal/api/v1/post.go
@@ -1,14 +1,28 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package v1
import (
- "time"
"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/postv1"
- "github.com/hexolan/panels/gateway-service/internal/api/handlers"
)
func getPostById(postId string) (*postv1.Post, error) {
@@ -155,7 +169,7 @@ func UpdatePost(c *fiber.Ctx) error {
return err
}
- if (post.AuthorId != currentUser.Id) {
+ if post.AuthorId != currentUser.Id {
return fiber.NewError(fiber.StatusForbidden, "no permissions to update that post")
}
@@ -191,10 +205,10 @@ func DeletePost(c *fiber.Ctx) error {
return err
}
- if (post.AuthorId != currentUser.Id && !currentUser.IsAdmin) {
+ 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()
@@ -235,8 +249,8 @@ func CreatePanelPostFromId(c *fiber.Ctx) error {
ctx,
&postv1.CreatePostRequest{
PanelId: panel.Id,
- UserId: tokenClaims.Subject,
- Data: newPost,
+ UserId: tokenClaims.Subject,
+ Data: newPost,
},
)
if err != nil {
@@ -272,8 +286,8 @@ func CreatePanelPostFromName(c *fiber.Ctx) error {
ctx,
&postv1.CreatePostRequest{
PanelId: panelId,
- UserId: tokenClaims.Subject,
- Data: newPost,
+ UserId: tokenClaims.Subject,
+ Data: newPost,
},
)
if err != nil {
@@ -281,4 +295,4 @@ func CreatePanelPostFromName(c *fiber.Ctx) error {
}
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
index fbf5600..5a54df8 100644
--- a/services/gateway-service/internal/api/v1/user.go
+++ b/services/gateway-service/internal/api/v1/user.go
@@ -1,14 +1,28 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package v1
import (
- "time"
"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/userv1"
- "github.com/hexolan/panels/gateway-service/internal/api/handlers"
)
type userSignupForm struct {
@@ -87,7 +101,7 @@ func DeleteUserById(c *fiber.Ctx) error {
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()
@@ -113,7 +127,7 @@ func DeleteUserByUsername(c *fiber.Ctx) error {
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()
@@ -155,7 +169,7 @@ func UserSignup(c *fiber.Ctx) error {
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)
@@ -189,8 +203,8 @@ func UserSignup(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"status": "success",
"data": fiber.Map{
- "user": user,
+ "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
index 10a58b2..3d4e93b 100644
--- a/services/gateway-service/internal/config.go
+++ b/services/gateway-service/internal/config.go
@@ -1,12 +1,26 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package internal
import (
- "os"
"crypto/rsa"
"encoding/base64"
+ "os"
- "github.com/golang-jwt/jwt/v5"
"github.com/gofiber/fiber/v2/log"
+ "github.com/golang-jwt/jwt/v5"
)
func NewConfig() Config {
@@ -21,10 +35,10 @@ func NewConfig() Config {
}
return Config{
- PanelSvcAddr: optFromEnvRequire("PANEL_SVC_ADDR"),
- PostSvcAddr: optFromEnvRequire("POST_SVC_ADDR"),
- UserSvcAddr: optFromEnvRequire("USER_SVC_ADDR"),
- AuthSvcAddr: optFromEnvRequire("AUTH_SVC_ADDR"),
+ 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,
@@ -40,11 +54,11 @@ func optFromEnvRequire(opt string) string {
}
type Config struct {
- PostSvcAddr string
- PanelSvcAddr string
- UserSvcAddr string
- AuthSvcAddr string
+ 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
index 8c35cdc..0014205 100644
--- a/services/gateway-service/internal/rpc/authv1/auth.pb.go
+++ b/services/gateway-service/internal/rpc/authv1/auth.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.28.1
+// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: auth.proto
diff --git a/services/gateway-service/internal/rpc/authv1/auth_grpc.pb.go b/services/gateway-service/internal/rpc/authv1/auth_grpc.pb.go
index 68ed22d..900239c 100644
--- a/services/gateway-service/internal/rpc/authv1/auth_grpc.pb.go
+++ b/services/gateway-service/internal/rpc/authv1/auth_grpc.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.2.0
+// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// source: auth.proto
@@ -19,6 +33,12 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
+const (
+ AuthService_AuthWithPassword_FullMethodName = "/panels.auth.v1.AuthService/AuthWithPassword"
+ AuthService_SetPasswordAuth_FullMethodName = "/panels.auth.v1.AuthService/SetPasswordAuth"
+ AuthService_DeletePasswordAuth_FullMethodName = "/panels.auth.v1.AuthService/DeletePasswordAuth"
+)
+
// 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.
@@ -38,7 +58,7 @@ func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
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...)
+ err := c.cc.Invoke(ctx, AuthService_AuthWithPassword_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -47,7 +67,7 @@ func (c *authServiceClient) AuthWithPassword(ctx context.Context, in *PasswordAu
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...)
+ err := c.cc.Invoke(ctx, AuthService_SetPasswordAuth_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -56,7 +76,7 @@ func (c *authServiceClient) SetPasswordAuth(ctx context.Context, in *SetPassword
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...)
+ err := c.cc.Invoke(ctx, AuthService_DeletePasswordAuth_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -109,7 +129,7 @@ func _AuthService_AuthWithPassword_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.auth.v1.AuthService/AuthWithPassword",
+ FullMethod: AuthService_AuthWithPassword_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).AuthWithPassword(ctx, req.(*PasswordAuthRequest))
@@ -127,7 +147,7 @@ func _AuthService_SetPasswordAuth_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.auth.v1.AuthService/SetPasswordAuth",
+ FullMethod: AuthService_SetPasswordAuth_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).SetPasswordAuth(ctx, req.(*SetPasswordAuthMethod))
@@ -145,7 +165,7 @@ func _AuthService_DeletePasswordAuth_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.auth.v1.AuthService/DeletePasswordAuth",
+ FullMethod: AuthService_DeletePasswordAuth_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).DeletePasswordAuth(ctx, req.(*DeletePasswordAuthMethod))
diff --git a/services/gateway-service/internal/rpc/commentv1/comment.pb.go b/services/gateway-service/internal/rpc/commentv1/comment.pb.go
index 98218cd..d02a165 100644
--- a/services/gateway-service/internal/rpc/commentv1/comment.pb.go
+++ b/services/gateway-service/internal/rpc/commentv1/comment.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.28.1
+// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: comment.proto
diff --git a/services/gateway-service/internal/rpc/commentv1/comment_grpc.pb.go b/services/gateway-service/internal/rpc/commentv1/comment_grpc.pb.go
index 2924d9c..0a664d6 100644
--- a/services/gateway-service/internal/rpc/commentv1/comment_grpc.pb.go
+++ b/services/gateway-service/internal/rpc/commentv1/comment_grpc.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.2.0
+// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// source: comment.proto
@@ -19,6 +33,14 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
+const (
+ CommentService_CreateComment_FullMethodName = "/panels.comment.v1.CommentService/CreateComment"
+ CommentService_UpdateComment_FullMethodName = "/panels.comment.v1.CommentService/UpdateComment"
+ CommentService_DeleteComment_FullMethodName = "/panels.comment.v1.CommentService/DeleteComment"
+ CommentService_GetComment_FullMethodName = "/panels.comment.v1.CommentService/GetComment"
+ CommentService_GetPostComments_FullMethodName = "/panels.comment.v1.CommentService/GetPostComments"
+)
+
// 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.
@@ -40,7 +62,7 @@ func NewCommentServiceClient(cc grpc.ClientConnInterface) CommentServiceClient {
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...)
+ err := c.cc.Invoke(ctx, CommentService_CreateComment_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -49,7 +71,7 @@ func (c *commentServiceClient) CreateComment(ctx context.Context, in *CreateComm
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...)
+ err := c.cc.Invoke(ctx, CommentService_UpdateComment_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -58,7 +80,7 @@ func (c *commentServiceClient) UpdateComment(ctx context.Context, in *UpdateComm
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...)
+ err := c.cc.Invoke(ctx, CommentService_DeleteComment_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -67,7 +89,7 @@ func (c *commentServiceClient) DeleteComment(ctx context.Context, in *DeleteComm
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...)
+ err := c.cc.Invoke(ctx, CommentService_GetComment_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -76,7 +98,7 @@ func (c *commentServiceClient) GetComment(ctx context.Context, in *GetCommentReq
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...)
+ err := c.cc.Invoke(ctx, CommentService_GetPostComments_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -137,7 +159,7 @@ func _CommentService_CreateComment_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.comment.v1.CommentService/CreateComment",
+ FullMethod: CommentService_CreateComment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CommentServiceServer).CreateComment(ctx, req.(*CreateCommentRequest))
@@ -155,7 +177,7 @@ func _CommentService_UpdateComment_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.comment.v1.CommentService/UpdateComment",
+ FullMethod: CommentService_UpdateComment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CommentServiceServer).UpdateComment(ctx, req.(*UpdateCommentRequest))
@@ -173,7 +195,7 @@ func _CommentService_DeleteComment_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.comment.v1.CommentService/DeleteComment",
+ FullMethod: CommentService_DeleteComment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CommentServiceServer).DeleteComment(ctx, req.(*DeleteCommentRequest))
@@ -191,7 +213,7 @@ func _CommentService_GetComment_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.comment.v1.CommentService/GetComment",
+ FullMethod: CommentService_GetComment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CommentServiceServer).GetComment(ctx, req.(*GetCommentRequest))
@@ -209,7 +231,7 @@ func _CommentService_GetPostComments_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.comment.v1.CommentService/GetPostComments",
+ FullMethod: CommentService_GetPostComments_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CommentServiceServer).GetPostComments(ctx, req.(*GetPostCommentsRequest))
diff --git a/services/gateway-service/internal/rpc/panelv1/panel.pb.go b/services/gateway-service/internal/rpc/panelv1/panel.pb.go
index aab4723..6966052 100644
--- a/services/gateway-service/internal/rpc/panelv1/panel.pb.go
+++ b/services/gateway-service/internal/rpc/panelv1/panel.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.28.1
+// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: panel.proto
diff --git a/services/gateway-service/internal/rpc/panelv1/panel_grpc.pb.go b/services/gateway-service/internal/rpc/panelv1/panel_grpc.pb.go
index 74a0694..80b489a 100644
--- a/services/gateway-service/internal/rpc/panelv1/panel_grpc.pb.go
+++ b/services/gateway-service/internal/rpc/panelv1/panel_grpc.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.2.0
+// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// source: panel.proto
@@ -19,6 +33,16 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
+const (
+ PanelService_CreatePanel_FullMethodName = "/panels.panel.v1.PanelService/CreatePanel"
+ PanelService_GetPanel_FullMethodName = "/panels.panel.v1.PanelService/GetPanel"
+ PanelService_GetPanelByName_FullMethodName = "/panels.panel.v1.PanelService/GetPanelByName"
+ PanelService_UpdatePanel_FullMethodName = "/panels.panel.v1.PanelService/UpdatePanel"
+ PanelService_UpdatePanelByName_FullMethodName = "/panels.panel.v1.PanelService/UpdatePanelByName"
+ PanelService_DeletePanel_FullMethodName = "/panels.panel.v1.PanelService/DeletePanel"
+ PanelService_DeletePanelByName_FullMethodName = "/panels.panel.v1.PanelService/DeletePanelByName"
+)
+
// 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.
@@ -42,7 +66,7 @@ func NewPanelServiceClient(cc grpc.ClientConnInterface) PanelServiceClient {
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...)
+ err := c.cc.Invoke(ctx, PanelService_CreatePanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -51,7 +75,7 @@ func (c *panelServiceClient) CreatePanel(ctx context.Context, in *CreatePanelReq
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...)
+ err := c.cc.Invoke(ctx, PanelService_GetPanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -60,7 +84,7 @@ func (c *panelServiceClient) GetPanel(ctx context.Context, in *GetPanelByIdReque
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...)
+ err := c.cc.Invoke(ctx, PanelService_GetPanelByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -69,7 +93,7 @@ func (c *panelServiceClient) GetPanelByName(ctx context.Context, in *GetPanelByN
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...)
+ err := c.cc.Invoke(ctx, PanelService_UpdatePanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -78,7 +102,7 @@ func (c *panelServiceClient) UpdatePanel(ctx context.Context, in *UpdatePanelByI
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...)
+ err := c.cc.Invoke(ctx, PanelService_UpdatePanelByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -87,7 +111,7 @@ func (c *panelServiceClient) UpdatePanelByName(ctx context.Context, in *UpdatePa
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...)
+ err := c.cc.Invoke(ctx, PanelService_DeletePanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -96,7 +120,7 @@ func (c *panelServiceClient) DeletePanel(ctx context.Context, in *DeletePanelByI
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...)
+ err := c.cc.Invoke(ctx, PanelService_DeletePanelByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -165,7 +189,7 @@ func _PanelService_CreatePanel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/CreatePanel",
+ FullMethod: PanelService_CreatePanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).CreatePanel(ctx, req.(*CreatePanelRequest))
@@ -183,7 +207,7 @@ func _PanelService_GetPanel_Handler(srv interface{}, ctx context.Context, dec fu
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/GetPanel",
+ FullMethod: PanelService_GetPanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).GetPanel(ctx, req.(*GetPanelByIdRequest))
@@ -201,7 +225,7 @@ func _PanelService_GetPanelByName_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/GetPanelByName",
+ FullMethod: PanelService_GetPanelByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).GetPanelByName(ctx, req.(*GetPanelByNameRequest))
@@ -219,7 +243,7 @@ func _PanelService_UpdatePanel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/UpdatePanel",
+ FullMethod: PanelService_UpdatePanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).UpdatePanel(ctx, req.(*UpdatePanelByIdRequest))
@@ -237,7 +261,7 @@ func _PanelService_UpdatePanelByName_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/UpdatePanelByName",
+ FullMethod: PanelService_UpdatePanelByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).UpdatePanelByName(ctx, req.(*UpdatePanelByNameRequest))
@@ -255,7 +279,7 @@ func _PanelService_DeletePanel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/DeletePanel",
+ FullMethod: PanelService_DeletePanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).DeletePanel(ctx, req.(*DeletePanelByIdRequest))
@@ -273,7 +297,7 @@ func _PanelService_DeletePanelByName_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/DeletePanelByName",
+ FullMethod: PanelService_DeletePanelByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).DeletePanelByName(ctx, req.(*DeletePanelByNameRequest))
diff --git a/services/gateway-service/internal/rpc/postv1/post.pb.go b/services/gateway-service/internal/rpc/postv1/post.pb.go
index 0477e8d..8b4e37e 100644
--- a/services/gateway-service/internal/rpc/postv1/post.pb.go
+++ b/services/gateway-service/internal/rpc/postv1/post.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.28.1
+// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: post.proto
diff --git a/services/gateway-service/internal/rpc/postv1/post_grpc.pb.go b/services/gateway-service/internal/rpc/postv1/post_grpc.pb.go
index b004ca4..65cd962 100644
--- a/services/gateway-service/internal/rpc/postv1/post_grpc.pb.go
+++ b/services/gateway-service/internal/rpc/postv1/post_grpc.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.2.0
+// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// source: post.proto
@@ -19,6 +33,17 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
+const (
+ PostService_CreatePost_FullMethodName = "/panels.post.v1.PostService/CreatePost"
+ PostService_GetPost_FullMethodName = "/panels.post.v1.PostService/GetPost"
+ PostService_GetPanelPost_FullMethodName = "/panels.post.v1.PostService/GetPanelPost"
+ PostService_UpdatePost_FullMethodName = "/panels.post.v1.PostService/UpdatePost"
+ PostService_DeletePost_FullMethodName = "/panels.post.v1.PostService/DeletePost"
+ PostService_GetFeedPosts_FullMethodName = "/panels.post.v1.PostService/GetFeedPosts"
+ PostService_GetUserPosts_FullMethodName = "/panels.post.v1.PostService/GetUserPosts"
+ PostService_GetPanelPosts_FullMethodName = "/panels.post.v1.PostService/GetPanelPosts"
+)
+
// 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.
@@ -43,7 +68,7 @@ func NewPostServiceClient(cc grpc.ClientConnInterface) PostServiceClient {
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...)
+ err := c.cc.Invoke(ctx, PostService_CreatePost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -52,7 +77,7 @@ func (c *postServiceClient) CreatePost(ctx context.Context, in *CreatePostReques
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...)
+ err := c.cc.Invoke(ctx, PostService_GetPost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -61,7 +86,7 @@ func (c *postServiceClient) GetPost(ctx context.Context, in *GetPostRequest, opt
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...)
+ err := c.cc.Invoke(ctx, PostService_GetPanelPost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -70,7 +95,7 @@ func (c *postServiceClient) GetPanelPost(ctx context.Context, in *GetPanelPostRe
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...)
+ err := c.cc.Invoke(ctx, PostService_UpdatePost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -79,7 +104,7 @@ func (c *postServiceClient) UpdatePost(ctx context.Context, in *UpdatePostReques
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...)
+ err := c.cc.Invoke(ctx, PostService_DeletePost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -88,7 +113,7 @@ func (c *postServiceClient) DeletePost(ctx context.Context, in *DeletePostReques
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...)
+ err := c.cc.Invoke(ctx, PostService_GetFeedPosts_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -97,7 +122,7 @@ func (c *postServiceClient) GetFeedPosts(ctx context.Context, in *GetFeedPostsRe
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...)
+ err := c.cc.Invoke(ctx, PostService_GetUserPosts_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -106,7 +131,7 @@ func (c *postServiceClient) GetUserPosts(ctx context.Context, in *GetUserPostsRe
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...)
+ err := c.cc.Invoke(ctx, PostService_GetPanelPosts_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -179,7 +204,7 @@ func _PostService_CreatePost_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/CreatePost",
+ FullMethod: PostService_CreatePost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).CreatePost(ctx, req.(*CreatePostRequest))
@@ -197,7 +222,7 @@ func _PostService_GetPost_Handler(srv interface{}, ctx context.Context, dec func
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetPost",
+ FullMethod: PostService_GetPost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetPost(ctx, req.(*GetPostRequest))
@@ -215,7 +240,7 @@ func _PostService_GetPanelPost_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetPanelPost",
+ FullMethod: PostService_GetPanelPost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetPanelPost(ctx, req.(*GetPanelPostRequest))
@@ -233,7 +258,7 @@ func _PostService_UpdatePost_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/UpdatePost",
+ FullMethod: PostService_UpdatePost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).UpdatePost(ctx, req.(*UpdatePostRequest))
@@ -251,7 +276,7 @@ func _PostService_DeletePost_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/DeletePost",
+ FullMethod: PostService_DeletePost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).DeletePost(ctx, req.(*DeletePostRequest))
@@ -269,7 +294,7 @@ func _PostService_GetFeedPosts_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetFeedPosts",
+ FullMethod: PostService_GetFeedPosts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetFeedPosts(ctx, req.(*GetFeedPostsRequest))
@@ -287,7 +312,7 @@ func _PostService_GetUserPosts_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetUserPosts",
+ FullMethod: PostService_GetUserPosts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetUserPosts(ctx, req.(*GetUserPostsRequest))
@@ -305,7 +330,7 @@ func _PostService_GetPanelPosts_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetPanelPosts",
+ FullMethod: PostService_GetPanelPosts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetPanelPosts(ctx, req.(*GetPanelPostsRequest))
diff --git a/services/gateway-service/internal/rpc/rpc.go b/services/gateway-service/internal/rpc/rpc.go
index aebe6b1..8f3af86 100644
--- a/services/gateway-service/internal/rpc/rpc.go
+++ b/services/gateway-service/internal/rpc/rpc.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package rpc
import (
@@ -7,20 +21,20 @@ import (
"google.golang.org/grpc/credentials/insecure"
"github.com/hexolan/panels/gateway-service/internal"
+ "github.com/hexolan/panels/gateway-service/internal/rpc/authv1"
+ "github.com/hexolan/panels/gateway-service/internal/rpc/commentv1"
"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
+ panelSvcConn *grpc.ClientConn
+ postSvcConn *grpc.ClientConn
+ userSvcConn *grpc.ClientConn
+ authSvcConn *grpc.ClientConn
commentSvcConn *grpc.ClientConn
}
@@ -46,10 +60,10 @@ func (rpcSvcs RPCServices) GetCommentSvc() commentv1.CommentServiceClient {
func DialRPCServices(cfg internal.Config) {
Svcs = RPCServices{
- panelSvcConn: dialRPC(cfg.PanelSvcAddr),
- postSvcConn: dialRPC(cfg.PostSvcAddr),
- userSvcConn: dialRPC(cfg.UserSvcAddr),
- authSvcConn: dialRPC(cfg.AuthSvcAddr),
+ panelSvcConn: dialRPC(cfg.PanelSvcAddr),
+ postSvcConn: dialRPC(cfg.PostSvcAddr),
+ userSvcConn: dialRPC(cfg.UserSvcAddr),
+ authSvcConn: dialRPC(cfg.AuthSvcAddr),
commentSvcConn: dialRPC(cfg.CommentSvcAddr),
}
}
@@ -61,4 +75,4 @@ func dialRPC(addr string) *grpc.ClientConn {
}
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
index bb9c12a..f30f336 100644
--- a/services/gateway-service/internal/rpc/userv1/user.pb.go
+++ b/services/gateway-service/internal/rpc/userv1/user.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.28.1
+// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: user.proto
diff --git a/services/gateway-service/internal/rpc/userv1/user_grpc.pb.go b/services/gateway-service/internal/rpc/userv1/user_grpc.pb.go
index a2cfefa..4c23d2c 100644
--- a/services/gateway-service/internal/rpc/userv1/user_grpc.pb.go
+++ b/services/gateway-service/internal/rpc/userv1/user_grpc.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.2.0
+// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// source: user.proto
@@ -19,6 +33,16 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
+const (
+ UserService_CreateUser_FullMethodName = "/panels.user.v1.UserService/CreateUser"
+ UserService_GetUser_FullMethodName = "/panels.user.v1.UserService/GetUser"
+ UserService_GetUserByName_FullMethodName = "/panels.user.v1.UserService/GetUserByName"
+ UserService_UpdateUser_FullMethodName = "/panels.user.v1.UserService/UpdateUser"
+ UserService_UpdateUserByName_FullMethodName = "/panels.user.v1.UserService/UpdateUserByName"
+ UserService_DeleteUser_FullMethodName = "/panels.user.v1.UserService/DeleteUser"
+ UserService_DeleteUserByName_FullMethodName = "/panels.user.v1.UserService/DeleteUserByName"
+)
+
// 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.
@@ -42,7 +66,7 @@ func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
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...)
+ err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -51,7 +75,7 @@ func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserReques
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...)
+ err := c.cc.Invoke(ctx, UserService_GetUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -60,7 +84,7 @@ func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserByIdRequest,
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...)
+ err := c.cc.Invoke(ctx, UserService_GetUserByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -69,7 +93,7 @@ func (c *userServiceClient) GetUserByName(ctx context.Context, in *GetUserByName
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...)
+ err := c.cc.Invoke(ctx, UserService_UpdateUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -78,7 +102,7 @@ func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserByIdRe
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...)
+ err := c.cc.Invoke(ctx, UserService_UpdateUserByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -87,7 +111,7 @@ func (c *userServiceClient) UpdateUserByName(ctx context.Context, in *UpdateUser
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...)
+ err := c.cc.Invoke(ctx, UserService_DeleteUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -96,7 +120,7 @@ func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserByIdRe
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...)
+ err := c.cc.Invoke(ctx, UserService_DeleteUserByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -165,7 +189,7 @@ func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/CreateUser",
+ FullMethod: UserService_CreateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest))
@@ -183,7 +207,7 @@ func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/GetUser",
+ FullMethod: UserService_GetUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserByIdRequest))
@@ -201,7 +225,7 @@ func _UserService_GetUserByName_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/GetUserByName",
+ FullMethod: UserService_GetUserByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).GetUserByName(ctx, req.(*GetUserByNameRequest))
@@ -219,7 +243,7 @@ func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/UpdateUser",
+ FullMethod: UserService_UpdateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserByIdRequest))
@@ -237,7 +261,7 @@ func _UserService_UpdateUserByName_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/UpdateUserByName",
+ FullMethod: UserService_UpdateUserByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).UpdateUserByName(ctx, req.(*UpdateUserByNameRequest))
@@ -255,7 +279,7 @@ func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/DeleteUser",
+ FullMethod: UserService_DeleteUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).DeleteUser(ctx, req.(*DeleteUserByIdRequest))
@@ -273,7 +297,7 @@ func _UserService_DeleteUserByName_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/DeleteUserByName",
+ FullMethod: UserService_DeleteUserByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).DeleteUserByName(ctx, req.(*DeleteUserByNameRequest))
diff --git a/services/panel-service/cmd/panel-service/main.go b/services/panel-service/cmd/panel-service/main.go
index 7e7a867..c6dd62b 100644
--- a/services/panel-service/cmd/panel-service/main.go
+++ b/services/panel-service/cmd/panel-service/main.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package main
import (
@@ -6,9 +20,9 @@ import (
"github.com/rs/zerolog"
"github.com/hexolan/panels/panel-service/internal"
+ "github.com/hexolan/panels/panel-service/internal/kafka"
"github.com/hexolan/panels/panel-service/internal/postgres"
"github.com/hexolan/panels/panel-service/internal/redis"
- "github.com/hexolan/panels/panel-service/internal/kafka"
"github.com/hexolan/panels/panel-service/internal/rpc"
"github.com/hexolan/panels/panel-service/internal/service"
)
@@ -34,4 +48,4 @@ func main() {
// Create and serve RPC
rpcServer := rpc.NewRPCServer(service)
rpcServer.Serve()
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/cmd/panel-service/tools.go b/services/panel-service/cmd/panel-service/tools.go
index 5c15732..fa8a5c8 100644
--- a/services/panel-service/cmd/panel-service/tools.go
+++ b/services/panel-service/cmd/panel-service/tools.go
@@ -1,12 +1,27 @@
//go:build tools
+
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package main
import (
// Protobuf Generation
- _ "google.golang.org/protobuf/cmd/protoc-gen-go"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
+ _ "google.golang.org/protobuf/cmd/protoc-gen-go"
// DB Migrations
- _ "github.com/golang-migrate/migrate/v4"
- _ "github.com/golang-migrate/migrate/v4/database/postgres"
-)
\ No newline at end of file
+ _ "github.com/golang-migrate/migrate/v4"
+ _ "github.com/golang-migrate/migrate/v4/database/postgres"
+)
diff --git a/services/panel-service/internal/config.go b/services/panel-service/internal/config.go
index f75fc8e..f985774 100644
--- a/services/panel-service/internal/config.go
+++ b/services/panel-service/internal/config.go
@@ -1,15 +1,29 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package internal
import (
- "os"
"fmt"
+ "os"
"strings"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
-func NewConfig() Config {
+func NewConfig() Config {
// Parse the log level
logLvl, err := zerolog.ParseLevel(optFromEnvFallback("LOG_LEVEL", "info"))
if err != nil {
@@ -24,10 +38,10 @@ func NewConfig() Config {
// Create the config
cfg := Config{
- RedisHost: optFromEnvRequire("REDIS_HOST"),
- RedisPass: optFromEnvRequire("REDIS_PASS"),
+ RedisHost: optFromEnvRequire("REDIS_HOST"),
+ RedisPass: optFromEnvRequire("REDIS_PASS"),
KafkaBrokers: kafkaBrokers,
- LogLevel: logLvl,
+ LogLevel: logLvl,
}
// Assemble the Config.PostgresURL
@@ -86,4 +100,4 @@ func (cfg Config) GetPostgresURL() string {
func (cfg Config) GetLogLevel() zerolog.Level {
return cfg.LogLevel
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/errors.go b/services/panel-service/internal/errors.go
index 620f874..9b1842f 100644
--- a/services/panel-service/internal/errors.go
+++ b/services/panel-service/internal/errors.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package internal
import (
@@ -10,7 +24,7 @@ import (
func NewServiceError(code ErrorCode, msg string) error {
return &ServiceError{
code: code,
- msg: msg,
+ msg: msg,
}
}
@@ -20,8 +34,8 @@ func NewServiceErrorf(code ErrorCode, msg string, args ...interface{}) error {
func WrapServiceError(original_err error, code ErrorCode, msg string) error {
return &ServiceError{
- code: code,
- msg: msg,
+ code: code,
+ msg: msg,
original_err: original_err,
}
}
@@ -39,12 +53,12 @@ const (
func (c ErrorCode) GRPCCode() codes.Code {
codeMap := map[ErrorCode]codes.Code{
- UnknownErrorCode: codes.Unknown,
- NotFoundErrorCode: codes.NotFound,
- ConflictErrorCode: codes.AlreadyExists,
- ForbiddenErrorCode: codes.PermissionDenied,
+ UnknownErrorCode: codes.Unknown,
+ NotFoundErrorCode: codes.NotFound,
+ ConflictErrorCode: codes.AlreadyExists,
+ ForbiddenErrorCode: codes.PermissionDenied,
InvalidArgumentErrorCode: codes.InvalidArgument,
- ConnectionErrorCode: codes.Unavailable,
+ ConnectionErrorCode: codes.Unavailable,
}
grpcCode, mapped := codeMap[c]
@@ -55,8 +69,8 @@ func (c ErrorCode) GRPCCode() codes.Code {
}
type ServiceError struct {
- code ErrorCode
- msg string
+ code ErrorCode
+ msg string
original_err error
}
@@ -77,4 +91,4 @@ func (e ServiceError) GRPCStatus() *status.Status {
func (e ServiceError) Unwrap() error {
return e.original_err
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/kafka/panel.go b/services/panel-service/internal/kafka/panel.go
index 8f1b59d..9cc26c5 100644
--- a/services/panel-service/internal/kafka/panel.go
+++ b/services/panel-service/internal/kafka/panel.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package kafka
import (
@@ -17,8 +31,8 @@ type PanelEventProducer struct {
func NewPanelEventProducer(cfg internal.Config) PanelEventProducer {
writer := &kafka.Writer{
- Addr: kafka.TCP(cfg.KafkaBrokers...),
- Topic: "panel",
+ Addr: kafka.TCP(cfg.KafkaBrokers...),
+ Topic: "panel",
Balancer: &kafka.LeastBytes{},
}
@@ -59,4 +73,4 @@ func (ep PanelEventProducer) DispatchDeletedEvent(id int64) {
Type: "deleted",
Data: &panelv1.Panel{Id: internal.StringifyPanelId(id)},
})
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/panel.go b/services/panel-service/internal/panel.go
index 7bed024..20ad1c1 100644
--- a/services/panel-service/internal/panel.go
+++ b/services/panel-service/internal/panel.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package internal
import (
@@ -13,9 +27,9 @@ import (
type Panel struct {
Id int64 `json:"id"`
- Name string `json:"name"`
+ Name string `json:"name"`
Description string `json:"description"`
-
+
CreatedAt pgtype.Timestamp `json:"created_at"`
UpdatedAt pgtype.Timestamp `json:"updated_at"`
}
@@ -34,7 +48,7 @@ func DestringifyPanelId(reprId string) (int64, error) {
// Model for creating panels
type PanelCreate struct {
- Name string `json:"name"`
+ Name string `json:"name"`
Description string `json:"description"`
}
@@ -48,7 +62,7 @@ func (p *PanelCreate) Validate() error {
// Model for updating a panel
type PanelUpdate struct {
- Name *string `json:"name,omitempty"`
+ Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
}
@@ -75,4 +89,4 @@ type PanelRepository interface {
GetPanelIdFromName(ctx context.Context, name string) (*int64, error)
UpdatePanel(ctx context.Context, id int64, data PanelUpdate) (*Panel, error)
DeletePanel(ctx context.Context, id int64) error
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/postgres/panel.go b/services/panel-service/internal/postgres/panel.go
index 09c13bd..6a88f22 100644
--- a/services/panel-service/internal/postgres/panel.go
+++ b/services/panel-service/internal/postgres/panel.go
@@ -1,18 +1,32 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package postgres
import (
"context"
+ "encoding/json"
"errors"
"strings"
- "encoding/json"
- "github.com/rs/zerolog/log"
"github.com/doug-martin/goqu/v9"
_ "github.com/doug-martin/goqu/v9/dialect/postgres"
"github.com/jackc/pgerrcode"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgxpool"
+ "github.com/rs/zerolog/log"
"github.com/hexolan/panels/panel-service/internal"
)
@@ -40,7 +54,7 @@ func (r panelDatabaseRepo) transformToPatchData(data internal.PanelUpdate) goqu.
func (r panelDatabaseRepo) GetPanelIdFromName(ctx context.Context, name string) (*int64, error) {
var id int64
err := r.db.QueryRow(ctx, "SELECT id FROM panels WHERE LOWER(name)=LOWER($1)", name).Scan(&id)
- if err != nil {
+ if err != nil {
if err == pgx.ErrNoRows {
return nil, internal.WrapServiceError(err, internal.NotFoundErrorCode, "panel not found")
} else if strings.Contains(err.Error(), "failed to connect to") {
@@ -76,7 +90,7 @@ func (r panelDatabaseRepo) GetPanel(ctx context.Context, id int64) (*internal.Pa
var panel internal.Panel
row := r.db.QueryRow(ctx, "SELECT id, name, description, created_at, updated_at FROM panels WHERE id=$1", id)
err := row.Scan(&panel.Id, &panel.Name, &panel.Description, &panel.CreatedAt, &panel.UpdatedAt)
- if err != nil {
+ if err != nil {
if err == pgx.ErrNoRows {
return nil, internal.WrapServiceError(err, internal.NotFoundErrorCode, "panel not found")
} else if strings.Contains(err.Error(), "failed to connect to") {
@@ -137,4 +151,4 @@ func (r panelDatabaseRepo) DeletePanel(ctx context.Context, id int64) error {
}
return nil
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/postgres/postgres.go b/services/panel-service/internal/postgres/postgres.go
index 7f66155..05a67f2 100644
--- a/services/panel-service/internal/postgres/postgres.go
+++ b/services/panel-service/internal/postgres/postgres.go
@@ -1,10 +1,24 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package postgres
import (
"context"
- "github.com/rs/zerolog/log"
"github.com/jackc/pgx/v5/pgxpool"
+ "github.com/rs/zerolog/log"
"github.com/hexolan/panels/panel-service/internal"
)
@@ -14,11 +28,11 @@ func NewPostgresInterface(ctx context.Context, cfg internal.Config) *pgxpool.Poo
if err != nil {
log.Panic().Err(err).Caller().Msg("")
}
-
+
err = db.Ping(ctx)
if err != nil {
log.Warn().Err(err).Msg("failed Postgres ping")
}
return db
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/redis/panel.go b/services/panel-service/internal/redis/panel.go
index 7a9cfef..8d8f210 100644
--- a/services/panel-service/internal/redis/panel.go
+++ b/services/panel-service/internal/redis/panel.go
@@ -1,12 +1,26 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package redis
import (
- "time"
"context"
"encoding/json"
+ "time"
- "github.com/rs/zerolog/log"
"github.com/redis/go-redis/v9"
+ "github.com/rs/zerolog/log"
"github.com/hexolan/panels/panel-service/internal"
)
@@ -19,7 +33,7 @@ type panelCacheRepo struct {
func NewPanelRepository(rdb *redis.Client, repo internal.PanelRepository) internal.PanelRepository {
return panelCacheRepo{
- rdb: rdb,
+ rdb: rdb,
repo: repo,
}
}
@@ -57,7 +71,7 @@ func (r panelCacheRepo) cachePanel(ctx context.Context, panel *internal.Panel) {
return
}
- err = r.rdb.Set(ctx, internal.StringifyPanelId(panel.Id), string(value), 5 * time.Minute).Err()
+ err = r.rdb.Set(ctx, internal.StringifyPanelId(panel.Id), string(value), 5*time.Minute).Err()
if err != nil {
log.Error().Err(err).Msg("failed to cache panel")
return
@@ -120,4 +134,4 @@ func (r panelCacheRepo) DeletePanel(ctx context.Context, id int64) error {
// Purge any cached version of the panel.
r.purgeCachedPanel(ctx, id)
return err
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/redis/redis.go b/services/panel-service/internal/redis/redis.go
index fb696b9..00565b3 100644
--- a/services/panel-service/internal/redis/redis.go
+++ b/services/panel-service/internal/redis/redis.go
@@ -1,24 +1,38 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package redis
import (
- "time"
"context"
+ "time"
- "github.com/rs/zerolog/log"
"github.com/redis/go-redis/v9"
+ "github.com/rs/zerolog/log"
"github.com/hexolan/panels/panel-service/internal"
)
func NewRedisInterface(ctx context.Context, cfg internal.Config) *redis.Client {
- rdb := redis.NewClient(&redis.Options{
- Addr: cfg.RedisHost,
- Password: cfg.RedisPass,
- DB: 0,
+ rdb := redis.NewClient(&redis.Options{
+ Addr: cfg.RedisHost,
+ Password: cfg.RedisPass,
+ DB: 0,
DialTimeout: time.Millisecond * 250,
ReadTimeout: time.Millisecond * 500,
- })
+ })
_, err := rdb.Ping(ctx).Result()
if err != nil {
@@ -26,4 +40,4 @@ func NewRedisInterface(ctx context.Context, cfg internal.Config) *redis.Client {
}
return rdb
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/rpc/panel.go b/services/panel-service/internal/rpc/panel.go
index fb92487..20dbbf6 100644
--- a/services/panel-service/internal/rpc/panel.go
+++ b/services/panel-service/internal/rpc/panel.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package rpc
import (
@@ -13,7 +27,7 @@ import (
type panelServer struct {
pb.UnimplementedPanelServiceServer
-
+
service internal.PanelService
}
@@ -29,7 +43,7 @@ func (svr *panelServer) CreatePanel(ctx context.Context, request *pb.CreatePanel
// Convert to business model
data := pb.PanelCreateFromProto(request.GetData())
-
+
// Attempt to create the panel
panel, err := svr.service.CreatePanel(ctx, data)
if err != nil {
@@ -159,4 +173,4 @@ func (svr *panelServer) DeletePanelByName(ctx context.Context, request *pb.Delet
return nil, err
}
return &emptypb.Empty{}, nil
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/rpc/panelv1/conversion.go b/services/panel-service/internal/rpc/panelv1/conversion.go
index b7588f4..2af6227 100644
--- a/services/panel-service/internal/rpc/panelv1/conversion.go
+++ b/services/panel-service/internal/rpc/panelv1/conversion.go
@@ -11,10 +11,10 @@ import (
// Panel -> Protobuf 'Panel'
func PanelToProto(panel *internal.Panel) *Panel {
proto := Panel{
- Id: internal.StringifyPanelId(panel.Id),
- Name: panel.Name,
+ Id: internal.StringifyPanelId(panel.Id),
+ Name: panel.Name,
Description: panel.Description,
- CreatedAt: timestamppb.New(panel.CreatedAt.Time),
+ CreatedAt: timestamppb.New(panel.CreatedAt.Time),
}
// convert nullable attributes to PB form (if present)
@@ -44,7 +44,7 @@ func PanelFromProto(proto *Panel) (*internal.Panel, error) {
// Protobuf 'PanelMutable' -> PanelCreate
func PanelCreateFromProto(proto *PanelMutable) internal.PanelCreate {
return internal.PanelCreate{
- Name: proto.GetName(),
+ Name: proto.GetName(),
Description: proto.GetDescription(),
}
}
@@ -52,7 +52,7 @@ func PanelCreateFromProto(proto *PanelMutable) internal.PanelCreate {
// Protobuf 'PanelMutable' -> PanelUpdate
func PanelUpdateFromProto(proto *PanelMutable) internal.PanelUpdate {
return internal.PanelUpdate{
- Name: proto.Name,
+ Name: proto.Name,
Description: proto.Description,
}
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/rpc/panelv1/panel.pb.go b/services/panel-service/internal/rpc/panelv1/panel.pb.go
index aab4723..6966052 100644
--- a/services/panel-service/internal/rpc/panelv1/panel.pb.go
+++ b/services/panel-service/internal/rpc/panelv1/panel.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.28.1
+// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: panel.proto
diff --git a/services/panel-service/internal/rpc/panelv1/panel_grpc.pb.go b/services/panel-service/internal/rpc/panelv1/panel_grpc.pb.go
index 74a0694..80b489a 100644
--- a/services/panel-service/internal/rpc/panelv1/panel_grpc.pb.go
+++ b/services/panel-service/internal/rpc/panelv1/panel_grpc.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.2.0
+// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// source: panel.proto
@@ -19,6 +33,16 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
+const (
+ PanelService_CreatePanel_FullMethodName = "/panels.panel.v1.PanelService/CreatePanel"
+ PanelService_GetPanel_FullMethodName = "/panels.panel.v1.PanelService/GetPanel"
+ PanelService_GetPanelByName_FullMethodName = "/panels.panel.v1.PanelService/GetPanelByName"
+ PanelService_UpdatePanel_FullMethodName = "/panels.panel.v1.PanelService/UpdatePanel"
+ PanelService_UpdatePanelByName_FullMethodName = "/panels.panel.v1.PanelService/UpdatePanelByName"
+ PanelService_DeletePanel_FullMethodName = "/panels.panel.v1.PanelService/DeletePanel"
+ PanelService_DeletePanelByName_FullMethodName = "/panels.panel.v1.PanelService/DeletePanelByName"
+)
+
// 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.
@@ -42,7 +66,7 @@ func NewPanelServiceClient(cc grpc.ClientConnInterface) PanelServiceClient {
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...)
+ err := c.cc.Invoke(ctx, PanelService_CreatePanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -51,7 +75,7 @@ func (c *panelServiceClient) CreatePanel(ctx context.Context, in *CreatePanelReq
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...)
+ err := c.cc.Invoke(ctx, PanelService_GetPanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -60,7 +84,7 @@ func (c *panelServiceClient) GetPanel(ctx context.Context, in *GetPanelByIdReque
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...)
+ err := c.cc.Invoke(ctx, PanelService_GetPanelByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -69,7 +93,7 @@ func (c *panelServiceClient) GetPanelByName(ctx context.Context, in *GetPanelByN
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...)
+ err := c.cc.Invoke(ctx, PanelService_UpdatePanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -78,7 +102,7 @@ func (c *panelServiceClient) UpdatePanel(ctx context.Context, in *UpdatePanelByI
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...)
+ err := c.cc.Invoke(ctx, PanelService_UpdatePanelByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -87,7 +111,7 @@ func (c *panelServiceClient) UpdatePanelByName(ctx context.Context, in *UpdatePa
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...)
+ err := c.cc.Invoke(ctx, PanelService_DeletePanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -96,7 +120,7 @@ func (c *panelServiceClient) DeletePanel(ctx context.Context, in *DeletePanelByI
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...)
+ err := c.cc.Invoke(ctx, PanelService_DeletePanelByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -165,7 +189,7 @@ func _PanelService_CreatePanel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/CreatePanel",
+ FullMethod: PanelService_CreatePanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).CreatePanel(ctx, req.(*CreatePanelRequest))
@@ -183,7 +207,7 @@ func _PanelService_GetPanel_Handler(srv interface{}, ctx context.Context, dec fu
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/GetPanel",
+ FullMethod: PanelService_GetPanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).GetPanel(ctx, req.(*GetPanelByIdRequest))
@@ -201,7 +225,7 @@ func _PanelService_GetPanelByName_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/GetPanelByName",
+ FullMethod: PanelService_GetPanelByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).GetPanelByName(ctx, req.(*GetPanelByNameRequest))
@@ -219,7 +243,7 @@ func _PanelService_UpdatePanel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/UpdatePanel",
+ FullMethod: PanelService_UpdatePanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).UpdatePanel(ctx, req.(*UpdatePanelByIdRequest))
@@ -237,7 +261,7 @@ func _PanelService_UpdatePanelByName_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/UpdatePanelByName",
+ FullMethod: PanelService_UpdatePanelByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).UpdatePanelByName(ctx, req.(*UpdatePanelByNameRequest))
@@ -255,7 +279,7 @@ func _PanelService_DeletePanel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/DeletePanel",
+ FullMethod: PanelService_DeletePanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).DeletePanel(ctx, req.(*DeletePanelByIdRequest))
@@ -273,7 +297,7 @@ func _PanelService_DeletePanelByName_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/DeletePanelByName",
+ FullMethod: PanelService_DeletePanelByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).DeletePanelByName(ctx, req.(*DeletePanelByNameRequest))
diff --git a/services/panel-service/internal/rpc/rpc.go b/services/panel-service/internal/rpc/rpc.go
index b2c83b2..5873591 100644
--- a/services/panel-service/internal/rpc/rpc.go
+++ b/services/panel-service/internal/rpc/rpc.go
@@ -1,15 +1,29 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package rpc
import (
- "net"
"context"
+ "net"
+ "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
+ "github.com/rs/zerolog"
+ "github.com/rs/zerolog/log"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
- "github.com/rs/zerolog"
- "github.com/rs/zerolog/log"
- "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
"github.com/hexolan/panels/panel-service/internal"
"github.com/hexolan/panels/panel-service/internal/rpc/panelv1"
@@ -47,16 +61,16 @@ func loggingInterceptor(logger zerolog.Logger) logging.Logger {
logger := logger.With().Fields(fields).Logger()
switch lvl {
- case logging.LevelError:
- logger.Error().Msg(msg)
- case logging.LevelWarn:
- logger.Warn().Msg(msg)
- case logging.LevelInfo:
- logger.Info().Msg(msg)
- case logging.LevelDebug:
- logger.Debug().Msg(msg)
- default:
- logger.Debug().Interface("unknown-log-level", lvl).Msg(msg)
+ case logging.LevelError:
+ logger.Error().Msg(msg)
+ case logging.LevelWarn:
+ logger.Warn().Msg(msg)
+ case logging.LevelInfo:
+ logger.Info().Msg(msg)
+ case logging.LevelDebug:
+ logger.Debug().Msg(msg)
+ default:
+ logger.Debug().Interface("unknown-log-level", lvl).Msg(msg)
}
})
}
@@ -67,11 +81,11 @@ func (r *RPCServer) Serve() {
if err != nil {
log.Panic().Err(err).Caller().Msg("failed to listen on RPC port (:9090)")
}
-
+
// Begin serving gRPC.
log.Info().Str("address", lis.Addr().String()).Msg("attempting to serve RPC...")
err = r.grpcSvr.Serve(lis)
if err != nil {
log.Panic().Err(err).Caller().Msg("failed to serve RPC")
}
-}
\ No newline at end of file
+}
diff --git a/services/panel-service/internal/service/panel.go b/services/panel-service/internal/service/panel.go
index 4d54ae0..6ffdc89 100644
--- a/services/panel-service/internal/service/panel.go
+++ b/services/panel-service/internal/service/panel.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package service
import (
@@ -16,7 +30,7 @@ type panelService struct {
func NewPanelService(events kafka.PanelEventProducer, repo internal.PanelRepository) internal.PanelService {
return panelService{
events: events,
- repo: repo,
+ repo: repo,
}
}
@@ -52,7 +66,7 @@ func (srv panelService) GetPanelByName(ctx context.Context, name string) (*inter
if err != nil {
return nil, err
}
-
+
// Pass to service method for GetPanel (by id).
return srv.GetPanel(ctx, *id)
}
@@ -92,7 +106,7 @@ func (srv panelService) UpdatePanelByName(ctx context.Context, name string, data
if err != nil {
return nil, err
}
-
+
// Pass to service method for UpdatePanel (by id).
return srv.UpdatePanel(ctx, *id, data)
}
@@ -123,4 +137,4 @@ func (srv panelService) DeletePanelByName(ctx context.Context, name string) erro
// Pass to service method for DeletePanel (by id).
return srv.DeletePanel(ctx, *id)
-}
\ No newline at end of file
+}
diff --git a/services/post-service/cmd/post-service/main.go b/services/post-service/cmd/post-service/main.go
index ce6508a..dd20ab4 100644
--- a/services/post-service/cmd/post-service/main.go
+++ b/services/post-service/cmd/post-service/main.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package main
import (
@@ -6,17 +20,17 @@ import (
"github.com/rs/zerolog"
"github.com/hexolan/panels/post-service/internal"
- "github.com/hexolan/panels/post-service/internal/postgres"
- "github.com/hexolan/panels/post-service/internal/redis"
"github.com/hexolan/panels/post-service/internal/kafka"
"github.com/hexolan/panels/post-service/internal/kafka/producer"
+ "github.com/hexolan/panels/post-service/internal/postgres"
+ "github.com/hexolan/panels/post-service/internal/redis"
"github.com/hexolan/panels/post-service/internal/rpc"
"github.com/hexolan/panels/post-service/internal/service"
)
func main() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
-
+
// Load the configuration
cfg := internal.NewConfig()
zerolog.SetGlobalLevel(cfg.GetLogLevel())
@@ -39,4 +53,4 @@ func main() {
// Create and serve RPC
rpcServer := rpc.NewRPCServer(service)
rpcServer.Serve()
-}
\ No newline at end of file
+}
diff --git a/services/post-service/cmd/post-service/tools.go b/services/post-service/cmd/post-service/tools.go
index 5c15732..fa8a5c8 100644
--- a/services/post-service/cmd/post-service/tools.go
+++ b/services/post-service/cmd/post-service/tools.go
@@ -1,12 +1,27 @@
//go:build tools
+
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package main
import (
// Protobuf Generation
- _ "google.golang.org/protobuf/cmd/protoc-gen-go"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
+ _ "google.golang.org/protobuf/cmd/protoc-gen-go"
// DB Migrations
- _ "github.com/golang-migrate/migrate/v4"
- _ "github.com/golang-migrate/migrate/v4/database/postgres"
-)
\ No newline at end of file
+ _ "github.com/golang-migrate/migrate/v4"
+ _ "github.com/golang-migrate/migrate/v4/database/postgres"
+)
diff --git a/services/post-service/internal/config.go b/services/post-service/internal/config.go
index f75fc8e..f985774 100644
--- a/services/post-service/internal/config.go
+++ b/services/post-service/internal/config.go
@@ -1,15 +1,29 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package internal
import (
- "os"
"fmt"
+ "os"
"strings"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
-func NewConfig() Config {
+func NewConfig() Config {
// Parse the log level
logLvl, err := zerolog.ParseLevel(optFromEnvFallback("LOG_LEVEL", "info"))
if err != nil {
@@ -24,10 +38,10 @@ func NewConfig() Config {
// Create the config
cfg := Config{
- RedisHost: optFromEnvRequire("REDIS_HOST"),
- RedisPass: optFromEnvRequire("REDIS_PASS"),
+ RedisHost: optFromEnvRequire("REDIS_HOST"),
+ RedisPass: optFromEnvRequire("REDIS_PASS"),
KafkaBrokers: kafkaBrokers,
- LogLevel: logLvl,
+ LogLevel: logLvl,
}
// Assemble the Config.PostgresURL
@@ -86,4 +100,4 @@ func (cfg Config) GetPostgresURL() string {
func (cfg Config) GetLogLevel() zerolog.Level {
return cfg.LogLevel
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/errors.go b/services/post-service/internal/errors.go
index 620f874..9b1842f 100644
--- a/services/post-service/internal/errors.go
+++ b/services/post-service/internal/errors.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package internal
import (
@@ -10,7 +24,7 @@ import (
func NewServiceError(code ErrorCode, msg string) error {
return &ServiceError{
code: code,
- msg: msg,
+ msg: msg,
}
}
@@ -20,8 +34,8 @@ func NewServiceErrorf(code ErrorCode, msg string, args ...interface{}) error {
func WrapServiceError(original_err error, code ErrorCode, msg string) error {
return &ServiceError{
- code: code,
- msg: msg,
+ code: code,
+ msg: msg,
original_err: original_err,
}
}
@@ -39,12 +53,12 @@ const (
func (c ErrorCode) GRPCCode() codes.Code {
codeMap := map[ErrorCode]codes.Code{
- UnknownErrorCode: codes.Unknown,
- NotFoundErrorCode: codes.NotFound,
- ConflictErrorCode: codes.AlreadyExists,
- ForbiddenErrorCode: codes.PermissionDenied,
+ UnknownErrorCode: codes.Unknown,
+ NotFoundErrorCode: codes.NotFound,
+ ConflictErrorCode: codes.AlreadyExists,
+ ForbiddenErrorCode: codes.PermissionDenied,
InvalidArgumentErrorCode: codes.InvalidArgument,
- ConnectionErrorCode: codes.Unavailable,
+ ConnectionErrorCode: codes.Unavailable,
}
grpcCode, mapped := codeMap[c]
@@ -55,8 +69,8 @@ func (c ErrorCode) GRPCCode() codes.Code {
}
type ServiceError struct {
- code ErrorCode
- msg string
+ code ErrorCode
+ msg string
original_err error
}
@@ -77,4 +91,4 @@ func (e ServiceError) GRPCStatus() *status.Status {
func (e ServiceError) Unwrap() error {
return e.original_err
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/kafka/consumers/panel.go b/services/post-service/internal/kafka/consumers/panel.go
index 418970f..8d4f07b 100644
--- a/services/post-service/internal/kafka/consumers/panel.go
+++ b/services/post-service/internal/kafka/consumers/panel.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package consumers
import (
@@ -8,14 +22,14 @@ import (
"google.golang.org/protobuf/proto"
"github.com/hexolan/panels/post-service/internal"
- "github.com/hexolan/panels/post-service/internal/kafka/producer"
"github.com/hexolan/panels/post-service/internal/kafka/consumers/panelv1"
+ "github.com/hexolan/panels/post-service/internal/kafka/producer"
)
type PanelEventConsumer struct {
reader *kafka.Reader
- dbRepo internal.PostDBRepository
+ dbRepo internal.PostDBRepository
eventProd producer.PostEventProducer
}
@@ -24,9 +38,9 @@ func NewPanelEventConsumer(cfg internal.Config, dbRepo internal.PostDBRepository
reader: kafka.NewReader(kafka.ReaderConfig{
Brokers: cfg.KafkaBrokers,
GroupID: "post-service",
- Topic: "panel",
+ Topic: "panel",
}),
- dbRepo: dbRepo,
+ dbRepo: dbRepo,
eventProd: eventProd,
}
}
@@ -42,7 +56,7 @@ func (ec PanelEventConsumer) ProcessEvent(evt *panelv1.PanelEvent) {
if err == nil {
for _, postId := range postIds {
ec.eventProd.DispatchDeletedEvent(postId)
- }
+ }
}
log.Debug().Str("src", "panel-event-consumer").Any("event", evt).Msg("processed panel deleted event")
}
@@ -73,4 +87,4 @@ func (ec PanelEventConsumer) Start() {
if err := ec.reader.Close(); err != nil {
log.Panic().Err(err).Str("src", "panel-event-consumer").Msg("failed to close Kafka reader")
}
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/kafka/consumers/panelv1/panel.pb.go b/services/post-service/internal/kafka/consumers/panelv1/panel.pb.go
index aab4723..6966052 100644
--- a/services/post-service/internal/kafka/consumers/panelv1/panel.pb.go
+++ b/services/post-service/internal/kafka/consumers/panelv1/panel.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.28.1
+// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: panel.proto
diff --git a/services/post-service/internal/kafka/consumers/panelv1/panel_grpc.pb.go b/services/post-service/internal/kafka/consumers/panelv1/panel_grpc.pb.go
index 74a0694..80b489a 100644
--- a/services/post-service/internal/kafka/consumers/panelv1/panel_grpc.pb.go
+++ b/services/post-service/internal/kafka/consumers/panelv1/panel_grpc.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.2.0
+// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// source: panel.proto
@@ -19,6 +33,16 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
+const (
+ PanelService_CreatePanel_FullMethodName = "/panels.panel.v1.PanelService/CreatePanel"
+ PanelService_GetPanel_FullMethodName = "/panels.panel.v1.PanelService/GetPanel"
+ PanelService_GetPanelByName_FullMethodName = "/panels.panel.v1.PanelService/GetPanelByName"
+ PanelService_UpdatePanel_FullMethodName = "/panels.panel.v1.PanelService/UpdatePanel"
+ PanelService_UpdatePanelByName_FullMethodName = "/panels.panel.v1.PanelService/UpdatePanelByName"
+ PanelService_DeletePanel_FullMethodName = "/panels.panel.v1.PanelService/DeletePanel"
+ PanelService_DeletePanelByName_FullMethodName = "/panels.panel.v1.PanelService/DeletePanelByName"
+)
+
// 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.
@@ -42,7 +66,7 @@ func NewPanelServiceClient(cc grpc.ClientConnInterface) PanelServiceClient {
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...)
+ err := c.cc.Invoke(ctx, PanelService_CreatePanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -51,7 +75,7 @@ func (c *panelServiceClient) CreatePanel(ctx context.Context, in *CreatePanelReq
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...)
+ err := c.cc.Invoke(ctx, PanelService_GetPanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -60,7 +84,7 @@ func (c *panelServiceClient) GetPanel(ctx context.Context, in *GetPanelByIdReque
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...)
+ err := c.cc.Invoke(ctx, PanelService_GetPanelByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -69,7 +93,7 @@ func (c *panelServiceClient) GetPanelByName(ctx context.Context, in *GetPanelByN
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...)
+ err := c.cc.Invoke(ctx, PanelService_UpdatePanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -78,7 +102,7 @@ func (c *panelServiceClient) UpdatePanel(ctx context.Context, in *UpdatePanelByI
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...)
+ err := c.cc.Invoke(ctx, PanelService_UpdatePanelByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -87,7 +111,7 @@ func (c *panelServiceClient) UpdatePanelByName(ctx context.Context, in *UpdatePa
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...)
+ err := c.cc.Invoke(ctx, PanelService_DeletePanel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -96,7 +120,7 @@ func (c *panelServiceClient) DeletePanel(ctx context.Context, in *DeletePanelByI
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...)
+ err := c.cc.Invoke(ctx, PanelService_DeletePanelByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -165,7 +189,7 @@ func _PanelService_CreatePanel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/CreatePanel",
+ FullMethod: PanelService_CreatePanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).CreatePanel(ctx, req.(*CreatePanelRequest))
@@ -183,7 +207,7 @@ func _PanelService_GetPanel_Handler(srv interface{}, ctx context.Context, dec fu
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/GetPanel",
+ FullMethod: PanelService_GetPanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).GetPanel(ctx, req.(*GetPanelByIdRequest))
@@ -201,7 +225,7 @@ func _PanelService_GetPanelByName_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/GetPanelByName",
+ FullMethod: PanelService_GetPanelByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).GetPanelByName(ctx, req.(*GetPanelByNameRequest))
@@ -219,7 +243,7 @@ func _PanelService_UpdatePanel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/UpdatePanel",
+ FullMethod: PanelService_UpdatePanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).UpdatePanel(ctx, req.(*UpdatePanelByIdRequest))
@@ -237,7 +261,7 @@ func _PanelService_UpdatePanelByName_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/UpdatePanelByName",
+ FullMethod: PanelService_UpdatePanelByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).UpdatePanelByName(ctx, req.(*UpdatePanelByNameRequest))
@@ -255,7 +279,7 @@ func _PanelService_DeletePanel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/DeletePanel",
+ FullMethod: PanelService_DeletePanel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).DeletePanel(ctx, req.(*DeletePanelByIdRequest))
@@ -273,7 +297,7 @@ func _PanelService_DeletePanelByName_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.panel.v1.PanelService/DeletePanelByName",
+ FullMethod: PanelService_DeletePanelByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PanelServiceServer).DeletePanelByName(ctx, req.(*DeletePanelByNameRequest))
diff --git a/services/post-service/internal/kafka/consumers/user.go b/services/post-service/internal/kafka/consumers/user.go
index b8c769d..8cbf710 100644
--- a/services/post-service/internal/kafka/consumers/user.go
+++ b/services/post-service/internal/kafka/consumers/user.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package consumers
import (
@@ -8,14 +22,14 @@ import (
"google.golang.org/protobuf/proto"
"github.com/hexolan/panels/post-service/internal"
- "github.com/hexolan/panels/post-service/internal/kafka/producer"
"github.com/hexolan/panels/post-service/internal/kafka/consumers/userv1"
+ "github.com/hexolan/panels/post-service/internal/kafka/producer"
)
type UserEventConsumer struct {
reader *kafka.Reader
- dbRepo internal.PostDBRepository
+ dbRepo internal.PostDBRepository
eventProd producer.PostEventProducer
}
@@ -24,7 +38,7 @@ func NewUserEventConsumer(cfg internal.Config, dbRepo internal.PostDBRepository,
reader: kafka.NewReader(kafka.ReaderConfig{
Brokers: cfg.KafkaBrokers,
GroupID: "post-service",
- Topic: "user",
+ Topic: "user",
}),
dbRepo: dbRepo,
}
@@ -72,4 +86,4 @@ func (ec UserEventConsumer) Start() {
if err := ec.reader.Close(); err != nil {
log.Panic().Err(err).Str("src", "user-event-consumer").Msg("failed to close Kafka reader")
}
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/kafka/consumers/userv1/user.pb.go b/services/post-service/internal/kafka/consumers/userv1/user.pb.go
index bb9c12a..f30f336 100644
--- a/services/post-service/internal/kafka/consumers/userv1/user.pb.go
+++ b/services/post-service/internal/kafka/consumers/userv1/user.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.28.1
+// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: user.proto
diff --git a/services/post-service/internal/kafka/consumers/userv1/user_grpc.pb.go b/services/post-service/internal/kafka/consumers/userv1/user_grpc.pb.go
index a2cfefa..4c23d2c 100644
--- a/services/post-service/internal/kafka/consumers/userv1/user_grpc.pb.go
+++ b/services/post-service/internal/kafka/consumers/userv1/user_grpc.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.2.0
+// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// source: user.proto
@@ -19,6 +33,16 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
+const (
+ UserService_CreateUser_FullMethodName = "/panels.user.v1.UserService/CreateUser"
+ UserService_GetUser_FullMethodName = "/panels.user.v1.UserService/GetUser"
+ UserService_GetUserByName_FullMethodName = "/panels.user.v1.UserService/GetUserByName"
+ UserService_UpdateUser_FullMethodName = "/panels.user.v1.UserService/UpdateUser"
+ UserService_UpdateUserByName_FullMethodName = "/panels.user.v1.UserService/UpdateUserByName"
+ UserService_DeleteUser_FullMethodName = "/panels.user.v1.UserService/DeleteUser"
+ UserService_DeleteUserByName_FullMethodName = "/panels.user.v1.UserService/DeleteUserByName"
+)
+
// 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.
@@ -42,7 +66,7 @@ func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
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...)
+ err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -51,7 +75,7 @@ func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserReques
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...)
+ err := c.cc.Invoke(ctx, UserService_GetUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -60,7 +84,7 @@ func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserByIdRequest,
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...)
+ err := c.cc.Invoke(ctx, UserService_GetUserByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -69,7 +93,7 @@ func (c *userServiceClient) GetUserByName(ctx context.Context, in *GetUserByName
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...)
+ err := c.cc.Invoke(ctx, UserService_UpdateUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -78,7 +102,7 @@ func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserByIdRe
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...)
+ err := c.cc.Invoke(ctx, UserService_UpdateUserByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -87,7 +111,7 @@ func (c *userServiceClient) UpdateUserByName(ctx context.Context, in *UpdateUser
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...)
+ err := c.cc.Invoke(ctx, UserService_DeleteUser_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -96,7 +120,7 @@ func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserByIdRe
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...)
+ err := c.cc.Invoke(ctx, UserService_DeleteUserByName_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -165,7 +189,7 @@ func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/CreateUser",
+ FullMethod: UserService_CreateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest))
@@ -183,7 +207,7 @@ func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/GetUser",
+ FullMethod: UserService_GetUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserByIdRequest))
@@ -201,7 +225,7 @@ func _UserService_GetUserByName_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/GetUserByName",
+ FullMethod: UserService_GetUserByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).GetUserByName(ctx, req.(*GetUserByNameRequest))
@@ -219,7 +243,7 @@ func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/UpdateUser",
+ FullMethod: UserService_UpdateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserByIdRequest))
@@ -237,7 +261,7 @@ func _UserService_UpdateUserByName_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/UpdateUserByName",
+ FullMethod: UserService_UpdateUserByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).UpdateUserByName(ctx, req.(*UpdateUserByNameRequest))
@@ -255,7 +279,7 @@ func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/DeleteUser",
+ FullMethod: UserService_DeleteUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).DeleteUser(ctx, req.(*DeleteUserByIdRequest))
@@ -273,7 +297,7 @@ func _UserService_DeleteUserByName_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.user.v1.UserService/DeleteUserByName",
+ FullMethod: UserService_DeleteUserByName_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).DeleteUserByName(ctx, req.(*DeleteUserByNameRequest))
diff --git a/services/post-service/internal/kafka/kafka.go b/services/post-service/internal/kafka/kafka.go
index 9834ce7..5880dfd 100644
--- a/services/post-service/internal/kafka/kafka.go
+++ b/services/post-service/internal/kafka/kafka.go
@@ -1,23 +1,37 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package kafka
import (
"github.com/hexolan/panels/post-service/internal"
- "github.com/hexolan/panels/post-service/internal/kafka/producer"
"github.com/hexolan/panels/post-service/internal/kafka/consumers"
+ "github.com/hexolan/panels/post-service/internal/kafka/producer"
)
type eventConsumers struct {
- userEC consumers.UserEventConsumer
+ userEC consumers.UserEventConsumer
panelEC consumers.PanelEventConsumer
}
func NewEventConsumers(cfg internal.Config, dbRepo internal.PostDBRepository, eventProd producer.PostEventProducer) eventConsumers {
return eventConsumers{
- userEC: consumers.NewUserEventConsumer(cfg, dbRepo, eventProd),
+ userEC: consumers.NewUserEventConsumer(cfg, dbRepo, eventProd),
panelEC: consumers.NewPanelEventConsumer(cfg, dbRepo, eventProd),
}
}
func (ecs eventConsumers) Start() {
go ecs.panelEC.Start()
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/kafka/producer/post.go b/services/post-service/internal/kafka/producer/post.go
index a9d31c1..c132357 100644
--- a/services/post-service/internal/kafka/producer/post.go
+++ b/services/post-service/internal/kafka/producer/post.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package producer
import (
@@ -17,8 +31,8 @@ type PostEventProducer struct {
func NewPostEventProducer(cfg internal.Config) PostEventProducer {
writer := &kafka.Writer{
- Addr: kafka.TCP(cfg.KafkaBrokers...),
- Topic: "post",
+ Addr: kafka.TCP(cfg.KafkaBrokers...),
+ Topic: "post",
Balancer: &kafka.LeastBytes{},
}
@@ -57,4 +71,4 @@ func (ep PostEventProducer) DispatchDeletedEvent(id internal.PostId) {
Type: "deleted",
Data: &postv1.Post{Id: id.GetReprId()},
})
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/post.go b/services/post-service/internal/post.go
index 7dcf971..afdf6cd 100644
--- a/services/post-service/internal/post.go
+++ b/services/post-service/internal/post.go
@@ -1,33 +1,47 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package internal
import (
- "regexp"
"context"
- "strconv"
- "encoding/json"
"database/sql"
"database/sql/driver"
-
- "github.com/jackc/pgx/v5/pgtype"
+ "encoding/json"
+ "regexp"
+ "strconv"
+
"github.com/go-ozzo/ozzo-validation/v4"
+ "github.com/jackc/pgx/v5/pgtype"
)
// Post Models
type Post struct {
Id PostId `json:"id"`
- PanelId string `json:"panel_id"`
+ PanelId string `json:"panel_id"`
AuthorId string `json:"author_id"`
- Title string `json:"title"`
+ Title string `json:"title"`
Content string `json:"content"`
-
+
CreatedAt pgtype.Timestamp `json:"created_at"`
UpdatedAt pgtype.Timestamp `json:"updated_at"`
}
type PostCreate struct {
- Title string `json:"title"`
+ Title string `json:"title"`
Content string `json:"content"`
}
@@ -40,7 +54,7 @@ func (p *PostCreate) Validate() error {
}
type PostUpdate struct {
- Title *string `json:"title,omitempty"`
+ Title *string `json:"title,omitempty"`
Content *string `json:"content,omitempty"`
}
@@ -58,15 +72,15 @@ type PostService interface {
}
type PostRepository interface {
- CreatePost(ctx context.Context, panelId string, authorId string, data PostCreate) (*Post, error)
- GetPost(ctx context.Context, id PostId) (*Post, error)
- GetPanelPost(ctx context.Context, id PostId, panelId string) (*Post, error)
- UpdatePost(ctx context.Context, id PostId, data PostUpdate) (*Post, error)
- DeletePost(ctx context.Context, id PostId) error
+ CreatePost(ctx context.Context, panelId string, authorId string, data PostCreate) (*Post, error)
+ GetPost(ctx context.Context, id PostId) (*Post, error)
+ GetPanelPost(ctx context.Context, id PostId, panelId string) (*Post, error)
+ UpdatePost(ctx context.Context, id PostId, data PostUpdate) (*Post, error)
+ DeletePost(ctx context.Context, id PostId) error
- GetFeedPosts(ctx context.Context) ([]*Post, error)
- GetUserPosts(ctx context.Context, userId string) ([]*Post, error)
- GetPanelPosts(ctx context.Context, panelId string) ([]*Post, error)
+ GetFeedPosts(ctx context.Context) ([]*Post, error)
+ GetUserPosts(ctx context.Context, userId string) ([]*Post, error)
+ GetPanelPosts(ctx context.Context, panelId string) ([]*Post, error)
}
type PostDBRepository interface {
@@ -159,4 +173,4 @@ func NewPostIdFromRepr(reprId string) (*PostId, error) {
func getIdFromRepr(reprId string) (*int64, error) {
id, err := strconv.ParseInt(reprId, 36, 64)
return &id, err
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/postgres/post.go b/services/post-service/internal/postgres/post.go
index a2e162b..3f9db0b 100644
--- a/services/post-service/internal/postgres/post.go
+++ b/services/post-service/internal/postgres/post.go
@@ -1,15 +1,29 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package postgres
import (
"context"
- "strings"
"encoding/json"
+ "strings"
- "github.com/rs/zerolog/log"
"github.com/doug-martin/goqu/v9"
_ "github.com/doug-martin/goqu/v9/dialect/postgres"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
+ "github.com/rs/zerolog/log"
"github.com/hexolan/panels/post-service/internal"
)
@@ -42,7 +56,7 @@ func (r postDatabaseRepo) GetPost(ctx context.Context, id internal.PostId) (*int
var post internal.Post
row := r.db.QueryRow(ctx, "SELECT id, panel_id, author_id, title, content, created_at, updated_at FROM posts WHERE id=$1", id)
err := row.Scan(&post.Id, &post.PanelId, &post.AuthorId, &post.Title, &post.Content, &post.CreatedAt, &post.UpdatedAt)
- if err != nil {
+ if err != nil {
if err == pgx.ErrNoRows {
return nil, internal.WrapServiceError(err, internal.NotFoundErrorCode, "post not found")
} else if strings.Contains(err.Error(), "failed to connect to") {
@@ -59,7 +73,7 @@ func (r postDatabaseRepo) GetPanelPost(ctx context.Context, id internal.PostId,
var post internal.Post
row := r.db.QueryRow(ctx, "SELECT id, panel_id, author_id, title, content, created_at, updated_at FROM posts WHERE id=$1 AND panel_id=$2", id, panelId)
err := row.Scan(&post.Id, &post.PanelId, &post.AuthorId, &post.Title, &post.Content, &post.CreatedAt, &post.UpdatedAt)
- if err != nil {
+ if err != nil {
if err == pgx.ErrNoRows {
return nil, internal.WrapServiceError(err, internal.NotFoundErrorCode, "post not found on that panel")
} else if strings.Contains(err.Error(), "failed to connect to") {
@@ -77,7 +91,7 @@ func (r postDatabaseRepo) UpdatePost(ctx context.Context, id internal.PostId, da
patchData := goqu.Record{"updated_at": goqu.L("timezone('utc', now())")}
marshalled, _ := json.Marshal(data)
_ = json.Unmarshal(marshalled, &patchData)
-
+
// Build a statement to updated the post
statement, args, _ := goqu.Dialect("postgres").Update("posts").Prepared(true).Set(patchData).Where(goqu.C("id").Eq(id)).ToSQL()
@@ -123,7 +137,7 @@ func (r postDatabaseRepo) DeletePost(ctx context.Context, id internal.PostId) er
func (r postDatabaseRepo) GetFeedPosts(ctx context.Context) ([]*internal.Post, error) {
// todo: pagination
rows, err := r.db.Query(ctx, "SELECT id, panel_id, author_id, title, content, created_at, updated_at FROM posts ORDER BY created_at DESC LIMIT 25")
- if err != nil {
+ if err != nil {
if strings.Contains(err.Error(), "failed to connect to") {
return nil, internal.WrapServiceError(err, internal.ConnectionErrorCode, "failed to connect to database")
}
@@ -152,7 +166,7 @@ func (r postDatabaseRepo) GetFeedPosts(ctx context.Context) ([]*internal.Post, e
func (r postDatabaseRepo) GetUserPosts(ctx context.Context, userId string) ([]*internal.Post, error) {
// todo: pagination
rows, err := r.db.Query(ctx, "SELECT id, panel_id, author_id, title, content, created_at, updated_at FROM posts WHERE author_id=$1 ORDER BY created_at DESC LIMIT 25", userId)
- if err != nil {
+ if err != nil {
if strings.Contains(err.Error(), "failed to connect to") {
return nil, internal.WrapServiceError(err, internal.ConnectionErrorCode, "failed to connect to database")
}
@@ -181,7 +195,7 @@ func (r postDatabaseRepo) GetUserPosts(ctx context.Context, userId string) ([]*i
func (r postDatabaseRepo) GetPanelPosts(ctx context.Context, panelId string) ([]*internal.Post, error) {
// todo: pagination
rows, err := r.db.Query(ctx, "SELECT id, panel_id, author_id, title, content, created_at, updated_at FROM posts WHERE panel_id=$1 ORDER BY created_at DESC LIMIT 25", panelId)
- if err != nil {
+ if err != nil {
if strings.Contains(err.Error(), "failed to connect to") {
return nil, internal.WrapServiceError(err, internal.ConnectionErrorCode, "failed to connect to database")
}
@@ -259,4 +273,4 @@ func (r postDatabaseRepo) DeletePostsOnPanel(ctx context.Context, panelId string
}
return deletedIds, nil
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/postgres/postgres.go b/services/post-service/internal/postgres/postgres.go
index 88331d3..8dcca66 100644
--- a/services/post-service/internal/postgres/postgres.go
+++ b/services/post-service/internal/postgres/postgres.go
@@ -1,10 +1,24 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package postgres
import (
"context"
- "github.com/rs/zerolog/log"
"github.com/jackc/pgx/v5/pgxpool"
+ "github.com/rs/zerolog/log"
"github.com/hexolan/panels/post-service/internal"
)
@@ -14,11 +28,11 @@ func NewPostgresInterface(ctx context.Context, cfg internal.Config) *pgxpool.Poo
if err != nil {
log.Panic().Err(err).Caller().Msg("")
}
-
+
err = db.Ping(ctx)
if err != nil {
log.Warn().Err(err).Msg("failed Postgres ping")
}
return db
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/redis/post.go b/services/post-service/internal/redis/post.go
index 66670bf..4d29b79 100644
--- a/services/post-service/internal/redis/post.go
+++ b/services/post-service/internal/redis/post.go
@@ -1,12 +1,26 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package redis
import (
- "time"
"context"
"encoding/json"
+ "time"
- "github.com/rs/zerolog/log"
"github.com/redis/go-redis/v9"
+ "github.com/rs/zerolog/log"
"github.com/hexolan/panels/post-service/internal"
)
@@ -19,7 +33,7 @@ type postCacheRepo struct {
func NewPostRepository(rdb *redis.Client, repo internal.PostRepository) internal.PostRepository {
return postCacheRepo{
- rdb: rdb,
+ rdb: rdb,
repo: repo,
}
}
@@ -50,7 +64,7 @@ func (r postCacheRepo) cachePost(ctx context.Context, post *internal.Post) {
return
}
- err = r.rdb.Set(ctx, post.Id.GetReprId(), string(value), 2 * time.Minute).Err()
+ err = r.rdb.Set(ctx, post.Id.GetReprId(), string(value), 2*time.Minute).Err()
if err != nil {
log.Error().Err(err).Msg("failed to cache post")
return
@@ -148,4 +162,4 @@ func (r postCacheRepo) GetUserPosts(ctx context.Context, userId string) ([]*inte
func (r postCacheRepo) GetPanelPosts(ctx context.Context, panelId string) ([]*internal.Post, error) {
return r.repo.GetPanelPosts(ctx, panelId)
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/redis/redis.go b/services/post-service/internal/redis/redis.go
index 4581666..a7934a0 100644
--- a/services/post-service/internal/redis/redis.go
+++ b/services/post-service/internal/redis/redis.go
@@ -1,24 +1,38 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package redis
import (
- "time"
"context"
+ "time"
- "github.com/rs/zerolog/log"
"github.com/redis/go-redis/v9"
+ "github.com/rs/zerolog/log"
"github.com/hexolan/panels/post-service/internal"
)
func NewRedisInterface(ctx context.Context, cfg internal.Config) *redis.Client {
- rdb := redis.NewClient(&redis.Options{
- Addr: cfg.RedisHost,
- Password: cfg.RedisPass,
- DB: 0,
+ rdb := redis.NewClient(&redis.Options{
+ Addr: cfg.RedisHost,
+ Password: cfg.RedisPass,
+ DB: 0,
DialTimeout: time.Millisecond * 250,
ReadTimeout: time.Millisecond * 500,
- })
+ })
_, err := rdb.Ping(ctx).Result()
if err != nil {
@@ -26,4 +40,4 @@ func NewRedisInterface(ctx context.Context, cfg internal.Config) *redis.Client {
}
return rdb
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/rpc/post.go b/services/post-service/internal/rpc/post.go
index c589dc4..dfdc31c 100644
--- a/services/post-service/internal/rpc/post.go
+++ b/services/post-service/internal/rpc/post.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package rpc
import (
@@ -13,7 +27,7 @@ import (
type postServer struct {
pb.UnimplementedPostServiceServer
-
+
service internal.PostService
}
@@ -37,7 +51,7 @@ func (svr *postServer) CreatePost(ctx context.Context, request *pb.CreatePostReq
// Convert to service model
data := pb.PostCreateFromProto(request.GetData())
-
+
// Pass to service method for creation
post, err := svr.service.CreatePost(ctx, request.GetPanelId(), request.GetUserId(), data)
if err != nil {
@@ -176,4 +190,4 @@ func (svr *postServer) GetPanelPosts(ctx context.Context, request *pb.GetPanelPo
}
return &pb.PanelPosts{Posts: pb.PostsToProto(posts)}, nil
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/rpc/postv1/conversion.go b/services/post-service/internal/rpc/postv1/conversion.go
index 3002e1e..8daf760 100644
--- a/services/post-service/internal/rpc/postv1/conversion.go
+++ b/services/post-service/internal/rpc/postv1/conversion.go
@@ -12,10 +12,10 @@ func PostToProto(post *internal.Post) *Post {
proto := Post{
Id: post.Id.GetReprId(),
- PanelId: post.PanelId,
+ PanelId: post.PanelId,
AuthorId: post.AuthorId,
- Title: post.Title,
+ Title: post.Title,
Content: post.Content,
CreatedAt: timestamppb.New(post.CreatedAt.Time),
@@ -36,12 +36,12 @@ func PostsToProto(posts []*internal.Post) []*Post {
protoPosts = append(protoPosts, PostToProto(post))
}
return protoPosts
-}
+}
// Protobuf 'PostMutable' -> PostCreate
func PostCreateFromProto(proto *PostMutable) internal.PostCreate {
return internal.PostCreate{
- Title: proto.GetTitle(),
+ Title: proto.GetTitle(),
Content: proto.GetContent(),
}
}
@@ -49,7 +49,7 @@ func PostCreateFromProto(proto *PostMutable) internal.PostCreate {
// Protobuf 'PostMutable' -> PostUpdate
func PostUpdateFromProto(proto *PostMutable) internal.PostUpdate {
return internal.PostUpdate{
- Title: proto.Title,
+ Title: proto.Title,
Content: proto.Content,
}
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/rpc/postv1/post.pb.go b/services/post-service/internal/rpc/postv1/post.pb.go
index 0477e8d..8b4e37e 100644
--- a/services/post-service/internal/rpc/postv1/post.pb.go
+++ b/services/post-service/internal/rpc/postv1/post.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.28.1
+// protoc-gen-go v1.31.0
// protoc v4.23.4
// source: post.proto
diff --git a/services/post-service/internal/rpc/postv1/post_grpc.pb.go b/services/post-service/internal/rpc/postv1/post_grpc.pb.go
index b004ca4..65cd962 100644
--- a/services/post-service/internal/rpc/postv1/post_grpc.pb.go
+++ b/services/post-service/internal/rpc/postv1/post_grpc.pb.go
@@ -1,6 +1,20 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.2.0
+// - protoc-gen-go-grpc v1.3.0
// - protoc v4.23.4
// source: post.proto
@@ -19,6 +33,17 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
+const (
+ PostService_CreatePost_FullMethodName = "/panels.post.v1.PostService/CreatePost"
+ PostService_GetPost_FullMethodName = "/panels.post.v1.PostService/GetPost"
+ PostService_GetPanelPost_FullMethodName = "/panels.post.v1.PostService/GetPanelPost"
+ PostService_UpdatePost_FullMethodName = "/panels.post.v1.PostService/UpdatePost"
+ PostService_DeletePost_FullMethodName = "/panels.post.v1.PostService/DeletePost"
+ PostService_GetFeedPosts_FullMethodName = "/panels.post.v1.PostService/GetFeedPosts"
+ PostService_GetUserPosts_FullMethodName = "/panels.post.v1.PostService/GetUserPosts"
+ PostService_GetPanelPosts_FullMethodName = "/panels.post.v1.PostService/GetPanelPosts"
+)
+
// 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.
@@ -43,7 +68,7 @@ func NewPostServiceClient(cc grpc.ClientConnInterface) PostServiceClient {
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...)
+ err := c.cc.Invoke(ctx, PostService_CreatePost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -52,7 +77,7 @@ func (c *postServiceClient) CreatePost(ctx context.Context, in *CreatePostReques
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...)
+ err := c.cc.Invoke(ctx, PostService_GetPost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -61,7 +86,7 @@ func (c *postServiceClient) GetPost(ctx context.Context, in *GetPostRequest, opt
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...)
+ err := c.cc.Invoke(ctx, PostService_GetPanelPost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -70,7 +95,7 @@ func (c *postServiceClient) GetPanelPost(ctx context.Context, in *GetPanelPostRe
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...)
+ err := c.cc.Invoke(ctx, PostService_UpdatePost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -79,7 +104,7 @@ func (c *postServiceClient) UpdatePost(ctx context.Context, in *UpdatePostReques
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...)
+ err := c.cc.Invoke(ctx, PostService_DeletePost_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -88,7 +113,7 @@ func (c *postServiceClient) DeletePost(ctx context.Context, in *DeletePostReques
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...)
+ err := c.cc.Invoke(ctx, PostService_GetFeedPosts_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -97,7 +122,7 @@ func (c *postServiceClient) GetFeedPosts(ctx context.Context, in *GetFeedPostsRe
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...)
+ err := c.cc.Invoke(ctx, PostService_GetUserPosts_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -106,7 +131,7 @@ func (c *postServiceClient) GetUserPosts(ctx context.Context, in *GetUserPostsRe
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...)
+ err := c.cc.Invoke(ctx, PostService_GetPanelPosts_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -179,7 +204,7 @@ func _PostService_CreatePost_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/CreatePost",
+ FullMethod: PostService_CreatePost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).CreatePost(ctx, req.(*CreatePostRequest))
@@ -197,7 +222,7 @@ func _PostService_GetPost_Handler(srv interface{}, ctx context.Context, dec func
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetPost",
+ FullMethod: PostService_GetPost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetPost(ctx, req.(*GetPostRequest))
@@ -215,7 +240,7 @@ func _PostService_GetPanelPost_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetPanelPost",
+ FullMethod: PostService_GetPanelPost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetPanelPost(ctx, req.(*GetPanelPostRequest))
@@ -233,7 +258,7 @@ func _PostService_UpdatePost_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/UpdatePost",
+ FullMethod: PostService_UpdatePost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).UpdatePost(ctx, req.(*UpdatePostRequest))
@@ -251,7 +276,7 @@ func _PostService_DeletePost_Handler(srv interface{}, ctx context.Context, dec f
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/DeletePost",
+ FullMethod: PostService_DeletePost_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).DeletePost(ctx, req.(*DeletePostRequest))
@@ -269,7 +294,7 @@ func _PostService_GetFeedPosts_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetFeedPosts",
+ FullMethod: PostService_GetFeedPosts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetFeedPosts(ctx, req.(*GetFeedPostsRequest))
@@ -287,7 +312,7 @@ func _PostService_GetUserPosts_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetUserPosts",
+ FullMethod: PostService_GetUserPosts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetUserPosts(ctx, req.(*GetUserPostsRequest))
@@ -305,7 +330,7 @@ func _PostService_GetPanelPosts_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/panels.post.v1.PostService/GetPanelPosts",
+ FullMethod: PostService_GetPanelPosts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PostServiceServer).GetPanelPosts(ctx, req.(*GetPanelPostsRequest))
diff --git a/services/post-service/internal/rpc/rpc.go b/services/post-service/internal/rpc/rpc.go
index 9307a13..dd56b4f 100644
--- a/services/post-service/internal/rpc/rpc.go
+++ b/services/post-service/internal/rpc/rpc.go
@@ -1,15 +1,29 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package rpc
import (
- "net"
"context"
+ "net"
+ "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
+ "github.com/rs/zerolog"
+ "github.com/rs/zerolog/log"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
"google.golang.org/grpc/health/grpc_health_v1"
- "github.com/rs/zerolog"
- "github.com/rs/zerolog/log"
- "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
"github.com/hexolan/panels/post-service/internal"
"github.com/hexolan/panels/post-service/internal/rpc/postv1"
@@ -47,16 +61,16 @@ func loggingInterceptor(logger zerolog.Logger) logging.Logger {
logger := logger.With().Fields(fields).Logger()
switch lvl {
- case logging.LevelError:
- logger.Error().Msg(msg)
- case logging.LevelWarn:
- logger.Warn().Msg(msg)
- case logging.LevelInfo:
- logger.Info().Msg(msg)
- case logging.LevelDebug:
- logger.Debug().Msg(msg)
- default:
- logger.Debug().Interface("unknown-log-level", lvl).Msg(msg)
+ case logging.LevelError:
+ logger.Error().Msg(msg)
+ case logging.LevelWarn:
+ logger.Warn().Msg(msg)
+ case logging.LevelInfo:
+ logger.Info().Msg(msg)
+ case logging.LevelDebug:
+ logger.Debug().Msg(msg)
+ default:
+ logger.Debug().Interface("unknown-log-level", lvl).Msg(msg)
}
})
}
@@ -67,11 +81,11 @@ func (r *RPCServer) Serve() {
if err != nil {
log.Panic().Err(err).Caller().Msg("failed to listen on RPC port (:9090)")
}
-
+
// Begin serving RPC
log.Info().Str("address", lis.Addr().String()).Msg("Attempting to serve RPC...")
err = r.grpcSvr.Serve(lis)
if err != nil {
log.Panic().Err(err).Caller().Msg("failed to serve RPC")
}
-}
\ No newline at end of file
+}
diff --git a/services/post-service/internal/service/post.go b/services/post-service/internal/service/post.go
index 4b19a20..18f2f8d 100644
--- a/services/post-service/internal/service/post.go
+++ b/services/post-service/internal/service/post.go
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package service
import (
@@ -17,7 +31,7 @@ type postService struct {
func NewPostService(events producer.PostEventProducer, repo internal.PostRepository) internal.PostService {
return postService{
events: events,
- repo: repo,
+ repo: repo,
}
}
@@ -30,7 +44,7 @@ func (srv postService) CreatePost(ctx context.Context, panelId string, authorId
// Create the post
post, err := srv.repo.CreatePost(ctx, panelId, authorId, data)
-
+
// Dispatch post created event
if err == nil {
srv.events.DispatchCreatedEvent(post)
@@ -44,7 +58,7 @@ func (srv postService) GetPost(ctx context.Context, id internal.PostId) (*intern
}
func (srv postService) GetPanelPost(ctx context.Context, id internal.PostId, panelId string) (*internal.Post, error) {
- panelId = strings.ToLower(panelId) // Panel IDs are case insensitive
+ panelId = strings.ToLower(panelId) // Panel IDs are case insensitive
return srv.repo.GetPanelPost(ctx, id, panelId)
}
@@ -72,7 +86,7 @@ func (srv postService) UpdatePost(ctx context.Context, id internal.PostId, data
func (srv postService) DeletePost(ctx context.Context, id internal.PostId) error {
err := srv.repo.DeletePost(ctx, id)
-
+
// Dispatch post deleted event
if err == nil {
srv.events.DispatchDeletedEvent(id)
@@ -91,4 +105,4 @@ func (srv postService) GetUserPosts(ctx context.Context, userId string) ([]*inte
func (srv postService) GetPanelPosts(ctx context.Context, panelId string) ([]*internal.Post, error) {
return srv.repo.GetPanelPosts(ctx, panelId)
-}
\ No newline at end of file
+}
diff --git a/services/user-service/package.json b/services/user-service/package.json
index 3f92ead..1580477 100644
--- a/services/user-service/package.json
+++ b/services/user-service/package.json
@@ -2,7 +2,7 @@
"name": "user-service",
"description": "Panels - User Service",
"version": "1.0.0",
- "author": "Declan ",
+ "author": "Declan Teevan ",
"license": "Apache-2.0",
"main": "index.ts",
"scripts": {
diff --git a/services/user-service/src/config.ts b/services/user-service/src/config.ts
index 25ad748..942a18f 100644
--- a/services/user-service/src/config.ts
+++ b/services/user-service/src/config.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
function getMongoURI(): string {
if (process.env.MONGODB_URI === undefined) {
throw new Error("mongodb_uri configuration not provided");
diff --git a/services/user-service/src/kafka/producer.ts b/services/user-service/src/kafka/producer.ts
index 400a754..0dd1626 100644
--- a/services/user-service/src/kafka/producer.ts
+++ b/services/user-service/src/kafka/producer.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import { Kafka, Message, Producer } from "kafkajs";
import { kafkaBrokers } from "../config";
diff --git a/services/user-service/src/main.ts b/services/user-service/src/main.ts
index 8e6bee1..f223b01 100644
--- a/services/user-service/src/main.ts
+++ b/services/user-service/src/main.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import mongoose from "mongoose";
import { mongodbUri } from "./config";
diff --git a/services/user-service/src/mongo/User.ts b/services/user-service/src/mongo/User.ts
index b4a0420..11094c6 100644
--- a/services/user-service/src/mongo/User.ts
+++ b/services/user-service/src/mongo/User.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import { Document, Schema, model } from "mongoose";
import uniqueValidator from "mongoose-unique-validator";
diff --git a/services/user-service/src/proto/convert.ts b/services/user-service/src/proto/convert.ts
index 3a65b63..80f1460 100644
--- a/services/user-service/src/proto/convert.ts
+++ b/services/user-service/src/proto/convert.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import { Timestamp } from "@bufbuild/protobuf";
import { User as ProtoUser } from "../proto/user_pb";
diff --git a/services/user-service/src/proto/user_connect.ts b/services/user-service/src/proto/user_connect.ts
index 89402dd..765b64e 100644
--- a/services/user-service/src/proto/user_connect.ts
+++ b/services/user-service/src/proto/user_connect.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// @generated by protoc-gen-connect-es v0.13.2 with parameter "target=ts"
// @generated from file user.proto (package panels.user.v1, syntax proto3)
/* eslint-disable */
diff --git a/services/user-service/src/proto/user_pb.ts b/services/user-service/src/proto/user_pb.ts
index 877ba7e..c8fa9bd 100644
--- a/services/user-service/src/proto/user_pb.ts
+++ b/services/user-service/src/proto/user_pb.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
// @generated by protoc-gen-es v1.3.1 with parameter "target=ts"
// @generated from file user.proto (package panels.user.v1, syntax proto3)
/* eslint-disable */
diff --git a/services/user-service/src/rpc/connect.ts b/services/user-service/src/rpc/connect.ts
index 1f48e1c..e13830d 100644
--- a/services/user-service/src/rpc/connect.ts
+++ b/services/user-service/src/rpc/connect.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import { Empty } from "@bufbuild/protobuf"
import { ConnectRouter, ConnectError, Code } from "@connectrpc/connect"
diff --git a/services/user-service/src/rpc/server.ts b/services/user-service/src/rpc/server.ts
index 0984797..940b60a 100644
--- a/services/user-service/src/rpc/server.ts
+++ b/services/user-service/src/rpc/server.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import { fastify } from "fastify";
import { fastifyConnectPlugin } from "@connectrpc/connect-fastify";
diff --git a/services/user-service/src/service.ts b/services/user-service/src/service.ts
index ef3935f..d1bc5f0 100644
--- a/services/user-service/src/service.ts
+++ b/services/user-service/src/service.ts
@@ -1,3 +1,17 @@
+// Copyright 2023 Declan Teevan
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
import { Types } from "mongoose";
import { ConnectError, Code } from "@connectrpc/connect";