@shophost/rest-api 2.0.29 → 2.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +18 -13
- package/scripts/minify.mjs +110 -0
- package/src/app.js +1 -53
- package/src/core/auth/auth.schema.js +1 -41
- package/src/core/auth/auth.util.js +1 -44
- package/src/core/auth/better-auth.lib.js +1 -100
- package/src/core/auth/generate-password-hash.util.d.ts +0 -3
- package/src/core/auth/generate-password-hash.util.js +1 -30
- package/src/core/auth/headers.schema.js +1 -22
- package/src/core/auth/user.schema.js +1 -30
- package/src/core/db/__generated__/client/browser.d.ts +0 -128
- package/src/core/db/__generated__/client/browser.js +1 -18
- package/src/core/db/__generated__/client/client.d.ts +0 -143
- package/src/core/db/__generated__/client/client.js +1 -35
- package/src/core/db/__generated__/client/commonInputTypes.js +1 -11
- package/src/core/db/__generated__/client/enums.js +1 -200
- package/src/core/db/__generated__/client/internal/class.d.ts +0 -343
- package/src/core/db/__generated__/client/internal/class.js +1 -55
- package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +0 -234
- package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -541
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.d.ts +0 -15
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -512
- package/src/core/db/__generated__/client/models/Account.d.ts +0 -628
- package/src/core/db/__generated__/client/models/Account.js +1 -2
- package/src/core/db/__generated__/client/models/Address.d.ts +0 -701
- package/src/core/db/__generated__/client/models/Address.js +1 -2
- package/src/core/db/__generated__/client/models/Campaign.d.ts +0 -638
- package/src/core/db/__generated__/client/models/Campaign.js +1 -2
- package/src/core/db/__generated__/client/models/ClosingTimes.d.ts +0 -634
- package/src/core/db/__generated__/client/models/ClosingTimes.js +1 -2
- package/src/core/db/__generated__/client/models/File.d.ts +0 -752
- package/src/core/db/__generated__/client/models/File.js +1 -2
- package/src/core/db/__generated__/client/models/Invitation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/Invitation.js +1 -2
- package/src/core/db/__generated__/client/models/LegalEntity.d.ts +0 -652
- package/src/core/db/__generated__/client/models/LegalEntity.js +1 -2
- package/src/core/db/__generated__/client/models/Manufacturer.d.ts +0 -679
- package/src/core/db/__generated__/client/models/Manufacturer.js +1 -2
- package/src/core/db/__generated__/client/models/ManufacturerTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/ManufacturerTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/Member.d.ts +0 -628
- package/src/core/db/__generated__/client/models/Member.js +1 -2
- package/src/core/db/__generated__/client/models/Modifier.d.ts +0 -662
- package/src/core/db/__generated__/client/models/Modifier.js +1 -2
- package/src/core/db/__generated__/client/models/ModifierGroup.d.ts +0 -686
- package/src/core/db/__generated__/client/models/ModifierGroup.js +1 -2
- package/src/core/db/__generated__/client/models/ModifierGroupTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/OpeningTimes.d.ts +0 -634
- package/src/core/db/__generated__/client/models/OpeningTimes.js +1 -2
- package/src/core/db/__generated__/client/models/Order.d.ts +0 -700
- package/src/core/db/__generated__/client/models/Order.js +1 -2
- package/src/core/db/__generated__/client/models/OrderItem.d.ts +0 -686
- package/src/core/db/__generated__/client/models/OrderItem.js +1 -2
- package/src/core/db/__generated__/client/models/OrderItemTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/OrderItemTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/Organization.d.ts +0 -811
- package/src/core/db/__generated__/client/models/Organization.js +1 -2
- package/src/core/db/__generated__/client/models/OrganizationConfiguration.d.ts +0 -676
- package/src/core/db/__generated__/client/models/OrganizationConfiguration.js +1 -2
- package/src/core/db/__generated__/client/models/Payment.d.ts +0 -668
- package/src/core/db/__generated__/client/models/Payment.js +1 -2
- package/src/core/db/__generated__/client/models/PaymentSession.d.ts +0 -638
- package/src/core/db/__generated__/client/models/PaymentSession.js +1 -2
- package/src/core/db/__generated__/client/models/Product.d.ts +0 -746
- package/src/core/db/__generated__/client/models/Product.js +1 -2
- package/src/core/db/__generated__/client/models/ProductCategory.d.ts +0 -689
- package/src/core/db/__generated__/client/models/ProductCategory.js +1 -2
- package/src/core/db/__generated__/client/models/ProductCategoryTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/ProductSnapshot.d.ts +0 -664
- package/src/core/db/__generated__/client/models/ProductSnapshot.js +1 -2
- package/src/core/db/__generated__/client/models/ProductTranslation.d.ts +0 -628
- package/src/core/db/__generated__/client/models/ProductTranslation.js +1 -2
- package/src/core/db/__generated__/client/models/Reservation.d.ts +0 -650
- package/src/core/db/__generated__/client/models/Reservation.js +1 -2
- package/src/core/db/__generated__/client/models/Session.d.ts +0 -628
- package/src/core/db/__generated__/client/models/Session.js +1 -2
- package/src/core/db/__generated__/client/models/ShippingMethod.d.ts +0 -679
- package/src/core/db/__generated__/client/models/ShippingMethod.js +1 -2
- package/src/core/db/__generated__/client/models/ShippingZone.d.ts +0 -638
- package/src/core/db/__generated__/client/models/ShippingZone.js +1 -2
- package/src/core/db/__generated__/client/models/User.d.ts +0 -736
- package/src/core/db/__generated__/client/models/User.js +1 -2
- package/src/core/db/__generated__/client/models/Verification.d.ts +0 -592
- package/src/core/db/__generated__/client/models/Verification.js +1 -2
- package/src/core/db/__generated__/client/models.js +1 -2
- package/src/core/db/index.js +1 -2
- package/src/core/exceptions/http-exception.js +1 -9
- package/src/core/hono/hono.js +1 -123
- package/src/core/lib/prisma.d.ts +9 -1
- package/src/core/lib/prisma.js +1 -11
- package/src/core/logging/pino.js +1 -5
- package/src/core/notifications/email.service.d.ts +0 -15
- package/src/core/notifications/email.service.js +1 -116
- package/src/core/openapi/openapi.lib.js +1 -26
- package/src/core/types/google-maps.types.js +1 -2
- package/src/core/utils/currency.util.js +1 -11
- package/src/core/utils/env.util.js +1 -8
- package/src/core/utils/object.util.d.ts +0 -10
- package/src/core/utils/object.util.js +1 -39
- package/src/core/utils/translations.util.js +0 -2
- package/src/core/utils/zod.util.d.ts +0 -12
- package/src/core/utils/zod.util.js +1 -85
- package/src/db.js +1 -3
- package/src/features/access/access.handler.js +1 -91
- package/src/features/access/access.route.js +1 -220
- package/src/features/access/access.schema.js +1 -108
- package/src/features/access/access.service.js +1 -294
- package/src/features/cart/cart.handler.js +1 -17
- package/src/features/cart/cart.route.js +1 -32
- package/src/features/cart/cart.schema.js +1 -39
- package/src/features/cart/cart.service.d.ts +0 -7
- package/src/features/cart/cart.service.js +1 -97
- package/src/features/cart/cart.util.js +1 -76
- package/src/features/file/file.handler.js +1 -23
- package/src/features/file/file.route.js +1 -34
- package/src/features/file/file.schema.js +1 -77
- package/src/features/file/file.service.d.ts +0 -6
- package/src/features/file/file.service.js +1 -66
- package/src/features/health/health.handler.js +1 -10
- package/src/features/health/health.route.js +1 -25
- package/src/features/index.js +1 -16
- package/src/features/location/location.handler.js +1 -25
- package/src/features/location/location.route.js +1 -56
- package/src/features/location/location.schema.js +1 -50
- package/src/features/location/location.service.d.ts +0 -3
- package/src/features/location/location.service.js +1 -141
- package/src/features/manufacturer/manufacturer.handler.js +1 -53
- package/src/features/manufacturer/manufacturer.route.js +1 -97
- package/src/features/manufacturer/manufacturer.schema.js +1 -125
- package/src/features/manufacturer/manufacturer.service.d.ts +0 -19
- package/src/features/manufacturer/manufacturer.service.js +1 -190
- package/src/features/order/emails/order-confirmation.email.js +1 -229
- package/src/features/order/emails/order-notification.email.js +1 -229
- package/src/features/order/fulfilment.schema.js +1 -3
- package/src/features/order/order.handler.js +1 -54
- package/src/features/order/order.route.js +1 -111
- package/src/features/order/order.schema.js +1 -158
- package/src/features/order/order.service.d.ts +0 -15
- package/src/features/order/order.service.js +1 -306
- package/src/features/order/recipient.schema.js +1 -38
- package/src/features/organization/legal-entity.schema.js +1 -83
- package/src/features/organization/organization-configuration.schema.js +1 -115
- package/src/features/organization/organization.handler.js +1 -48
- package/src/features/organization/organization.route.js +1 -84
- package/src/features/organization/organization.schema.js +1 -64
- package/src/features/organization/organization.service.d.ts +0 -15
- package/src/features/organization/organization.service.js +1 -334
- package/src/features/payment/payment.handler.js +1 -16
- package/src/features/payment/payment.route.js +1 -22
- package/src/features/payment/payment.schema.js +1 -46
- package/src/features/payment/payment.service.js +1 -100
- package/src/features/payment/stripe.service.js +1 -164
- package/src/features/product/product-modifier.schema.js +1 -84
- package/src/features/product/product.handler.js +1 -87
- package/src/features/product/product.route.js +1 -179
- package/src/features/product/product.schema.js +1 -143
- package/src/features/product/product.service.d.ts +0 -25
- package/src/features/product/product.service.js +1 -440
- package/src/features/product-category/product-category.handler.js +1 -59
- package/src/features/product-category/product-category.route.js +1 -139
- package/src/features/product-category/product-category.schema.js +1 -86
- package/src/features/product-category/product-category.service.d.ts +0 -22
- package/src/features/product-category/product-category.service.js +1 -220
- package/src/features/reservation/emails/reservation-cancellation.email.js +1 -82
- package/src/features/reservation/emails/reservation-confirmation.email.js +1 -82
- package/src/features/reservation/emails/reservation-notification.email.js +1 -93
- package/src/features/reservation/reservation.handler.js +1 -65
- package/src/features/reservation/reservation.route.js +1 -167
- package/src/features/reservation/reservation.schema.js +1 -51
- package/src/features/reservation/reservation.service.d.ts +0 -18
- package/src/features/reservation/reservation.service.js +1 -231
- package/src/features/shipping/shipping.handler.js +1 -32
- package/src/features/shipping/shipping.route.js +1 -51
- package/src/features/shipping/shipping.service.d.ts +0 -7
- package/src/features/shipping/shipping.service.js +1 -96
- package/src/features/shipping-method/shipping-method.handler.js +1 -60
- package/src/features/shipping-method/shipping-method.route.js +1 -144
- package/src/features/shipping-method/shipping-method.schema.js +1 -48
- package/src/features/shipping-method/shipping-method.service.d.ts +0 -25
- package/src/features/shipping-method/shipping-method.service.js +1 -229
- package/src/features/shipping-method/shipping-zone.schema.js +1 -31
- package/src/features/webhook/webhook.handler.js +1 -50
- package/src/features/webhook/webhook.route.js +1 -33
- package/src/index.js +1 -6
- package/src/integrations/next.js +1 -82
- package/src/schemas/address.schema.d.ts +0 -8
- package/src/schemas/address.schema.js +1 -112
- package/src/schemas/currency.schema.d.ts +0 -42
- package/src/schemas/currency.schema.js +1 -118
- package/src/schemas/error.schema.js +1 -12
- package/src/schemas/index.js +1 -29
- package/src/schemas/locales.schema.js +1 -238
- package/src/schemas/number.schema.js +1 -29
- package/src/schemas/pagination.schema.js +1 -54
- package/src/schemas/params.schema.js +1 -20
- package/src/schemas/queries.schema.js +1 -6
- package/src/test/global-setup.d.ts +1 -0
- package/src/test/global-setup.js +1 -0
- package/src/test/integration/api-fixtures.d.ts +4 -16
- package/src/test/integration/api-fixtures.js +1 -225
- package/src/test/integration/seed.d.ts +81 -0
- package/src/test/integration/seed.js +1 -0
- package/src/test/integration/test-helpers.d.ts +107 -924
- package/src/test/integration/test-helpers.js +1 -1100
- package/src/test/setup-test-env.d.ts +1 -1
- package/src/test/setup-test-env.js +1 -29
- package/src/app.js.map +0 -1
- package/src/core/auth/auth.schema.js.map +0 -1
- package/src/core/auth/auth.util.js.map +0 -1
- package/src/core/auth/better-auth.lib.js.map +0 -1
- package/src/core/auth/generate-password-hash.util.js.map +0 -1
- package/src/core/auth/headers.schema.js.map +0 -1
- package/src/core/auth/user.schema.js.map +0 -1
- package/src/core/db/__generated__/client/browser.js.map +0 -1
- package/src/core/db/__generated__/client/client.js.map +0 -1
- package/src/core/db/__generated__/client/commonInputTypes.js.map +0 -1
- package/src/core/db/__generated__/client/enums.js.map +0 -1
- package/src/core/db/__generated__/client/internal/class.js.map +0 -1
- package/src/core/db/__generated__/client/internal/prismaNamespace.js.map +0 -1
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js.map +0 -1
- package/src/core/db/__generated__/client/models/Account.js.map +0 -1
- package/src/core/db/__generated__/client/models/Address.js.map +0 -1
- package/src/core/db/__generated__/client/models/Campaign.js.map +0 -1
- package/src/core/db/__generated__/client/models/ClosingTimes.js.map +0 -1
- package/src/core/db/__generated__/client/models/File.js.map +0 -1
- package/src/core/db/__generated__/client/models/Invitation.js.map +0 -1
- package/src/core/db/__generated__/client/models/LegalEntity.js.map +0 -1
- package/src/core/db/__generated__/client/models/Manufacturer.js.map +0 -1
- package/src/core/db/__generated__/client/models/ManufacturerTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/Member.js.map +0 -1
- package/src/core/db/__generated__/client/models/Modifier.js.map +0 -1
- package/src/core/db/__generated__/client/models/ModifierGroup.js.map +0 -1
- package/src/core/db/__generated__/client/models/ModifierGroupTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/OpeningTimes.js.map +0 -1
- package/src/core/db/__generated__/client/models/Order.js.map +0 -1
- package/src/core/db/__generated__/client/models/OrderItem.js.map +0 -1
- package/src/core/db/__generated__/client/models/OrderItemTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/Organization.js.map +0 -1
- package/src/core/db/__generated__/client/models/OrganizationConfiguration.js.map +0 -1
- package/src/core/db/__generated__/client/models/Payment.js.map +0 -1
- package/src/core/db/__generated__/client/models/PaymentSession.js.map +0 -1
- package/src/core/db/__generated__/client/models/Product.js.map +0 -1
- package/src/core/db/__generated__/client/models/ProductCategory.js.map +0 -1
- package/src/core/db/__generated__/client/models/ProductCategoryTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/ProductSnapshot.js.map +0 -1
- package/src/core/db/__generated__/client/models/ProductTranslation.js.map +0 -1
- package/src/core/db/__generated__/client/models/Reservation.js.map +0 -1
- package/src/core/db/__generated__/client/models/Session.js.map +0 -1
- package/src/core/db/__generated__/client/models/ShippingMethod.js.map +0 -1
- package/src/core/db/__generated__/client/models/ShippingZone.js.map +0 -1
- package/src/core/db/__generated__/client/models/User.js.map +0 -1
- package/src/core/db/__generated__/client/models/Verification.js.map +0 -1
- package/src/core/db/__generated__/client/models.js.map +0 -1
- package/src/core/db/index.js.map +0 -1
- package/src/core/exceptions/http-exception.js.map +0 -1
- package/src/core/hono/hono.js.map +0 -1
- package/src/core/lib/prisma.js.map +0 -1
- package/src/core/logging/pino.js.map +0 -1
- package/src/core/notifications/email.service.js.map +0 -1
- package/src/core/openapi/openapi.lib.js.map +0 -1
- package/src/core/types/google-maps.types.js.map +0 -1
- package/src/core/utils/currency.util.js.map +0 -1
- package/src/core/utils/env.util.js.map +0 -1
- package/src/core/utils/object.util.js.map +0 -1
- package/src/core/utils/translations.util.js.map +0 -1
- package/src/core/utils/zod.util.js.map +0 -1
- package/src/db.js.map +0 -1
- package/src/features/access/access.handler.js.map +0 -1
- package/src/features/access/access.route.js.map +0 -1
- package/src/features/access/access.schema.js.map +0 -1
- package/src/features/access/access.service.js.map +0 -1
- package/src/features/cart/cart.handler.js.map +0 -1
- package/src/features/cart/cart.route.js.map +0 -1
- package/src/features/cart/cart.schema.js.map +0 -1
- package/src/features/cart/cart.service.js.map +0 -1
- package/src/features/cart/cart.util.js.map +0 -1
- package/src/features/file/file.handler.js.map +0 -1
- package/src/features/file/file.route.js.map +0 -1
- package/src/features/file/file.schema.js.map +0 -1
- package/src/features/file/file.service.js.map +0 -1
- package/src/features/health/health.handler.js.map +0 -1
- package/src/features/health/health.route.js.map +0 -1
- package/src/features/index.js.map +0 -1
- package/src/features/location/location.handler.js.map +0 -1
- package/src/features/location/location.route.js.map +0 -1
- package/src/features/location/location.schema.js.map +0 -1
- package/src/features/location/location.service.js.map +0 -1
- package/src/features/manufacturer/manufacturer.handler.js.map +0 -1
- package/src/features/manufacturer/manufacturer.route.js.map +0 -1
- package/src/features/manufacturer/manufacturer.schema.js.map +0 -1
- package/src/features/manufacturer/manufacturer.service.js.map +0 -1
- package/src/features/order/emails/order-confirmation.email.js.map +0 -1
- package/src/features/order/emails/order-notification.email.js.map +0 -1
- package/src/features/order/fulfilment.schema.js.map +0 -1
- package/src/features/order/order.handler.js.map +0 -1
- package/src/features/order/order.route.js.map +0 -1
- package/src/features/order/order.schema.js.map +0 -1
- package/src/features/order/order.service.js.map +0 -1
- package/src/features/order/recipient.schema.js.map +0 -1
- package/src/features/organization/legal-entity.schema.js.map +0 -1
- package/src/features/organization/organization-configuration.schema.js.map +0 -1
- package/src/features/organization/organization.handler.js.map +0 -1
- package/src/features/organization/organization.route.js.map +0 -1
- package/src/features/organization/organization.schema.js.map +0 -1
- package/src/features/organization/organization.service.js.map +0 -1
- package/src/features/payment/payment.handler.js.map +0 -1
- package/src/features/payment/payment.route.js.map +0 -1
- package/src/features/payment/payment.schema.js.map +0 -1
- package/src/features/payment/payment.service.js.map +0 -1
- package/src/features/payment/stripe.service.js.map +0 -1
- package/src/features/product/product-modifier.schema.js.map +0 -1
- package/src/features/product/product.handler.js.map +0 -1
- package/src/features/product/product.route.js.map +0 -1
- package/src/features/product/product.schema.js.map +0 -1
- package/src/features/product/product.service.js.map +0 -1
- package/src/features/product-category/product-category.handler.js.map +0 -1
- package/src/features/product-category/product-category.route.js.map +0 -1
- package/src/features/product-category/product-category.schema.js.map +0 -1
- package/src/features/product-category/product-category.service.js.map +0 -1
- package/src/features/reservation/emails/reservation-cancellation.email.js.map +0 -1
- package/src/features/reservation/emails/reservation-confirmation.email.js.map +0 -1
- package/src/features/reservation/emails/reservation-notification.email.js.map +0 -1
- package/src/features/reservation/reservation.handler.js.map +0 -1
- package/src/features/reservation/reservation.route.js.map +0 -1
- package/src/features/reservation/reservation.schema.js.map +0 -1
- package/src/features/reservation/reservation.service.js.map +0 -1
- package/src/features/shipping/shipping.handler.js.map +0 -1
- package/src/features/shipping/shipping.route.js.map +0 -1
- package/src/features/shipping/shipping.service.js.map +0 -1
- package/src/features/shipping-method/shipping-method.handler.js.map +0 -1
- package/src/features/shipping-method/shipping-method.route.js.map +0 -1
- package/src/features/shipping-method/shipping-method.schema.js.map +0 -1
- package/src/features/shipping-method/shipping-method.service.js.map +0 -1
- package/src/features/shipping-method/shipping-zone.schema.js.map +0 -1
- package/src/features/webhook/webhook.handler.js.map +0 -1
- package/src/features/webhook/webhook.route.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/integrations/next.js.map +0 -1
- package/src/schemas/address.schema.js.map +0 -1
- package/src/schemas/currency.schema.js.map +0 -1
- package/src/schemas/error.schema.js.map +0 -1
- package/src/schemas/index.js.map +0 -1
- package/src/schemas/locales.schema.js.map +0 -1
- package/src/schemas/number.schema.js.map +0 -1
- package/src/schemas/pagination.schema.js.map +0 -1
- package/src/schemas/params.schema.js.map +0 -1
- package/src/schemas/queries.schema.js.map +0 -1
- package/src/test/integration/api-fixtures.js.map +0 -1
- package/src/test/integration/test-helpers.js.map +0 -1
- package/src/test/setup-test-env.js.map +0 -1
|
@@ -1,83 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AddressSchema, CreateAddressSchema, UpdateAddressSchema, } from "../../schemas/address.schema";
|
|
3
|
-
export const LegalEntitySchema = z
|
|
4
|
-
.object({
|
|
5
|
-
id: z.string().openapi({
|
|
6
|
-
example: "clm1234567890abcdef",
|
|
7
|
-
description: "The unique identifier of the legal entity",
|
|
8
|
-
}),
|
|
9
|
-
name: z.string().openapi({
|
|
10
|
-
example: "Acme Corporation",
|
|
11
|
-
description: "The name of the legal entity",
|
|
12
|
-
}),
|
|
13
|
-
taxId: z.string().min(2).max(20).openapi({
|
|
14
|
-
example: "PL1234567890",
|
|
15
|
-
description: "The TAX ID of the legal entity",
|
|
16
|
-
}),
|
|
17
|
-
email: z.string().email().nullable().openapi({
|
|
18
|
-
example: "contact@acme.com",
|
|
19
|
-
description: "The email of the legal entity",
|
|
20
|
-
format: "email",
|
|
21
|
-
}),
|
|
22
|
-
phone: z.string().nullable().openapi({
|
|
23
|
-
example: "+48123456789",
|
|
24
|
-
description: "The phone number of the legal entity",
|
|
25
|
-
}),
|
|
26
|
-
createdAt: z.date().openapi({
|
|
27
|
-
description: "The date and time when the legal entity was created",
|
|
28
|
-
format: "date-time",
|
|
29
|
-
}),
|
|
30
|
-
address: AddressSchema.required().openapi({
|
|
31
|
-
description: "The address of the legal entity",
|
|
32
|
-
}),
|
|
33
|
-
})
|
|
34
|
-
.openapi("LegalEntity");
|
|
35
|
-
export const CreateLegalEntitySchema = z
|
|
36
|
-
.object({
|
|
37
|
-
name: z.string().min(1, "Name is required").openapi({
|
|
38
|
-
example: "Acme Corporation",
|
|
39
|
-
description: "The name of the legal entity",
|
|
40
|
-
}),
|
|
41
|
-
taxId: z.string().min(2).max(20).openapi({
|
|
42
|
-
example: "PL1234567890",
|
|
43
|
-
description: "The TAX ID of the legal entity",
|
|
44
|
-
}),
|
|
45
|
-
email: z.string().email().optional().openapi({
|
|
46
|
-
example: "contact@acme.com",
|
|
47
|
-
description: "The email of the legal entity",
|
|
48
|
-
format: "email",
|
|
49
|
-
}),
|
|
50
|
-
phone: z.string().optional().openapi({
|
|
51
|
-
example: "+48123456789",
|
|
52
|
-
description: "The phone number of the legal entity",
|
|
53
|
-
}),
|
|
54
|
-
address: CreateAddressSchema.required().openapi({
|
|
55
|
-
description: "The address of the legal entity",
|
|
56
|
-
}),
|
|
57
|
-
})
|
|
58
|
-
.openapi("CreateLegalEntity");
|
|
59
|
-
export const UpdateLegalEntitySchema = z
|
|
60
|
-
.object({
|
|
61
|
-
name: z.string().min(1, "Name is required").optional().openapi({
|
|
62
|
-
example: "Acme Corporation",
|
|
63
|
-
description: "The name of the legal entity",
|
|
64
|
-
}),
|
|
65
|
-
taxId: z.string().min(2).max(20).openapi({
|
|
66
|
-
example: "PL1234567890",
|
|
67
|
-
description: "The TAX ID of the legal entity",
|
|
68
|
-
}),
|
|
69
|
-
email: z.string().email().optional().openapi({
|
|
70
|
-
example: "contact@acme.com",
|
|
71
|
-
description: "The email of the legal entity",
|
|
72
|
-
format: "email",
|
|
73
|
-
}),
|
|
74
|
-
phone: z.string().optional().openapi({
|
|
75
|
-
example: "+48123456789",
|
|
76
|
-
description: "The phone number of the legal entity",
|
|
77
|
-
}),
|
|
78
|
-
address: UpdateAddressSchema.required().openapi({
|
|
79
|
-
description: "The address of the legal entity",
|
|
80
|
-
}),
|
|
81
|
-
})
|
|
82
|
-
.openapi("UpdateLegalEntity");
|
|
83
|
-
//# sourceMappingURL=legal-entity.schema.js.map
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";import{AddressSchema as t,CreateAddressSchema as i,UpdateAddressSchema as a}from"../../schemas/address.schema";export const LegalEntitySchema=e.object({id:e.string().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the legal entity"}),name:e.string().openapi({example:"Acme Corporation",description:"The name of the legal entity"}),taxId:e.string().min(2).max(20).openapi({example:"PL1234567890",description:"The TAX ID of the legal entity"}),email:e.string().email().nullable().openapi({example:"contact@acme.com",description:"The email of the legal entity",format:"email"}),phone:e.string().nullable().openapi({example:"+48123456789",description:"The phone number of the legal entity"}),createdAt:e.date().openapi({description:"The date and time when the legal entity was created",format:"date-time"}),address:t.required().openapi({description:"The address of the legal entity"})}).openapi("LegalEntity");export const CreateLegalEntitySchema=e.object({name:e.string().min(1,"Name is required").openapi({example:"Acme Corporation",description:"The name of the legal entity"}),taxId:e.string().min(2).max(20).openapi({example:"PL1234567890",description:"The TAX ID of the legal entity"}),email:e.string().email().optional().openapi({example:"contact@acme.com",description:"The email of the legal entity",format:"email"}),phone:e.string().optional().openapi({example:"+48123456789",description:"The phone number of the legal entity"}),address:i.required().openapi({description:"The address of the legal entity"})}).openapi("CreateLegalEntity");export const UpdateLegalEntitySchema=e.object({name:e.string().min(1,"Name is required").optional().openapi({example:"Acme Corporation",description:"The name of the legal entity"}),taxId:e.string().min(2).max(20).openapi({example:"PL1234567890",description:"The TAX ID of the legal entity"}),email:e.string().email().optional().openapi({example:"contact@acme.com",description:"The email of the legal entity",format:"email"}),phone:e.string().optional().openapi({example:"+48123456789",description:"The phone number of the legal entity"}),address:a.required().openapi({description:"The address of the legal entity"})}).openapi("UpdateLegalEntity");
|
|
@@ -1,115 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { currency } from "../../schemas/currency.schema";
|
|
3
|
-
import { locale } from "../../schemas/locales.schema";
|
|
4
|
-
export const TimeScheduleSchema = z
|
|
5
|
-
.object({
|
|
6
|
-
monday: z.string().nullable().openapi({
|
|
7
|
-
example: "09:00",
|
|
8
|
-
description: "Opening time for Monday",
|
|
9
|
-
}),
|
|
10
|
-
tuesday: z.string().nullable().openapi({
|
|
11
|
-
example: "09:00",
|
|
12
|
-
description: "Opening time for Tuesday",
|
|
13
|
-
}),
|
|
14
|
-
wednesday: z.string().nullable().openapi({
|
|
15
|
-
example: "09:00",
|
|
16
|
-
description: "Opening time for Wednesday",
|
|
17
|
-
}),
|
|
18
|
-
thursday: z.string().nullable().openapi({
|
|
19
|
-
example: "09:00",
|
|
20
|
-
description: "Opening time for Thursday",
|
|
21
|
-
}),
|
|
22
|
-
friday: z.string().nullable().openapi({
|
|
23
|
-
example: "09:00",
|
|
24
|
-
description: "Opening time for Friday",
|
|
25
|
-
}),
|
|
26
|
-
saturday: z.string().nullable().openapi({
|
|
27
|
-
example: "09:00",
|
|
28
|
-
description: "Opening time for Saturday",
|
|
29
|
-
}),
|
|
30
|
-
sunday: z.string().nullable().openapi({
|
|
31
|
-
example: "09:00",
|
|
32
|
-
description: "Opening time for Sunday",
|
|
33
|
-
}),
|
|
34
|
-
})
|
|
35
|
-
.openapi("TimeSchedule");
|
|
36
|
-
export const OrganizationConfigurationSchema = z
|
|
37
|
-
.object({
|
|
38
|
-
id: z.string().openapi({
|
|
39
|
-
example: "clm1234567890abcdef",
|
|
40
|
-
description: "Unique identifier for the organization configuration",
|
|
41
|
-
}),
|
|
42
|
-
hostname: z.coerce.string().optional().openapi({
|
|
43
|
-
example: "store.example.com",
|
|
44
|
-
description: "Hostname associated with the organization",
|
|
45
|
-
}),
|
|
46
|
-
countriesShipping: z.array(z.string()).openapi({
|
|
47
|
-
example: ["US", "CA"],
|
|
48
|
-
description: "List of countries where shipping is available",
|
|
49
|
-
}),
|
|
50
|
-
stripeAccountId: z.coerce.string().optional().openapi({
|
|
51
|
-
example: "acct_123456789",
|
|
52
|
-
description: "Stripe account ID associated with the organization",
|
|
53
|
-
}),
|
|
54
|
-
enableHostCheckout: z.boolean().openapi({
|
|
55
|
-
example: true,
|
|
56
|
-
description: "Indicates if host checkout is enabled",
|
|
57
|
-
}),
|
|
58
|
-
enableHostTracking: z.boolean().openapi({
|
|
59
|
-
example: true,
|
|
60
|
-
description: "Indicates if host tracking is enabled",
|
|
61
|
-
}),
|
|
62
|
-
isAcceptingOrders: z.boolean().openapi({
|
|
63
|
-
example: true,
|
|
64
|
-
description: "Indicates if the organization is currently accepting orders",
|
|
65
|
-
}),
|
|
66
|
-
isOpen: z.boolean().default(false).openapi({
|
|
67
|
-
example: true,
|
|
68
|
-
description: "Indicates if the organization is currently open",
|
|
69
|
-
}),
|
|
70
|
-
defaultLocale: locale,
|
|
71
|
-
supportedLocales: z.array(locale).openapi({
|
|
72
|
-
description: "List of supported locales for the organization",
|
|
73
|
-
}),
|
|
74
|
-
openingTimes: TimeScheduleSchema.optional(),
|
|
75
|
-
closingTimes: TimeScheduleSchema.optional(),
|
|
76
|
-
facebookProfile: z.string().nullable().optional().openapi({
|
|
77
|
-
example: "https://www.facebook.com/example",
|
|
78
|
-
description: "Facebook profile URL for the organization",
|
|
79
|
-
}),
|
|
80
|
-
instagramProfile: z.string().nullable().optional().openapi({
|
|
81
|
-
example: "https://www.instagram.com/example",
|
|
82
|
-
description: "Instagram profile URL for the organization",
|
|
83
|
-
}),
|
|
84
|
-
xProfile: z.string().nullable().optional().openapi({
|
|
85
|
-
example: "https://www.x.com/example",
|
|
86
|
-
description: "X profile URL for the organization",
|
|
87
|
-
}),
|
|
88
|
-
defaultCurrency: currency.openapi({
|
|
89
|
-
example: "USD",
|
|
90
|
-
description: "Default currency for the organization",
|
|
91
|
-
}),
|
|
92
|
-
createdAt: z.date().openapi({
|
|
93
|
-
description: "Timestamp when the organization configuration was created",
|
|
94
|
-
}),
|
|
95
|
-
})
|
|
96
|
-
.openapi("OrganizationConfiguration");
|
|
97
|
-
export const UpdateOrganizationConfigurationSchema = OrganizationConfigurationSchema.pick({
|
|
98
|
-
hostname: true,
|
|
99
|
-
countriesShipping: true,
|
|
100
|
-
stripeAccountId: true,
|
|
101
|
-
enableHostCheckout: true,
|
|
102
|
-
enableHostTracking: true,
|
|
103
|
-
isAcceptingOrders: true,
|
|
104
|
-
defaultLocale: true,
|
|
105
|
-
supportedLocales: true,
|
|
106
|
-
defaultCurrency: true,
|
|
107
|
-
openingTimes: true,
|
|
108
|
-
closingTimes: true,
|
|
109
|
-
facebookProfile: true,
|
|
110
|
-
instagramProfile: true,
|
|
111
|
-
xProfile: true,
|
|
112
|
-
})
|
|
113
|
-
.partial()
|
|
114
|
-
.openapi("UpdateOrganizationConfiguration");
|
|
115
|
-
//# sourceMappingURL=organization-configuration.schema.js.map
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";import{currency as i}from"../../schemas/currency.schema";import{locale as o}from"../../schemas/locales.schema";export const TimeScheduleSchema=e.object({monday:e.string().nullable().openapi({example:"09:00",description:"Opening time for Monday"}),tuesday:e.string().nullable().openapi({example:"09:00",description:"Opening time for Tuesday"}),wednesday:e.string().nullable().openapi({example:"09:00",description:"Opening time for Wednesday"}),thursday:e.string().nullable().openapi({example:"09:00",description:"Opening time for Thursday"}),friday:e.string().nullable().openapi({example:"09:00",description:"Opening time for Friday"}),saturday:e.string().nullable().openapi({example:"09:00",description:"Opening time for Saturday"}),sunday:e.string().nullable().openapi({example:"09:00",description:"Opening time for Sunday"})}).openapi("TimeSchedule");export const OrganizationConfigurationSchema=e.object({id:e.string().openapi({example:"clm1234567890abcdef",description:"Unique identifier for the organization configuration"}),hostname:e.coerce.string().optional().openapi({example:"store.example.com",description:"Hostname associated with the organization"}),countriesShipping:e.array(e.string()).openapi({example:["US","CA"],description:"List of countries where shipping is available"}),stripeAccountId:e.coerce.string().optional().openapi({example:"acct_123456789",description:"Stripe account ID associated with the organization"}),enableHostCheckout:e.boolean().openapi({example:!0,description:"Indicates if host checkout is enabled"}),enableHostTracking:e.boolean().openapi({example:!0,description:"Indicates if host tracking is enabled"}),isAcceptingOrders:e.boolean().openapi({example:!0,description:"Indicates if the organization is currently accepting orders"}),isOpen:e.boolean().default(!1).openapi({example:!0,description:"Indicates if the organization is currently open"}),defaultLocale:o,supportedLocales:e.array(o).openapi({description:"List of supported locales for the organization"}),openingTimes:TimeScheduleSchema.optional(),closingTimes:TimeScheduleSchema.optional(),facebookProfile:e.string().nullable().optional().openapi({example:"https://www.facebook.com/example",description:"Facebook profile URL for the organization"}),instagramProfile:e.string().nullable().optional().openapi({example:"https://www.instagram.com/example",description:"Instagram profile URL for the organization"}),xProfile:e.string().nullable().optional().openapi({example:"https://www.x.com/example",description:"X profile URL for the organization"}),defaultCurrency:i.openapi({example:"USD",description:"Default currency for the organization"}),createdAt:e.date().openapi({description:"Timestamp when the organization configuration was created"})}).openapi("OrganizationConfiguration");export const UpdateOrganizationConfigurationSchema=OrganizationConfigurationSchema.pick({hostname:!0,countriesShipping:!0,stripeAccountId:!0,enableHostCheckout:!0,enableHostTracking:!0,isAcceptingOrders:!0,defaultLocale:!0,supportedLocales:!0,defaultCurrency:!0,openingTimes:!0,closingTimes:!0,facebookProfile:!0,instagramProfile:!0,xProfile:!0}).partial().openapi("UpdateOrganizationConfiguration");
|
|
@@ -1,48 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createApiRouter } from "../../core/hono/hono";
|
|
3
|
-
import { organizationRoute } from "./organization.route";
|
|
4
|
-
import { OrganizationService } from "./organization.service";
|
|
5
|
-
export const buildOrganizationHandler = (prisma, googleMapsApiKey) => {
|
|
6
|
-
const app = createApiRouter();
|
|
7
|
-
app.openapi(organizationRoute.getOrganizations, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
-
const auth = c.get("auth");
|
|
9
|
-
const query = c.req.valid("query");
|
|
10
|
-
const user = yield auth.getCurrentUser();
|
|
11
|
-
const service = new OrganizationService(prisma, googleMapsApiKey);
|
|
12
|
-
const result = yield service.getOrganizations(user.id, query);
|
|
13
|
-
return c.json(result, 200);
|
|
14
|
-
}));
|
|
15
|
-
app.openapi(organizationRoute.getOrganization, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
const params = c.req.valid("param");
|
|
17
|
-
const service = new OrganizationService(prisma, googleMapsApiKey);
|
|
18
|
-
const organization = yield service.getOrganization(params.organizationId);
|
|
19
|
-
return c.json(organization, 200);
|
|
20
|
-
}));
|
|
21
|
-
app.openapi(organizationRoute.createOrganization, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
const auth = c.get("auth");
|
|
23
|
-
const body = c.req.valid("json");
|
|
24
|
-
const user = yield auth.getCurrentUser();
|
|
25
|
-
const service = new OrganizationService(prisma, googleMapsApiKey);
|
|
26
|
-
const organization = yield service.createOrganization(user.id, body);
|
|
27
|
-
return c.json(organization, 201);
|
|
28
|
-
}));
|
|
29
|
-
app.openapi(organizationRoute.updateOrganization, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
-
const auth = c.get("auth");
|
|
31
|
-
const params = c.req.valid("param");
|
|
32
|
-
const body = c.req.valid("json");
|
|
33
|
-
const user = yield auth.isGranted("update");
|
|
34
|
-
const service = new OrganizationService(prisma, googleMapsApiKey);
|
|
35
|
-
const organization = yield service.updateOrganization(params.organizationId, user.id, body);
|
|
36
|
-
return c.json(organization, 200);
|
|
37
|
-
}));
|
|
38
|
-
app.openapi(organizationRoute.deleteOrganization, (c) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
-
const auth = c.get("auth");
|
|
40
|
-
const params = c.req.valid("param");
|
|
41
|
-
const user = yield auth.isGranted("delete");
|
|
42
|
-
const service = new OrganizationService(prisma, googleMapsApiKey);
|
|
43
|
-
yield service.deleteOrganization(params.organizationId, user.id);
|
|
44
|
-
return c.body(null, 204);
|
|
45
|
-
}));
|
|
46
|
-
return app;
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=organization.handler.js.map
|
|
1
|
+
import{__awaiter as i}from"tslib";import{createApiRouter as n}from"../../core/hono/hono";import{organizationRoute as o}from"./organization.route";import{OrganizationService as e}from"./organization.service";export const buildOrganizationHandler=(t,a)=>{const r=n();return r.openapi(o.getOrganizations,n=>i(void 0,void 0,void 0,function*(){const i=n.get("auth"),o=n.req.valid("query"),r=yield i.getCurrentUser(),d=new e(t,a),g=yield d.getOrganizations(r.id,o);return n.json(g,200)})),r.openapi(o.getOrganization,n=>i(void 0,void 0,void 0,function*(){const i=n.req.valid("param"),o=new e(t,a),r=yield o.getOrganization(i.organizationId);return n.json(r,200)})),r.openapi(o.createOrganization,n=>i(void 0,void 0,void 0,function*(){const i=n.get("auth"),o=n.req.valid("json"),r=yield i.getCurrentUser(),d=new e(t,a),g=yield d.createOrganization(r.id,o);return n.json(g,201)})),r.openapi(o.updateOrganization,n=>i(void 0,void 0,void 0,function*(){const i=n.get("auth"),o=n.req.valid("param"),r=n.req.valid("json"),d=yield i.isGranted("update"),g=new e(t,a),u=yield g.updateOrganization(o.organizationId,d.id,r);return n.json(u,200)})),r.openapi(o.deleteOrganization,n=>i(void 0,void 0,void 0,function*(){const i=n.get("auth"),o=n.req.valid("param"),r=yield i.isGranted("delete"),d=new e(t,a);return yield d.deleteOrganization(o.organizationId,r.id),n.body(null,204)})),r};
|
|
@@ -1,84 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createApiRoute } from "../../core/hono/hono";
|
|
3
|
-
import { CreateOrganizationSchema, ErrorSchema, HeaderSchema, OrganizationParams, OrganizationSchema, PaginationMetaSchema, PaginationQuerySchema, UpdateOrganizationSchema, } from "../../schemas";
|
|
4
|
-
const getOrganizationsRoute = createApiRoute({
|
|
5
|
-
description: "Fetches a paginated list of organizations",
|
|
6
|
-
headers: HeaderSchema,
|
|
7
|
-
method: "GET",
|
|
8
|
-
operationId: "getOrganizations",
|
|
9
|
-
path: "/organizations",
|
|
10
|
-
query: PaginationQuerySchema,
|
|
11
|
-
responses: {
|
|
12
|
-
200: z.object({
|
|
13
|
-
list: z.array(OrganizationSchema),
|
|
14
|
-
meta: PaginationMetaSchema,
|
|
15
|
-
}),
|
|
16
|
-
},
|
|
17
|
-
summary: "Get Organizations",
|
|
18
|
-
tags: ["Organization"],
|
|
19
|
-
});
|
|
20
|
-
const getOrganizationRoute = createApiRoute({
|
|
21
|
-
description: "Fetches a specific organization by ID",
|
|
22
|
-
headers: HeaderSchema,
|
|
23
|
-
method: "GET",
|
|
24
|
-
operationId: "getOrganization",
|
|
25
|
-
path: "/organizations/:organizationId",
|
|
26
|
-
pathParams: OrganizationParams,
|
|
27
|
-
responses: {
|
|
28
|
-
200: OrganizationSchema,
|
|
29
|
-
404: ErrorSchema,
|
|
30
|
-
},
|
|
31
|
-
summary: "Get Organization",
|
|
32
|
-
tags: ["Organization"],
|
|
33
|
-
});
|
|
34
|
-
const createOrganizationRoute = createApiRoute({
|
|
35
|
-
body: CreateOrganizationSchema,
|
|
36
|
-
description: "Creates a new organization",
|
|
37
|
-
headers: HeaderSchema,
|
|
38
|
-
method: "POST",
|
|
39
|
-
operationId: "createOrganization",
|
|
40
|
-
path: "/organizations",
|
|
41
|
-
responses: {
|
|
42
|
-
201: OrganizationSchema,
|
|
43
|
-
400: ErrorSchema,
|
|
44
|
-
},
|
|
45
|
-
summary: "Create Organization",
|
|
46
|
-
tags: ["Organization"],
|
|
47
|
-
});
|
|
48
|
-
const updateOrganizationRoute = createApiRoute({
|
|
49
|
-
body: UpdateOrganizationSchema,
|
|
50
|
-
description: "Updates a specific organization by ID",
|
|
51
|
-
headers: HeaderSchema,
|
|
52
|
-
method: "PATCH",
|
|
53
|
-
operationId: "updateOrganization",
|
|
54
|
-
path: "/organizations/:organizationId",
|
|
55
|
-
pathParams: OrganizationParams,
|
|
56
|
-
responses: {
|
|
57
|
-
200: OrganizationSchema,
|
|
58
|
-
404: ErrorSchema,
|
|
59
|
-
},
|
|
60
|
-
summary: "Update Organization",
|
|
61
|
-
tags: ["Organization"],
|
|
62
|
-
});
|
|
63
|
-
const deleteOrganizationRoute = createApiRoute({
|
|
64
|
-
description: "Deletes a specific organization by ID",
|
|
65
|
-
headers: HeaderSchema,
|
|
66
|
-
method: "DELETE",
|
|
67
|
-
operationId: "deleteOrganization",
|
|
68
|
-
path: "/organizations/:organizationId",
|
|
69
|
-
pathParams: OrganizationParams,
|
|
70
|
-
responses: {
|
|
71
|
-
204: null,
|
|
72
|
-
404: ErrorSchema,
|
|
73
|
-
},
|
|
74
|
-
summary: "Delete Organization",
|
|
75
|
-
tags: ["Organization"],
|
|
76
|
-
});
|
|
77
|
-
export const organizationRoute = {
|
|
78
|
-
getOrganizations: getOrganizationsRoute,
|
|
79
|
-
getOrganization: getOrganizationRoute,
|
|
80
|
-
createOrganization: createOrganizationRoute,
|
|
81
|
-
updateOrganization: updateOrganizationRoute,
|
|
82
|
-
deleteOrganization: deleteOrganizationRoute,
|
|
83
|
-
};
|
|
84
|
-
//# sourceMappingURL=organization.route.js.map
|
|
1
|
+
import{z as a}from"@hono/zod-openapi";import{createApiRoute as i}from"../../core/hono/hono";import{CreateOrganizationSchema as o,ErrorSchema as t,HeaderSchema as n,OrganizationParams as e,OrganizationSchema as r,PaginationMetaSchema as s,PaginationQuerySchema as g,UpdateOrganizationSchema as p}from"../../schemas";const z=i({description:"Fetches a paginated list of organizations",headers:n,method:"GET",operationId:"getOrganizations",path:"/organizations",query:g,responses:{200:a.object({list:a.array(r),meta:s})},summary:"Get Organizations",tags:["Organization"]}),d=i({description:"Fetches a specific organization by ID",headers:n,method:"GET",operationId:"getOrganization",path:"/organizations/:organizationId",pathParams:e,responses:{200:r,404:t},summary:"Get Organization",tags:["Organization"]}),m=i({body:o,description:"Creates a new organization",headers:n,method:"POST",operationId:"createOrganization",path:"/organizations",responses:{201:r,400:t},summary:"Create Organization",tags:["Organization"]}),h=i({body:p,description:"Updates a specific organization by ID",headers:n,method:"PATCH",operationId:"updateOrganization",path:"/organizations/:organizationId",pathParams:e,responses:{200:r,404:t},summary:"Update Organization",tags:["Organization"]}),O=i({description:"Deletes a specific organization by ID",headers:n,method:"DELETE",operationId:"deleteOrganization",path:"/organizations/:organizationId",pathParams:e,responses:{204:null,404:t},summary:"Delete Organization",tags:["Organization"]});export const organizationRoute={getOrganizations:z,getOrganization:d,createOrganization:m,updateOrganization:h,deleteOrganization:O};
|
|
@@ -1,64 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AddressSchema, CreateAddressSchema, UpdateAddressSchema, } from "../../schemas/address.schema";
|
|
3
|
-
import { FileSchema } from "../file/file.schema";
|
|
4
|
-
import { OrganizationConfigurationSchema, UpdateOrganizationConfigurationSchema, } from "./organization-configuration.schema";
|
|
5
|
-
export const OrganizationSchema = z
|
|
6
|
-
.object({
|
|
7
|
-
id: z.string().openapi({
|
|
8
|
-
example: "clm1234567890abcdef",
|
|
9
|
-
description: "The unique identifier of the organization",
|
|
10
|
-
}),
|
|
11
|
-
name: z.string().openapi({
|
|
12
|
-
example: "Acme Store",
|
|
13
|
-
description: "The name of the organization",
|
|
14
|
-
}),
|
|
15
|
-
phone: z.string().min(1, "Phone number is required").openapi({
|
|
16
|
-
example: "+48123456890",
|
|
17
|
-
description: "The phone number of the organization",
|
|
18
|
-
}),
|
|
19
|
-
email: z.string().email().optional().openapi({
|
|
20
|
-
example: "john.doe@example.com",
|
|
21
|
-
description: "The email address of the organization",
|
|
22
|
-
}),
|
|
23
|
-
createdAt: z.date().openapi({
|
|
24
|
-
example: "2022-01-01T00:00:00.000Z",
|
|
25
|
-
description: "The date and time the organization was created",
|
|
26
|
-
}),
|
|
27
|
-
legalEntityId: z.string().nullable().openapi({
|
|
28
|
-
example: "clm1234567890abcdef",
|
|
29
|
-
description: "The unique identifier of the legal entity associated with the organization",
|
|
30
|
-
}),
|
|
31
|
-
address: AddressSchema,
|
|
32
|
-
configuration: OrganizationConfigurationSchema.openapi({
|
|
33
|
-
description: "The configuration settings for the organization",
|
|
34
|
-
}),
|
|
35
|
-
logo: z.string().url().optional().nullable().openapi({
|
|
36
|
-
example: "https://example.com/logo.jpg",
|
|
37
|
-
description: "The logo of the organization",
|
|
38
|
-
}),
|
|
39
|
-
logoFile: FileSchema.optional().nullable().openapi({
|
|
40
|
-
description: "The logo of the organization",
|
|
41
|
-
}),
|
|
42
|
-
})
|
|
43
|
-
.openapi("Organization");
|
|
44
|
-
export const CreateOrganizationSchema = OrganizationSchema.pick({
|
|
45
|
-
name: true,
|
|
46
|
-
phone: true,
|
|
47
|
-
email: true,
|
|
48
|
-
logoFile: true,
|
|
49
|
-
})
|
|
50
|
-
.extend({
|
|
51
|
-
logoId: z.string().optional().nullable().openapi({
|
|
52
|
-
example: "clm1234567890abcdef",
|
|
53
|
-
description: "The unique identifier of the thumbnail image associated with the organization",
|
|
54
|
-
}),
|
|
55
|
-
address: CreateAddressSchema,
|
|
56
|
-
})
|
|
57
|
-
.openapi("CreateOrganization");
|
|
58
|
-
export const UpdateOrganizationSchema = CreateOrganizationSchema.extend({
|
|
59
|
-
address: UpdateAddressSchema,
|
|
60
|
-
configuration: UpdateOrganizationConfigurationSchema,
|
|
61
|
-
})
|
|
62
|
-
.partial()
|
|
63
|
-
.openapi("UpdateOrganization");
|
|
64
|
-
//# sourceMappingURL=organization.schema.js.map
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";import{AddressSchema as i,CreateAddressSchema as o,UpdateAddressSchema as a}from"../../schemas/address.schema";import{FileSchema as n}from"../file/file.schema";import{OrganizationConfigurationSchema as t,UpdateOrganizationConfigurationSchema as r}from"./organization-configuration.schema";export const OrganizationSchema=e.object({id:e.string().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the organization"}),name:e.string().openapi({example:"Acme Store",description:"The name of the organization"}),phone:e.string().min(1,"Phone number is required").openapi({example:"+48123456890",description:"The phone number of the organization"}),email:e.string().email().optional().openapi({example:"john.doe@example.com",description:"The email address of the organization"}),createdAt:e.date().openapi({example:"2022-01-01T00:00:00.000Z",description:"The date and time the organization was created"}),legalEntityId:e.string().nullable().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the legal entity associated with the organization"}),address:i,configuration:t.openapi({description:"The configuration settings for the organization"}),logo:e.string().url().optional().nullable().openapi({example:"https://example.com/logo.jpg",description:"The logo of the organization"}),logoFile:n.optional().nullable().openapi({description:"The logo of the organization"})}).openapi("Organization");export const CreateOrganizationSchema=OrganizationSchema.pick({name:!0,phone:!0,email:!0,logoFile:!0}).extend({logoId:e.string().optional().nullable().openapi({example:"clm1234567890abcdef",description:"The unique identifier of the thumbnail image associated with the organization"}),address:o}).openapi("CreateOrganization");export const UpdateOrganizationSchema=CreateOrganizationSchema.extend({address:a,configuration:r}).partial().openapi("UpdateOrganization");
|
|
@@ -5,9 +5,6 @@ declare class OrganizationService {
|
|
|
5
5
|
private readonly prisma;
|
|
6
6
|
private locationService;
|
|
7
7
|
constructor(prisma: PrismaClientType, googleMapsApiKey: string);
|
|
8
|
-
/**
|
|
9
|
-
* Get a paginated list of organizations
|
|
10
|
-
*/
|
|
11
8
|
getOrganizations(userId: string, query: {
|
|
12
9
|
page: number;
|
|
13
10
|
limit: number;
|
|
@@ -89,9 +86,6 @@ declare class OrganizationService {
|
|
|
89
86
|
}>;
|
|
90
87
|
private convertToTimeString;
|
|
91
88
|
private formatDateScheduleToTimeString;
|
|
92
|
-
/**
|
|
93
|
-
* Get a specific organization by ID
|
|
94
|
-
*/
|
|
95
89
|
getOrganization(organizationId: string): Promise<{
|
|
96
90
|
id: string;
|
|
97
91
|
name: string;
|
|
@@ -157,9 +151,6 @@ declare class OrganizationService {
|
|
|
157
151
|
filename: string;
|
|
158
152
|
} | null | undefined;
|
|
159
153
|
}>;
|
|
160
|
-
/**
|
|
161
|
-
* Create a new organization
|
|
162
|
-
*/
|
|
163
154
|
createOrganization(userId: string, body: z.infer<typeof CreateOrganizationSchema>): Promise<{
|
|
164
155
|
id: string;
|
|
165
156
|
name: string;
|
|
@@ -225,9 +216,6 @@ declare class OrganizationService {
|
|
|
225
216
|
filename: string;
|
|
226
217
|
} | null | undefined;
|
|
227
218
|
}>;
|
|
228
|
-
/**
|
|
229
|
-
* Update an existing organization
|
|
230
|
-
*/
|
|
231
219
|
updateOrganization(organizationId: string, userId: string, body: z.infer<typeof UpdateOrganizationSchema>): Promise<{
|
|
232
220
|
id: string;
|
|
233
221
|
name: string;
|
|
@@ -293,9 +281,6 @@ declare class OrganizationService {
|
|
|
293
281
|
filename: string;
|
|
294
282
|
} | null | undefined;
|
|
295
283
|
}>;
|
|
296
|
-
/**
|
|
297
|
-
* Delete an organization (soft delete)
|
|
298
|
-
*/
|
|
299
284
|
deleteOrganization(organizationId: string, userId: string): Promise<void>;
|
|
300
285
|
}
|
|
301
286
|
export { OrganizationService };
|