From 2bc6d8e1ae4defcee055661c310d3ea94eda20a0 Mon Sep 17 00:00:00 2001 From: Meysam Hadeli <35596795+meysamhadeli@users.noreply.github.com> Date: Sun, 27 Oct 2024 14:38:57 +0330 Subject: [PATCH] refactor: refactor infrastructure deployment --- .../docker-compose/infrastructure.yaml | 26 +- internal/pkg/go.mod | 2 +- internal/services/identity_service/go.mod | 12 +- internal/services/identity_service/go.sum | 20 +- internal/services/inventory_service/go.mod | 2 +- internal/services/product_service/go.mod | 2 +- services/product_service/docs/docs.go | 490 ------------------ services/product_service/docs/swagger.json | 462 ----------------- services/product_service/docs/swagger.yaml | 290 ----------- 9 files changed, 34 insertions(+), 1272 deletions(-) delete mode 100644 services/product_service/docs/docs.go delete mode 100644 services/product_service/docs/swagger.json delete mode 100644 services/product_service/docs/swagger.yaml diff --git a/deployments/docker-compose/infrastructure.yaml b/deployments/docker-compose/infrastructure.yaml index 4b0a9df..5830fee 100644 --- a/deployments/docker-compose/infrastructure.yaml +++ b/deployments/docker-compose/infrastructure.yaml @@ -5,8 +5,8 @@ services: # Rabbitmq ####################################################### rabbitmq: - image: rabbitmq:3-management container_name: rabbitmq + image: rabbitmq:management restart: unless-stopped ports: - 5672:5672 @@ -14,29 +14,33 @@ services: networks: - shop - ####################################################### # Postgress ####################################################### postgres: + image: postgres:latest container_name: postgres - image: postgres:13-alpine restart: unless-stopped ports: - - '5432:5432' + - '5432:5432' environment: - - POSTGRES_USER=postgress - - POSTGRES_PASSWORD=postgress + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + command: + - "postgres" + - "-c" + - "wal_level=logical" + - "-c" + - "max_prepared_transactions=10" networks: - - shop - - + - shop + ####################################################### # Jaeger ####################################################### jaeger: - image: jaegertracing/all-in-one container_name: jaeger + image: jaegertracing/all-in-one restart: unless-stopped networks: - shop @@ -47,7 +51,7 @@ services: - 6832:6832/udp - 9411:9411 - 14268:14268 - - 16686:16686 + - 16686:16686 networks: diff --git a/internal/pkg/go.mod b/internal/pkg/go.mod index 757598e..e45ad18 100644 --- a/internal/pkg/go.mod +++ b/internal/pkg/go.mod @@ -1,6 +1,6 @@ module github.com/meysamhadeli/shop-golang-microservices/internal/pkg -go 1.22 +go 1.23.2 require ( github.com/ahmetb/go-linq/v3 v3.2.0 diff --git a/internal/services/identity_service/go.mod b/internal/services/identity_service/go.mod index cefe8fd..a8f9fbd 100644 --- a/internal/services/identity_service/go.mod +++ b/internal/services/identity_service/go.mod @@ -1,6 +1,6 @@ module github.com/meysamhadeli/shop-golang-microservices/internal/services/identity_service -go 1.22 +go 1.23.2 replace github.com/meysamhadeli/shop-golang-microservices/internal/pkg => ../../pkg @@ -16,7 +16,7 @@ require ( github.com/sirupsen/logrus v1.9.0 github.com/spf13/viper v1.14.0 github.com/swaggo/echo-swagger v1.4.1 - github.com/swaggo/swag v1.16.3 + github.com/swaggo/swag v1.16.4 go.uber.org/fx v1.18.2 google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 @@ -108,10 +108,10 @@ require ( go.uber.org/dig v1.15.0 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect golang.org/x/tools v0.7.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e // indirect diff --git a/internal/services/identity_service/go.sum b/internal/services/identity_service/go.sum index 1db609b..5db5e58 100644 --- a/internal/services/identity_service/go.sum +++ b/internal/services/identity_service/go.sum @@ -441,8 +441,8 @@ github.com/swaggo/echo-swagger v1.4.1 h1:Yf0uPaJWp1uRtDloZALyLnvdBeoEL5Kc7DtnjzO github.com/swaggo/echo-swagger v1.4.1/go.mod h1:C8bSi+9yH2FLZsnhqMZLIZddpUxZdBYuNHbtaS1Hljc= github.com/swaggo/files/v2 v2.0.0 h1:hmAt8Dkynw7Ssz46F6pn8ok6YmGZqHSVLZ+HQM7i0kw= github.com/swaggo/files/v2 v2.0.0/go.mod h1:24kk2Y9NYEJ5lHuCra6iVwkMjIekMCaFq/0JQj66kyM= -github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= -github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= +github.com/swaggo/swag v1.16.4 h1:clWJtd9LStiG3VeijiCfOVODP6VpHtKdQy9ELFG3s1A= +github.com/swaggo/swag v1.16.4/go.mod h1:VBsHJRsDvfYvqoiMKnsdwhNV9LEMHgEDZcyVYX0sxPg= github.com/tidwall/btree v0.0.0-20191029221954-400434d76274 h1:G6Z6HvJuPjG6XfNGi/feOATzeJrfgTNJY+rGrHbA04E= github.com/tidwall/btree v0.0.0-20191029221954-400434d76274/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8= github.com/tidwall/buntdb v1.1.2 h1:noCrqQXL9EKMtcdwJcmuVKSEjqu1ua99RHHgbLTEHRo= @@ -562,8 +562,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -638,8 +638,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -720,8 +720,8 @@ golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -733,8 +733,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/internal/services/inventory_service/go.mod b/internal/services/inventory_service/go.mod index 3bb82ee..b2ee542 100644 --- a/internal/services/inventory_service/go.mod +++ b/internal/services/inventory_service/go.mod @@ -1,6 +1,6 @@ module github.com/meysamhadeli/shop-golang-microservices/internal/services/inventory_service -go 1.22 +go 1.23.2 replace github.com/meysamhadeli/shop-golang-microservices/internal/pkg => ../../pkg diff --git a/internal/services/product_service/go.mod b/internal/services/product_service/go.mod index 33df1bd..1e06dd1 100644 --- a/internal/services/product_service/go.mod +++ b/internal/services/product_service/go.mod @@ -1,6 +1,6 @@ module github.com/meysamhadeli/shop-golang-microservices/internal/services/product_service -go 1.22 +go 1.23.2 replace github.com/meysamhadeli/shop-golang-microservices/internal/pkg => ../../pkg diff --git a/services/product_service/docs/docs.go b/services/product_service/docs/docs.go deleted file mode 100644 index 8e47450..0000000 --- a/services/product_service/docs/docs.go +++ /dev/null @@ -1,490 +0,0 @@ -// Package docs GENERATED BY SWAG; DO NOT EDIT -// This file was generated by swaggo/swag -package docs - -import "github.com/swaggo/swag" - -const docTemplate = `{ - "schemes": {{ marshal .Schemes }}, - "swagger": "2.0", - "info": { - "description": "{{escape .Description}}", - "title": "{{.Title}}", - "contact": {}, - "version": "{{.Version}}" - }, - "host": "{{.Host}}", - "basePath": "{{.BasePath}}", - "paths": { - "/api/v1/products": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Get all products", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Get all product", - "parameters": [ - { - "type": "string", - "name": "orderBy", - "in": "query" - }, - { - "type": "integer", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "name": "size", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dtos.GetProductsResponseDto" - } - } - } - }, - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Create new product item", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Create product", - "parameters": [ - { - "description": "Product data", - "name": "CreateProductRequestDto", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dtos.CreateProductRequestDto" - } - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/dtos.CreateProductResponseDto" - } - } - } - } - }, - "/api/v1/products/search": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Search products", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Search products", - "parameters": [ - { - "type": "string", - "name": "orderBy", - "in": "query" - }, - { - "type": "integer", - "name": "page", - "in": "query" - }, - { - "type": "string", - "name": "search", - "in": "query" - }, - { - "type": "integer", - "name": "size", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dtos.SearchProductsResponseDto" - } - } - } - } - }, - "/api/v1/products/{id}": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Get product by id", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Get product", - "parameters": [ - { - "type": "string", - "description": "Product ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dtos.GetProductByIdResponseDto" - } - } - } - }, - "put": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Update existing product", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Update product", - "parameters": [ - { - "description": "Product data", - "name": "UpdateProductRequestDto", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dtos.UpdateProductRequestDto" - } - }, - { - "type": "string", - "description": "Product ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "" - } - } - }, - "delete": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Delete existing product", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Delete product", - "parameters": [ - { - "type": "string", - "description": "Product ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "" - } - } - } - }, - "/api/v1/users": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Create new user", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Users" - ], - "summary": "Register user", - "parameters": [ - { - "description": "User data", - "name": "RegisterUserRequestDto", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dtos.RegisterUserRequestDto" - } - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/dtos.RegisterUserResponseDto" - } - } - } - } - } - }, - "definitions": { - "dtos.CreateProductRequestDto": { - "type": "object", - "properties": { - "count": { - "type": "integer" - }, - "description": { - "type": "string" - }, - "inventoryId": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "price": { - "type": "number" - } - } - }, - "dtos.CreateProductResponseDto": { - "type": "object", - "properties": { - "productId": { - "type": "string" - } - } - }, - "dtos.GetProductByIdResponseDto": { - "type": "object", - "properties": { - "product": { - "$ref": "#/definitions/dtos.ProductDto" - } - } - }, - "dtos.GetProductsResponseDto": { - "type": "object", - "properties": { - "products": { - "type": "object" - } - } - }, - "dtos.ProductDto": { - "type": "object", - "properties": { - "count": { - "type": "integer" - }, - "createdAt": { - "type": "string" - }, - "description": { - "type": "string" - }, - "inventoryId": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "price": { - "type": "number" - }, - "productId": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "dtos.RegisterUserRequestDto": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - }, - "password": { - "type": "string" - }, - "userName": { - "type": "string" - } - } - }, - "dtos.RegisterUserResponseDto": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - }, - "password": { - "type": "string" - }, - "userId": { - "type": "string" - }, - "userName": { - "type": "string" - } - } - }, - "dtos.SearchProductsResponseDto": { - "type": "object", - "properties": { - "products": { - "type": "object" - } - } - }, - "dtos.UpdateProductRequestDto": { - "type": "object", - "required": [ - "count", - "inventoryId", - "name", - "price" - ], - "properties": { - "count": { - "type": "integer" - }, - "description": { - "type": "string" - }, - "inventoryId": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "price": { - "type": "number" - } - } - }, - "utils.FilterModel": { - "type": "object", - "properties": { - "comparison": { - "type": "string" - }, - "field": { - "type": "string" - }, - "value": { - "type": "string" - } - } - } - }, - "securityDefinitions": { - "ApiKeyAuth": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - } -}` - -// SwaggerInfo holds exported Swagger Info so clients can modify it -var SwaggerInfo = &swag.Spec{ - Version: "", - Host: "", - BasePath: "", - Schemes: []string{}, - Title: "", - Description: "", - InfoInstanceName: "swagger", - SwaggerTemplate: docTemplate, -} - -func init() { - swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) -} diff --git a/services/product_service/docs/swagger.json b/services/product_service/docs/swagger.json deleted file mode 100644 index d35df53..0000000 --- a/services/product_service/docs/swagger.json +++ /dev/null @@ -1,462 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "contact": {} - }, - "paths": { - "/api/v1/products": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Get all products", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Get all product", - "parameters": [ - { - "type": "string", - "name": "orderBy", - "in": "query" - }, - { - "type": "integer", - "name": "page", - "in": "query" - }, - { - "type": "integer", - "name": "size", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dtos.GetProductsResponseDto" - } - } - } - }, - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Create new product item", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Create product", - "parameters": [ - { - "description": "Product data", - "name": "CreateProductRequestDto", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dtos.CreateProductRequestDto" - } - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/dtos.CreateProductResponseDto" - } - } - } - } - }, - "/api/v1/products/search": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Search products", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Search products", - "parameters": [ - { - "type": "string", - "name": "orderBy", - "in": "query" - }, - { - "type": "integer", - "name": "page", - "in": "query" - }, - { - "type": "string", - "name": "search", - "in": "query" - }, - { - "type": "integer", - "name": "size", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dtos.SearchProductsResponseDto" - } - } - } - } - }, - "/api/v1/products/{id}": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Get product by id", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Get product", - "parameters": [ - { - "type": "string", - "description": "Product ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dtos.GetProductByIdResponseDto" - } - } - } - }, - "put": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Update existing product", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Update product", - "parameters": [ - { - "description": "Product data", - "name": "UpdateProductRequestDto", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dtos.UpdateProductRequestDto" - } - }, - { - "type": "string", - "description": "Product ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "" - } - } - }, - "delete": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Delete existing product", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Products" - ], - "summary": "Delete product", - "parameters": [ - { - "type": "string", - "description": "Product ID", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "204": { - "description": "" - } - } - } - }, - "/api/v1/users": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "Create new user", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Users" - ], - "summary": "Register user", - "parameters": [ - { - "description": "User data", - "name": "RegisterUserRequestDto", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dtos.RegisterUserRequestDto" - } - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/dtos.RegisterUserResponseDto" - } - } - } - } - } - }, - "definitions": { - "dtos.CreateProductRequestDto": { - "type": "object", - "properties": { - "count": { - "type": "integer" - }, - "description": { - "type": "string" - }, - "inventoryId": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "price": { - "type": "number" - } - } - }, - "dtos.CreateProductResponseDto": { - "type": "object", - "properties": { - "productId": { - "type": "string" - } - } - }, - "dtos.GetProductByIdResponseDto": { - "type": "object", - "properties": { - "product": { - "$ref": "#/definitions/dtos.ProductDto" - } - } - }, - "dtos.GetProductsResponseDto": { - "type": "object", - "properties": { - "products": { - "type": "object" - } - } - }, - "dtos.ProductDto": { - "type": "object", - "properties": { - "count": { - "type": "integer" - }, - "createdAt": { - "type": "string" - }, - "description": { - "type": "string" - }, - "inventoryId": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "price": { - "type": "number" - }, - "productId": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "dtos.RegisterUserRequestDto": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - }, - "password": { - "type": "string" - }, - "userName": { - "type": "string" - } - } - }, - "dtos.RegisterUserResponseDto": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - }, - "password": { - "type": "string" - }, - "userId": { - "type": "string" - }, - "userName": { - "type": "string" - } - } - }, - "dtos.SearchProductsResponseDto": { - "type": "object", - "properties": { - "products": { - "type": "object" - } - } - }, - "dtos.UpdateProductRequestDto": { - "type": "object", - "required": [ - "count", - "inventoryId", - "name", - "price" - ], - "properties": { - "count": { - "type": "integer" - }, - "description": { - "type": "string" - }, - "inventoryId": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "price": { - "type": "number" - } - } - }, - "utils.FilterModel": { - "type": "object", - "properties": { - "comparison": { - "type": "string" - }, - "field": { - "type": "string" - }, - "value": { - "type": "string" - } - } - } - }, - "securityDefinitions": { - "ApiKeyAuth": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - } -} \ No newline at end of file diff --git a/services/product_service/docs/swagger.yaml b/services/product_service/docs/swagger.yaml deleted file mode 100644 index fee6e97..0000000 --- a/services/product_service/docs/swagger.yaml +++ /dev/null @@ -1,290 +0,0 @@ -definitions: - dtos.CreateProductRequestDto: - properties: - count: - type: integer - description: - type: string - inventoryId: - type: integer - name: - type: string - price: - type: number - type: object - dtos.CreateProductResponseDto: - properties: - productId: - type: string - type: object - dtos.GetProductByIdResponseDto: - properties: - product: - $ref: '#/definitions/dtos.ProductDto' - type: object - dtos.GetProductsResponseDto: - properties: - products: - type: object - type: object - dtos.ProductDto: - properties: - count: - type: integer - createdAt: - type: string - description: - type: string - inventoryId: - type: integer - name: - type: string - price: - type: number - productId: - type: string - updatedAt: - type: string - type: object - dtos.RegisterUserRequestDto: - properties: - email: - type: string - firstName: - type: string - lastName: - type: string - password: - type: string - userName: - type: string - type: object - dtos.RegisterUserResponseDto: - properties: - email: - type: string - firstName: - type: string - lastName: - type: string - password: - type: string - userId: - type: string - userName: - type: string - type: object - dtos.SearchProductsResponseDto: - properties: - products: - type: object - type: object - dtos.UpdateProductRequestDto: - properties: - count: - type: integer - description: - type: string - inventoryId: - type: integer - name: - type: string - price: - type: number - required: - - count - - inventoryId - - name - - price - type: object - utils.FilterModel: - properties: - comparison: - type: string - field: - type: string - value: - type: string - type: object -info: - contact: {} -paths: - /api/v1/products: - get: - consumes: - - application/json - description: Get all products - parameters: - - in: query - name: orderBy - type: string - - in: query - name: page - type: integer - - in: query - name: size - type: integer - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/dtos.GetProductsResponseDto' - security: - - ApiKeyAuth: [] - summary: Get all product - tags: - - Products - post: - consumes: - - application/json - description: Create new product item - parameters: - - description: Product data - in: body - name: CreateProductRequestDto - required: true - schema: - $ref: '#/definitions/dtos.CreateProductRequestDto' - produces: - - application/json - responses: - "201": - description: Created - schema: - $ref: '#/definitions/dtos.CreateProductResponseDto' - security: - - ApiKeyAuth: [] - summary: Create product - tags: - - Products - /api/v1/products/{id}: - delete: - consumes: - - application/json - description: Delete existing product - parameters: - - description: Product ID - in: path - name: id - required: true - type: string - produces: - - application/json - responses: - "204": - description: "" - security: - - ApiKeyAuth: [] - summary: Delete product - tags: - - Products - get: - consumes: - - application/json - description: Get product by id - parameters: - - description: Product ID - in: path - name: id - required: true - type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/dtos.GetProductByIdResponseDto' - security: - - ApiKeyAuth: [] - summary: Get product - tags: - - Products - put: - consumes: - - application/json - description: Update existing product - parameters: - - description: Product data - in: body - name: UpdateProductRequestDto - required: true - schema: - $ref: '#/definitions/dtos.UpdateProductRequestDto' - - description: Product ID - in: path - name: id - required: true - type: string - produces: - - application/json - responses: - "204": - description: "" - security: - - ApiKeyAuth: [] - summary: Update product - tags: - - Products - /api/v1/products/search: - get: - consumes: - - application/json - description: Search products - parameters: - - in: query - name: orderBy - type: string - - in: query - name: page - type: integer - - in: query - name: search - type: string - - in: query - name: size - type: integer - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/dtos.SearchProductsResponseDto' - security: - - ApiKeyAuth: [] - summary: Search products - tags: - - Products - /api/v1/users: - post: - consumes: - - application/json - description: Create new user - parameters: - - description: User data - in: body - name: RegisterUserRequestDto - required: true - schema: - $ref: '#/definitions/dtos.RegisterUserRequestDto' - produces: - - application/json - responses: - "201": - description: Created - schema: - $ref: '#/definitions/dtos.RegisterUserResponseDto' - security: - - ApiKeyAuth: [] - summary: Register user - tags: - - Users -securityDefinitions: - ApiKeyAuth: - in: header - name: Authorization - type: apiKey -swagger: "2.0"