Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user and iam module initialization #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
API_NAME=gomora
API_NAME=celeste
API_ENV=local
API_URL_GRPC=http://localhost
API_URL_GRPC_PORT=9090
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ lint:
.PHONY: build
build:
mkdir -p bin
go build -o bin/gomora \
go build -o bin/celeste \
cmd/main.go

.PHONY: build-dev
build-dev:
mkdir -p bin
go build -race -o bin/gomora \
go build -race -o bin/celeste \
cmd/main.go

.PHONY: test
Expand All @@ -32,11 +32,11 @@ test:

.PHONY: run
run: build
./bin/gomora
./bin/celeste

.PHONY: run-dev
run-dev: build-dev
./bin/gomora
./bin/celeste

.PHONY: up
up:
Expand Down
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (

"github.com/joho/godotenv"

"gomora/interfaces/http/grpc"
"gomora/interfaces/http/rest"
"celeste/interfaces/http/grpc"
"celeste/interfaces/http/rest"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services:
gomora:
celeste:
build: .
container_name: ${API_NAME}
mem_limit: "3g"
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title>Gomora API Documentation</title>
<title>Celeste API Documentation</title>
<!-- Embed elements Elements via Web Component -->
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
<link
Expand Down
42 changes: 23 additions & 19 deletions docs/openapi.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"openapi": "3.0.2",
"info": {
"title": "Gomora API",
"description": "A progressive framework-agnostic API template following CLEAN architecture and SOLID principles. DDD inspired :)",
"termsOfService": "https://github.com/Nuxify/gomora",
"title": "Celeste API",
"description": "Celeste API Documentation",
"termsOfService": "https://github.com/Nuxify/celeste",
"contact": {
"name": "Nuxify Inc.",
"email": "[email protected]"
Expand All @@ -12,11 +12,11 @@
},
"servers": [
{
"url": "https://gomora-api.nuxify.tech/v1",
"url": "https://celeste-api.nuxify.tech/v1",
"description": "Production"
},
{
"url": "https://staging-gomora-api.nuxify.tech/v1",
"url": "https://staging-celeste-api.nuxify.tech/v1",
"description": "Staging"
},
{
Expand All @@ -26,22 +26,26 @@
],
"tags": [
{
"name": "record",
"description": "Record service"
"name": "iam",
"description": "IAM service"
},
{
"name": "user",
"description": "User service"
}
],
"paths": {
"/record": {
"/user": {
"post": {
"tags": ["record"],
"summary": "Create Record",
"description": "Creates a record",
"tags": ["user"],
"summary": "Create User",
"description": "Creates a user",
"requestBody": {
"description": "Creates a record request",
"description": "Creates a user request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateRecordRequest"
"$ref": "#/components/schemas/CreateUserRequest"
}
}
},
Expand All @@ -60,16 +64,16 @@
}
}
},
"/record/{id}": {
"/user/{id}": {
"get": {
"tags": ["record"],
"summary": "Get Record By ID",
"description": "Get record by its id",
"tags": ["user"],
"summary": "Get User By ID",
"description": "Get user by its id",
"parameters": [
{
"name": "id",
"in": "path",
"description": "Record id",
"description": "User id",
"required": true,
"schema": {
"type": "string"
Expand All @@ -92,7 +96,7 @@
},
"components": {
"schemas": {
"CreateRecordRequest": {
"CreateUserRequest": {
"required": ["id", "data"],
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module gomora
module celeste

go 1.21

Expand Down
2 changes: 1 addition & 1 deletion infrastructures/database/mysql/MySQLDBHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"

"gomora/infrastructures/database/mysql/types"
"celeste/infrastructures/database/mysql/types"
)

// MySQLDBHandler handles mysql operations
Expand Down
2 changes: 1 addition & 1 deletion infrastructures/database/mysql/MySQLDBHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/joho/godotenv"

"gomora/infrastructures/database/mysql/types"
"celeste/infrastructures/database/mysql/types"
)

func TestConnection(t *testing.T) {
Expand Down
11 changes: 4 additions & 7 deletions interfaces/http/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import (
"sync"

"google.golang.org/grpc"

"gomora/interfaces"
recordGRPCPB "gomora/module/record/interfaces/http/grpc/pb"
)

// GRPCServerInterface holds the implementable method for the grpc server interface
Expand All @@ -34,11 +31,11 @@ func (s *server) Serve(port int) {
// create grpc server
grpcServer := grpc.NewServer()

recordCommandServer := interfaces.ServiceContainer().RegisterRecordGRPCCommandController()
recordQueryServer := interfaces.ServiceContainer().RegisterRecordGRPCQueryController()
//recordCommandServer := interfaces.ServiceContainer().RegisterRecordGRPCCommandController()
//recordQueryServer := interfaces.ServiceContainer().RegisterRecordGRPCQueryController()

recordGRPCPB.RegisterRecordCommandServiceServer(grpcServer, &recordCommandServer)
recordGRPCPB.RegisterRecordQueryServiceServer(grpcServer, &recordQueryServer)
//recordGRPCPB.RegisterRecordCommandServiceServer(grpcServer, &recordCommandServer)
//recordGRPCPB.RegisterRecordQueryServiceServer(grpcServer, &recordQueryServer)

log.Printf("[SERVER] gRPC server running on :%d", port)
if err := grpcServer.Serve(lis); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion interfaces/http/rest/middlewares/cors/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cors
import (
"github.com/go-chi/cors"

corsConfig "gomora/configs/cors"
corsConfig "celeste/configs/cors"
)

// Init initializes the CORS configuration
Expand Down
14 changes: 4 additions & 10 deletions interfaces/http/rest/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ import (
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"

"gomora/interfaces"
"gomora/interfaces/http/rest/middlewares/cors"
"gomora/interfaces/http/rest/viewmodels"
"celeste/interfaces/http/rest/middlewares/cors"
"celeste/interfaces/http/rest/viewmodels"
)

// ChiRouterInterface declares methods for the chi router
Expand All @@ -42,8 +41,8 @@ var (
// InitRouter initializes main routes
func (router *router) InitRouter() *chi.Mux {
// DI assignment
recordCommandController := interfaces.ServiceContainer().RegisterRecordRESTCommandController()
recordQueryController := interfaces.ServiceContainer().RegisterRecordRESTQueryController()
// iamCommandController := interfaces.ServiceContainer().RegisterIAMRESTCommandController()
// iamQueryController := interfaces.ServiceContainer().RegisterIAMRESTQueryController()

// create router
r := chi.NewRouter()
Expand Down Expand Up @@ -81,11 +80,6 @@ func (router *router) InitRouter() *chi.Mux {
// API routes
r.Group(func(r chi.Router) {
r.Route("/v1", func(r chi.Router) {
// record module
r.Route("/record", func(r chi.Router) {
r.Post("/", recordCommandController.CreateRecord)
r.Get("/{id}", recordQueryController.GetRecordByID)
})
})
})

Expand Down
Loading