From f6da7eab4d5243fa6e9bcc90c83e9f1151fa8a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20=C3=81lvarez?= <86166683+ralvarezdev@users.noreply.github.com> Date: Sat, 21 Dec 2024 19:17:32 -0400 Subject: [PATCH] refactor: Simplified gRPC methods interceptions * Simplified gRPC methods interceptions * Forked this repository into 'github.com/ralvarezdev/go-jwt' and 'github.com/ralvarezdev/go-parser' --- compile.bat | 3 - config/grpc/auth/interceptions.go | 30 --- config/grpc/auth/methods.go | 31 --- config/grpc/order/interceptions.go | 18 -- config/grpc/order/methods.go | 18 -- config/grpc/payment/interceptions.go | 23 -- config/grpc/payment/methods.go | 23 -- config/grpc/shop/interceptions.go | 64 ----- config/grpc/shop/methods.go | 64 ----- config/grpc/user/interceptions.go | 34 --- config/grpc/user/methods.go | 34 --- config/rest/api/endpoints.go | 8 - .../api/v1/auth/access-tokens/endpoints.go | 16 -- .../rest/api/v1/auth/access-tokens/mappers.go | 11 - config/rest/api/v1/auth/endpoints.go | 14 - config/rest/api/v1/auth/mappers.go | 12 - .../rest/api/v1/auth/permissions/endpoints.go | 14 - .../rest/api/v1/auth/permissions/mappers.go | 14 - .../api/v1/auth/refresh-tokens/endpoints.go | 21 -- .../api/v1/auth/refresh-tokens/mappers.go | 16 -- .../api/v1/auth/role-permissions/endpoints.go | 15 -- .../api/v1/auth/role-permissions/mappers.go | 11 - config/rest/api/v1/auth/roles/endpoints.go | 14 - config/rest/api/v1/auth/roles/mappers.go | 15 -- .../rest/api/v1/auth/user-roles/endpoints.go | 14 - config/rest/api/v1/auth/user-roles/mappers.go | 13 - config/rest/api/v1/endpoints.go | 8 - .../api/v1/orders/carts/current/endpoints.go | 14 - .../api/v1/orders/carts/current/mappers.go | 14 - config/rest/api/v1/orders/carts/endpoints.go | 15 -- config/rest/api/v1/orders/carts/mappers.go | 13 - config/rest/api/v1/orders/endpoints.go | 14 - config/rest/api/v1/orders/mappers.go | 12 - .../api/v1/payments/accounts/endpoints.go | 18 -- .../rest/api/v1/payments/accounts/mappers.go | 17 -- .../api/v1/payments/branch-rents/endpoints.go | 15 -- .../api/v1/payments/branch-rents/mappers.go | 14 - config/rest/api/v1/payments/endpoints.go | 8 - .../rest/api/v1/payments/orders/endpoints.go | 14 - config/rest/api/v1/payments/orders/mappers.go | 13 - .../v1/shops/businesses/branches/endpoints.go | 17 -- .../v1/shops/businesses/branches/mappers.go | 17 -- .../businesses/branches/products/endpoints.go | 16 -- .../businesses/branches/products/mappers.go | 22 -- .../v1/shops/businesses/clients/endpoints.go | 13 - .../v1/shops/businesses/clients/mappers.go | 12 - .../rest/api/v1/shops/businesses/endpoints.go | 15 -- .../rest/api/v1/shops/businesses/mappers.go | 18 -- .../v1/shops/businesses/markets/endpoints.go | 14 - .../v1/shops/businesses/markets/mappers.go | 12 - .../v1/shops/businesses/owners/endpoints.go | 13 - .../api/v1/shops/businesses/owners/mappers.go | 13 - .../v1/shops/businesses/products/endpoints.go | 15 -- .../v1/shops/businesses/products/mappers.go | 14 - config/rest/api/v1/shops/endpoints.go | 8 - .../v1/shops/markets/categories/endpoints.go | 14 - .../v1/shops/markets/categories/mappers.go | 13 - config/rest/api/v1/shops/markets/endpoints.go | 8 - .../v1/shops/products/categories/endpoints.go | 14 - .../v1/shops/products/categories/mappers.go | 13 - .../rest/api/v1/shops/products/endpoints.go | 15 -- config/rest/api/v1/shops/products/mappers.go | 14 - .../shops/revisions/businesses/endpoints.go | 14 - .../v1/shops/revisions/businesses/mappers.go | 15 -- .../rest/api/v1/shops/revisions/endpoints.go | 15 -- config/rest/api/v1/shops/revisions/mappers.go | 14 - config/rest/api/v1/shops/stores/endpoints.go | 15 -- config/rest/api/v1/shops/stores/mappers.go | 14 - .../api/v1/shops/stores/rents/endpoints.go | 17 -- .../rest/api/v1/shops/stores/rents/mappers.go | 18 -- config/rest/api/v1/users/emails/endpoints.go | 19 -- config/rest/api/v1/users/emails/mappers.go | 17 -- config/rest/api/v1/users/endpoints.go | 26 -- config/rest/api/v1/users/mappers.go | 19 -- .../api/v1/users/phone-numbers/endpoints.go | 17 -- .../api/v1/users/phone-numbers/mappers.go | 14 - .../rest/api/v1/users/profiles/endpoints.go | 14 - config/rest/api/v1/users/profiles/mappers.go | 12 - .../rest/api/v1/users/usernames/endpoints.go | 19 -- config/rest/api/v1/users/usernames/mappers.go | 12 - go.mod | 11 +- go.sum | 6 + go/pixel_plaza/auth/interceptions.go | 31 +++ go/pixel_plaza/order/interceptions.go | 19 ++ go/pixel_plaza/payment/interceptions.go | 24 ++ go/pixel_plaza/shop/interceptions.go | 65 +++++ go/pixel_plaza/user/interceptions.go | 35 +++ hide-json-tags.bat | 8 - main.go | 255 ------------------ types/grpc/interceptions.go | 13 - types/grpc/methods.go | 28 -- types/rest/endpoints.go | 38 --- types/rest/handlers.go | 29 -- types/rest/methods.go | 36 --- types/rest/params.go | 41 --- utils/parser/errors.go | 10 - utils/parser/parsers.go | 51 ---- utils/parser/tags/errors.go | 11 - utils/parser/tags/hide-json-tags.go | 40 --- utils/parser/tags/overwite-json-tags.go | 123 --------- utils/parser/tags/types.go | 9 - utils/parser/traverse.go | 19 -- utils/path/path.go | 10 - utils/strings/to-lowercase.go | 24 -- 104 files changed, 186 insertions(+), 2090 deletions(-) delete mode 100644 compile.bat delete mode 100644 config/grpc/auth/interceptions.go delete mode 100644 config/grpc/auth/methods.go delete mode 100644 config/grpc/order/interceptions.go delete mode 100644 config/grpc/order/methods.go delete mode 100644 config/grpc/payment/interceptions.go delete mode 100644 config/grpc/payment/methods.go delete mode 100644 config/grpc/shop/interceptions.go delete mode 100644 config/grpc/shop/methods.go delete mode 100644 config/grpc/user/interceptions.go delete mode 100644 config/grpc/user/methods.go delete mode 100644 config/rest/api/endpoints.go delete mode 100644 config/rest/api/v1/auth/access-tokens/endpoints.go delete mode 100644 config/rest/api/v1/auth/access-tokens/mappers.go delete mode 100644 config/rest/api/v1/auth/endpoints.go delete mode 100644 config/rest/api/v1/auth/mappers.go delete mode 100644 config/rest/api/v1/auth/permissions/endpoints.go delete mode 100644 config/rest/api/v1/auth/permissions/mappers.go delete mode 100644 config/rest/api/v1/auth/refresh-tokens/endpoints.go delete mode 100644 config/rest/api/v1/auth/refresh-tokens/mappers.go delete mode 100644 config/rest/api/v1/auth/role-permissions/endpoints.go delete mode 100644 config/rest/api/v1/auth/role-permissions/mappers.go delete mode 100644 config/rest/api/v1/auth/roles/endpoints.go delete mode 100644 config/rest/api/v1/auth/roles/mappers.go delete mode 100644 config/rest/api/v1/auth/user-roles/endpoints.go delete mode 100644 config/rest/api/v1/auth/user-roles/mappers.go delete mode 100644 config/rest/api/v1/endpoints.go delete mode 100644 config/rest/api/v1/orders/carts/current/endpoints.go delete mode 100644 config/rest/api/v1/orders/carts/current/mappers.go delete mode 100644 config/rest/api/v1/orders/carts/endpoints.go delete mode 100644 config/rest/api/v1/orders/carts/mappers.go delete mode 100644 config/rest/api/v1/orders/endpoints.go delete mode 100644 config/rest/api/v1/orders/mappers.go delete mode 100644 config/rest/api/v1/payments/accounts/endpoints.go delete mode 100644 config/rest/api/v1/payments/accounts/mappers.go delete mode 100644 config/rest/api/v1/payments/branch-rents/endpoints.go delete mode 100644 config/rest/api/v1/payments/branch-rents/mappers.go delete mode 100644 config/rest/api/v1/payments/endpoints.go delete mode 100644 config/rest/api/v1/payments/orders/endpoints.go delete mode 100644 config/rest/api/v1/payments/orders/mappers.go delete mode 100644 config/rest/api/v1/shops/businesses/branches/endpoints.go delete mode 100644 config/rest/api/v1/shops/businesses/branches/mappers.go delete mode 100644 config/rest/api/v1/shops/businesses/branches/products/endpoints.go delete mode 100644 config/rest/api/v1/shops/businesses/branches/products/mappers.go delete mode 100644 config/rest/api/v1/shops/businesses/clients/endpoints.go delete mode 100644 config/rest/api/v1/shops/businesses/clients/mappers.go delete mode 100644 config/rest/api/v1/shops/businesses/endpoints.go delete mode 100644 config/rest/api/v1/shops/businesses/mappers.go delete mode 100644 config/rest/api/v1/shops/businesses/markets/endpoints.go delete mode 100644 config/rest/api/v1/shops/businesses/markets/mappers.go delete mode 100644 config/rest/api/v1/shops/businesses/owners/endpoints.go delete mode 100644 config/rest/api/v1/shops/businesses/owners/mappers.go delete mode 100644 config/rest/api/v1/shops/businesses/products/endpoints.go delete mode 100644 config/rest/api/v1/shops/businesses/products/mappers.go delete mode 100644 config/rest/api/v1/shops/endpoints.go delete mode 100644 config/rest/api/v1/shops/markets/categories/endpoints.go delete mode 100644 config/rest/api/v1/shops/markets/categories/mappers.go delete mode 100644 config/rest/api/v1/shops/markets/endpoints.go delete mode 100644 config/rest/api/v1/shops/products/categories/endpoints.go delete mode 100644 config/rest/api/v1/shops/products/categories/mappers.go delete mode 100644 config/rest/api/v1/shops/products/endpoints.go delete mode 100644 config/rest/api/v1/shops/products/mappers.go delete mode 100644 config/rest/api/v1/shops/revisions/businesses/endpoints.go delete mode 100644 config/rest/api/v1/shops/revisions/businesses/mappers.go delete mode 100644 config/rest/api/v1/shops/revisions/endpoints.go delete mode 100644 config/rest/api/v1/shops/revisions/mappers.go delete mode 100644 config/rest/api/v1/shops/stores/endpoints.go delete mode 100644 config/rest/api/v1/shops/stores/mappers.go delete mode 100644 config/rest/api/v1/shops/stores/rents/endpoints.go delete mode 100644 config/rest/api/v1/shops/stores/rents/mappers.go delete mode 100644 config/rest/api/v1/users/emails/endpoints.go delete mode 100644 config/rest/api/v1/users/emails/mappers.go delete mode 100644 config/rest/api/v1/users/endpoints.go delete mode 100644 config/rest/api/v1/users/mappers.go delete mode 100644 config/rest/api/v1/users/phone-numbers/endpoints.go delete mode 100644 config/rest/api/v1/users/phone-numbers/mappers.go delete mode 100644 config/rest/api/v1/users/profiles/endpoints.go delete mode 100644 config/rest/api/v1/users/profiles/mappers.go delete mode 100644 config/rest/api/v1/users/usernames/endpoints.go delete mode 100644 config/rest/api/v1/users/usernames/mappers.go create mode 100644 go/pixel_plaza/auth/interceptions.go create mode 100644 go/pixel_plaza/order/interceptions.go create mode 100644 go/pixel_plaza/payment/interceptions.go create mode 100644 go/pixel_plaza/shop/interceptions.go create mode 100644 go/pixel_plaza/user/interceptions.go delete mode 100644 hide-json-tags.bat delete mode 100644 main.go delete mode 100644 types/grpc/interceptions.go delete mode 100644 types/grpc/methods.go delete mode 100644 types/rest/endpoints.go delete mode 100644 types/rest/handlers.go delete mode 100644 types/rest/methods.go delete mode 100644 types/rest/params.go delete mode 100644 utils/parser/errors.go delete mode 100644 utils/parser/parsers.go delete mode 100644 utils/parser/tags/errors.go delete mode 100644 utils/parser/tags/hide-json-tags.go delete mode 100644 utils/parser/tags/overwite-json-tags.go delete mode 100644 utils/parser/tags/types.go delete mode 100644 utils/parser/traverse.go delete mode 100644 utils/path/path.go delete mode 100644 utils/strings/to-lowercase.go diff --git a/compile.bat b/compile.bat deleted file mode 100644 index 0e9fb08..0000000 --- a/compile.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -call compile-proto.bat -call hide-json-tags.bat \ No newline at end of file diff --git a/config/grpc/auth/interceptions.go b/config/grpc/auth/interceptions.go deleted file mode 100644 index 4ad620a..0000000 --- a/config/grpc/auth/interceptions.go +++ /dev/null @@ -1,30 +0,0 @@ -package auth - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// Interceptions is the list of gRPC methods to intercept -var Interceptions = map[grpc.Method]grpc.Interception{ - LogIn: grpc.None, - IsAccessTokenValid: grpc.None, - IsRefreshTokenValid: grpc.None, - RefreshToken: grpc.RefreshToken, - LogOut: grpc.AccessToken, - GetRefreshTokenInformation: grpc.AccessToken, - GetRefreshTokensInformation: grpc.AccessToken, - RevokeRefreshToken: grpc.AccessToken, - RevokeRefreshTokens: grpc.AccessToken, - AddPermission: grpc.AccessToken, - RevokePermission: grpc.AccessToken, - GetPermission: grpc.AccessToken, - GetPermissions: grpc.AccessToken, - AddRolePermission: grpc.AccessToken, - RevokeRolePermission: grpc.AccessToken, - AddRole: grpc.AccessToken, - RevokeRole: grpc.AccessToken, - GetRoles: grpc.AccessToken, - AddUserRole: grpc.AccessToken, - RevokeUserRole: grpc.AccessToken, - GetUserRoles: grpc.AccessToken, -} diff --git a/config/grpc/auth/methods.go b/config/grpc/auth/methods.go deleted file mode 100644 index ee9205d..0000000 --- a/config/grpc/auth/methods.go +++ /dev/null @@ -1,31 +0,0 @@ -package auth - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// Auth service gRPC methods -var ( - LogIn = grpc.NewMethod("LogIn") - IsAccessTokenValid = grpc.NewMethod("IsAccessTokenValid") - IsRefreshTokenValid = grpc.NewMethod("IsRefreshTokenValid") - RefreshToken = grpc.NewMethod("RefreshToken") - LogOut = grpc.NewMethod("LogOut") - GetRefreshTokenInformation = grpc.NewMethod("GetRefreshTokenInformation") - GetRefreshTokensInformation = grpc.NewMethod("GetRefreshTokensInformation") - RevokeRefreshToken = grpc.NewMethod("RevokeRefreshToken") - RevokeRefreshTokens = grpc.NewMethod("RevokeRefreshTokens") - AddPermission = grpc.NewMethod("AddPermission") - RevokePermission = grpc.NewMethod("RevokePermission") - GetPermission = grpc.NewMethod("GetPermission") - GetPermissions = grpc.NewMethod("GetPermissions") - AddRolePermission = grpc.NewMethod("AddRolePermission") - RevokeRolePermission = grpc.NewMethod("RevokeRolePermission") - GetRolePermissions = grpc.NewMethod("GetRolePermissions") - AddRole = grpc.NewMethod("AddRole") - RevokeRole = grpc.NewMethod("RevokeRole") - GetRoles = grpc.NewMethod("GetRoles") - AddUserRole = grpc.NewMethod("AddUserRole") - RevokeUserRole = grpc.NewMethod("RevokeUserRole") - GetUserRoles = grpc.NewMethod("GetUserRoles") -) diff --git a/config/grpc/order/interceptions.go b/config/grpc/order/interceptions.go deleted file mode 100644 index f3131b1..0000000 --- a/config/grpc/order/interceptions.go +++ /dev/null @@ -1,18 +0,0 @@ -package order - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// Interceptions is the list of gRPC methods to intercept -var Interceptions = map[grpc.Method]grpc.Interception{ - AddProductToCart: grpc.AccessToken, - RemoveProductFromCart: grpc.AccessToken, - GetCart: grpc.AccessToken, - GetCurrentCart: grpc.AccessToken, - GetCarts: grpc.AccessToken, - GetCartTotal: grpc.AccessToken, - PlaceOrder: grpc.AccessToken, - GetOrders: grpc.AccessToken, - GetOrder: grpc.AccessToken, -} diff --git a/config/grpc/order/methods.go b/config/grpc/order/methods.go deleted file mode 100644 index 5d6a5d8..0000000 --- a/config/grpc/order/methods.go +++ /dev/null @@ -1,18 +0,0 @@ -package order - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// Order service gRPC methods -var ( - AddProductToCart = grpc.NewMethod("AddProductToCart") - RemoveProductFromCart = grpc.NewMethod("RemoveProductFromCart") - GetCart = grpc.NewMethod("GetCart") - GetCurrentCart = grpc.NewMethod("GetCurrentCart") - GetCarts = grpc.NewMethod("GetCarts") - GetCartTotal = grpc.NewMethod("GetCartTotal") - PlaceOrder = grpc.NewMethod("PlaceOrder") - GetOrders = grpc.NewMethod("GetOrders") - GetOrder = grpc.NewMethod("GetOrder") -) diff --git a/config/grpc/payment/interceptions.go b/config/grpc/payment/interceptions.go deleted file mode 100644 index 806c2d4..0000000 --- a/config/grpc/payment/interceptions.go +++ /dev/null @@ -1,23 +0,0 @@ -package payment - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// Interceptions is the list of gRPC methods to intercept -var Interceptions = map[grpc.Method]grpc.Interception{ - AddOrderPayment: grpc.AccessToken, - GetOrderPayments: grpc.AccessToken, - AddBranchRentPayment: grpc.AccessToken, - GetBranchRentPayments: grpc.AccessToken, - GetBranchRentsPayments: grpc.AccessToken, - VerifyPayment: grpc.AccessToken, - AddPaymentAccount: grpc.AccessToken, - GetPaymentAccounts: grpc.AccessToken, - GetActivePaymentAccounts: grpc.AccessToken, - GetSuspendedPaymentAccounts: grpc.AccessToken, - SuspendPaymentAccount: grpc.AccessToken, - ActivatePaymentAccount: grpc.AccessToken, - PayForOrder: grpc.AccessToken, - PayForBranchRent: grpc.AccessToken, -} diff --git a/config/grpc/payment/methods.go b/config/grpc/payment/methods.go deleted file mode 100644 index 56d100d..0000000 --- a/config/grpc/payment/methods.go +++ /dev/null @@ -1,23 +0,0 @@ -package payment - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// Payment service gRPC methods -var ( - AddOrderPayment = grpc.NewMethod("AddOrderPayment") - GetOrderPayments = grpc.NewMethod("GetOrderPayments") - AddBranchRentPayment = grpc.NewMethod("AddBranchRentPayment") - GetBranchRentPayments = grpc.NewMethod("GetBranchRentPayments") - GetBranchRentsPayments = grpc.NewMethod("GetBranchRentsPayments") - VerifyPayment = grpc.NewMethod("VerifyPayment") - AddPaymentAccount = grpc.NewMethod("AddPaymentAccount") - GetPaymentAccounts = grpc.NewMethod("GetPaymentAccounts") - GetActivePaymentAccounts = grpc.NewMethod("GetActivePaymentAccounts") - GetSuspendedPaymentAccounts = grpc.NewMethod("GetSuspendedPaymentAccounts") - SuspendPaymentAccount = grpc.NewMethod("SuspendPaymentAccount") - ActivatePaymentAccount = grpc.NewMethod("ActivatePaymentAccount") - PayForOrder = grpc.NewMethod("PayForOrder") - PayForBranchRent = grpc.NewMethod("PayForBranchRent") -) diff --git a/config/grpc/shop/interceptions.go b/config/grpc/shop/interceptions.go deleted file mode 100644 index 32a5514..0000000 --- a/config/grpc/shop/interceptions.go +++ /dev/null @@ -1,64 +0,0 @@ -package shop - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// Interceptions is the list of gRPC methods to intercept -var Interceptions = map[grpc.Method]grpc.Interception{ - UpdateAdminRevision: grpc.AccessToken, - GetAdminRevisions: grpc.AccessToken, - CloseAdminRevision: grpc.AccessToken, - AddBusiness: grpc.AccessToken, - GetBusiness: grpc.None, - UpdateBusiness: grpc.AccessToken, - SetBusinessProfilePicture: grpc.AccessToken, - OpenAdminRevisionToBusiness: grpc.AccessToken, - DeleteBusiness: grpc.AccessToken, - AddBusinessOwner: grpc.AccessToken, - RemoveBusinessOwner: grpc.AccessToken, - GetBusinessOwners: grpc.AccessToken, - AddBusinessClient: grpc.AccessToken, - IsBusinessClient: grpc.AccessToken, - AddMarketCategory: grpc.AccessToken, - GetMarketCategory: grpc.None, - UpdateMarketCategory: grpc.AccessToken, - AddBusinessMarketCategory: grpc.AccessToken, - GetBusinessMarketCategories: grpc.None, - AddStore: grpc.AccessToken, - GetStore: grpc.None, - DeleteStore: grpc.AccessToken, - GetUnoccupiedStores: grpc.None, - AddBranch: grpc.AccessToken, - GetBranch: grpc.None, - GetBusinessBranches: grpc.None, - UpdateBranch: grpc.AccessToken, - CloseTemporarilyBranch: grpc.AccessToken, - OpenBranch: grpc.AccessToken, - OpenAdminRevisionToBranch: grpc.AccessToken, - DeleteBranch: grpc.AccessToken, - AddBranchRent: grpc.AccessToken, - GetBranchRents: grpc.AccessToken, - UpdateBranchRent: grpc.AccessToken, - GetUnpaidBranchRents: grpc.AccessToken, - GetBusinessUnpaidBranchRents: grpc.AccessToken, - AddProductCategory: grpc.AccessToken, - GetProductCategory: grpc.None, - UpdateProductCategory: grpc.AccessToken, - AddProduct: grpc.AccessToken, - GetProduct: grpc.None, - UpdateProduct: grpc.AccessToken, - SearchProducts: grpc.None, - OpenAdminRevisionToProduct: grpc.AccessToken, - AddBusinessProduct: grpc.AccessToken, - GetBusinessProduct: grpc.None, - UpdateBusinessProduct: grpc.AccessToken, - SearchBusinessProducts: grpc.None, - OpenAdminRevisionToBusinessProduct: grpc.AccessToken, - AddBranchProduct: grpc.AccessToken, - GetBranchProduct: grpc.None, - SearchBranchProducts: grpc.None, - UpdateBranchProduct: grpc.AccessToken, - IncreaseBranchProductStock: grpc.AccessToken, - DecreaseBranchProductStock: grpc.AccessToken, -} diff --git a/config/grpc/shop/methods.go b/config/grpc/shop/methods.go deleted file mode 100644 index 73872ef..0000000 --- a/config/grpc/shop/methods.go +++ /dev/null @@ -1,64 +0,0 @@ -package shop - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// Business service gRPC methods -var ( - UpdateAdminRevision = grpc.NewMethod("UpdateAdminRevision") - GetAdminRevisions = grpc.NewMethod("GetAdminRevisions") - CloseAdminRevision = grpc.NewMethod("CloseAdminRevision") - AddBusiness = grpc.NewMethod("AddBusiness") - GetBusiness = grpc.NewMethod("GetBusiness") - UpdateBusiness = grpc.NewMethod("UpdateBusiness") - SetBusinessProfilePicture = grpc.NewMethod("SetBusinessProfilePicture") - OpenAdminRevisionToBusiness = grpc.NewMethod("OpenAdminRevisionToBusiness") - DeleteBusiness = grpc.NewMethod("DeleteBusiness") - AddBusinessOwner = grpc.NewMethod("AddBusinessOwner") - RemoveBusinessOwner = grpc.NewMethod("RemoveBusinessOwner") - GetBusinessOwners = grpc.NewMethod("GetBusinessOwners") - AddBusinessClient = grpc.NewMethod("AddBusinessClient") - IsBusinessClient = grpc.NewMethod("IsBusinessClient") - AddMarketCategory = grpc.NewMethod("AddMarketCategory") - GetMarketCategory = grpc.NewMethod("GetMarketCategory") - UpdateMarketCategory = grpc.NewMethod("UpdateMarketCategory") - AddBusinessMarketCategory = grpc.NewMethod("AddBusinessMarketCategory") - GetBusinessMarketCategories = grpc.NewMethod("GetBusinessMarketCategories") - AddStore = grpc.NewMethod("AddStore") - GetStore = grpc.NewMethod("GetStore") - DeleteStore = grpc.NewMethod("DeleteStore") - GetUnoccupiedStores = grpc.NewMethod("GetUnoccupiedStores") - AddBranch = grpc.NewMethod("AddBranch") - GetBranch = grpc.NewMethod("GetBranch") - GetBusinessBranches = grpc.NewMethod("GetBusinessBranches") - UpdateBranch = grpc.NewMethod("UpdateBranch") - CloseTemporarilyBranch = grpc.NewMethod("CloseTemporarilyBranch") - OpenBranch = grpc.NewMethod("OpenBranch") - OpenAdminRevisionToBranch = grpc.NewMethod("OpenAdminRevisionToBranch") - DeleteBranch = grpc.NewMethod("DeleteBranch") - AddBranchRent = grpc.NewMethod("AddBranchRent") - GetBranchRents = grpc.NewMethod("GetBranchRents") - UpdateBranchRent = grpc.NewMethod("UpdateBranchRent") - GetUnpaidBranchRents = grpc.NewMethod("GetUnpaidBranchRents") - GetBusinessUnpaidBranchRents = grpc.NewMethod("GetBusinessUnpaidBranchRents") - AddProductCategory = grpc.NewMethod("AddProductCategory") - GetProductCategory = grpc.NewMethod("GetProductCategory") - UpdateProductCategory = grpc.NewMethod("UpdateProductCategory") - AddProduct = grpc.NewMethod("AddProduct") - GetProduct = grpc.NewMethod("GetProduct") - UpdateProduct = grpc.NewMethod("UpdateProduct") - SearchProducts = grpc.NewMethod("SearchProducts") - OpenAdminRevisionToProduct = grpc.NewMethod("OpenAdminRevisionToProduct") - AddBusinessProduct = grpc.NewMethod("AddBusinessProduct") - GetBusinessProduct = grpc.NewMethod("GetBusinessProduct") - UpdateBusinessProduct = grpc.NewMethod("UpdateBusinessProduct") - SearchBusinessProducts = grpc.NewMethod("SearchBusinessProducts") - OpenAdminRevisionToBusinessProduct = grpc.NewMethod("OpenAdminRevisionToBusinessProduct") - AddBranchProduct = grpc.NewMethod("AddBranchProduct") - GetBranchProduct = grpc.NewMethod("GetBranchProduct") - SearchBranchProducts = grpc.NewMethod("SearchBranchProducts") - UpdateBranchProduct = grpc.NewMethod("UpdateBranchProduct") - IncreaseBranchProductStock = grpc.NewMethod("IncreaseBranchProductStock") - DecreaseBranchProductStock = grpc.NewMethod("DecreaseBranchProductStock") -) diff --git a/config/grpc/user/interceptions.go b/config/grpc/user/interceptions.go deleted file mode 100644 index 73c1c5b..0000000 --- a/config/grpc/user/interceptions.go +++ /dev/null @@ -1,34 +0,0 @@ -package user - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// Interceptions is the list of gRPC methods to intercept -var Interceptions = map[grpc.Method]grpc.Interception{ - SignUp: grpc.None, - UsernameExists: grpc.None, - GetUserIdByUsername: grpc.None, - GetUsernameByUserId: grpc.None, - IsPasswordCorrect: grpc.None, - GetProfile: grpc.None, - UpdateUser: grpc.AccessToken, - SetProfilePicture: grpc.AccessToken, - GetMyProfile: grpc.AccessToken, - ChangePassword: grpc.AccessToken, - ChangeUsername: grpc.AccessToken, - AddEmail: grpc.AccessToken, - DeleteEmail: grpc.AccessToken, - SendVerificationEmail: grpc.AccessToken, - VerifyEmail: grpc.AccessToken, - GetPrimaryEmail: grpc.AccessToken, - ChangePrimaryEmail: grpc.AccessToken, - GetActiveEmails: grpc.AccessToken, - ChangePhoneNumber: grpc.AccessToken, - GetPhoneNumber: grpc.AccessToken, - SendVerificationSMS: grpc.AccessToken, - VerifyPhoneNumber: grpc.AccessToken, - ForgotPassword: grpc.None, - ResetPassword: grpc.None, - DeleteUser: grpc.AccessToken, -} diff --git a/config/grpc/user/methods.go b/config/grpc/user/methods.go deleted file mode 100644 index cc8f372..0000000 --- a/config/grpc/user/methods.go +++ /dev/null @@ -1,34 +0,0 @@ -package user - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -// User service gRPC methods -var ( - SignUp = grpc.NewMethod("SignUp") - UsernameExists = grpc.NewMethod("UsernameExists") - GetUserIdByUsername = grpc.NewMethod("GetUserIdByUsername") - GetUsernameByUserId = grpc.NewMethod("GetUsernameByUserId") - IsPasswordCorrect = grpc.NewMethod("IsPasswordCorrect") - UpdateUser = grpc.NewMethod("UpdateUser") - SetProfilePicture = grpc.NewMethod("SetProfilePicture") - GetProfile = grpc.NewMethod("GetProfile") - GetMyProfile = grpc.NewMethod("GetMyProfile") - ChangePassword = grpc.NewMethod("ChangePassword") - ChangeUsername = grpc.NewMethod("ChangeUsername") - AddEmail = grpc.NewMethod("AddEmail") - DeleteEmail = grpc.NewMethod("DeleteEmail") - SendVerificationEmail = grpc.NewMethod("SendVerificationEmail") - VerifyEmail = grpc.NewMethod("VerifyEmail") - GetPrimaryEmail = grpc.NewMethod("GetPrimaryEmail") - ChangePrimaryEmail = grpc.NewMethod("ChangePrimaryEmail") - GetActiveEmails = grpc.NewMethod("GetActiveEmails") - ChangePhoneNumber = grpc.NewMethod("ChangePhoneNumber") - GetPhoneNumber = grpc.NewMethod("GetPhoneNumber") - SendVerificationSMS = grpc.NewMethod("SendVerificationSMS") - VerifyPhoneNumber = grpc.NewMethod("VerifyPhoneNumber") - ForgotPassword = grpc.NewMethod("ForgotPassword") - ResetPassword = grpc.NewMethod("ResetPassword") - DeleteUser = grpc.NewMethod("DeleteUser") -) diff --git a/config/rest/api/endpoints.go b/config/rest/api/endpoints.go deleted file mode 100644 index e3ba1ff..0000000 --- a/config/rest/api/endpoints.go +++ /dev/null @@ -1,8 +0,0 @@ -package api - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the API REST endpoints -var Base = typesrest.NewBaseEndpoint("api") diff --git a/config/rest/api/v1/auth/access-tokens/endpoints.go b/config/rest/api/v1/auth/access-tokens/endpoints.go deleted file mode 100644 index a3ab796..0000000 --- a/config/rest/api/v1/auth/access-tokens/endpoints.go +++ /dev/null @@ -1,16 +0,0 @@ -package access_tokens - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the auth service access tokens REST endpoints -var Base = typesrest.NewBaseEndpoint("access-tokens") - -// Auth service access tokens REST endpoints -var ( - ValidByJwtId = typesrest.NewEndpoint( - "valid", - typesrest.JwtId, - ) -) diff --git a/config/rest/api/v1/auth/access-tokens/mappers.go b/config/rest/api/v1/auth/access-tokens/mappers.go deleted file mode 100644 index a841ecc..0000000 --- a/config/rest/api/v1/auth/access-tokens/mappers.go +++ /dev/null @@ -1,11 +0,0 @@ -package access_tokens - -import ( - grpcauth "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/auth" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Auth service access tokens endpoints mapping -var ( - IsAccessTokenValidMapper = typesrest.NewMapper(ValidByJwtId, grpcauth.IsAccessTokenValid) -) diff --git a/config/rest/api/v1/auth/endpoints.go b/config/rest/api/v1/auth/endpoints.go deleted file mode 100644 index 722bc1f..0000000 --- a/config/rest/api/v1/auth/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package auth - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the auth service REST endpoints -var Base = typesrest.NewBaseEndpoint("auth") - -// Auth service REST endpoints -var ( - LogIn = typesrest.NewEndpoint("log-in") - LogOut = typesrest.NewEndpoint("log-out") -) diff --git a/config/rest/api/v1/auth/mappers.go b/config/rest/api/v1/auth/mappers.go deleted file mode 100644 index 9470c3a..0000000 --- a/config/rest/api/v1/auth/mappers.go +++ /dev/null @@ -1,12 +0,0 @@ -package auth - -import ( - grpcauth "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/auth" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Auth service endpoints mapping -var ( - LogInMapper = typesrest.NewMapper(LogIn, grpcauth.LogIn) - LogOutMapper = typesrest.NewMapper(LogOut, grpcauth.LogOut) -) diff --git a/config/rest/api/v1/auth/permissions/endpoints.go b/config/rest/api/v1/auth/permissions/endpoints.go deleted file mode 100644 index 3c9de93..0000000 --- a/config/rest/api/v1/auth/permissions/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package permissions - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the auth service permissions REST endpoints -var Base = typesrest.NewBaseEndpoint("permissions") - -// Auth service permissions REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByPermissionId = typesrest.NewRelativeEndpoint(typesrest.PermissionId) -) diff --git a/config/rest/api/v1/auth/permissions/mappers.go b/config/rest/api/v1/auth/permissions/mappers.go deleted file mode 100644 index d1881eb..0000000 --- a/config/rest/api/v1/auth/permissions/mappers.go +++ /dev/null @@ -1,14 +0,0 @@ -package permissions - -import ( - grpcauth "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/auth" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Auth service permissions endpoints mapping -var ( - GetPermissionsMapper = typesrest.NewMapper(Relative, grpcauth.GetPermissions) - AddPermissionMapper = typesrest.NewMapper(Relative, grpcauth.AddPermission) - GetPermissionMapper = typesrest.NewMapper(ByPermissionId, grpcauth.GetPermission) - RevokePermissionMapper = typesrest.NewMapper(ByPermissionId, grpcauth.RevokePermission) -) diff --git a/config/rest/api/v1/auth/refresh-tokens/endpoints.go b/config/rest/api/v1/auth/refresh-tokens/endpoints.go deleted file mode 100644 index 23cf1b6..0000000 --- a/config/rest/api/v1/auth/refresh-tokens/endpoints.go +++ /dev/null @@ -1,21 +0,0 @@ -package refresh_tokens - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the auth service refresh tokens REST endpoints -var Base = typesrest.NewBaseEndpoint("refresh-tokens") - -// Auth service refresh tokens REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByJwtId = typesrest.NewRelativeEndpoint( - - typesrest.JwtId, - ) - ValidByJwtId = typesrest.NewEndpoint( - "valid", - typesrest.JwtId, - ) -) diff --git a/config/rest/api/v1/auth/refresh-tokens/mappers.go b/config/rest/api/v1/auth/refresh-tokens/mappers.go deleted file mode 100644 index de9a10a..0000000 --- a/config/rest/api/v1/auth/refresh-tokens/mappers.go +++ /dev/null @@ -1,16 +0,0 @@ -package refresh_tokens - -import ( - grpcauth "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/auth" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Auth service refresh tokens endpoints mapping -var ( - RefreshTokenMapper = typesrest.NewMapper(Relative, grpcauth.RefreshToken) - GetRefreshTokensInformationMapper = typesrest.NewMapper(Relative, grpcauth.GetRefreshTokensInformation) - RevokeRefreshTokensMapper = typesrest.NewMapper(Relative, grpcauth.RevokeRefreshTokens) - GetRefreshTokenInformationMapper = typesrest.NewMapper(ByJwtId, grpcauth.GetRefreshTokenInformation) - RevokeRefreshTokenMapper = typesrest.NewMapper(ByJwtId, grpcauth.RevokeRefreshToken) - IsRefreshTokenValidMapper = typesrest.NewMapper(ValidByJwtId, grpcauth.IsRefreshTokenValid) -) diff --git a/config/rest/api/v1/auth/role-permissions/endpoints.go b/config/rest/api/v1/auth/role-permissions/endpoints.go deleted file mode 100644 index c5d98ff..0000000 --- a/config/rest/api/v1/auth/role-permissions/endpoints.go +++ /dev/null @@ -1,15 +0,0 @@ -package role_permissions - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the auth service role permissions REST endpoints -var Base = typesrest.NewBaseEndpoint("role-permissions") - -// Auth service role permissions REST endpoints -var ( - ByRoleId = typesrest.NewRelativeEndpoint( - typesrest.RoleId, - ) -) diff --git a/config/rest/api/v1/auth/role-permissions/mappers.go b/config/rest/api/v1/auth/role-permissions/mappers.go deleted file mode 100644 index 710e98a..0000000 --- a/config/rest/api/v1/auth/role-permissions/mappers.go +++ /dev/null @@ -1,11 +0,0 @@ -package role_permissions - -import ( - grpcauth "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/auth" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Auth service role permissions endpoints mapping -var ( - RevokeRolePermissionMapper = typesrest.NewMapper(ByRoleId, grpcauth.RevokeRolePermission) -) diff --git a/config/rest/api/v1/auth/roles/endpoints.go b/config/rest/api/v1/auth/roles/endpoints.go deleted file mode 100644 index 8e32163..0000000 --- a/config/rest/api/v1/auth/roles/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package roles - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the auth service roles REST endpoints -var Base = typesrest.NewBaseEndpoint("roles") - -// Auth service roles REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByRoleId = typesrest.NewRelativeEndpoint(typesrest.RoleId) -) diff --git a/config/rest/api/v1/auth/roles/mappers.go b/config/rest/api/v1/auth/roles/mappers.go deleted file mode 100644 index 0401d87..0000000 --- a/config/rest/api/v1/auth/roles/mappers.go +++ /dev/null @@ -1,15 +0,0 @@ -package roles - -import ( - grpcauth "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/auth" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Auth service roles endpoints mapping -var ( - AddRoleMapper = typesrest.NewMapper(Relative, grpcauth.AddRole) - GetRolesMapper = typesrest.NewMapper(Relative, grpcauth.GetRoles) - AddRolePermissionMapper = typesrest.NewMapper(ByRoleId, grpcauth.AddRolePermission) - GetRolePermissionsMapper = typesrest.NewMapper(ByRoleId, grpcauth.GetRolePermissions) - RevokeRoleMapper = typesrest.NewMapper(ByRoleId, grpcauth.RevokeRole) -) diff --git a/config/rest/api/v1/auth/user-roles/endpoints.go b/config/rest/api/v1/auth/user-roles/endpoints.go deleted file mode 100644 index b93651a..0000000 --- a/config/rest/api/v1/auth/user-roles/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package user_roles - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the auth service user roles REST endpoints -var Base = typesrest.NewBaseEndpoint("user-roles") - -// Auth service user roles REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByUserId = typesrest.NewRelativeEndpoint(typesrest.UserId) -) diff --git a/config/rest/api/v1/auth/user-roles/mappers.go b/config/rest/api/v1/auth/user-roles/mappers.go deleted file mode 100644 index 94f75f6..0000000 --- a/config/rest/api/v1/auth/user-roles/mappers.go +++ /dev/null @@ -1,13 +0,0 @@ -package user_roles - -import ( - grpcauth "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/auth" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Auth service user roles endpoints mapping -var ( - AddUserRoleMapper = typesrest.NewMapper(Relative, grpcauth.AddUserRole) - RevokeUserRoleMapper = typesrest.NewMapper(Relative, grpcauth.RevokeUserRole) - GetUserRolesMapper = typesrest.NewMapper(ByUserId, grpcauth.GetUserRoles) -) diff --git a/config/rest/api/v1/endpoints.go b/config/rest/api/v1/endpoints.go deleted file mode 100644 index ef8e28a..0000000 --- a/config/rest/api/v1/endpoints.go +++ /dev/null @@ -1,8 +0,0 @@ -package v1 - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the API version 1 REST endpoints -var Base = typesrest.NewBaseEndpoint("v1") diff --git a/config/rest/api/v1/orders/carts/current/endpoints.go b/config/rest/api/v1/orders/carts/current/endpoints.go deleted file mode 100644 index 324c50f..0000000 --- a/config/rest/api/v1/orders/carts/current/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package carts - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the orders service current cart REST endpoints -var Base = typesrest.NewBaseEndpoint("current") - -// Orders service current cart REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - Checkout = typesrest.NewEndpoint("checkout") -) diff --git a/config/rest/api/v1/orders/carts/current/mappers.go b/config/rest/api/v1/orders/carts/current/mappers.go deleted file mode 100644 index 626dae6..0000000 --- a/config/rest/api/v1/orders/carts/current/mappers.go +++ /dev/null @@ -1,14 +0,0 @@ -package carts - -import ( - grpcorder "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/order" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Order service current cart endpoints mapping -var ( - GetCurrentCart = typesrest.NewMapper(Relative, grpcorder.GetCurrentCart) - AddProductToCartMapper = typesrest.NewMapper(Relative, grpcorder.AddProductToCart) - RemoveProductFromCartMapper = typesrest.NewMapper(Relative, grpcorder.RemoveProductFromCart) - PlaceOrderMapper = typesrest.NewMapper(Checkout, grpcorder.PlaceOrder) -) diff --git a/config/rest/api/v1/orders/carts/endpoints.go b/config/rest/api/v1/orders/carts/endpoints.go deleted file mode 100644 index f0fb1f0..0000000 --- a/config/rest/api/v1/orders/carts/endpoints.go +++ /dev/null @@ -1,15 +0,0 @@ -package carts - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the orders service carts REST endpoints -var Base = typesrest.NewBaseEndpoint("carts") - -// Orders service carts REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByCartId = typesrest.NewRelativeEndpoint(typesrest.CartId) - TotalByCartId = typesrest.NewEndpoint("total", typesrest.CartId) -) diff --git a/config/rest/api/v1/orders/carts/mappers.go b/config/rest/api/v1/orders/carts/mappers.go deleted file mode 100644 index 4973013..0000000 --- a/config/rest/api/v1/orders/carts/mappers.go +++ /dev/null @@ -1,13 +0,0 @@ -package carts - -import ( - grpcorder "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/order" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Order service carts endpoints mapping -var ( - GetCartsMapper = typesrest.NewMapper(Relative, grpcorder.GetCarts) - GetCartMapper = typesrest.NewMapper(ByCartId, grpcorder.GetCart) - GetCartTotalMapper = typesrest.NewMapper(TotalByCartId, grpcorder.GetCartTotal) -) diff --git a/config/rest/api/v1/orders/endpoints.go b/config/rest/api/v1/orders/endpoints.go deleted file mode 100644 index c0551fc..0000000 --- a/config/rest/api/v1/orders/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package orders - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the order service REST endpoints -var Base = typesrest.NewBaseEndpoint("orders") - -// Order service REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByOrderId = typesrest.NewRelativeEndpoint(typesrest.OrderId) -) diff --git a/config/rest/api/v1/orders/mappers.go b/config/rest/api/v1/orders/mappers.go deleted file mode 100644 index b1775eb..0000000 --- a/config/rest/api/v1/orders/mappers.go +++ /dev/null @@ -1,12 +0,0 @@ -package orders - -import ( - grpcorder "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/order" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Order service endpoints mapping -var ( - GetOrdersMapper = typesrest.NewMapper(Relative, grpcorder.GetOrders) - GetOrderMapper = typesrest.NewMapper(ByOrderId, grpcorder.GetOrder) -) diff --git a/config/rest/api/v1/payments/accounts/endpoints.go b/config/rest/api/v1/payments/accounts/endpoints.go deleted file mode 100644 index d4ab5bd..0000000 --- a/config/rest/api/v1/payments/accounts/endpoints.go +++ /dev/null @@ -1,18 +0,0 @@ -package accounts - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the payment service accounts REST endpoints -var Base = typesrest.NewEndpoint("accounts") - -// Payment service accounts REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - Active = typesrest.NewEndpoint("active") - ActivateByAccountId = typesrest.NewEndpoint("activate", typesrest.AccountId) - Suspended = typesrest.NewEndpoint("suspended") - SuspendByAccountId = typesrest.NewEndpoint("suspend", typesrest.AccountId) - VerifyPayment = typesrest.NewEndpoint("verify") -) diff --git a/config/rest/api/v1/payments/accounts/mappers.go b/config/rest/api/v1/payments/accounts/mappers.go deleted file mode 100644 index b743fe5..0000000 --- a/config/rest/api/v1/payments/accounts/mappers.go +++ /dev/null @@ -1,17 +0,0 @@ -package accounts - -import ( - grpcpayment "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/payment" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Payment service accounts endpoints mapping -var ( - AddPaymentAccountMapper = typesrest.NewMapper(Relative, grpcpayment.AddPaymentAccount) - GetPaymentAccountsMapper = typesrest.NewMapper(Relative, grpcpayment.GetPaymentAccounts) - GetActivePaymentAccountsMapper = typesrest.NewMapper(Active, grpcpayment.GetActivePaymentAccounts) - ActivatePaymentAccountMapper = typesrest.NewMapper(ActivateByAccountId, grpcpayment.ActivatePaymentAccount) - GetSuspendedPaymentAccountsMapper = typesrest.NewMapper(Suspended, grpcpayment.GetSuspendedPaymentAccounts) - SuspendPaymentAccountMapper = typesrest.NewMapper(SuspendByAccountId, grpcpayment.SuspendPaymentAccount) - VerifyPaymentMapper = typesrest.NewMapper(VerifyPayment, grpcpayment.VerifyPayment) -) diff --git a/config/rest/api/v1/payments/branch-rents/endpoints.go b/config/rest/api/v1/payments/branch-rents/endpoints.go deleted file mode 100644 index a8b83b1..0000000 --- a/config/rest/api/v1/payments/branch-rents/endpoints.go +++ /dev/null @@ -1,15 +0,0 @@ -package branch_rents - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the payment service branch rents REST endpoints -var Base = typesrest.NewEndpoint("branch-rents") - -// Payment service branch rents REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByBranchRentId = typesrest.NewRelativeEndpoint(typesrest.BranchRentId) - PayByBranchRentId = typesrest.NewEndpoint("pay", typesrest.BranchRentId) -) diff --git a/config/rest/api/v1/payments/branch-rents/mappers.go b/config/rest/api/v1/payments/branch-rents/mappers.go deleted file mode 100644 index c37f4d7..0000000 --- a/config/rest/api/v1/payments/branch-rents/mappers.go +++ /dev/null @@ -1,14 +0,0 @@ -package branch_rents - -import ( - grpcpayment "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/payment" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Payment service branch rents endpoints mapping -var ( - GetBranchRentsPaymentsMapper = typesrest.NewMapper(Relative, grpcpayment.GetBranchRentsPayments) - AddBranchRentPaymentMapper = typesrest.NewMapper(ByBranchRentId, grpcpayment.AddBranchRentPayment) - GetBranchRentPaymentsMapper = typesrest.NewMapper(ByBranchRentId, grpcpayment.GetBranchRentPayments) - PayForBranchRentMapper = typesrest.NewMapper(PayByBranchRentId, grpcpayment.PayForBranchRent) -) diff --git a/config/rest/api/v1/payments/endpoints.go b/config/rest/api/v1/payments/endpoints.go deleted file mode 100644 index 9e7923a..0000000 --- a/config/rest/api/v1/payments/endpoints.go +++ /dev/null @@ -1,8 +0,0 @@ -package payments - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the payment service REST endpoints -var Base = typesrest.NewEndpoint("payments") diff --git a/config/rest/api/v1/payments/orders/endpoints.go b/config/rest/api/v1/payments/orders/endpoints.go deleted file mode 100644 index 9b6db33..0000000 --- a/config/rest/api/v1/payments/orders/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package orders - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the payment service orders REST endpoints -var Base = typesrest.NewBaseEndpoint("orders") - -// Payment service orders REST endpoints -var ( - ByOrderId = typesrest.NewRelativeEndpoint(typesrest.OrderId) - PayByOrderId = typesrest.NewEndpoint("pay", typesrest.OrderId) -) diff --git a/config/rest/api/v1/payments/orders/mappers.go b/config/rest/api/v1/payments/orders/mappers.go deleted file mode 100644 index 93b7541..0000000 --- a/config/rest/api/v1/payments/orders/mappers.go +++ /dev/null @@ -1,13 +0,0 @@ -package orders - -import ( - grpcpayment "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/payment" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Payment service orders endpoints mapping -var ( - AddOrderPaymentMapper = typesrest.NewMapper(ByOrderId, grpcpayment.AddOrderPayment) - GetOrderPaymentsMapper = typesrest.NewMapper(ByOrderId, grpcpayment.GetOrderPayments) - PayForOrderMapper = typesrest.NewMapper(PayByOrderId, grpcpayment.PayForOrder) -) diff --git a/config/rest/api/v1/shops/businesses/branches/endpoints.go b/config/rest/api/v1/shops/businesses/branches/endpoints.go deleted file mode 100644 index a0d59cb..0000000 --- a/config/rest/api/v1/shops/businesses/branches/endpoints.go +++ /dev/null @@ -1,17 +0,0 @@ -package branches - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service branches REST endpoints -var Base = typesrest.NewBaseEndpoint("branches") - -// Shop service branches REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByBranchId = typesrest.NewRelativeEndpoint(typesrest.BranchId) - ByBusinessId = typesrest.NewEndpoint("business-id", typesrest.BusinessId) - CloseTemporarilyByBranchId = typesrest.NewEndpoint("close-temporarily", typesrest.BranchId) - OpenByBranchId = typesrest.NewEndpoint("open", typesrest.BranchId) -) diff --git a/config/rest/api/v1/shops/businesses/branches/mappers.go b/config/rest/api/v1/shops/businesses/branches/mappers.go deleted file mode 100644 index 943122b..0000000 --- a/config/rest/api/v1/shops/businesses/branches/mappers.go +++ /dev/null @@ -1,17 +0,0 @@ -package branches - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service branches endpoints mapping -var ( - AddBranchMapper = typesrest.NewMapper(Relative, grpcshop.AddBranch) - GetBranchMapper = typesrest.NewMapper(ByBranchId, grpcshop.GetBranch) - GetBusinessBranchesMapper = typesrest.NewMapper(ByBusinessId, grpcshop.GetBusinessBranches) - UpdateBranchMapper = typesrest.NewMapper(ByBranchId, grpcshop.UpdateBranch) - CloseTemporarilyBranchMapper = typesrest.NewMapper(CloseTemporarilyByBranchId, grpcshop.CloseTemporarilyBranch) - OpenBranchMapper = typesrest.NewMapper(OpenByBranchId, grpcshop.OpenBranch) - DeleteBranchMapper = typesrest.NewMapper(ByBranchId, grpcshop.DeleteBranch) -) diff --git a/config/rest/api/v1/shops/businesses/branches/products/endpoints.go b/config/rest/api/v1/shops/businesses/branches/products/endpoints.go deleted file mode 100644 index b0ebfdd..0000000 --- a/config/rest/api/v1/shops/businesses/branches/products/endpoints.go +++ /dev/null @@ -1,16 +0,0 @@ -package products - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service branches products REST endpoints -var Base = typesrest.NewBaseEndpoint("products") - -// Shop service branches products REST endpoints -var ( - ByBranchId = typesrest.NewRelativeEndpoint(typesrest.BranchId) - Search = typesrest.NewEndpoint("search") - IncreaseStockByBranchProductId = typesrest.NewEndpoint("increase-stock", typesrest.BranchProductId) - DecreaseStockByBranchProductId = typesrest.NewEndpoint("decrease-stock", typesrest.BranchProductId) -) diff --git a/config/rest/api/v1/shops/businesses/branches/products/mappers.go b/config/rest/api/v1/shops/businesses/branches/products/mappers.go deleted file mode 100644 index caebe4d..0000000 --- a/config/rest/api/v1/shops/businesses/branches/products/mappers.go +++ /dev/null @@ -1,22 +0,0 @@ -package products - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service branches products endpoints mapping -var ( - AddBranchProductMapper = typesrest.NewMapper(ByBranchId, grpcshop.AddBranchProduct) - GetBranchProductMapper = typesrest.NewMapper(ByBranchId, grpcshop.GetBranchProduct) - UpdateBranchProductMapper = typesrest.NewMapper(ByBranchId, grpcshop.UpdateBranchProduct) - SearchBranchProductsMapper = typesrest.NewMapper(Search, grpcshop.SearchBranchProducts) - IncreaseBranchProductStockMapper = typesrest.NewMapper( - IncreaseStockByBranchProductId, - grpcshop.IncreaseBranchProductStock, - ) - DecreaseBranchProductStockMapper = typesrest.NewMapper( - DecreaseStockByBranchProductId, - grpcshop.DecreaseBranchProductStock, - ) -) diff --git a/config/rest/api/v1/shops/businesses/clients/endpoints.go b/config/rest/api/v1/shops/businesses/clients/endpoints.go deleted file mode 100644 index 7478d78..0000000 --- a/config/rest/api/v1/shops/businesses/clients/endpoints.go +++ /dev/null @@ -1,13 +0,0 @@ -package clients - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service clients REST endpoints -var Base = typesrest.NewBaseEndpoint("clients") - -// Shop service clients REST endpoints -var ( - ByBusinessId = typesrest.NewRelativeEndpoint(typesrest.BusinessId) -) diff --git a/config/rest/api/v1/shops/businesses/clients/mappers.go b/config/rest/api/v1/shops/businesses/clients/mappers.go deleted file mode 100644 index 35c9624..0000000 --- a/config/rest/api/v1/shops/businesses/clients/mappers.go +++ /dev/null @@ -1,12 +0,0 @@ -package clients - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service endpoints clients mapping -var ( - AddBusinessClientMapper = typesrest.NewMapper(ByBusinessId, grpcshop.AddBusinessClient) - IsBusinessClientMapper = typesrest.NewMapper(ByBusinessId, grpcshop.IsBusinessClient) -) diff --git a/config/rest/api/v1/shops/businesses/endpoints.go b/config/rest/api/v1/shops/businesses/endpoints.go deleted file mode 100644 index cfca2d8..0000000 --- a/config/rest/api/v1/shops/businesses/endpoints.go +++ /dev/null @@ -1,15 +0,0 @@ -package businesses - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service REST endpoints -var Base = typesrest.NewBaseEndpoint("shops") - -// Shop service REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByBusinessId = typesrest.NewRelativeEndpoint(typesrest.BusinessId) - ProfilePictureByBusinessId = typesrest.NewEndpoint("profile-picture", typesrest.BusinessId) -) diff --git a/config/rest/api/v1/shops/businesses/mappers.go b/config/rest/api/v1/shops/businesses/mappers.go deleted file mode 100644 index a662507..0000000 --- a/config/rest/api/v1/shops/businesses/mappers.go +++ /dev/null @@ -1,18 +0,0 @@ -package businesses - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service endpoints mapping -var ( - AddBusinessMapper = typesrest.NewMapper(Relative, grpcshop.AddBusiness) - GetBusinessMapper = typesrest.NewMapper(ByBusinessId, grpcshop.GetBusiness) - UpdateBusinessMapper = typesrest.NewMapper(ByBusinessId, grpcshop.UpdateBusiness) - SetBusinessProfilePictureMapper = typesrest.NewMapper( - ProfilePictureByBusinessId, - grpcshop.SetBusinessProfilePicture, - ) - DeleteBusinessMapper = typesrest.NewMapper(ByBusinessId, grpcshop.DeleteBusiness) -) diff --git a/config/rest/api/v1/shops/businesses/markets/endpoints.go b/config/rest/api/v1/shops/businesses/markets/endpoints.go deleted file mode 100644 index 0974c31..0000000 --- a/config/rest/api/v1/shops/businesses/markets/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package markets - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service markets REST endpoints -var Base = typesrest.NewBaseEndpoint("markets") - -// Shop service markets REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByBusinessId = typesrest.NewRelativeEndpoint(typesrest.BusinessId) -) diff --git a/config/rest/api/v1/shops/businesses/markets/mappers.go b/config/rest/api/v1/shops/businesses/markets/mappers.go deleted file mode 100644 index 70936e5..0000000 --- a/config/rest/api/v1/shops/businesses/markets/mappers.go +++ /dev/null @@ -1,12 +0,0 @@ -package markets - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service markets endpoints mapping -var ( - AddBusinessMarketCategoryMapper = typesrest.NewMapper(Relative, grpcshop.AddBusinessMarketCategory) - GetBusinessMarketCategoriesMapper = typesrest.NewMapper(ByBusinessId, grpcshop.GetBusinessMarketCategories) -) diff --git a/config/rest/api/v1/shops/businesses/owners/endpoints.go b/config/rest/api/v1/shops/businesses/owners/endpoints.go deleted file mode 100644 index 06175ed..0000000 --- a/config/rest/api/v1/shops/businesses/owners/endpoints.go +++ /dev/null @@ -1,13 +0,0 @@ -package owners - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service owners REST endpoints -var Base = typesrest.NewBaseEndpoint("owners") - -// Shop service owners REST endpoints -var ( - ByBusinessId = typesrest.NewRelativeEndpoint(typesrest.BusinessId) -) diff --git a/config/rest/api/v1/shops/businesses/owners/mappers.go b/config/rest/api/v1/shops/businesses/owners/mappers.go deleted file mode 100644 index c31523c..0000000 --- a/config/rest/api/v1/shops/businesses/owners/mappers.go +++ /dev/null @@ -1,13 +0,0 @@ -package owners - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service endpoints owners mapping -var ( - AddBusinessOwnerMapper = typesrest.NewMapper(ByBusinessId, grpcshop.AddBusinessOwner) - RemoveBusinessOwnerMapper = typesrest.NewMapper(ByBusinessId, grpcshop.RemoveBusinessOwner) - GetBusinessOwnersMapper = typesrest.NewMapper(ByBusinessId, grpcshop.GetBusinessOwners) -) diff --git a/config/rest/api/v1/shops/businesses/products/endpoints.go b/config/rest/api/v1/shops/businesses/products/endpoints.go deleted file mode 100644 index c579142..0000000 --- a/config/rest/api/v1/shops/businesses/products/endpoints.go +++ /dev/null @@ -1,15 +0,0 @@ -package products - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service businesses products REST endpoints -var Base = typesrest.NewBaseEndpoint("products") - -// Shop service businesses products REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByProductId = typesrest.NewRelativeEndpoint(typesrest.ProductId) - Search = typesrest.NewEndpoint("search") -) diff --git a/config/rest/api/v1/shops/businesses/products/mappers.go b/config/rest/api/v1/shops/businesses/products/mappers.go deleted file mode 100644 index 6a8ea07..0000000 --- a/config/rest/api/v1/shops/businesses/products/mappers.go +++ /dev/null @@ -1,14 +0,0 @@ -package products - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service businesses products endpoints mapping -var ( - AddBusinessProductMapper = typesrest.NewMapper(Relative, grpcshop.AddBusinessProduct) - GetBusinessProductMapper = typesrest.NewMapper(ByProductId, grpcshop.GetBusinessProduct) - UpdateBusinessProductMapper = typesrest.NewMapper(ByProductId, grpcshop.UpdateBusinessProduct) - SearchBusinessProductsMapper = typesrest.NewMapper(Search, grpcshop.SearchBusinessProducts) -) diff --git a/config/rest/api/v1/shops/endpoints.go b/config/rest/api/v1/shops/endpoints.go deleted file mode 100644 index 3748414..0000000 --- a/config/rest/api/v1/shops/endpoints.go +++ /dev/null @@ -1,8 +0,0 @@ -package shops - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service shops REST endpoints -var Base = typesrest.NewBaseEndpoint("shops") diff --git a/config/rest/api/v1/shops/markets/categories/endpoints.go b/config/rest/api/v1/shops/markets/categories/endpoints.go deleted file mode 100644 index 930bfe6..0000000 --- a/config/rest/api/v1/shops/markets/categories/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package categories - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service market categories REST endpoints -var Base = typesrest.NewBaseEndpoint("categories") - -// Shop service market categories REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByCategoryId = typesrest.NewRelativeEndpoint(typesrest.CategoryId) -) diff --git a/config/rest/api/v1/shops/markets/categories/mappers.go b/config/rest/api/v1/shops/markets/categories/mappers.go deleted file mode 100644 index aed2580..0000000 --- a/config/rest/api/v1/shops/markets/categories/mappers.go +++ /dev/null @@ -1,13 +0,0 @@ -package categories - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service market categories endpoints mapping -var ( - AddMarketCategoryMapper = typesrest.NewMapper(Relative, grpcshop.AddMarketCategory) - GetMarketCategoryMapper = typesrest.NewMapper(ByCategoryId, grpcshop.GetMarketCategory) - UpdateMarketCategoryMapper = typesrest.NewMapper(ByCategoryId, grpcshop.UpdateMarketCategory) -) diff --git a/config/rest/api/v1/shops/markets/endpoints.go b/config/rest/api/v1/shops/markets/endpoints.go deleted file mode 100644 index 7c4c5d1..0000000 --- a/config/rest/api/v1/shops/markets/endpoints.go +++ /dev/null @@ -1,8 +0,0 @@ -package categories - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service markets REST endpoints -var Base = typesrest.NewBaseEndpoint("markets") diff --git a/config/rest/api/v1/shops/products/categories/endpoints.go b/config/rest/api/v1/shops/products/categories/endpoints.go deleted file mode 100644 index 757d5a4..0000000 --- a/config/rest/api/v1/shops/products/categories/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package categories - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service product categories REST endpoints -var Base = typesrest.NewBaseEndpoint("categories") - -// Shop service product categories REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByCategoryId = typesrest.NewRelativeEndpoint(typesrest.CategoryId) -) diff --git a/config/rest/api/v1/shops/products/categories/mappers.go b/config/rest/api/v1/shops/products/categories/mappers.go deleted file mode 100644 index d102e50..0000000 --- a/config/rest/api/v1/shops/products/categories/mappers.go +++ /dev/null @@ -1,13 +0,0 @@ -package categories - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service product categories endpoints mapping -var ( - AddProductCategoryMapper = typesrest.NewMapper(Relative, grpcshop.AddProductCategory) - GetProductCategoryMapper = typesrest.NewMapper(ByCategoryId, grpcshop.GetProductCategory) - UpdateProductCategoryMapper = typesrest.NewMapper(ByCategoryId, grpcshop.UpdateProductCategory) -) diff --git a/config/rest/api/v1/shops/products/endpoints.go b/config/rest/api/v1/shops/products/endpoints.go deleted file mode 100644 index 1d6a755..0000000 --- a/config/rest/api/v1/shops/products/endpoints.go +++ /dev/null @@ -1,15 +0,0 @@ -package products - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service products REST endpoints -var Base = typesrest.NewBaseEndpoint("products") - -// Shop service products REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByProductId = typesrest.NewRelativeEndpoint(typesrest.ProductId) - Search = typesrest.NewEndpoint("search") -) diff --git a/config/rest/api/v1/shops/products/mappers.go b/config/rest/api/v1/shops/products/mappers.go deleted file mode 100644 index 85e60ab..0000000 --- a/config/rest/api/v1/shops/products/mappers.go +++ /dev/null @@ -1,14 +0,0 @@ -package products - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service products endpoints mapping -var ( - AddProductMapper = typesrest.NewMapper(Relative, grpcshop.AddProduct) - GetProductMapper = typesrest.NewMapper(ByProductId, grpcshop.GetProduct) - UpdateProductMapper = typesrest.NewMapper(ByProductId, grpcshop.UpdateProduct) - SearchProductsMapper = typesrest.NewMapper(Search, grpcshop.SearchProducts) -) diff --git a/config/rest/api/v1/shops/revisions/businesses/endpoints.go b/config/rest/api/v1/shops/revisions/businesses/endpoints.go deleted file mode 100644 index 2554352..0000000 --- a/config/rest/api/v1/shops/revisions/businesses/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package businesses - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service businesses revisions REST endpoints -var Base = typesrest.NewBaseEndpoint("businesses") - -// Shop service REST businesses revisions endpoints -var ( - ByBusinessId = typesrest.NewRelativeEndpoint(typesrest.BusinessId) - ProductsByProductId = typesrest.NewEndpoint("products", typesrest.ProductId) -) diff --git a/config/rest/api/v1/shops/revisions/businesses/mappers.go b/config/rest/api/v1/shops/revisions/businesses/mappers.go deleted file mode 100644 index 2eb7221..0000000 --- a/config/rest/api/v1/shops/revisions/businesses/mappers.go +++ /dev/null @@ -1,15 +0,0 @@ -package businesses - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service endpoints business revisions mapping -var ( - OpenAdminRevisionToBusinessMapper = typesrest.NewMapper(ByBusinessId, grpcshop.OpenAdminRevisionToBusiness) - OpenAdminRevisionToBusinessProductMapper = typesrest.NewMapper( - ProductsByProductId, - grpcshop.OpenAdminRevisionToBusinessProduct, - ) -) diff --git a/config/rest/api/v1/shops/revisions/endpoints.go b/config/rest/api/v1/shops/revisions/endpoints.go deleted file mode 100644 index cb462c5..0000000 --- a/config/rest/api/v1/shops/revisions/endpoints.go +++ /dev/null @@ -1,15 +0,0 @@ -package revisions - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service revisions REST endpoints -var Base = typesrest.NewBaseEndpoint("revisions") - -// Shop service REST revisions endpoints -var ( - Relative = typesrest.NewRelativeEndpoint(typesrest.RevisionId) - BranchesByBranchId = typesrest.NewEndpoint("branches", typesrest.BranchId) - ProductsByProductId = typesrest.NewEndpoint("products", typesrest.ProductId) -) diff --git a/config/rest/api/v1/shops/revisions/mappers.go b/config/rest/api/v1/shops/revisions/mappers.go deleted file mode 100644 index 45f7d2c..0000000 --- a/config/rest/api/v1/shops/revisions/mappers.go +++ /dev/null @@ -1,14 +0,0 @@ -package revisions - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service endpoints revisions mapping -var ( - UpdateAdminRevisionMapper = typesrest.NewMapper(Relative, grpcshop.UpdateAdminRevision) - CloseAdminRevisionMapper = typesrest.NewMapper(Relative, grpcshop.CloseAdminRevision) - OpenAdminRevisionToBranchMapper = typesrest.NewMapper(BranchesByBranchId, grpcshop.OpenAdminRevisionToBranch) - OpenAdminRevisionToProductMapper = typesrest.NewMapper(ProductsByProductId, grpcshop.OpenAdminRevisionToProduct) -) diff --git a/config/rest/api/v1/shops/stores/endpoints.go b/config/rest/api/v1/shops/stores/endpoints.go deleted file mode 100644 index 0edae51..0000000 --- a/config/rest/api/v1/shops/stores/endpoints.go +++ /dev/null @@ -1,15 +0,0 @@ -package stores - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service stores REST endpoints -var Base = typesrest.NewBaseEndpoint("stores") - -// Shop service stores REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByStoreId = typesrest.NewRelativeEndpoint(typesrest.StoreId) - Unoccupied = typesrest.NewEndpoint("unoccupied") -) diff --git a/config/rest/api/v1/shops/stores/mappers.go b/config/rest/api/v1/shops/stores/mappers.go deleted file mode 100644 index 65eba2f..0000000 --- a/config/rest/api/v1/shops/stores/mappers.go +++ /dev/null @@ -1,14 +0,0 @@ -package stores - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service stores endpoints mapping -var ( - AddStoreMapper = typesrest.NewMapper(Relative, grpcshop.AddStore) - GetStoreMapper = typesrest.NewMapper(ByStoreId, grpcshop.GetStore) - DeleteStoreMapper = typesrest.NewMapper(ByStoreId, grpcshop.DeleteStore) - GetUnoccupiedStoresMapper = typesrest.NewMapper(Unoccupied, grpcshop.GetUnoccupiedStores) -) diff --git a/config/rest/api/v1/shops/stores/rents/endpoints.go b/config/rest/api/v1/shops/stores/rents/endpoints.go deleted file mode 100644 index 2a17496..0000000 --- a/config/rest/api/v1/shops/stores/rents/endpoints.go +++ /dev/null @@ -1,17 +0,0 @@ -package rents - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the shop service stores rents REST endpoints -var Base = typesrest.NewBaseEndpoint("rents") - -// Shop service stores rents REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByBranchRentId = typesrest.NewRelativeEndpoint(typesrest.BranchRentId) - ByBranchId = typesrest.NewRelativeEndpoint(typesrest.BranchId) - BranchUnpaidByBranchId = typesrest.NewEndpoint("branch-unpaid", typesrest.BranchId) - BusinessUnpaidByBusinessId = typesrest.NewEndpoint("business-unpaid", typesrest.BusinessId) -) diff --git a/config/rest/api/v1/shops/stores/rents/mappers.go b/config/rest/api/v1/shops/stores/rents/mappers.go deleted file mode 100644 index c31a314..0000000 --- a/config/rest/api/v1/shops/stores/rents/mappers.go +++ /dev/null @@ -1,18 +0,0 @@ -package rents - -import ( - grpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Shop service stores rents endpoints mapping -var ( - AddBranchRentMapper = typesrest.NewMapper(Relative, grpcshop.AddBranchRent) - GetBranchRentsMapper = typesrest.NewMapper(ByBranchId, grpcshop.GetBranchRents) - UpdateBranchRentMapper = typesrest.NewMapper(ByBranchRentId, grpcshop.UpdateBranchRent) - GetUnpaidBranchRentsMapper = typesrest.NewMapper(BranchUnpaidByBranchId, grpcshop.GetUnpaidBranchRents) - GetBusinessUnpaidBranchRentsMapper = typesrest.NewMapper( - BusinessUnpaidByBusinessId, - grpcshop.GetBusinessUnpaidBranchRents, - ) -) diff --git a/config/rest/api/v1/users/emails/endpoints.go b/config/rest/api/v1/users/emails/endpoints.go deleted file mode 100644 index 912f6fb..0000000 --- a/config/rest/api/v1/users/emails/endpoints.go +++ /dev/null @@ -1,19 +0,0 @@ -package emails - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the user service emails REST endpoints -var Base = typesrest.NewBaseEndpoint("emails") - -// User service emails REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByEmail = typesrest.NewRelativeEndpoint(typesrest.Email) - Primary = typesrest.NewEndpoint("primary") - SendVerification = typesrest.NewEndpoint("send-verification") - VerifyByToken = typesrest.NewEndpoint( - "verify", typesrest.Token, - ) -) diff --git a/config/rest/api/v1/users/emails/mappers.go b/config/rest/api/v1/users/emails/mappers.go deleted file mode 100644 index 9a84db8..0000000 --- a/config/rest/api/v1/users/emails/mappers.go +++ /dev/null @@ -1,17 +0,0 @@ -package emails - -import ( - grpcuser "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/user" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Users service emails endpoints mapping -var ( - GetActiveEmailsMapper = typesrest.NewMapper(Relative, grpcuser.GetActiveEmails) - AddEmailMapper = typesrest.NewMapper(Relative, grpcuser.AddEmail) - GetPrimaryEmailMapper = typesrest.NewMapper(Primary, grpcuser.GetPrimaryEmail) - ChangePrimaryEmailMapper = typesrest.NewMapper(Primary, grpcuser.ChangePrimaryEmail) - DeleteEmailMapper = typesrest.NewMapper(ByEmail, grpcuser.DeleteEmail) - SendVerificationEmailMapper = typesrest.NewMapper(SendVerification, grpcuser.SendVerificationEmail) - VerifyEmailMapper = typesrest.NewMapper(VerifyByToken, grpcuser.VerifyEmail) -) diff --git a/config/rest/api/v1/users/endpoints.go b/config/rest/api/v1/users/endpoints.go deleted file mode 100644 index a638581..0000000 --- a/config/rest/api/v1/users/endpoints.go +++ /dev/null @@ -1,26 +0,0 @@ -package users - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the user service REST endpoints -var Base = typesrest.NewBaseEndpoint("users") - -// Users service REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - SignUp = typesrest.NewEndpoint("sign-up") - Password = typesrest.NewEndpoint("password") - Username = typesrest.NewEndpoint("username") - ProfilePicture = typesrest.NewEndpoint("profile-picture") - UserIdByUsername = typesrest.NewEndpoint( - "user-id", - typesrest.Username, - ) - ForgotPassword = typesrest.NewEndpoint("forgot-password") - ResetPasswordByToken = typesrest.NewEndpoint( - "reset-password", typesrest.Token, - ) - DeleteAccount = typesrest.NewEndpoint("delete-account") -) diff --git a/config/rest/api/v1/users/mappers.go b/config/rest/api/v1/users/mappers.go deleted file mode 100644 index 5bc4fce..0000000 --- a/config/rest/api/v1/users/mappers.go +++ /dev/null @@ -1,19 +0,0 @@ -package users - -import ( - configusers "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/user" - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Users service endpoints mapping -var ( - UpdateUserMapper = rest.NewMapper(Relative, configusers.UpdateUser) - SignUpMapper = rest.NewMapper(SignUp, configusers.SignUp) - GetUserIdByUsernameMapper = rest.NewMapper(UserIdByUsername, configusers.GetUserIdByUsername) - ChangePasswordMapper = rest.NewMapper(Password, configusers.ChangePassword) - ChangeUsernameMapper = rest.NewMapper(Username, configusers.ChangeUsername) - SetProfilePictureMapper = rest.NewMapper(ProfilePicture, configusers.SetProfilePicture) - ForgotPasswordMapper = rest.NewMapper(ForgotPassword, configusers.ForgotPassword) - ResetPasswordMapper = rest.NewMapper(ResetPasswordByToken, configusers.ResetPassword) - DeleteAccountMapper = rest.NewMapper(DeleteAccount, configusers.DeleteUser) -) diff --git a/config/rest/api/v1/users/phone-numbers/endpoints.go b/config/rest/api/v1/users/phone-numbers/endpoints.go deleted file mode 100644 index e662bc6..0000000 --- a/config/rest/api/v1/users/phone-numbers/endpoints.go +++ /dev/null @@ -1,17 +0,0 @@ -package phone_numbers - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the user service phone numbers REST endpoints -var Base = typesrest.NewBaseEndpoint("phone-numbers") - -// User service phone numbers REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - SendVerification = typesrest.NewEndpoint("send-verification") - VerifyByToken = typesrest.NewEndpoint( - "verify", typesrest.Token, - ) -) diff --git a/config/rest/api/v1/users/phone-numbers/mappers.go b/config/rest/api/v1/users/phone-numbers/mappers.go deleted file mode 100644 index ffd3628..0000000 --- a/config/rest/api/v1/users/phone-numbers/mappers.go +++ /dev/null @@ -1,14 +0,0 @@ -package phone_numbers - -import ( - grpcuser "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/user" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Users service phone numbers endpoints mapping -var ( - ChangePhoneNumberMapper = typesrest.NewMapper(Relative, grpcuser.ChangePhoneNumber) - GetPhoneNumberMapper = typesrest.NewMapper(Relative, grpcuser.GetPhoneNumber) - SendVerificationSMSMapper = typesrest.NewMapper(SendVerification, grpcuser.SendVerificationSMS) - VerifyPhoneNumberMapper = typesrest.NewMapper(VerifyByToken, grpcuser.VerifyPhoneNumber) -) diff --git a/config/rest/api/v1/users/profiles/endpoints.go b/config/rest/api/v1/users/profiles/endpoints.go deleted file mode 100644 index a850b97..0000000 --- a/config/rest/api/v1/users/profiles/endpoints.go +++ /dev/null @@ -1,14 +0,0 @@ -package profiles - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the user service profiles REST endpoints -var Base = typesrest.NewBaseEndpoint("profiles") - -// User service profiles REST endpoints -var ( - Relative = typesrest.NewRelativeEndpoint() - ByUsername = typesrest.NewRelativeEndpoint(typesrest.Username) -) diff --git a/config/rest/api/v1/users/profiles/mappers.go b/config/rest/api/v1/users/profiles/mappers.go deleted file mode 100644 index c5f34d3..0000000 --- a/config/rest/api/v1/users/profiles/mappers.go +++ /dev/null @@ -1,12 +0,0 @@ -package profiles - -import ( - grpcuser "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/user" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Users service profiles endpoints mapping -var ( - GetMyProfileMapper = typesrest.NewMapper(Relative, grpcuser.GetMyProfile) - GetProfileMapper = typesrest.NewMapper(ByUsername, grpcuser.GetProfile) -) diff --git a/config/rest/api/v1/users/usernames/endpoints.go b/config/rest/api/v1/users/usernames/endpoints.go deleted file mode 100644 index 723fa91..0000000 --- a/config/rest/api/v1/users/usernames/endpoints.go +++ /dev/null @@ -1,19 +0,0 @@ -package usernames - -import ( - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Base is the base endpoint for the user service usernames REST endpoints -var Base = typesrest.NewBaseEndpoint("usernames") - -// User service usernames REST endpoints -var ( - ByUserId = typesrest.NewRelativeEndpoint( - typesrest.UserId, - ) - ExistsByUsername = typesrest.NewEndpoint( - "exists", - typesrest.Username, - ) -) diff --git a/config/rest/api/v1/users/usernames/mappers.go b/config/rest/api/v1/users/usernames/mappers.go deleted file mode 100644 index 0926145..0000000 --- a/config/rest/api/v1/users/usernames/mappers.go +++ /dev/null @@ -1,12 +0,0 @@ -package usernames - -import ( - grpcuser "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/user" - typesrest "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/rest" -) - -// Users service usernames endpoints mapping -var ( - GetUsernameByUserIdMapper = typesrest.NewMapper(ByUserId, grpcuser.GetUsernameByUserId) - UsernameExistsMapper = typesrest.NewMapper(ExistsByUsername, grpcuser.UsernameExists) -) diff --git a/go.mod b/go.mod index d52fc3e..01f349a 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,16 @@ module github.com/pixel-plaza-dev/uru-databases-2-protobuf-common -go 1.23.2 +go 1.23.4 require ( google.golang.org/grpc v1.67.1 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.36.0 ) require ( - golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/text v0.17.0 // indirect + github.com/ralvarezdev/go-jwt v0.2.1 // indirect + golang.org/x/net v0.33.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect ) diff --git a/go.sum b/go.sum index a8432dc..343f3c8 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,20 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/ralvarezdev/go-jwt v0.2.1 h1:plcHDPhuhHpKolNiZzAL5kK1KCpM6Zyox2FimaxzmDQ= +github.com/ralvarezdev/go-jwt v0.2.1/go.mod h1:CKxcQ+o7CMqMd2/2UYEOSbk3yqDyu1NnVZWsxjwpayI= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= diff --git a/go/pixel_plaza/auth/interceptions.go b/go/pixel_plaza/auth/interceptions.go new file mode 100644 index 0000000..04ed610 --- /dev/null +++ b/go/pixel_plaza/auth/interceptions.go @@ -0,0 +1,31 @@ +package auth + +import ( + compiled "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/compiled/pixel_plaza/auth" + "github.com/ralvarezdev/go-jwt/token/interception" +) + +// Interceptions is the list of gRPC methods to intercept +var Interceptions = map[string]interception.Interception{ + compiled.Auth_LogIn_FullMethodName: interception.None, + compiled.Auth_IsAccessTokenValid_FullMethodName: interception.None, + compiled.Auth_IsRefreshTokenValid_FullMethodName: interception.None, + compiled.Auth_RefreshToken_FullMethodName: interception.RefreshToken, + compiled.Auth_LogOut_FullMethodName: interception.AccessToken, + compiled.Auth_GetRefreshTokenInformation_FullMethodName: interception.AccessToken, + compiled.Auth_GetRefreshTokensInformation_FullMethodName: interception.AccessToken, + compiled.Auth_RevokeRefreshToken_FullMethodName: interception.AccessToken, + compiled.Auth_RevokeRefreshTokens_FullMethodName: interception.AccessToken, + compiled.Auth_AddPermission_FullMethodName: interception.AccessToken, + compiled.Auth_RevokePermission_FullMethodName: interception.AccessToken, + compiled.Auth_GetPermission_FullMethodName: interception.AccessToken, + compiled.Auth_GetPermissions_FullMethodName: interception.AccessToken, + compiled.Auth_AddRolePermission_FullMethodName: interception.AccessToken, + compiled.Auth_RevokeRolePermission_FullMethodName: interception.AccessToken, + compiled.Auth_AddRole_FullMethodName: interception.AccessToken, + compiled.Auth_RevokeRole_FullMethodName: interception.AccessToken, + compiled.Auth_GetRoles_FullMethodName: interception.AccessToken, + compiled.Auth_AddUserRole_FullMethodName: interception.AccessToken, + compiled.Auth_RevokeUserRole_FullMethodName: interception.AccessToken, + compiled.Auth_GetUserRoles_FullMethodName: interception.AccessToken, +} diff --git a/go/pixel_plaza/order/interceptions.go b/go/pixel_plaza/order/interceptions.go new file mode 100644 index 0000000..bc0ae95 --- /dev/null +++ b/go/pixel_plaza/order/interceptions.go @@ -0,0 +1,19 @@ +package order + +import ( + compiled "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/compiled/pixel_plaza/order" + "github.com/ralvarezdev/go-jwt/token/interception" +) + +// Interceptions is the list of gRPC methods to intercept +var Interceptions = map[string]interception.Interception{ + compiled.Order_AddProductToCart_FullMethodName: interception.AccessToken, + compiled.Order_RemoveProductFromCart_FullMethodName: interception.AccessToken, + compiled.Order_GetCart_FullMethodName: interception.AccessToken, + compiled.Order_GetCurrentCart_FullMethodName: interception.AccessToken, + compiled.Order_GetCarts_FullMethodName: interception.AccessToken, + compiled.Order_GetCartTotal_FullMethodName: interception.AccessToken, + compiled.Order_PlaceOrder_FullMethodName: interception.AccessToken, + compiled.Order_GetOrders_FullMethodName: interception.AccessToken, + compiled.Order_GetOrder_FullMethodName: interception.AccessToken, +} diff --git a/go/pixel_plaza/payment/interceptions.go b/go/pixel_plaza/payment/interceptions.go new file mode 100644 index 0000000..a79d344 --- /dev/null +++ b/go/pixel_plaza/payment/interceptions.go @@ -0,0 +1,24 @@ +package payment + +import ( + compiled "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/compiled/pixel_plaza/payment" + "github.com/ralvarezdev/go-jwt/token/interception" +) + +// Interceptions is the list of gRPC methods to intercept +var Interceptions = map[string]interception.Interception{ + compiled.Payment_AddOrderPayment_FullMethodName: interception.AccessToken, + compiled.Payment_GetOrderPayments_FullMethodName: interception.AccessToken, + compiled.Payment_AddBranchRentPayment_FullMethodName: interception.AccessToken, + compiled.Payment_GetBranchRentPayments_FullMethodName: interception.AccessToken, + compiled.Payment_GetBranchRentsPayments_FullMethodName: interception.AccessToken, + compiled.Payment_VerifyPayment_FullMethodName: interception.AccessToken, + compiled.Payment_AddPaymentAccount_FullMethodName: interception.AccessToken, + compiled.Payment_GetPaymentAccounts_FullMethodName: interception.AccessToken, + compiled.Payment_GetActivePaymentAccounts_FullMethodName: interception.AccessToken, + compiled.Payment_GetSuspendedPaymentAccounts_FullMethodName: interception.AccessToken, + compiled.Payment_SuspendPaymentAccount_FullMethodName: interception.AccessToken, + compiled.Payment_ActivatePaymentAccount_FullMethodName: interception.AccessToken, + compiled.Payment_PayForOrder_FullMethodName: interception.AccessToken, + compiled.Payment_PayForBranchRent_FullMethodName: interception.AccessToken, +} diff --git a/go/pixel_plaza/shop/interceptions.go b/go/pixel_plaza/shop/interceptions.go new file mode 100644 index 0000000..9e5725e --- /dev/null +++ b/go/pixel_plaza/shop/interceptions.go @@ -0,0 +1,65 @@ +package shop + +import ( + compiled "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/compiled/pixel_plaza/shop" + "github.com/ralvarezdev/go-jwt/token/interception" +) + +// Interceptions is the list of gRPC methods to intercept +var Interceptions = map[string]interception.Interception{ + compiled.Shop_UpdateAdminRevision_FullMethodName: interception.AccessToken, + compiled.Shop_GetAdminRevisions_FullMethodName: interception.AccessToken, + compiled.Shop_CloseAdminRevision_FullMethodName: interception.AccessToken, + compiled.Shop_AddBusiness_FullMethodName: interception.AccessToken, + compiled.Shop_GetBusiness_FullMethodName: interception.None, + compiled.Shop_UpdateBusiness_FullMethodName: interception.AccessToken, + compiled.Shop_SetBusinessProfilePicture_FullMethodName: interception.AccessToken, + compiled.Shop_OpenAdminRevisionToBusiness_FullMethodName: interception.AccessToken, + compiled.Shop_DeleteBusiness_FullMethodName: interception.AccessToken, + compiled.Shop_AddBusinessOwner_FullMethodName: interception.AccessToken, + compiled.Shop_RemoveBusinessOwner_FullMethodName: interception.AccessToken, + compiled.Shop_GetBusinessOwners_FullMethodName: interception.AccessToken, + compiled.Shop_AddBusinessClient_FullMethodName: interception.AccessToken, + compiled.Shop_IsBusinessClient_FullMethodName: interception.AccessToken, + compiled.Shop_AddMarketCategory_FullMethodName: interception.AccessToken, + compiled.Shop_GetMarketCategory_FullMethodName: interception.None, + compiled.Shop_UpdateMarketCategory_FullMethodName: interception.AccessToken, + compiled.Shop_AddBusinessMarketCategory_FullMethodName: interception.AccessToken, + compiled.Shop_GetBusinessMarketCategories_FullMethodName: interception.None, + compiled.Shop_AddStore_FullMethodName: interception.AccessToken, + compiled.Shop_GetStore_FullMethodName: interception.None, + compiled.Shop_DeleteStore_FullMethodName: interception.AccessToken, + compiled.Shop_GetUnoccupiedStores_FullMethodName: interception.None, + compiled.Shop_AddBranch_FullMethodName: interception.AccessToken, + compiled.Shop_GetBranch_FullMethodName: interception.None, + compiled.Shop_GetBusinessBranches_FullMethodName: interception.None, + compiled.Shop_UpdateBranch_FullMethodName: interception.AccessToken, + compiled.Shop_CloseTemporarilyBranch_FullMethodName: interception.AccessToken, + compiled.Shop_OpenBranch_FullMethodName: interception.AccessToken, + compiled.Shop_OpenAdminRevisionToBranch_FullMethodName: interception.AccessToken, + compiled.Shop_DeleteBranch_FullMethodName: interception.AccessToken, + compiled.Shop_AddBranchRent_FullMethodName: interception.AccessToken, + compiled.Shop_GetBranchRents_FullMethodName: interception.AccessToken, + compiled.Shop_UpdateBranchRent_FullMethodName: interception.AccessToken, + compiled.Shop_GetUnpaidBranchRents_FullMethodName: interception.AccessToken, + compiled.Shop_GetBusinessUnpaidBranchRents_FullMethodName: interception.AccessToken, + compiled.Shop_AddProductCategory_FullMethodName: interception.AccessToken, + compiled.Shop_GetProductCategory_FullMethodName: interception.None, + compiled.Shop_UpdateProductCategory_FullMethodName: interception.AccessToken, + compiled.Shop_AddProduct_FullMethodName: interception.AccessToken, + compiled.Shop_GetProduct_FullMethodName: interception.None, + compiled.Shop_UpdateProduct_FullMethodName: interception.AccessToken, + compiled.Shop_SearchProducts_FullMethodName: interception.None, + compiled.Shop_OpenAdminRevisionToProduct_FullMethodName: interception.AccessToken, + compiled.Shop_AddBusinessProduct_FullMethodName: interception.AccessToken, + compiled.Shop_GetBusinessProduct_FullMethodName: interception.None, + compiled.Shop_UpdateBusinessProduct_FullMethodName: interception.AccessToken, + compiled.Shop_SearchBusinessProducts_FullMethodName: interception.None, + compiled.Shop_OpenAdminRevisionToBusinessProduct_FullMethodName: interception.AccessToken, + compiled.Shop_AddBranchProduct_FullMethodName: interception.AccessToken, + compiled.Shop_GetBranchProduct_FullMethodName: interception.None, + compiled.Shop_SearchBranchProducts_FullMethodName: interception.None, + compiled.Shop_UpdateBranchProduct_FullMethodName: interception.AccessToken, + compiled.Shop_IncreaseBranchProductStock_FullMethodName: interception.AccessToken, + compiled.Shop_DecreaseBranchProductStock_FullMethodName: interception.AccessToken, +} diff --git a/go/pixel_plaza/user/interceptions.go b/go/pixel_plaza/user/interceptions.go new file mode 100644 index 0000000..8745a37 --- /dev/null +++ b/go/pixel_plaza/user/interceptions.go @@ -0,0 +1,35 @@ +package user + +import ( + compiled "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/compiled/pixel_plaza/user" + "github.com/ralvarezdev/go-jwt/token/interception" +) + +// Interceptions is the list of gRPC methods to intercept +var Interceptions = map[string]interception.Interception{ + compiled.User_SignUp_FullMethodName: interception.None, + compiled.User_UsernameExists_FullMethodName: interception.None, + compiled.User_GetUserIdByUsername_FullMethodName: interception.None, + compiled.User_GetUsernameByUserId_FullMethodName: interception.None, + compiled.User_IsPasswordCorrect_FullMethodName: interception.None, + compiled.User_GetProfile_FullMethodName: interception.None, + compiled.User_UpdateUser_FullMethodName: interception.AccessToken, + compiled.User_SetProfilePicture_FullMethodName: interception.AccessToken, + compiled.User_GetMyProfile_FullMethodName: interception.AccessToken, + compiled.User_ChangePassword_FullMethodName: interception.AccessToken, + compiled.User_ChangeUsername_FullMethodName: interception.AccessToken, + compiled.User_AddEmail_FullMethodName: interception.AccessToken, + compiled.User_DeleteEmail_FullMethodName: interception.AccessToken, + compiled.User_SendVerificationEmail_FullMethodName: interception.AccessToken, + compiled.User_VerifyEmail_FullMethodName: interception.AccessToken, + compiled.User_GetPrimaryEmail_FullMethodName: interception.AccessToken, + compiled.User_ChangePrimaryEmail_FullMethodName: interception.AccessToken, + compiled.User_GetActiveEmails_FullMethodName: interception.AccessToken, + compiled.User_ChangePhoneNumber_FullMethodName: interception.AccessToken, + compiled.User_GetPhoneNumber_FullMethodName: interception.AccessToken, + compiled.User_SendVerificationSMS_FullMethodName: interception.AccessToken, + compiled.User_VerifyPhoneNumber_FullMethodName: interception.AccessToken, + compiled.User_ForgotPassword_FullMethodName: interception.None, + compiled.User_ResetPassword_FullMethodName: interception.None, + compiled.User_DeleteUser_FullMethodName: interception.AccessToken, +} diff --git a/hide-json-tags.bat b/hide-json-tags.bat deleted file mode 100644 index bc3d19b..0000000 --- a/hide-json-tags.bat +++ /dev/null @@ -1,8 +0,0 @@ -@echo off -echo Compiling .go files... -go build -o ./bin/ -echo Compiling .go files... Done. - -echo Executing /bin/uru-databases-2-protobuf-common.exe... -start "" "./bin/uru-databases-2-protobuf-common.exe" -echo Executing /bin/uru-databases-2-protobuf-common.exe... Done. \ No newline at end of file diff --git a/main.go b/main.go deleted file mode 100644 index 0beae0e..0000000 --- a/main.go +++ /dev/null @@ -1,255 +0,0 @@ -package main - -import ( - "fmt" - configgrpcauth "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/auth" - configgrpcorder "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/order" - configgrpcpayment "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/payment" - configgrpcshop "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/shop" - configgrpcuser "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/config/grpc/user" - utilsparsertags "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/utils/parser/tags" - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/utils/path" -) - -func main() { - // Get the path of the compiled protobuf file in Go - userPath := path.GetProtoGoPath("pixel_plaza", "user") - authPath := path.GetProtoGoPath("pixel_plaza", "auth") - orderPath := path.GetProtoGoPath("pixel_plaza", "order") - paymentPath := path.GetProtoGoPath("pixel_plaza", "payment") - shopPath := path.GetProtoGoPath("pixel_plaza", "shop") - - // Create the GoFileStructFields map - goFileStructFields := utilsparsertags.GoFileStructFields{ - userPath: { - configgrpcuser.DeleteEmail.RequestString(): []string{ - "Email", - }, - configgrpcuser.VerifyEmail.RequestString(): []string{ - "Token", - }, - configgrpcuser.VerifyPhoneNumber.RequestString(): []string{ - "Token", - }, - configgrpcuser.GetProfile.RequestString(): []string{ - "Username", - }, - configgrpcuser.GetUsernameByUserId.RequestString(): []string{ - "UserId", - }, - configgrpcuser.GetUserIdByUsername.RequestString(): []string{ - "Username", - }, - configgrpcuser.ResetPassword.RequestString(): []string{ - "Token", - }, - }, - authPath: { - configgrpcauth.IsAccessTokenValid.RequestString(): []string{ - "JwtId", - }, - configgrpcauth.GetPermission.RequestString(): []string{ - "PermissionId", - }, - configgrpcauth.RevokePermission.RequestString(): []string{ - "PermissionId", - }, - configgrpcauth.IsRefreshTokenValid.RequestString(): []string{ - "JwtId", - }, - configgrpcauth.GetRefreshTokenInformation.RequestString(): []string{ - "JwtId", - }, - configgrpcauth.RevokeRefreshToken.RequestString(): []string{ - "JwtId", - }, - configgrpcauth.RevokeRolePermission.RequestString(): []string{ - "RoleId", - }, - configgrpcauth.AddRolePermission.RequestString(): []string{ - "RoleId", - }, - configgrpcauth.GetRolePermissions.RequestString(): []string{ - "RoleId", - }, - configgrpcauth.RevokeRole.RequestString(): []string{ - "RoleId", - }, - configgrpcauth.GetUserRoles.RequestString(): []string{ - "UserId", - }, - configgrpcauth.AddUserRole.RequestString(): []string{ - "UserId", - }, - configgrpcauth.RevokeUserRole.RequestString(): []string{ - "UserId", - }, - }, - orderPath: { - configgrpcorder.GetCart.RequestString(): []string{ - "CartId", - }, - configgrpcorder.GetCartTotal.RequestString(): []string{ - "CartId", - }, - configgrpcorder.GetOrder.RequestString(): []string{ - "OrderId", - }, - }, - paymentPath: { - configgrpcpayment.ActivatePaymentAccount.RequestString(): []string{ - "PaymentAccountId", - }, - configgrpcpayment.SuspendPaymentAccount.RequestString(): []string{ - "PaymentAccountId", - }, - configgrpcpayment.AddBranchRentPayment.RequestString(): []string{ - "BranchRentId", - }, - configgrpcpayment.GetBranchRentPayments.RequestString(): []string{ - "BranchRentId", - }, - configgrpcpayment.PayForBranchRent.RequestString(): []string{ - "BranchRentId", - }, - configgrpcpayment.AddOrderPayment.RequestString(): []string{ - "OrderId", - }, - configgrpcpayment.GetOrderPayments.RequestString(): []string{ - "OrderId", - }, - configgrpcpayment.PayForOrder.RequestString(): []string{ - "OrderId", - }, - }, - shopPath: { - configgrpcshop.UpdateAdminRevision.RequestString(): []string{ - "AdminRevisionId", - }, - configgrpcshop.CloseAdminRevision.RequestString(): []string{ - "AdminRevisionId", - }, - configgrpcshop.GetStore.RequestString(): []string{ - "StoreId", - }, - configgrpcshop.DeleteStore.RequestString(): []string{ - "StoreId", - }, - configgrpcshop.AddBranchProduct.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.GetBranchProduct.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.UpdateBranchProduct.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.GetBusinessMarketCategories.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.GetProductCategory.RequestString(): []string{ - "ProductCategoryId", - }, - configgrpcshop.UpdateProductCategory.RequestString(): []string{ - "ProductCategoryId", - }, - configgrpcshop.GetMarketCategory.RequestString(): []string{ - "MarketCategoryId", - }, - configgrpcshop.UpdateMarketCategory.RequestString(): []string{ - "MarketCategoryId", - }, - configgrpcshop.GetProduct.RequestString(): []string{ - "ProductId", - }, - configgrpcshop.UpdateProduct.RequestString(): []string{ - "ProductId", - }, - configgrpcshop.OpenAdminRevisionToProduct.RequestString(): []string{ - "ProductId", - }, - configgrpcshop.GetBusinessProduct.RequestString(): []string{ - "ProductId", - }, - configgrpcshop.UpdateBusinessProduct.RequestString(): []string{ - "ProductId", - }, - configgrpcshop.OpenAdminRevisionToBusinessProduct.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.GetBranchRents.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.UpdateBranchRent.RequestString(): []string{ - "BranchRentId", - }, - configgrpcshop.GetUnpaidBranchRents.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.GetBusinessUnpaidBranchRents.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.GetBranch.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.GetBusinessBranches.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.UpdateBranch.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.OpenBranch.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.CloseTemporarilyBranch.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.OpenAdminRevisionToBranch.RequestString(): []string{ - "BranchId", - }, - configgrpcshop.AddBusinessOwner.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.RemoveBusinessOwner.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.GetBusinessOwners.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.GetBusiness.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.UpdateBusiness.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.SetBusinessProfilePicture.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.OpenAdminRevisionToBusiness.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.DeleteBusiness.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.AddBusinessClient.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.IsBusinessClient.RequestString(): []string{ - "BusinessId", - }, - configgrpcshop.IncreaseBranchProductStock.RequestString(): []string{ - "BranchProductId", - }, - configgrpcshop.DecreaseBranchProductStock.RequestString(): []string{ - "BranchProductId", - }, - }, - } - - // Hide the JSON tags in the specified files - err := utilsparsertags.HideFilesJSONTags(&goFileStructFields) - if err != nil { - panic(err) - } - fmt.Println("Structs JSON tags hidden successfully") -} diff --git a/types/grpc/interceptions.go b/types/grpc/interceptions.go deleted file mode 100644 index 9c30cef..0000000 --- a/types/grpc/interceptions.go +++ /dev/null @@ -1,13 +0,0 @@ -package grpc - -type ( - // Interception is the type of interception - Interception int -) - -// Interception values -const ( - RefreshToken Interception = iota - AccessToken - None -) diff --git a/types/grpc/methods.go b/types/grpc/methods.go deleted file mode 100644 index cc7e13d..0000000 --- a/types/grpc/methods.go +++ /dev/null @@ -1,28 +0,0 @@ -package grpc - -type ( - // Method is the gRPC method Name - Method struct { - Name string - } -) - -// NewMethod creates a new Method -func NewMethod(name string) Method { - return Method{name} -} - -// String returns the string representation of the Method -func (g Method) String() string { - return g.Name -} - -// RequestString returns the string representation of the Method for the request -func (g Method) RequestString() string { - return g.Name + "Request" -} - -// ResponseString returns the string representation of the Method for the response -func (g Method) ResponseString() string { - return g.Name + "Response" -} diff --git a/types/rest/endpoints.go b/types/rest/endpoints.go deleted file mode 100644 index 6238d0b..0000000 --- a/types/rest/endpoints.go +++ /dev/null @@ -1,38 +0,0 @@ -package rest - -type ( - // Endpoint is the REST endpoint - Endpoint struct { - Name string - Params []Param - } -) - -// NewEndpoint creates a new Endpoint -func NewEndpoint(name string, params ...Param) *Endpoint { - return &Endpoint{Name: name, Params: params} -} - -// NewRelativeEndpoint creates a new relative Endpoint -func NewRelativeEndpoint(params ...Param) *Endpoint { - return &Endpoint{Name: "", Params: params} -} - -// NewBaseEndpoint creates a new base Endpoint -func NewBaseEndpoint(name string) *Endpoint { - return &Endpoint{Name: name} -} - -// String returns the string representation of the Endpoint -func (r Endpoint) String() string { - formattedParams := "" - for _, param := range r.Params { - formattedParams += "/:" + param.String() - } - return "/" + r.Name + formattedParams -} - -// Path returns the path of the Endpoint -func (r Endpoint) Path() string { - return r.String() -} diff --git a/types/rest/handlers.go b/types/rest/handlers.go deleted file mode 100644 index 59952d7..0000000 --- a/types/rest/handlers.go +++ /dev/null @@ -1,29 +0,0 @@ -package rest - -import ( - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/types/grpc" -) - -type ( - // Mapper is the mapper for a REST endpoint and a gRPC method - Mapper struct { - Endpoint *Endpoint - GRPCMethod grpc.Method - } -) - -// NewMapper creates a new mapper -func NewMapper( - endpoint *Endpoint, - grpcMethod grpc.Method, -) *Mapper { - return &Mapper{ - Endpoint: endpoint, - GRPCMethod: grpcMethod, - } -} - -// Path returns the path of the REST endpoint -func (m Mapper) Path() string { - return m.Endpoint.Path() -} diff --git a/types/rest/methods.go b/types/rest/methods.go deleted file mode 100644 index ad9facf..0000000 --- a/types/rest/methods.go +++ /dev/null @@ -1,36 +0,0 @@ -package rest - -type ( - // Method is the type of REST request method - Method int -) - -// GetMethod returns the Method from the string -func GetMethod(method string) Method { - switch method { - case "": - case "GET": - return GET - case "POST": - return POST - case "PUT": - return PUT - case "PATCH": - return PATCH - case "DELETE": - return DELETE - default: - return INVALID - } - return INVALID -} - -// Method values -const ( - GET Method = iota - POST - PUT - PATCH - DELETE - INVALID -) diff --git a/types/rest/params.go b/types/rest/params.go deleted file mode 100644 index f40a534..0000000 --- a/types/rest/params.go +++ /dev/null @@ -1,41 +0,0 @@ -package rest - -type ( - // Param is the type of REST request parameter - Param struct { - Name string - } -) - -// NewParam creates a new Param -func NewParam(name string) Param { - return Param{name} -} - -// String returns the string representation of the Param -func (r Param) String() string { - return r.Name -} - -// Param values -var ( - Email = NewParam("email") - Username = NewParam("username") - Token = NewParam("token") - Id = NewParam("id") - PermissionId = NewParam("permission-id") - RoleId = NewParam("role-id") - UserId = NewParam("user-id") - JwtId = NewParam("jwt-id") - AccountId = NewParam("account-id") - OrderId = NewParam("order-id") - CartId = NewParam("cart-id") - BranchRentId = NewParam("branch-rent-id") - BranchId = NewParam("branch-id") - StoreId = NewParam("store-id") - BusinessId = NewParam("business-id") - CategoryId = NewParam("category-id") - ProductId = NewParam("product-id") - RevisionId = NewParam("revision-id") - BranchProductId = NewParam("branch-product-id") -) diff --git a/utils/parser/errors.go b/utils/parser/errors.go deleted file mode 100644 index 6f099b7..0000000 --- a/utils/parser/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package parser - -import ( - "errors" -) - -var ( - NilFileSetError = errors.New("file set is nil") - NilASTNodeError = errors.New("ast node is nil") -) diff --git a/utils/parser/parsers.go b/utils/parser/parsers.go deleted file mode 100644 index c80f269..0000000 --- a/utils/parser/parsers.go +++ /dev/null @@ -1,51 +0,0 @@ -package parser - -import ( - "fmt" - "go/ast" - "go/parser" - "go/printer" - "go/token" - "os" -) - -// ParseGoFile parse the given Go file and return the file set and the AST node -func ParseGoFile(filePath string) (*token.FileSet, *ast.File, error) { - // Parse the Go file - fileSet := token.NewFileSet() - node, err := parser.ParseFile(fileSet, filePath, nil, parser.ParseComments) - if err != nil { - return nil, nil, fmt.Errorf("failed to parse file: %w", err) - } - - return fileSet, node, nil -} - -// WriteGoFile write the given AST node to the given file path -func WriteGoFile(filePath string, fileSet *token.FileSet, node *ast.File) error { - // Check the file set and the AST node - if fileSet == nil { - return NilFileSetError - } - if node == nil { - return NilASTNodeError - } - - // Write the modified AST back to the file - file, err := os.Create(filePath) - if err != nil { - return fmt.Errorf("failed to create file: %w", err) - } - defer func(file *os.File) { - err := file.Close() - if err != nil { - panic(err) - } - }(file) - - if err := printer.Fprint(file, fileSet, node); err != nil { - return fmt.Errorf("failed to write file: %w", err) - } - - return nil -} diff --git a/utils/parser/tags/errors.go b/utils/parser/tags/errors.go deleted file mode 100644 index 0d0493b..0000000 --- a/utils/parser/tags/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package tags - -import ( - "errors" -) - -var ( - NilStructFieldsError = errors.New("nil struct fields") - NilGoStructFieldsError = errors.New("nil go struct fields") - NilStructJSONTagError = errors.New("nil struct json tag") -) diff --git a/utils/parser/tags/hide-json-tags.go b/utils/parser/tags/hide-json-tags.go deleted file mode 100644 index 277a305..0000000 --- a/utils/parser/tags/hide-json-tags.go +++ /dev/null @@ -1,40 +0,0 @@ -package tags - -// HideFileJSONTags hides the JSON tags in the specified file -func HideFileJSONTags(filePath string, structFields *StructFields) error { - // Check if the StructFields is nil - if structFields == nil { - return NilStructFieldsError - } - - // Generate the StructJSONTag - structJSONTag := StructJSONTag{} - - // Loop through the struct fields - for structName, fields := range *structFields { - fieldJSONTag := FieldJSONTag{} - for _, field := range fields { - fieldJSONTag[field] = "-" - } - structJSONTag[structName] = fieldJSONTag - } - // Overwrite the JSON tags - return OverwriteJSONTags(filePath, &structJSONTag) -} - -// HideFilesJSONTags hides the JSON tags in the specified files -func HideFilesJSONTags(goFileStructFields *GoFileStructFields) error { - // Check if the GoFileStructFields is nil - if goFileStructFields == nil { - return NilGoStructFieldsError - } - - // Loop through the file paths - for filePath, structFields := range *goFileStructFields { - // Hide the JSON tags in the file - if err := HideFileJSONTags(filePath, structFields); err != nil { - return err - } - } - return nil -} diff --git a/utils/parser/tags/overwite-json-tags.go b/utils/parser/tags/overwite-json-tags.go deleted file mode 100644 index 184b1f2..0000000 --- a/utils/parser/tags/overwite-json-tags.go +++ /dev/null @@ -1,123 +0,0 @@ -package tags - -import ( - "fmt" - "github.com/pixel-plaza-dev/uru-databases-2-protobuf-common/utils/parser" - "go/ast" - "go/token" - "regexp" -) - -type ( - // FieldJSONTag map the field name to the new JSON tag - FieldJSONTag map[string]string - - // StructJSONTag map the struct name to the field JSON tag - StructJSONTag map[string]FieldJSONTag -) - -// OverwriteJSONTags overwrite the given structs fields JSON tags from the given Go file -func OverwriteJSONTags(filePath string, structJSONTag *StructJSONTag) error { - // Check if the struct JSON tag is nil - if structJSONTag == nil { - return NilStructJSONTagError - } - - // Compile the regex pattern to match any content inside json tag - regex, err := regexp.Compile(`json:"[^"]*"`) - if err != nil { - return fmt.Errorf("failed to compile regex: %w", err) - } - - // Parse the Go file - fileSet, node, err := parser.ParseGoFile(filePath) - if err != nil { - return err - } - - // Traverse the AST to find the struct and field - err = parser.TraverseAST( - node, func(n ast.Node) bool { - // Check if the node is a type spec - ts, ok := n.(*ast.TypeSpec) - if !ok { - return true - } - - // Check if the node is a struct - st, ok := ts.Type.(*ast.StructType) - if !ok { - return true - } - - // Check if the struct name is in the map - fieldJSONTag, ok := (*structJSONTag)[ts.Name.Name] - if !ok { - return true - } - - // Iterate the struct fields - for _, field := range st.Fields.List { - for _, name := range field.Names { - // Check if the field name is in the map and get the new JSON tag - newJSONTag, ok := fieldJSONTag[name.Name] - if !ok { - continue - } - - // Print the struct and field name - // fmt.Printf("Struct: %s, Field: %s\n", ts.Name.Name, name.Name) - - // Modify the JSON tag - if field.Tag != nil { - tag := field.Tag.Value - - // Replace the matched content - newTag := regex.ReplaceAllString(tag, fmt.Sprintf(`json:"%s"`, newJSONTag)) - - field.Tag.Value = newTag - } else { - field.Tag = &ast.BasicLit{ - Kind: token.STRING, - Value: fmt.Sprintf("`json:\"%s\"`", newJSONTag), - } - } - - // Remove the field from the map - delete(fieldJSONTag, name.Name) - } - } - - // Check if the struct has fields to update - numFields := len(fieldJSONTag) - if numFields == 0 { - delete(*structJSONTag, ts.Name.Name) - return false - } - return true - }, - ) - if err != nil { - return err - } - - // Check if all structs have been updated - if len(*structJSONTag) > 0 { - // Print the structs fields that haven't been updated - fmt.Println("The following structs fields haven't been updated:") - for structName := range *structJSONTag { - for fieldName := range (*structJSONTag)[structName] { - fmt.Printf("Struct: %s, Field: %s\n", structName, fieldName) - } - } - - return fmt.Errorf("failed to update all structs") - } - - // Write the modified AST back to the file - if err := parser.WriteGoFile(filePath, fileSet, node); err != nil { - return err - } - - return nil -} diff --git a/utils/parser/tags/types.go b/utils/parser/tags/types.go deleted file mode 100644 index e57f191..0000000 --- a/utils/parser/tags/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package tags - -type ( - // StructFields map the struct name to the fields name - StructFields map[string][]string - - // GoFileStructFields map the Go file path to the struct fields - GoFileStructFields map[string]*StructFields -) diff --git a/utils/parser/traverse.go b/utils/parser/traverse.go deleted file mode 100644 index 860a972..0000000 --- a/utils/parser/traverse.go +++ /dev/null @@ -1,19 +0,0 @@ -package parser - -import ( - "go/ast" -) - -// TraverseAST traverse the given AST node and call the given function for each node -func TraverseAST(node *ast.File, fn func(ast.Node) bool) error { - // Check if the node is nil - if node == nil { - return NilFileSetError - } - - // Traverse the AST to find the struct and field - ast.Inspect( - node, fn, - ) - return nil -} diff --git a/utils/path/path.go b/utils/path/path.go deleted file mode 100644 index 9108510..0000000 --- a/utils/path/path.go +++ /dev/null @@ -1,10 +0,0 @@ -package path - -import ( - "strings" -) - -// GetProtoGoPath returns path of the compiled protobuf file in Go -func GetProtoGoPath(protoPackage, protoService string) string { - return strings.Join([]string{"protobuf/compiled", protoPackage, protoService, protoService + ".pb.go"}, "/") -} diff --git a/utils/strings/to-lowercase.go b/utils/strings/to-lowercase.go deleted file mode 100644 index 29f82f5..0000000 --- a/utils/strings/to-lowercase.go +++ /dev/null @@ -1,24 +0,0 @@ -package strings - -import ( - "strings" - "unicode" -) - -// ToSnakeCase convert string to lower case -func ToSnakeCase(s string) string { - var result string - - for _, char := range s { - if unicode.IsUpper(char) { - if len(result) > 0 { - result += "_" - } - result += strings.ToLower(string(char)) - } else { - result += string(char) - } - } - - return result -}