style: license headers + gofmt

This commit is contained in:
2024-03-27 11:12:43 +00:00
parent e9a1653c4e
commit 4d9a7a4856
109 changed files with 2059 additions and 530 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
@@ -62,9 +76,7 @@ message DeletePostRequest {
string id = 1;
}
message GetFeedPostsRequest {
}
message GetFeedPostsRequest {}
message FeedPosts {
repeated Post posts = 1;

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -5,7 +5,7 @@ description = "Panels - Auth Service"
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/hexolan/panels"
authors = ["Declan <declan@hexolan.dev>"]
authors = ["Declan Teevan <dt@hexolan.com>"]
[tool.poetry.dependencies]
python = "^3.9"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -5,7 +5,7 @@ description = "Panels - Comment Service"
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/hexolan/panels"
authors = ["Declan <declan@hexolan.dev>"]
authors = ["Declan Teevan <dt@hexolan.com>"]
[tool.poetry.dependencies]
python = "^3.9"

View File

@@ -2,7 +2,7 @@
"name": "frontend",
"description": "Panels - Frontend Site",
"version": "1.0.0",
"author": "Declan <declan@hexolan.dev>",
"author": "Declan Teevan <dt@hexolan.com>",
"license": "Apache-2.0",
"type": "module",
"scripts": {

View File

@@ -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 (

View File

@@ -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"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
)

View File

@@ -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 (

View File

@@ -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"
)

View File

@@ -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 (

View File

@@ -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) {

View File

@@ -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"

View File

@@ -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")
}
@@ -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")
}

View File

@@ -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"

View File

@@ -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,7 +205,7 @@ 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")
}

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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

View File

@@ -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))

View File

@@ -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

View File

@@ -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))

View File

@@ -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

View File

@@ -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))

View File

@@ -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

View File

@@ -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))

View File

@@ -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,11 +21,11 @@ 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

View File

@@ -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

View File

@@ -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))

View File

@@ -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"
)

View File

@@ -1,10 +1,25 @@
//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"

View File

@@ -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 internal
import (
"os"
"fmt"
"os"
"strings"
"github.com/rs/zerolog"

View File

@@ -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 (

View File

@@ -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 (

View File

@@ -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 (

View File

@@ -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"
)

View File

@@ -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"
)

View File

@@ -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"
)
@@ -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

View File

@@ -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 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"
)

View File

@@ -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 (

View File

@@ -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

View File

@@ -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))

View File

@@ -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"

View File

@@ -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 (

View File

@@ -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,10 +20,10 @@ 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"
)

View File

@@ -1,10 +1,25 @@
//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"

View File

@@ -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 internal
import (
"os"
"fmt"
"os"
"strings"
"github.com/rs/zerolog"

View File

@@ -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 (

View File

@@ -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,8 +22,8 @@ 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 {

View File

@@ -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

View File

@@ -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))

View File

@@ -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,8 +22,8 @@ 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 {

View File

@@ -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

View File

@@ -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))

View File

@@ -1,9 +1,23 @@
// 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 {

View File

@@ -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 (

View File

@@ -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 (
"regexp"
"context"
"strconv"
"encoding/json"
"database/sql"
"database/sql/driver"
"encoding/json"
"regexp"
"strconv"
"github.com/jackc/pgx/v5/pgtype"
"github.com/go-ozzo/ozzo-validation/v4"
"github.com/jackc/pgx/v5/pgtype"
)
// Post Models

View File

@@ -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"
)

View File

@@ -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"
)

View File

@@ -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"
)
@@ -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

View File

@@ -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 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"
)

View File

@@ -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 (

View File

@@ -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

View File

@@ -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))

View File

@@ -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"

View File

@@ -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 (

View File

@@ -2,7 +2,7 @@
"name": "user-service",
"description": "Panels - User Service",
"version": "1.0.0",
"author": "Declan <declan@hexolan.dev>",
"author": "Declan Teevan <dt@hexolan.com>",
"license": "Apache-2.0",
"main": "index.ts",
"scripts": {

View File

@@ -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");

View File

@@ -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";

View File

@@ -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";

Some files were not shown because too many files have changed in this diff Show More