From 5a22695d12b9f68bc223fb71dd30ac25fc9e3670 Mon Sep 17 00:00:00 2001 From: dinosoeren Date: Fri, 27 Feb 2026 18:17:03 -0700 Subject: [PATCH] refactor: move services into egress for clarity --- docs/config/swagger-merger-config.json | 14 +++++++------- gen.sh | 8 ++++---- server/{ => egress}/server.proto | 4 ++-- server/{ => egress}/shop/catalog/v1/enums.proto | 4 ++-- server/{ => egress}/shop/catalog/v1/service.proto | 12 ++++++------ server/{ => egress}/shop/purchase/v1/enums.proto | 4 ++-- server/{ => egress}/shop/purchase/v1/service.proto | 14 +++++++------- server/{ => egress}/shop/user/v1/service.proto | 8 ++++---- server/{ => egress}/shop/v1/enums.proto | 4 ++-- 9 files changed, 36 insertions(+), 36 deletions(-) rename server/{ => egress}/server.proto (96%) rename server/{ => egress}/shop/catalog/v1/enums.proto (98%) rename server/{ => egress}/shop/catalog/v1/service.proto (99%) rename server/{ => egress}/shop/purchase/v1/enums.proto (97%) rename server/{ => egress}/shop/purchase/v1/service.proto (96%) rename server/{ => egress}/shop/user/v1/service.proto (91%) rename server/{ => egress}/shop/v1/enums.proto (88%) diff --git a/docs/config/swagger-merger-config.json b/docs/config/swagger-merger-config.json index a7b8c2b..9630678 100644 --- a/docs/config/swagger-merger-config.json +++ b/docs/config/swagger-merger-config.json @@ -28,16 +28,16 @@ } ], "paths": { - "$ref": "../../gen/openapiv2/server/shop/catalog/v1/service.swagger.json#paths", - "$ref": "../../gen/openapiv2/server/shop/user/v1/service.swagger.json#paths", - "$ref": "../../gen/openapiv2/server/shop/purchase/v1/service.swagger.json#paths" + "$ref": "../../gen/openapiv2/server/egress/shop/catalog/v1/service.swagger.json#paths", + "$ref": "../../gen/openapiv2/server/egress/shop/user/v1/service.swagger.json#paths", + "$ref": "../../gen/openapiv2/server/egress/shop/purchase/v1/service.swagger.json#paths" }, "definitions": { - "$ref": "../../gen/openapiv2/server/shop/catalog/v1/service.swagger.json#definitions", - "$ref": "../../gen/openapiv2/server/shop/user/v1/service.swagger.json#definitions", - "$ref": "../../gen/openapiv2/server/shop/purchase/v1/service.swagger.json#definitions" + "$ref": "../../gen/openapiv2/server/egress/shop/catalog/v1/service.swagger.json#definitions", + "$ref": "../../gen/openapiv2/server/egress/shop/user/v1/service.swagger.json#definitions", + "$ref": "../../gen/openapiv2/server/egress/shop/purchase/v1/service.swagger.json#definitions" }, "securityDefinitions": { - "$ref": "../../gen/openapiv2/server/server.swagger.json#securityDefinitions" + "$ref": "../../gen/openapiv2/server/egress/server.swagger.json#securityDefinitions" } } diff --git a/gen.sh b/gen.sh index 8a5df67..648e56f 100755 --- a/gen.sh +++ b/gen.sh @@ -26,10 +26,10 @@ buf generate # Generate TypeScript clients from OpenAPI specs echo "Generating TypeScript clients..." -mkdir -p gen/typescript/server/shop/catalog gen/typescript/server/shop/user gen/typescript/server/shop/purchase -npx --yes swagger-typescript-api@9.3.1 -p ./gen/openapiv2/server/shop/catalog/v1/service.swagger.json -o ./gen/typescript/server/shop/catalog/ -n catalog-client.ts --route-types --module-name-index=1 --no-client -npx swagger-typescript-api@9.3.1 -p ./gen/openapiv2/server/shop/user/v1/service.swagger.json -o ./gen/typescript/server/shop/user/ -n user-client.ts --route-types --module-name-index=1 --no-client -npx swagger-typescript-api@9.3.1 -p ./gen/openapiv2/server/shop/purchase/v1/service.swagger.json -o ./gen/typescript/server/shop/purchase/ -n purchase-client.ts --route-types --module-name-index=1 --no-client +mkdir -p gen/typescript/server/egress/shop/catalog gen/typescript/server/egress/shop/user gen/typescript/server/egress/shop/purchase +npx --yes swagger-typescript-api@9.3.1 -p ./gen/openapiv2/server/egress/shop/catalog/v1/service.swagger.json -o ./gen/typescript/server/egress/shop/catalog/ -n catalog-client.ts --route-types --module-name-index=1 --no-client +npx swagger-typescript-api@9.3.1 -p ./gen/openapiv2/server/egress/shop/user/v1/service.swagger.json -o ./gen/typescript/server/egress/shop/user/ -n user-client.ts --route-types --module-name-index=1 --no-client +npx swagger-typescript-api@9.3.1 -p ./gen/openapiv2/server/egress/shop/purchase/v1/service.swagger.json -o ./gen/typescript/server/egress/shop/purchase/ -n purchase-client.ts --route-types --module-name-index=1 --no-client # Merge all OpenAPI specs into a single swagger file echo "Merging Swagger files..." diff --git a/server/server.proto b/server/egress/server.proto similarity index 96% rename from server/server.proto rename to server/egress/server.proto index 0d42547..20f34ea 100644 --- a/server/server.proto +++ b/server/egress/server.proto @@ -1,11 +1,11 @@ syntax = "proto3"; // buf:lint:ignore PACKAGE_VERSION_SUFFIX -package server; +package server.egress; import "protoc-gen-openapiv2/options/annotations.proto"; -option go_package = "github.com/stashgg/public-api/gen/proto/server"; +option go_package = "github.com/stashgg/public-api/gen/proto/server/egress"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { info: { title: "Stash Web Shop API" diff --git a/server/shop/catalog/v1/enums.proto b/server/egress/shop/catalog/v1/enums.proto similarity index 98% rename from server/shop/catalog/v1/enums.proto rename to server/egress/shop/catalog/v1/enums.proto index 9a4cce6..86546ee 100644 --- a/server/shop/catalog/v1/enums.proto +++ b/server/egress/shop/catalog/v1/enums.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package server.shop.catalog.v1; +package server.egress.shop.catalog.v1; import "protoc-gen-openapiv2/options/annotations.proto"; -option go_package = "github.com/stashgg/public-api/gen/proto/server/shop/catalog/v1"; +option go_package = "github.com/stashgg/public-api/gen/proto/server/egress/shop/catalog/v1"; enum CatalogPlatform { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_enum) = {description: "Represents the platform of the user viewing the catalog"}; diff --git a/server/shop/catalog/v1/service.proto b/server/egress/shop/catalog/v1/service.proto similarity index 99% rename from server/shop/catalog/v1/service.proto rename to server/egress/shop/catalog/v1/service.proto index d5632b8..587a528 100644 --- a/server/shop/catalog/v1/service.proto +++ b/server/egress/shop/catalog/v1/service.proto @@ -1,16 +1,16 @@ syntax = "proto3"; -package server.shop.catalog.v1; +package server.egress.shop.catalog.v1; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; -import "server/shop/catalog/v1/enums.proto"; -import "server/shop/v1/enums.proto"; +import "server/egress/shop/catalog/v1/enums.proto"; +import "server/egress/shop/v1/enums.proto"; import "validate/validate.proto"; -option go_package = "github.com/stashgg/public-api/gen/proto/server/shop/catalog/v1"; +option go_package = "github.com/stashgg/public-api/gen/proto/server/egress/shop/catalog/v1"; service CatalogService { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = { @@ -100,7 +100,7 @@ message GetCatalogRequest { }, (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Optional player ID filter to get player-specific catalog items"} ]; - server.shop.v1.PaymentEnvironment environment = 5 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; + server.egress.shop.v1.PaymentEnvironment environment = 5 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; } message GetCatalogResponse { @@ -708,7 +708,7 @@ message GetOfferDetailsRequest { }, (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Optional player ID filter to get player-specific catalog items"} ]; - server.shop.v1.PaymentEnvironment environment = 7 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; + server.egress.shop.v1.PaymentEnvironment environment = 7 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; } message GetOfferDetailsResponse { diff --git a/server/shop/purchase/v1/enums.proto b/server/egress/shop/purchase/v1/enums.proto similarity index 97% rename from server/shop/purchase/v1/enums.proto rename to server/egress/shop/purchase/v1/enums.proto index 596caf6..bc0a9fb 100644 --- a/server/shop/purchase/v1/enums.proto +++ b/server/egress/shop/purchase/v1/enums.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package server.shop.purchase.v1; +package server.egress.shop.purchase.v1; import "protoc-gen-openapiv2/options/annotations.proto"; -option go_package = "github.com/stashgg/public-api/gen/proto/server/shop/purchase/v1"; +option go_package = "github.com/stashgg/public-api/gen/proto/server/egress/shop/purchase/v1"; enum PurchaseRegistrationStatus { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_enum) = {description: "Represents the status of a purchase registration"}; diff --git a/server/shop/purchase/v1/service.proto b/server/egress/shop/purchase/v1/service.proto similarity index 96% rename from server/shop/purchase/v1/service.proto rename to server/egress/shop/purchase/v1/service.proto index ae347b1..79dde21 100644 --- a/server/shop/purchase/v1/service.proto +++ b/server/egress/shop/purchase/v1/service.proto @@ -1,15 +1,15 @@ syntax = "proto3"; -package server.shop.purchase.v1; +package server.egress.shop.purchase.v1; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; -import "server/shop/purchase/v1/enums.proto"; -import "server/shop/v1/enums.proto"; +import "server/egress/shop/purchase/v1/enums.proto"; +import "server/egress/shop/v1/enums.proto"; import "validate/validate.proto"; -option go_package = "github.com/stashgg/public-api/gen/proto/server/shop/purchase/v1"; +option go_package = "github.com/stashgg/public-api/gen/proto/server/egress/shop/purchase/v1"; service PurchaseService { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = { @@ -89,7 +89,7 @@ message RegisterPaymentRequest { (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Unique transaction identifier for this purchase session"} ]; optional string checkout_link_id = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Optional checkout link identifier if purchase was made through a checkout link"}]; - server.shop.v1.PaymentEnvironment environment = 12 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; + server.egress.shop.v1.PaymentEnvironment environment = 12 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; string currency = 4 [ (google.api.field_behavior) = REQUIRED, @@ -221,7 +221,7 @@ message CancelPaymentRequest { (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Transaction identifier to cancel"} ]; optional string checkout_link_id = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Optional checkout link identifier if purchase was made through a checkout link"}]; - server.shop.v1.PaymentEnvironment environment = 5 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; + server.egress.shop.v1.PaymentEnvironment environment = 5 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; message CanceledItem { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { @@ -303,7 +303,7 @@ message ConfirmPaymentRequest { (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Transaction identifier to confirm"} ]; optional string checkout_link_id = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Optional checkout link identifier if purchase was made through a checkout link"}]; - server.shop.v1.PaymentEnvironment environment = 21 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; + server.egress.shop.v1.PaymentEnvironment environment = 21 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; string currency = 4 [ (google.api.field_behavior) = REQUIRED, diff --git a/server/shop/user/v1/service.proto b/server/egress/shop/user/v1/service.proto similarity index 91% rename from server/shop/user/v1/service.proto rename to server/egress/shop/user/v1/service.proto index f991f6a..05e88aa 100644 --- a/server/shop/user/v1/service.proto +++ b/server/egress/shop/user/v1/service.proto @@ -1,14 +1,14 @@ syntax = "proto3"; -package server.shop.user.v1; +package server.egress.shop.user.v1; import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; -import "server/shop/v1/enums.proto"; +import "server/egress/shop/v1/enums.proto"; import "validate/validate.proto"; -option go_package = "github.com/stashgg/public-api/gen/proto/server/shop/user/v1"; +option go_package = "github.com/stashgg/public-api/gen/proto/server/egress/shop/user/v1"; service UserService { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_tag) = { @@ -42,7 +42,7 @@ message GetPlayerRequest { (validate.rules).string.min_len = 1, (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "The player ID to retrieve"} ]; - server.shop.v1.PaymentEnvironment environment = 2 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; + server.egress.shop.v1.PaymentEnvironment environment = 2 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "Payment environment for the request"}]; } message GetPlayerResponse { diff --git a/server/shop/v1/enums.proto b/server/egress/shop/v1/enums.proto similarity index 88% rename from server/shop/v1/enums.proto rename to server/egress/shop/v1/enums.proto index 95cbd03..2aa44a0 100644 --- a/server/shop/v1/enums.proto +++ b/server/egress/shop/v1/enums.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package server.shop.v1; +package server.egress.shop.v1; import "protoc-gen-openapiv2/options/annotations.proto"; -option go_package = "github.com/stashgg/public-api/gen/proto/server/shop/v1"; +option go_package = "github.com/stashgg/public-api/gen/proto/server/egress/shop/v1"; enum PaymentEnvironment { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_enum) = {description: "Represents the payment environment for the request"};