@shophost/rest-api 2.0.67 → 2.0.69
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 +1 -1
- package/schema.prisma +1 -0
- package/scripts/shophost-rest-api.mjs +198 -1
- package/src/bootstrap.js +1 -1
- package/src/container.js +1 -1
- package/src/core/auth/auth.schema.js +1 -1
- package/src/core/auth/auth.util.js +1 -1
- package/src/core/auth/better-auth.lib.js +1 -1
- package/src/core/auth/generate-password-hash.util.js +1 -1
- package/src/core/auth/headers.schema.js +1 -1
- package/src/core/auth/user.schema.js +1 -1
- package/src/core/db/__generated__/client/browser.js +1 -1
- package/src/core/db/__generated__/client/client.js +1 -1
- package/src/core/db/__generated__/client/enums.js +1 -1
- package/src/core/db/__generated__/client/internal/class.js +789 -1
- package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +1 -0
- package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -1
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.d.ts +1 -0
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -1
- package/src/core/db/__generated__/client/models/OrganizationConfiguration.d.ts +41 -1
- package/src/core/db/index.js +1 -1
- package/src/core/email/components.js +1 -1
- package/src/core/exceptions/http-exception.js +1 -1
- package/src/core/hono/hono.js +1 -1
- package/src/core/lib/prisma.js +1 -1
- package/src/core/logging/pino.js +1 -1
- package/src/core/notifications/email.service.js +1 -1
- package/src/core/openapi/openapi.lib.js +1 -1
- package/src/core/utils/currency.util.js +1 -1
- package/src/core/utils/env.util.js +1 -1
- package/src/core/utils/object.util.js +1 -1
- package/src/core/utils/translations.util.js +1 -1
- package/src/core/utils/zod.util.js +1 -1
- package/src/db.js +1 -1
- package/src/features/access/access.handler.js +1 -1
- package/src/features/access/access.route.js +1 -1
- package/src/features/access/access.schema.js +1 -1
- package/src/features/access/access.service.js +1 -1
- package/src/features/analytics/analytics.handler.js +1 -1
- package/src/features/analytics/analytics.route.js +1 -1
- package/src/features/analytics/analytics.schema.js +1 -1
- package/src/features/analytics/analytics.service.js +1 -1
- package/src/features/cart/cart.handler.js +1 -1
- package/src/features/cart/cart.route.js +1 -1
- package/src/features/cart/cart.schema.js +1 -1
- package/src/features/cart/cart.service.js +1 -1
- package/src/features/cart/cart.util.js +1 -1
- package/src/features/customer/customer.handler.js +1 -1
- package/src/features/customer/customer.route.js +1 -1
- package/src/features/customer/customer.schema.js +1 -1
- package/src/features/customer/customer.service.js +1 -1
- package/src/features/file/file.handler.js +1 -1
- package/src/features/file/file.route.js +1 -1
- package/src/features/file/file.schema.js +1 -1
- package/src/features/file/file.service.js +1 -1
- package/src/features/health/health.handler.js +1 -1
- package/src/features/health/health.route.js +1 -1
- package/src/features/index.js +1 -1
- package/src/features/integration/integration-config.js +1 -1
- package/src/features/integration/integration-registry.js +1 -1
- package/src/features/integration/integration.handler.js +1 -1
- package/src/features/integration/integration.route.js +1 -1
- package/src/features/integration/integration.schema.js +1 -1
- package/src/features/integration/integration.service.js +1 -1
- package/src/features/inventory/inventory.service.js +1 -1
- package/src/features/location/location.handler.js +1 -1
- package/src/features/location/location.route.js +1 -1
- package/src/features/location/location.schema.js +1 -1
- package/src/features/location/location.service.js +1 -1
- package/src/features/manufacturer/manufacturer.handler.js +1 -1
- package/src/features/manufacturer/manufacturer.route.js +1 -1
- package/src/features/manufacturer/manufacturer.schema.js +1 -1
- package/src/features/manufacturer/manufacturer.service.js +1 -1
- package/src/features/order/emails/order-confirmation.email.js +1 -1
- package/src/features/order/emails/order-notification.email.js +1 -1
- package/src/features/order/fulfilment.schema.js +1 -1
- package/src/features/order/order-fulfillment.service.js +1 -1
- package/src/features/order/order.handler.js +1 -1
- package/src/features/order/order.route.js +1 -1
- package/src/features/order/order.schema.js +1 -1
- package/src/features/order/order.service.js +1 -1
- package/src/features/order/recipient.schema.js +1 -1
- package/src/features/organization/legal-entity.schema.js +1 -1
- package/src/features/organization/organization-configuration.schema.d.ts +2 -0
- package/src/features/organization/organization-configuration.schema.js +1 -1
- package/src/features/organization/organization.handler.js +1 -1
- package/src/features/organization/organization.route.d.ts +5 -0
- package/src/features/organization/organization.route.js +1 -1
- package/src/features/organization/organization.schema.d.ts +2 -0
- package/src/features/organization/organization.schema.js +1 -1
- package/src/features/organization/organization.service.d.ts +4 -0
- package/src/features/organization/organization.service.js +1 -1
- package/src/features/payment/payment-webhook.service.js +1 -1
- package/src/features/payment/payment.handler.js +1 -1
- package/src/features/payment/payment.route.js +1 -1
- package/src/features/payment/payment.schema.js +1 -1
- package/src/features/payment/payment.service.js +1 -1
- package/src/features/payment/stripe.service.js +1 -1
- package/src/features/product/product-modifier.schema.js +1 -1
- package/src/features/product/product.handler.js +1 -1
- package/src/features/product/product.route.js +1 -1
- package/src/features/product/product.schema.js +1 -1
- package/src/features/product/product.service.js +1 -1
- package/src/features/product-category/product-category.handler.js +1 -1
- package/src/features/product-category/product-category.route.js +1 -1
- package/src/features/product-category/product-category.schema.js +1 -1
- package/src/features/product-category/product-category.service.js +1 -1
- package/src/features/reservation/emails/reservation-cancellation.email.js +1 -1
- package/src/features/reservation/emails/reservation-confirmation.email.js +1 -1
- package/src/features/reservation/emails/reservation-email-date.d.ts +2 -0
- package/src/features/reservation/emails/reservation-email-date.js +1 -0
- package/src/features/reservation/emails/reservation-notification.email.js +1 -1
- package/src/features/reservation/emails/reservation-updated.email.js +1 -1
- package/src/features/reservation/reservation.handler.js +1 -1
- package/src/features/reservation/reservation.route.js +1 -1
- package/src/features/reservation/reservation.schema.js +1 -1
- package/src/features/reservation/reservation.service.js +1 -1
- package/src/features/shipping/shipping.handler.js +1 -1
- package/src/features/shipping/shipping.route.js +1 -1
- package/src/features/shipping/shipping.service.js +1 -1
- package/src/features/shipping-method/shipping-method.handler.js +1 -1
- package/src/features/shipping-method/shipping-method.route.js +1 -1
- package/src/features/shipping-method/shipping-method.schema.js +1 -1
- package/src/features/shipping-method/shipping-method.service.js +1 -1
- package/src/features/shipping-method/shipping-zone.schema.js +1 -1
- package/src/features/webhook/webhook.handler.js +1 -1
- package/src/features/webhook/webhook.route.js +1 -1
- package/src/index.js +1 -1
- package/src/integrations/next.js +1 -1
- package/src/schemas/address.schema.js +1 -1
- package/src/schemas/currency.schema.js +1 -1
- package/src/schemas/error.schema.js +1 -1
- package/src/schemas/index.d.ts +1 -0
- package/src/schemas/index.js +1 -1
- package/src/schemas/locales.schema.js +1 -1
- package/src/schemas/number.schema.js +1 -1
- package/src/schemas/pagination.schema.js +1 -1
- package/src/schemas/params.schema.js +1 -1
- package/src/schemas/queries.schema.js +1 -1
- package/src/schemas/time-zone.schema.d.ts +9 -0
- package/src/schemas/time-zone.schema.js +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{z as r}from"@hono/zod-openapi";import{createApiRoute as t}from"../../core/hono/hono";import{CreateOrderSchema as p,ErrorSchema as e,HeaderSchema as a,locale as m,OrderSchema as o,OrderStatusSchema as h,OrganizationParams as s,OrganizationWithIdParams as d,PaginationMetaSchema as n,PaginationQuerySchema as i}from"../../schemas";import{CartConflictSchema as c}from"../cart/cart.schema";const g=t({description:"Fetches paginated list of orders",headers:a,method:"GET",operationId:"getOrders",path:"/:organizationId/orders",pathParams:s,query:i,responses:{200:r.object({list:r.array(o),meta:n}),400:e,401:e},summary:"Get Orders",tags:["Order"]}),O=t({description:"Fetches paginated list of orders for the authenticated user",headers:a,method:"GET",operationId:"getMyOrders",path:"/:organizationId/orders/me",pathParams:s,query:i,responses:{200:r.object({list:r.array(o),meta:n}),400:e,401:e},summary:"Get My Orders",tags:["Order"]}),u=t({body:p,description:"Creates a new order",headers:a,method:"POST",operationId:"createOrder",path:"/:organizationId/orders",pathParams:r.object({organizationId:r.string().cuid().min(1).openapi({description:"The organization ID",example:"ckel0e8qw00004n5p5w6fznym",param:{in:"path",name:"organizationId"}})}),query:r.object({locale:m.optional()}),responses:{201:r.object({order:o,redirectUrl:r.string().url().optional()}),409:c,400:e,401:e,404:e},summary:"Create Order",tags:["Order"]}),l=t({headers:a,method:"GET",operationId:"getOrder",path:"/:organizationId/orders/:id",pathParams:d,responses:{200:o,401:e,404:e},summary:"Get Order",tags:["Order"]}),y=t({description:"Changes the status of an existing order based on the operation",headers:a,method:"POST",operationId:"updateOrderStatus",path:"/:organizationId/orders/:id/status/:operation",pathParams:d.extend({operation:h}),responses:{200:o,400:e,401:e,404:e},summary:"Change Order Status",tags:["Order"]}),I=t({description:"Soft deletes order",headers:a,method:"DELETE",operationId:"deleteOrder",path:"/:organizationId/orders/:id",pathParams:d,responses:{204:null,400:e,401:e,404:e},summary:"Delete Order",tags:["Order"]});export const orderRoute={getOrders:g,getMyOrders:O,createOrder:u,getOrder:l,updateStatus:y,deleteOrder:I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x116ad4=_0x29b8,_0xcd3a8b=_0x29b8;(function(_0x4313fe,_0x396838){const _0x228211=_0x29b8,_0x3fe8f4=_0x29b8,_0x529385=_0x4313fe();while(!![]){try{const _0xe14d5a=-parseInt(_0x228211(0x9a))/0x1*(parseInt(_0x228211(0x99))/0x2)+parseInt(_0x228211(0x9d))/0x3*(-parseInt(_0x3fe8f4(0x6a))/0x4)+-parseInt(_0x3fe8f4(0x8f))/0x5*(-parseInt(_0x3fe8f4(0x6c))/0x6)+parseInt(_0x228211(0xc4))/0x7*(parseInt(_0x3fe8f4(0x6f))/0x8)+parseInt(_0x228211(0x88))/0x9+parseInt(_0x228211(0xcc))/0xa+-parseInt(_0x228211(0x9f))/0xb*(-parseInt(_0x3fe8f4(0x86))/0xc);if(_0xe14d5a===_0x396838)break;else _0x529385['push'](_0x529385['shift']());}catch(_0x47060f){_0x529385['push'](_0x529385['shift']());}}}(_0x1515,0x55156));import{z as _0x3f300f}from'@hono/zod-openapi';function _0x1515(){const _0x6e9e3b=['mtGXmLvkD3vzyq','BNvSBgfIBgu','nJqXnJf5B1fqEKm','mtvumtq6mZa','ig1HBNvHBca','ihvZzwqGzM8','zgvSAxzLCNK','BNrnzxrOB2q','q3jLyxrLt3i','ntC4nZa1vhfHCffH','yw5ZBgf0Aw8','yxrPB24','rgf0zsb3Agu','zIb1BML0CYa','ihjLzMvYzw4','CgvUzgLUzW','rgLZCgf0y2G','rxHWAxjHDgK','AwzPzxjZ','mLjvsLHVEq','ntKXodKXv2fICKPR','zIbVCMrLCIa','ywnJzxb0zwq','odKWndnjthv0yuW','ig1LDgHVzca','mJu4nuPLt05nAW','vg90ywWGChi','zw4Tvvm','zgvYihDHCYa','B3iGB3jKzxi','Dwn0zwqGywy','t3jKzxi','zxiGAxrLBq','zgLUzYbTB2q','mtHumte6ndu','zwrbDa','ihrOzsbVCMq','BgLUzsbPDgu','u3rHDhvZig8','AxjLzcb3Agu','t1jelteYmZq','DgvYihbHEw0','B3bLBMfWAq','rxH0zxjUywW','mJaYmY0XmI0','zwXPDMvYEsC','y3vPza','C3rYAw5N','AtLQma','mJaYmY0WnI0','DxaGB3iGzgu','ztvMnMC3AdG','qwrKAxrPB24','B3jKzxi','vvne','q3vYCMvUy3K','AxPLoIbmyxi','BIbMDwXMAwW','B2jQzwn0','yxjYyxK','zw51Bq','zM9YihrOzsa','nty1nJiXzfPWufr3','ywWGzgv0ywK','zIb0AguGDhi','igzVCIb0Agu','zhjHzNq','twv0Ag9Kswq','CMvMAw5L','twv0Ag9Kig8','mtmXmdy2mg1iwLzOza','tNvTyMvYig8','Aw50','qxjYyxKGB2y','oJaWwG','uhjPy2uGCgu','oJu5wG','igLZihjLCxu','u2HPChbPBMC','DhjHBNnMB3i','zhvJDa','tg9JywXLig8','CIb1BML0ig8','y2XQmtiZndu','BIb0AguGCge','CI1KAxnWyxq','igLUDMvUDg8','DeL0zw0','zw50','q29SB3i6ifm','y29TCgXLDgu','BwLU','CNKGD2fZigq','mZfumJm6ntK','AwX2zxiSifm','mtrumty6mJa','vgL0BguGB2y','BIb0AguGB3i','C2HPChbPBMC','B3b0Aw9UywW','zgvY','ihzLCMLMAwm','DcbIzsbKzwq','y2uGsuqGzM8','B24Gzgf0zsa','vhjHBNnSyxq','Aw9UCYbMB3i','ndbSCNHHsw4','z2DLzcbMB3i','mZbiwhnrqwq','EunVBMzSAwm','zxH0zw5K','ndHvqxjSvKS','vw5PCxvLigK','CIb0AguGB3i','mtzumdK6mtu','zgvMyxvSDa','y2fUy2vSBgu','AwnLigzVCIa','zgLZCgf0y2G','CIbMB3iGDgG','yxnZAwDU','BNvTyMvY','zIb0AguGAxq','zgf0zq','CMvHzhLgB3i','BwvUDe1LDgG','BsWGAw5JBhu','AwqGB3jKzxi','Aw52zw50B3i','BgL2zxj5kq','CMvHzhKTzM8','zNvSzMLSBwu','t3jKzxjjDgu','ihDHCYbMBge'];_0x1515=function(){return _0x6e9e3b;};return _0x1515();}import{AddressSchema as _0x6e3c04}from'../../schemas/address.schema';import{currency as _0x2d1fe9}from'../../schemas/currency.schema';import{locale as _0x314128}from'../../schemas/locales.schema';import{CartItemSchema as _0x296c8e,CartSchema as _0x447ef1}from'../cart/cart.schema';function _0x29b8(_0x4b5646,_0x137248){_0x4b5646=_0x4b5646-0x67;const _0x15156a=_0x1515();let _0x29b8f6=_0x15156a[_0x4b5646];if(_0x29b8['kLiPzz']===undefined){var _0x1dbb1f=function(_0x36518a){const _0x33f7bb='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4f4779='',_0x21bd65='';for(let _0x27d816=0x0,_0x15ee5d,_0x5b1d5e,_0x54bb0d=0x0;_0x5b1d5e=_0x36518a['charAt'](_0x54bb0d++);~_0x5b1d5e&&(_0x15ee5d=_0x27d816%0x4?_0x15ee5d*0x40+_0x5b1d5e:_0x5b1d5e,_0x27d816++%0x4)?_0x4f4779+=String['fromCharCode'](0xff&_0x15ee5d>>(-0x2*_0x27d816&0x6)):0x0){_0x5b1d5e=_0x33f7bb['indexOf'](_0x5b1d5e);}for(let _0x3b197a=0x0,_0x40bac1=_0x4f4779['length'];_0x3b197a<_0x40bac1;_0x3b197a++){_0x21bd65+='%'+('00'+_0x4f4779['charCodeAt'](_0x3b197a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x21bd65);};_0x29b8['usSyQK']=_0x1dbb1f,_0x29b8['ITJERx']={},_0x29b8['kLiPzz']=!![];}const _0x648017=_0x15156a[0x0],_0x41e1a7=_0x4b5646+_0x648017,_0x32d658=_0x29b8['ITJERx'][_0x41e1a7];return!_0x32d658?(_0x29b8f6=_0x29b8['usSyQK'](_0x29b8f6),_0x29b8['ITJERx'][_0x41e1a7]=_0x29b8f6):_0x29b8f6=_0x32d658,_0x29b8f6;}import{FileSchema as _0x13fcc0}from'../file/file.schema';import{PaymentMethodSchema as _0x3b865c,PaymentProviderSchema as _0x59fae5,PaymentSchema as _0xb2c478}from'../payment/payment.schema';import{ShippingMethodSchema as _0x57922d}from'../shipping-method/shipping-method.schema';import{fulfilmentMethod as _0x8c97e7}from'./fulfilment.schema';export const OrderStatusSchema=_0x3f300f[_0x116ad4(0xc2)]([_0x116ad4(0xc8),_0xcd3a8b(0x95),_0xcd3a8b(0x9c),_0x116ad4(0x82)+_0x116ad4(0xdb)+'ch',_0x116ad4(0x76)+'ed',_0x116ad4(0xe0)+'d','cancelle'+'d'])[_0x116ad4(0xb0)]({'description':_0x116ad4(0xac)+'f\x20the\x20or'+'der','example':_0x116ad4(0x9c)}),OrderItemSchema=_0x3f300f[_0x116ad4(0xc0)]({'translations':_0x3f300f[_0x116ad4(0xc1)](_0x3f300f[_0x116ad4(0xc0)]({'locale':_0x314128[_0x116ad4(0xb0)]({'description':_0x116ad4(0xd7)+_0x116ad4(0xc6)+_0xcd3a8b(0x90)+'n','example':_0x116ad4(0xa1)}),'title':_0x3f300f['string']()[_0x116ad4(0xb0)]({'description':_0xcd3a8b(0xe6)+_0xcd3a8b(0xaa)+'ered\x20pro'+_0x116ad4(0xd6),'example':'Premium\x20'+'Watch'}),'subtitle':_0x3f300f[_0x116ad4(0xb5)]()[_0x116ad4(0xb0)]({'description':_0xcd3a8b(0xba)+_0x116ad4(0xc5)+'ls\x20about'+_0x116ad4(0xaa)+'ered\x20ite'+_0xcd3a8b(0x7e)+_0x116ad4(0xa7)+_0xcd3a8b(0x98),'example':_0x116ad4(0xdf)+_0xcd3a8b(0xe4)+_0x116ad4(0xbe)+'ge'})}))[_0x116ad4(0xb0)]({'description':_0xcd3a8b(0x68)+_0x116ad4(0x69)+_0xcd3a8b(0xaa)+_0x116ad4(0xa6)}),'rawData':_0x296c8e,'unitPrice':_0x3f300f['number']()['min'](0x0)['openapi']({'description':_0x116ad4(0xd1)+_0x116ad4(0xd8)+_0x116ad4(0x7a)+'em','example':299.99}),'image':_0x13fcc0[_0x116ad4(0x87)]()[_0x116ad4(0xe9)](),'totalPrice':_0x3f300f[_0x116ad4(0x79)]()['min'](0x0)[_0xcd3a8b(0xb0)]({'description':_0xcd3a8b(0xa0)+_0xcd3a8b(0x75)+'this\x20ite'+'m\x20(unitP'+'rice\x20×\x20q'+'uantity)','example':599.98}),'quantity':_0x3f300f[_0xcd3a8b(0x79)]()['min'](0x1)[_0x116ad4(0xb0)]({'description':_0xcd3a8b(0xcd)+_0xcd3a8b(0x93)+'ordered','example':0x2}),'productSnapshotId':_0x3f300f[_0xcd3a8b(0xb5)]()[_0x116ad4(0xb4)]()})['openapi'](_0xcd3a8b(0x84)+'m'),InventoryConflictItemSchema=_0x3f300f[_0x116ad4(0xc0)]({'productId':_0x3f300f[_0x116ad4(0xb5)]()[_0xcd3a8b(0xb4)](),'title':_0x3f300f[_0xcd3a8b(0xb5)](),'requestedQuantity':_0x3f300f[_0x116ad4(0x79)]()[_0x116ad4(0xce)]()[_0x116ad4(0xe1)](0x1),'availableQuantity':_0x3f300f[_0xcd3a8b(0x79)]()[_0x116ad4(0xce)]()[_0xcd3a8b(0xe1)](0x0)})[_0xcd3a8b(0xb0)]('Inventor'+_0xcd3a8b(0x6d)+_0xcd3a8b(0xdd)),OrderSchema=_0x3f300f['object']({'id':_0x3f300f[_0xcd3a8b(0xb5)]()[_0xcd3a8b(0xb0)]({'description':_0xcd3a8b(0x70)+'dentifie'+_0x116ad4(0x77)+'e\x20order','example':_0xcd3a8b(0xd9)+'67890abc'+'def'}),'referenceId':_0x3f300f['string']()['openapi']({'description':_0x116ad4(0xb1)+_0xcd3a8b(0x94)+_0x116ad4(0xed)+'r\x20the\x20or'+_0xcd3a8b(0xea),'example':_0xcd3a8b(0xae)+'5'}),'status':OrderStatusSchema[_0x116ad4(0xe9)](),'token':_0x3f300f[_0xcd3a8b(0xb5)]()[_0x116ad4(0xb0)]({'description':'Security'+'\x20token\x20f'+_0xcd3a8b(0xa3)+_0xcd3a8b(0xeb)+_0xcd3a8b(0x91),'example':'a1b2c3d4'+_0xcd3a8b(0xb9)+_0x116ad4(0xb6)}),'expiresAt':_0x3f300f[_0xcd3a8b(0x7b)]()[_0xcd3a8b(0xb0)]({'description':_0xcd3a8b(0x97)+_0xcd3a8b(0x67)+_0x116ad4(0xc3)+_0xcd3a8b(0xbb),'example':_0xcd3a8b(0xb2)+_0x116ad4(0xe3)+_0xcd3a8b(0xd2)}),'items':_0x3f300f[_0x116ad4(0xc1)](OrderItemSchema)[_0xcd3a8b(0xe1)](0x1)['openapi']({'description':_0xcd3a8b(0xcf)+'\x20items\x20i'+_0xcd3a8b(0xe7)+_0xcd3a8b(0xea)}),'shippingMethod':_0x57922d[_0x116ad4(0x87)]()[_0x116ad4(0xb0)]({'description':_0x116ad4(0xd4)+_0xcd3a8b(0x9e)+'selected'+_0x116ad4(0xc7)+'\x20order'}),'acceptedAt':_0x3f300f['date']()[_0xcd3a8b(0x87)]()['optional']()[_0xcd3a8b(0xb0)]({'description':'Date\x20whe'+_0x116ad4(0xe7)+_0xcd3a8b(0xa2)+_0xcd3a8b(0x9c),'example':_0x116ad4(0xb7)+'15T14:30'+':00Z'}),'dispatchedAt':_0x3f300f[_0x116ad4(0x7b)]()[_0x116ad4(0x87)]()[_0xcd3a8b(0xe9)]()['openapi']({'description':_0xcd3a8b(0x92)+_0x116ad4(0xe7)+_0xcd3a8b(0xa2)+_0x116ad4(0x76)+'ed','example':_0x116ad4(0xb7)+_0xcd3a8b(0x72)+_0xcd3a8b(0xd0)}),'readyForDispatchAt':_0x3f300f['date']()[_0xcd3a8b(0x87)]()[_0x116ad4(0xe9)]()[_0xcd3a8b(0xb0)]({'description':'Date\x20whe'+'n\x20the\x20or'+_0xcd3a8b(0xa2)+'ready\x20fo'+'r\x20dispat'+'ch','example':_0x116ad4(0xb7)+_0x116ad4(0x72)+_0x116ad4(0xd0)}),'createdAt':_0x3f300f['date']()[_0x116ad4(0xb0)]({'description':_0xcd3a8b(0x92)+'n\x20the\x20or'+_0xcd3a8b(0xa2)+'created','example':_0xcd3a8b(0xb7)+_0xcd3a8b(0x89)+_0xcd3a8b(0xd0)}),'completedAt':_0x3f300f[_0xcd3a8b(0x7b)]()[_0x116ad4(0x87)]()['optional']()['openapi']({'description':_0xcd3a8b(0x92)+_0xcd3a8b(0xe7)+_0xcd3a8b(0xa2)+_0x116ad4(0xe0)+'d','example':_0xcd3a8b(0xb7)+_0xcd3a8b(0xa8)+':00Z'}),'cancelledAt':_0x3f300f[_0xcd3a8b(0x7b)]()[_0x116ad4(0x87)]()[_0xcd3a8b(0xe9)]()[_0xcd3a8b(0xb0)]({'description':_0x116ad4(0x92)+_0x116ad4(0xe7)+'der\x20was\x20'+_0xcd3a8b(0x74)+'d','example':_0xcd3a8b(0xb7)+_0xcd3a8b(0xe5)+_0xcd3a8b(0xd0)}),'inventoryDeductedAt':_0x3f300f['date']()[_0xcd3a8b(0x87)]()[_0xcd3a8b(0xe9)]()[_0x116ad4(0xb0)]({'description':_0xcd3a8b(0x92)+'n\x20the\x20pa'+_0xcd3a8b(0x7f)+_0xcd3a8b(0xdc)+_0x116ad4(0xe2)+'educted','example':'2023-06-'+_0xcd3a8b(0x89)+_0xcd3a8b(0xd0)}),'inventoryConflictAt':_0x3f300f[_0xcd3a8b(0x7b)]()[_0x116ad4(0x87)]()[_0x116ad4(0xe9)]()[_0x116ad4(0xb0)]({'description':'Date\x20whe'+_0xcd3a8b(0xda)+_0xcd3a8b(0x7f)+_0x116ad4(0x85)+_0xcd3a8b(0x6b)+_0x116ad4(0x8a)+_0xcd3a8b(0x80)+'y\x20review','example':_0xcd3a8b(0xb7)+'15T14:30'+_0x116ad4(0xd0)}),'inventoryConflictItems':_0x3f300f[_0xcd3a8b(0xc1)](InventoryConflictItemSchema)[_0xcd3a8b(0x87)]()['optional']()['openapi']({'description':'List\x20of\x20'+_0x116ad4(0xab)+'ms\x20that\x20'+'could\x20no'+_0x116ad4(0xec)+_0xcd3a8b(0xa4)+_0xcd3a8b(0xaf)+_0xcd3a8b(0xde)}),'shippingAddress':_0x6e3c04[_0xcd3a8b(0x87)]()[_0xcd3a8b(0xe9)](),'fulfilmentMethod':_0x8c97e7[_0xcd3a8b(0xb0)]({'description':_0x116ad4(0xcb)+_0xcd3a8b(0x9b)+'fulfilme'+'nt\x20(pick'+_0x116ad4(0xb8)+_0xcd3a8b(0x81),'example':_0x116ad4(0x8c)}),'currency':_0x2d1fe9[_0x116ad4(0xb0)]({'description':_0xcd3a8b(0xbd)+_0xcd3a8b(0x8b)+_0x116ad4(0x71)+_0xcd3a8b(0xea),'example':_0xcd3a8b(0xbc)}),'payment':_0xb2c478})[_0x116ad4(0xd5)+'m'](_0x1446f6=>{const _0x1dfc8f=_0xcd3a8b,_0x23605e=_0xcd3a8b,_0x3952d7={'sSZwF':_0x1dfc8f(0x9c)};let _0x8d9214;return _0x1446f6[_0x23605e(0x74)+'dAt']?_0x8d9214=_0x23605e(0x74)+'d':_0x1446f6[_0x1dfc8f(0xe0)+'dAt']?_0x8d9214='complete'+'d':_0x1446f6[_0x23605e(0x76)+_0x23605e(0xa9)]?_0x8d9214=_0x23605e(0x76)+'ed':_0x1446f6[_0x1dfc8f(0x7c)+_0x1dfc8f(0x96)+'At']?_0x8d9214=_0x1dfc8f(0x82)+_0x23605e(0xdb)+'ch':_0x1446f6[_0x23605e(0x9c)+'At']?_0x8d9214=_0x3952d7['sSZwF']:_0x8d9214=_0x1dfc8f(0x95),Object[_0x1dfc8f(0x78)](Object[_0x23605e(0x78)]({},_0x1446f6),{'status':_0x8d9214});})[_0x116ad4(0xb0)](_0x116ad4(0xa5)),CreateOrderSchema=_0x447ef1[_0xcd3a8b(0x6e)]({'fulfilmentMethod':_0x8c97e7[_0x116ad4(0x73)](_0xcd3a8b(0x8c)),'payment':_0x3f300f[_0xcd3a8b(0xc0)]({'provider':_0x59fae5,'method':_0x3b865c}),'checkoutBaseUrl':_0x3f300f['string']()['url']()})[_0xcd3a8b(0xca)](_0xc97386=>_0xc97386[_0x116ad4(0x83)+_0x116ad4(0x8d)]!==_0x116ad4(0x8c)||_0xc97386['shipping'+'MethodId']!==void 0x0,{'message':_0xcd3a8b(0xe8)+_0xcd3a8b(0xc9)+_0x116ad4(0xd3)+_0x116ad4(0xad)+_0xcd3a8b(0xbf)+_0x116ad4(0x7d)+'od\x20is\x20\x27d'+_0x116ad4(0xb3),'path':[_0x116ad4(0xe8)+'MethodId']})[_0xcd3a8b(0xb0)](_0x116ad4(0x8e)+_0xcd3a8b(0xea));
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";import{AddressSchema as a}from"../../schemas/address.schema";import{currency as o}from"../../schemas/currency.schema";import{locale as n}from"../../schemas/locales.schema";import{CartItemSchema as p,CartSchema as d}from"../cart/cart.schema";import{FileSchema as l}from"../file/file.schema";import{PaymentMethodSchema as c,PaymentProviderSchema as s,PaymentSchema as m}from"../payment/payment.schema";import{ShippingMethodSchema as h}from"../shipping-method/shipping-method.schema";import{fulfilmentMethod as r}from"./fulfilment.schema";export const OrderStatusSchema=e.enum(["draft","pending","accepted","ready-for-dispatch","dispatched","completed","cancelled"]).openapi({description:"Status of the order",example:"accepted"}),OrderItemSchema=e.object({translations:e.array(e.object({locale:n.openapi({description:"Locale of the translation",example:"en-US"}),title:e.string().openapi({description:"Title of the ordered product",example:"Premium Watch"}),subtitle:e.string().openapi({description:"Additional details about the ordered item, including modifiers",example:"Color: Silver, Size: Large"})})).openapi({description:"Translations for the order item"}),rawData:p,unitPrice:e.number().min(0).openapi({description:"Price per unit of the item",example:299.99}),image:l.nullable().optional(),totalPrice:e.number().min(0).openapi({description:"Total price for this item (unitPrice \xD7 quantity)",example:599.98}),quantity:e.number().min(1).openapi({description:"Number of units ordered",example:2}),productSnapshotId:e.string().cuid()}).openapi("OrderItem"),InventoryConflictItemSchema=e.object({productId:e.string().cuid(),title:e.string(),requestedQuantity:e.number().int().min(1),availableQuantity:e.number().int().min(0)}).openapi("InventoryConflictItem"),OrderSchema=e.object({id:e.string().openapi({description:"Unique identifier for the order",example:"clj1234567890abcdef"}),referenceId:e.string().openapi({description:"External reference ID for the order",example:"ORD-12345"}),status:OrderStatusSchema.optional(),token:e.string().openapi({description:"Security token for order verification",example:"a1b2c3d4e5f6g7h8i9j0"}),expiresAt:e.date().openapi({description:"Expiration date for the order",example:"2023-12-31T23:59:59Z"}),items:e.array(OrderItemSchema).min(1).openapi({description:"Array of items in the order"}),shippingMethod:h.nullable().openapi({description:"Shipping method selected for the order"}),acceptedAt:e.date().nullable().optional().openapi({description:"Date when the order was accepted",example:"2023-06-15T14:30:00Z"}),dispatchedAt:e.date().nullable().optional().openapi({description:"Date when the order was dispatched",example:"2023-06-16T09:15:00Z"}),readyForDispatchAt:e.date().nullable().optional().openapi({description:"Date when the order was ready for dispatch",example:"2023-06-16T09:15:00Z"}),createdAt:e.date().openapi({description:"Date when the order was created",example:"2023-06-15T14:30:00Z"}),completedAt:e.date().nullable().optional().openapi({description:"Date when the order was completed",example:"2023-06-18T11:45:00Z"}),cancelledAt:e.date().nullable().optional().openapi({description:"Date when the order was cancelled",example:"2023-06-14T16:20:00Z"}),inventoryDeductedAt:e.date().nullable().optional().openapi({description:"Date when the paid order inventory was deducted",example:"2023-06-15T14:30:00Z"}),inventoryConflictAt:e.date().nullable().optional().openapi({description:"Date when the paid order was flagged for manual inventory review",example:"2023-06-15T14:30:00Z"}),inventoryConflictItems:e.array(InventoryConflictItemSchema).nullable().optional().openapi({description:"List of line items that could not be deducted after payment"}),shippingAddress:a.nullable().optional(),fulfilmentMethod:r.openapi({description:"Method of order fulfilment (pickup or delivery)",example:"delivery"}),currency:o.openapi({description:"Currency used for the order",example:"USD"}),payment:m}).transform(t=>{let i;return t.cancelledAt?i="cancelled":t.completedAt?i="completed":t.dispatchedAt?i="dispatched":t.readyForDispatchAt?i="ready-for-dispatch":t.acceptedAt?i="accepted":i="pending",Object.assign(Object.assign({},t),{status:i})}).openapi("Order"),CreateOrderSchema=d.extend({fulfilmentMethod:r.default("delivery"),payment:e.object({provider:s,method:c}),checkoutBaseUrl:e.string().url()}).refine(t=>t.fulfilmentMethod!=="delivery"||t.shippingMethodId!==void 0,{message:"shippingMethodId is required when fulfilmentMethod is 'delivery'",path:["shippingMethodId"]}).openapi("CreateOrder");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x54463f=_0x1fbf,_0x111348=_0x1fbf;(function(_0x25b36a,_0x50f27a){const _0x57c044=_0x1fbf,_0x8750fb=_0x1fbf,_0x45f517=_0x25b36a();while(!![]){try{const _0x2dc60d=-parseInt(_0x57c044(0x170))/0x1+-parseInt(_0x8750fb(0x1d0))/0x2*(parseInt(_0x8750fb(0x1f9))/0x3)+parseInt(_0x8750fb(0x169))/0x4*(parseInt(_0x57c044(0x1b8))/0x5)+parseInt(_0x57c044(0x1cd))/0x6+parseInt(_0x8750fb(0x1cf))/0x7+parseInt(_0x8750fb(0x17c))/0x8+-parseInt(_0x8750fb(0x168))/0x9;if(_0x2dc60d===_0x50f27a)break;else _0x45f517['push'](_0x45f517['shift']());}catch(_0x282309){_0x45f517['push'](_0x45f517['shift']());}}}(_0x3074,0x84a46));import{__awaiter as _0x47d18e}from'tslib';import{z as _0x2fb85e}from'@hono/zod-openapi';import{customAlphabet as _0x4f0228}from'nanoid';function _0x1fbf(_0x121630,_0x410c2c){_0x121630=_0x121630-0x161;const _0x3074be=_0x3074();let _0x1fbf49=_0x3074be[_0x121630];if(_0x1fbf['yTsTjb']===undefined){var _0x4a9da3=function(_0x5c79cf){const _0xf85779='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4a8c84='',_0x3b7d26='';for(let _0x10ea66=0x0,_0x42e076,_0x4a006f,_0x4cc825=0x0;_0x4a006f=_0x5c79cf['charAt'](_0x4cc825++);~_0x4a006f&&(_0x42e076=_0x10ea66%0x4?_0x42e076*0x40+_0x4a006f:_0x4a006f,_0x10ea66++%0x4)?_0x4a8c84+=String['fromCharCode'](0xff&_0x42e076>>(-0x2*_0x10ea66&0x6)):0x0){_0x4a006f=_0xf85779['indexOf'](_0x4a006f);}for(let _0x4d2842=0x0,_0x3e2c35=_0x4a8c84['length'];_0x4d2842<_0x3e2c35;_0x4d2842++){_0x3b7d26+='%'+('00'+_0x4a8c84['charCodeAt'](_0x4d2842)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3b7d26);};_0x1fbf['jwJtuL']=_0x4a9da3,_0x1fbf['SjFRBR']={},_0x1fbf['yTsTjb']=!![];}const _0x3cf108=_0x3074be[0x0],_0x1cdc0a=_0x121630+_0x3cf108,_0x36392a=_0x1fbf['SjFRBR'][_0x1cdc0a];return!_0x36392a?(_0x1fbf49=_0x1fbf['jwJtuL'](_0x1fbf49),_0x1fbf['SjFRBR'][_0x1cdc0a]=_0x1fbf49):_0x1fbf49=_0x36392a,_0x1fbf49;}import{HttpException as _0x16afb}from'../../core/exceptions/http-exception';import{logger as _0x2e3ef6}from'../../core/logging/pino';import{OrderSchema as _0x55c48b,OrganizationSchema as _0x2d6e44,PaginationMetaSchema as _0x3bc409,UserSchema as _0x56f454,localeMap as _0x3e48b6}from'../../schemas';import{transformCartItemToOrderItem as _0x2bed78}from'../cart/cart.util';const S=_0x4f0228('12345678'+_0x54463f(0x1da)+_0x111348(0x1f3)+_0x54463f(0x1a9)+_0x111348(0x1f5),0x6);class z extends _0x16afb{constructor(_0x25cf47){const _0x367a32=_0x111348,_0x1a9d48=_0x111348;super(0x199,_0x25cf47[_0x367a32(0x1b3)]),this[_0x367a32(0x1b2)]=_0x25cf47;}}class _{constructor(_0x372b62,_0x2b5db,_0x17574d,_0x3ff762){const _0x12a018=_0x54463f,_0x533c22=_0x54463f;this[_0x12a018(0x1f7)]=_0x372b62,this[_0x12a018(0x1ae)+_0x12a018(0x164)]=_0x2b5db,this[_0x533c22(0x1c4)+_0x533c22(0x1c7)]=_0x17574d,this[_0x533c22(0x18d)+_0x533c22(0x175)]=_0x3ff762;}[_0x111348(0x174)+_0x54463f(0x1c6)](_0x58febc,_0x272c97){const _0x5d6787={'OsAij':function(_0x1f67eb,_0x408327,_0x586b62,_0x4c5477,_0x16163c){return _0x1f67eb(_0x408327,_0x586b62,_0x4c5477,_0x16163c);}};return _0x5d6787['OsAij'](_0x47d18e,this,void 0x0,void 0x0,function*(){const _0xc40ea6=_0x1fbf,_0x30ae46=_0x1fbf;try{yield _0x272c97();}catch(_0x4587fc){_0x2e3ef6[_0xc40ea6(0x191)](Object['assign']({'err':_0x4587fc},_0x58febc),_0x30ae46(0x1e3)+_0xc40ea6(0x176)+'ailed');}});}[_0x54463f(0x19a)+_0x54463f(0x182)+'es'](_0x3fc3bb){const _0x172939=_0x54463f,_0x5f3e84=_0x54463f,_0x49b9b0=_0x3fc3bb[_0x172939(0x16f)]()[_0x172939(0x1f1)+'ase']()[_0x5f3e84(0x172)](/-/g,'_');if(!_0x49b9b0)return[];const [_0x34a2af]=_0x49b9b0[_0x172939(0x190)]('_');return!_0x34a2af||_0x34a2af===_0x49b9b0?[_0x49b9b0]:[_0x49b9b0,_0x34a2af];}[_0x54463f(0x18a)+_0x54463f(0x1de)+_0x111348(0x18e)](_0x3f84b3,_0x263b0c,_0x46d5e6,_0x27d639){const _0x3dd068=_0x111348,_0x5df114=_0x111348,_0x3ecb7a=new Set(_0x46d5e6);if(_0x3f84b3&&_0x3ecb7a[_0x3dd068(0x1cb)](_0x3f84b3))return _0x3f84b3;if(!_0x263b0c)return _0x27d639;const _0x2d9768=_0x263b0c[_0x5df114(0x190)](',')[_0x5df114(0x19f)]((_0x3a159c,_0x3f83ff)=>{const _0x268ef1=_0x5df114,_0x4d3585=_0x5df114,[_0x49262d,..._0x33bf3b]=_0x3a159c[_0x268ef1(0x16f)]()[_0x268ef1(0x190)](';'),_0x737c33=_0x33bf3b[_0x268ef1(0x173)](_0x52316d=>_0x52316d[_0x268ef1(0x16f)]()[_0x4d3585(0x171)+'th']('q=')),_0x11c1ac=_0x737c33?Number['parseFlo'+'at'](_0x737c33['trim']()[_0x4d3585(0x18b)](0x2)):0x1;return{'index':_0x3f83ff,'quality':Number[_0x268ef1(0x19e)](_0x11c1ac)?_0x11c1ac:0x0,'rawLocale':_0x49262d};})[_0x5df114(0x1e1)](_0x403582=>_0x403582[_0x3dd068(0x1b7)+'e'])[_0x5df114(0x1b9)]((_0x42433f,_0x23e562)=>_0x23e562['quality']!==_0x42433f[_0x3dd068(0x16e)]?_0x23e562['quality']-_0x42433f[_0x3dd068(0x16e)]:_0x42433f[_0x5df114(0x1ce)]-_0x23e562[_0x5df114(0x1ce)]);for(const _0x1a48e5 of _0x2d9768)for(const _0x2b8a39 of this[_0x3dd068(0x19a)+_0x3dd068(0x182)+'es'](_0x1a48e5[_0x5df114(0x1b7)+'e']))if(_0x3e48b6[_0x5df114(0x1cb)](_0x2b8a39)&&_0x3ecb7a[_0x3dd068(0x1cb)](_0x2b8a39))return _0x2b8a39;return _0x27d639;}[_0x111348(0x1b0)+_0x111348(0x1db)](_0x3b62a2,_0x271d4d,_0x2465bf,_0x2028e0){const _0x1a52f1=_0x54463f,_0x47b68f=_0x54463f,_0x42c7e1={'MtxMh':_0x1a52f1(0x1d3)+_0x47b68f(0x166)+_0x1a52f1(0x1b1),'DCZDN':'delivery','rCLal':function(_0x38ce80,_0x4b730a){return _0x38ce80===_0x4b730a;},'wxAgp':function(_0x4c4ab9,_0x9b0d00){return _0x4c4ab9!==_0x9b0d00;},'XiDPe':function(_0x2311fa,_0x40cb5d,_0x111e24,_0x2edc53,_0x5c7b15){return _0x2311fa(_0x40cb5d,_0x111e24,_0x2edc53,_0x5c7b15);}};return _0x42c7e1[_0x1a52f1(0x1ba)](_0x47d18e,this,void 0x0,void 0x0,function*(){const _0x687a66=_0x47b68f,_0x4f96e1=_0x47b68f;var _0x2ac1c1,_0x4bf66c,_0x1cfee2,_0x5631a6,_0x3c3ba4;const _0x187eb8=yield this[_0x687a66(0x1f7)]['organiza'+_0x687a66(0x1d9)][_0x687a66(0x19b)+'t']({'where':{'id':_0x3b62a2},'include':{'configuration':!0x0}});if(!_0x187eb8)throw new _0x16afb(0x194,_0x42c7e1[_0x4f96e1(0x1a2)]);const _0x36efcd=this[_0x687a66(0x18a)+_0x4f96e1(0x1de)+_0x4f96e1(0x18e)](_0x2028e0?.[_0x4f96e1(0x1ea)],_0x2028e0?.[_0x687a66(0x1c9)+_0x4f96e1(0x193)],_0x187eb8[_0x687a66(0x1b4)+_0x4f96e1(0x1af)][_0x687a66(0x1ed)+_0x4f96e1(0x1c1)],_0x187eb8['configur'+_0x4f96e1(0x1af)][_0x687a66(0x1b5)+_0x4f96e1(0x18e)]),_0x4c000d=yield this[_0x4f96e1(0x1c4)+_0x4f96e1(0x1c7)][_0x687a66(0x187)+_0x687a66(0x17f)](_0x3b62a2,_0x2465bf,{'locale':_0x36efcd});if(_0x4c000d[_0x4f96e1(0x1dc)+'roductId'+'s'][_0x4f96e1(0x1e8)]>0x0||this[_0x687a66(0x1bd)+_0x4f96e1(0x19c)](_0x2465bf['items'],_0x4c000d[_0x687a66(0x17b)+_0x4f96e1(0x1e2)]))throw new z(Object['assign'](Object[_0x687a66(0x1e6)]({},_0x4c000d),{'message':_0x4f96e1(0x178)+_0x687a66(0x198)+_0x687a66(0x185)+_0x4f96e1(0x16b)+_0x4f96e1(0x1c0)+_0x687a66(0x1be)+_0x687a66(0x1bb)+_0x687a66(0x1bc)+_0x687a66(0x1bf)+'y.'}));const _0x47c3c1=yield this[_0x4f96e1(0x1f7)]['address'][_0x687a66(0x19b)+'t']({'where':{'users':{'some':{'id':_0x271d4d['id']}},'isDefault':!0x0}});if(_0x2465bf[_0x687a66(0x1e7)+'ntMethod']===_0x42c7e1[_0x4f96e1(0x17a)]&&!_0x47c3c1)throw new _0x16afb(0x190,_0x4f96e1(0x165)+_0x4f96e1(0x197)+_0x4f96e1(0x1d6)+_0x687a66(0x183)+_0x687a66(0x1d7)+_0x4f96e1(0x163)+'ss');const _0x2f7337=yield Promise[_0x687a66(0x1f2)](_0x4c000d[_0x687a66(0x17b)+_0x687a66(0x1e2)][_0x687a66(0x19f)](_0x2bed78(this['prisma']))),_0x49304a=yield this[_0x4f96e1(0x1f7)][_0x687a66(0x199)+_0x4f96e1(0x1d8)][_0x4f96e1(0x19b)+'t']({'where':{'id':_0x2465bf[_0x4f96e1(0x199)+_0x687a66(0x194)]},'include':{'shippingZones':!0x0}}),_0x1bbfea=(_0x4bf66c=(_0x2ac1c1=_0x49304a?.['shipping'+_0x687a66(0x1ad)][0x0])===null||_0x42c7e1[_0x4f96e1(0x192)](_0x2ac1c1,void 0x0)?void 0x0:_0x2ac1c1[_0x4f96e1(0x1a5)])!==null&&_0x4bf66c!==void 0x0?_0x4bf66c:0x0,_0xa4d16a=_0x2f7337[_0x4f96e1(0x1ef)]((_0x2c5204,_0x9b817f)=>_0x2c5204+_0x9b817f[_0x4f96e1(0x1a3)+'ce'],0x0),_0x690a11=_0xa4d16a+_0x1bbfea,_0x596a3=yield this[_0x4f96e1(0x1f7)]['order']['create']({'data':Object['assign'](Object[_0x4f96e1(0x1e6)]({'token':S(),'referenceId':S(),'organization':{'connect':{'id':_0x3b62a2}},'fulfilmentMethod':_0x2465bf[_0x687a66(0x1e7)+_0x4f96e1(0x1ec)],'shippingMethod':_0x2465bf[_0x4f96e1(0x199)+_0x687a66(0x194)]?{'connect':{'id':_0x2465bf[_0x4f96e1(0x199)+_0x4f96e1(0x194)]}}:void 0x0,'currency':_0x187eb8[_0x4f96e1(0x1b4)+_0x4f96e1(0x1af)][_0x4f96e1(0x1c3)+_0x687a66(0x1a8)],'sourceIp':_0x687a66(0x1a7)+'1','items':{'create':_0x2f7337}},_0x47c3c1?{'shippingAddress':{'create':Object[_0x4f96e1(0x1e6)](Object[_0x687a66(0x1e6)]({},_0x47c3c1),{'id':void 0x0})}}:{}),{'user':{'connect':{'id':_0x271d4d['id']}},'payment':{'create':{'method':_0x2465bf[_0x4f96e1(0x1e9)]['method'],'provider':_0x2465bf[_0x4f96e1(0x1e9)]['provider'],'shipping':(_0x5631a6=(_0x1cfee2=_0x49304a?.['shipping'+_0x4f96e1(0x1ad)][0x0])===null||_0x1cfee2===void 0x0?void 0x0:_0x1cfee2[_0x4f96e1(0x1a5)])!==null&&_0x5631a6!==void 0x0?_0x5631a6:0x0,'subtotal':_0xa4d16a,'total':_0x690a11,'discount':0x0,'currency':_0x187eb8[_0x4f96e1(0x1b4)+_0x4f96e1(0x1af)][_0x4f96e1(0x1c3)+_0x687a66(0x1a8)]}}}),'include':{'items':{'include':{'translations':!0x0,'image':!0x0}},'payment':!0x0,'shippingMethod':{'include':{'shippingZones':!0x0}}}}),_0x271b38=_0x55c48b[_0x687a66(0x1a1)](_0x596a3);return{'redirectUrl':(_0x3c3ba4=(yield this[_0x687a66(0x1ae)+_0x687a66(0x164)][_0x687a66(0x184)+_0x687a66(0x1dd)+_0x4f96e1(0x162)](_0x3b62a2,_0x271d4d,_0x271b38,{'locale':_0x36efcd,'defaultLocale':_0x187eb8[_0x687a66(0x1b4)+'ation'][_0x687a66(0x1b5)+_0x687a66(0x18e)],'successUrl':_0x2465bf[_0x687a66(0x179)+_0x687a66(0x1eb)]+('/account'+_0x4f96e1(0x1aa))+_0x596a3['id']+('?clearCa'+_0x687a66(0x195)),'cancelUrl':_0x2465bf['checkout'+'BaseUrl']+(_0x687a66(0x1a4)+_0x4f96e1(0x1e0)+_0x687a66(0x16c)+'ayment')}))[_0x687a66(0x186)+_0x4f96e1(0x177)])!==null&&_0x42c7e1['wxAgp'](_0x3c3ba4,void 0x0)?_0x3c3ba4:void 0x0,'order':_0x55c48b[_0x687a66(0x1a1)](_0x596a3)};});}[_0x111348(0x1bd)+_0x111348(0x19c)](_0x8c9c8e,_0x2b97df){const _0x2a2723=_0x54463f,_0x5dd023=_0x54463f;return JSON[_0x2a2723(0x180)+'y'](_0x8c9c8e)!==JSON[_0x5dd023(0x180)+'y'](_0x2b97df);}['sendOrde'+_0x54463f(0x1f4)+_0x111348(0x16d)](_0x496627,_0x4738d4){const _0x3495ee={'CZuTL':function(_0x49ea73,_0x40b623,_0x393315,_0x552fa0,_0x29e0b3){return _0x49ea73(_0x40b623,_0x393315,_0x552fa0,_0x29e0b3);}};return _0x3495ee['CZuTL'](_0x47d18e,this,void 0x0,void 0x0,function*(){const _0x582dc9=_0x1fbf,_0x533bb3=_0x1fbf,_0x89df77=yield this[_0x582dc9(0x1f7)][_0x582dc9(0x16a)][_0x533bb3(0x19b)+'t']({'where':{'id':_0x496627},'include':{'items':{'include':{'translations':!0x0,'image':!0x0}},'payment':!0x0,'organization':{'include':{'address':!0x0,'configuration':!0x0,'logoFile':!0x0,'members':{'include':{'user':!0x0}}}},'shippingAddress':!0x0,'shippingMethod':{'include':{'shippingZones':!0x0}}}}),_0x1c5777=_0x4738d4??_0x89df77?.['userId'],_0x13b661=_0x1c5777?yield this[_0x533bb3(0x1f7)][_0x533bb3(0x18f)][_0x582dc9(0x19b)+'t']({'where':{'id':_0x1c5777}}):null;if(!_0x89df77||!_0x13b661)return;const _0x3bbd47=_0x56f454[_0x533bb3(0x1a1)](_0x13b661),_0x407394=_0x2d6e44['parse'](_0x89df77['organiza'+'tion']),_0x32ae9f=_0x55c48b['parse'](_0x89df77);yield this[_0x582dc9(0x174)+'ndEmail']({'emailType':_0x533bb3(0x1d4)+_0x533bb3(0x161)+'on','orderId':_0x89df77['id'],'organizationId':_0x89df77[_0x582dc9(0x18c)+_0x582dc9(0x167)],'userId':_0x13b661['id']},()=>this['emailSer'+'vice'][_0x533bb3(0x1f6)+_0x533bb3(0x17e)+'ationEma'+'il'](_0x89df77[_0x582dc9(0x18c)+'tionId'],_0x3bbd47,_0x407394,_0x32ae9f));for(const _0x1dc9f1 of _0x89df77['organiza'+_0x533bb3(0x1d9)][_0x533bb3(0x1a6)])yield this[_0x582dc9(0x174)+_0x582dc9(0x1c6)]({'emailType':_0x582dc9(0x1ac)+'tificati'+'on','memberId':_0x1dc9f1[_0x533bb3(0x18f)]['id'],'orderId':_0x89df77['id'],'organizationId':_0x89df77[_0x533bb3(0x18c)+_0x582dc9(0x167)],'userId':_0x13b661['id']},()=>this[_0x582dc9(0x18d)+'vice'][_0x582dc9(0x1f6)+'rNotific'+_0x533bb3(0x1c8)+'il'](_0x89df77[_0x533bb3(0x18c)+'tionId'],_0x3bbd47,_0x56f454[_0x582dc9(0x1a1)](_0x1dc9f1[_0x533bb3(0x18f)]),_0x407394,_0x32ae9f));});}[_0x111348(0x1c5)](_0x106a4,_0x294298,_0xac57e9){const _0x23856d=_0x54463f,_0x38adbe=_0x54463f,_0x5cfb71={'sJuXe':_0x23856d(0x188)+_0x23856d(0x1e4)};return _0x47d18e(this,void 0x0,void 0x0,function*(){const _0x1e3648=_0x23856d,_0x46428d=_0x23856d,_0xcb18ed=yield this[_0x1e3648(0x1f7)][_0x1e3648(0x16a)][_0x46428d(0x1a0)+'ue']({'where':{'id':_0xac57e9,'organizationId':_0x294298,'deletedAt':null,'user':{'id':_0x106a4['id']}},'include':{'items':{'include':{'translations':!0x0,'image':!0x0}},'shippingAddress':!0x0,'shippingMethod':{'include':{'shippingZones':!0x0}},'payment':!0x0}});if(!_0xcb18ed)throw new _0x16afb(0x194,_0x5cfb71[_0x46428d(0x1f0)]);return _0x55c48b[_0x46428d(0x1a1)](_0xcb18ed);});}[_0x54463f(0x1d2)+_0x111348(0x181)](_0xd46c24,_0x376a9c,_0x410172){const _0x5a7a57=_0x111348,_0x563a2c={'XlCzL':'insensit'+_0x5a7a57(0x189)};return _0x47d18e(this,void 0x0,void 0x0,function*(){const _0x35fe81=_0x5a7a57,_0xe3e2c=_0x5a7a57,{page:_0xe77b29=0x1,limit:_0x40d0fa=0xa,search:_0x20878f}=_0x410172,[_0x577ee5,_0x3ea04e]=yield this[_0x35fe81(0x1f7)][_0xe3e2c(0x16a)]['paginate']({'where':Object[_0xe3e2c(0x1e6)]({'organizationId':_0x376a9c,'userId':_0xd46c24,'deletedAt':null},_0x20878f?{'referenceId':{'contains':_0x20878f,'mode':_0x563a2c[_0xe3e2c(0x19d)]}}:{}),'include':{'items':{'include':{'translations':!0x0,'image':!0x0}},'shippingAddress':!0x0,'shippingMethod':{'include':{'shippingZones':!0x0}},'payment':!0x0},'orderBy':{'createdAt':'desc'}})[_0x35fe81(0x1df)+'s']({'page':_0xe77b29,'limit':_0x40d0fa});return{'meta':_0x3bc409['parse'](_0x3ea04e),'list':_0x2fb85e[_0x35fe81(0x1e5)](_0x55c48b)[_0x35fe81(0x1a1)](_0x577ee5)};});}[_0x54463f(0x1c5)+'s'](_0x280d98,_0x4d908e){const _0x14e834=_0x111348,_0x361a2b={'BQZtu':function(_0x309a73,_0x16521e,_0x1c36aa,_0x4abd75,_0x5278a8){return _0x309a73(_0x16521e,_0x1c36aa,_0x4abd75,_0x5278a8);}};return _0x361a2b[_0x14e834(0x1cc)](_0x47d18e,this,void 0x0,void 0x0,function*(){const _0x479db3=_0x14e834,_0x237adc=_0x14e834,{page:_0x456922=0x1,limit:_0x146dca=0xa}=_0x4d908e,[_0x12eef1,_0x27f275]=yield this[_0x479db3(0x1f7)][_0x479db3(0x16a)][_0x479db3(0x1f8)]({'where':{'organizationId':_0x280d98,'deletedAt':null},'include':{'items':{'include':{'translations':!0x0,'image':!0x0}},'shippingAddress':!0x0,'shippingMethod':{'include':{'shippingZones':!0x0}},'payment':!0x0},'orderBy':{'createdAt':_0x237adc(0x17d)}})[_0x479db3(0x1df)+'s']({'page':_0x456922,'limit':_0x146dca});return{'meta':_0x3bc409['parse'](_0x27f275),'list':_0x2fb85e[_0x237adc(0x1e5)](_0x55c48b)[_0x237adc(0x1a1)](_0x12eef1)};});}[_0x54463f(0x1ee)+_0x54463f(0x1db)](_0x2ecc9a,_0x210537,_0x2489ce){return _0x47d18e(this,void 0x0,void 0x0,function*(){const _0xf318c=_0x1fbf,_0x25e97d=_0x1fbf;if(!(yield this[_0xf318c(0x1f7)][_0x25e97d(0x16a)]['findUniq'+'ue']({'where':{'id':_0x210537,'organizationId':_0x2ecc9a,'deletedAt':null}})))throw new _0x16afb(0x194,_0xf318c(0x188)+_0x25e97d(0x1e4));yield this[_0x25e97d(0x1f7)][_0x25e97d(0x16a)]['update']({'where':{'id':_0x210537,'organizationId':_0x2ecc9a,'deletedAt':null},'data':{'deletedAt':new Date(),'deletedBy':_0x2489ce}});});}['updateSt'+_0x54463f(0x1d1)](_0x1bc0e4,_0x25b97a,_0x516c63){return _0x47d18e(this,void 0x0,void 0x0,function*(){const _0x500803=_0x1fbf,_0x248568=_0x1fbf;if(!(yield this[_0x500803(0x1f7)][_0x248568(0x16a)][_0x248568(0x1a0)+'ue']({'where':{'id':_0x25b97a,'organizationId':_0x1bc0e4,'deletedAt':null},'include':{'items':!0x0,'shippingMethod':{'include':{'shippingZones':!0x0}}}})))throw new _0x16afb(0x194,'Order\x20no'+_0x248568(0x1e4));let _0x438cd9={};switch(_0x516c63){case _0x500803(0x1b6):_0x438cd9={'acceptedAt':new Date()};break;case _0x500803(0x1c2)+_0x248568(0x1ab)+'ch':_0x438cd9={'readyForDispatchAt':new Date()};break;case _0x248568(0x1d5)+'ed':_0x438cd9={'dispatchedAt':new Date()};break;case _0x500803(0x196)+'d':_0x438cd9={'completedAt':new Date()};break;case'cancelle'+'d':_0x438cd9={'cancelledAt':new Date()};break;}const _0x1e5092=yield this[_0x500803(0x1f7)][_0x500803(0x16a)][_0x248568(0x1ca)]({'where':{'id':_0x25b97a},'data':_0x438cd9,'include':{'items':{'include':{'translations':!0x0,'image':!0x0}},'shippingAddress':!0x0,'shippingMethod':{'include':{'shippingZones':!0x0}},'payment':!0x0}});return _0x55c48b[_0x500803(0x1a1)](_0x1e5092);});}}export{_ as OrderService};export{z as OrderInventoryConflictError};function _0x3074(){const _0x33982b=['Cgf5BwvUDa','Bg9JywXL','qMfZzvvYBa','BNrnzxrOB2q','C3vWCg9YDgu','zgvSzxrLt3i','CMvKDwnL','C0P1wgu','Dg9mB3DLCKm','ywXS','r0HjsKTmtu4','CK5VDgLMAwm','v1HzwG','C2vUze9Yzgu','ChjPC21H','CgfNAw5HDgu','mJm1mdy3nfrhq21bvq','BMzPCM1HDgK','C3nPB24','BMCGywrKCMu','zxj2AwnL','vgHPCYb1C2u','DgLVBIbUB3q','DgLVBKLK','nZe0mdC5ohvcqNbNEq','mJeWnfbNreH0rq','B3jKzxi','yxjLig5VigW','BMCTyw5Klxa','yxrPB25Z','CxvHBgL0Eq','DhjPBq','ntiXotK5DuTqCNvb','C3rHCNrZv2K','CMvWBgfJzq','zMLUza','C2fMzwX5u2u','DMLJzq','BgL2zxj5igy','vxjS','u29TzsbPDgu','y2HLy2TVDxq','renAre4','BM9YBwfSAxO','odq1mdG3mMzmyKDtqG','zgvZyW','CKnVBMzPCM0','yxrH','C3rYAw5NAwy','zxjZ','q2fUzgLKyxq','ysbKzwzHDwW','y3jLyxrLq2G','DxiGy2fYDca','CMvKAxjLy3q','z2v0q2fYDeq','t3jKzxiGBM8','AxzL','CMvZB2X2zum','C2XPy2u','B3jNyw5PEMe','zw1HAwXtzxi','B2nHBgu','DxnLCG','C3bSAxq','zxjYB3i','CKnmywW','BMD1ywDL','twv0Ag9Kswq','CNq9Dhj1zq','y29TCgXLDgu','CIbKB2vZig4','BxmGAw4GEw8','C2HPChbPBMC','Dg9mB2nHBgu','zMLUzezPCNm','B25MBgLJDa','wgXdEKW','AxngAw5PDgu','BwfW','zMLUzfvUAxe','CgfYC2u','txr4twG','Dg90ywXqCMK','l2nOzwnRB3u','ChjPy2u','BwvTyMvYCW','mti3lJaUmc4','DxjYzw5JEq','t1bruLnuvvy','l29YzgvYCY8','CI1KAxnWyxq','B3jKzxiTBM8','wM9Uzxm','Cgf5BwvUDfm','yxrPB24','y3jLyxrLt3i','igzVDw5K','Cgf5Bg9Hza','BwvZC2fNzq','y29UzMLNDxi','zgvMyxvSDeW','ywnJzxb0zwq','CMf3tg9JywW','nJG2nvnKsKvXza','C29YDa','wgLeugu','Aw4GDgHLihi','zxf1zxn0zwq','AgfZq2fYDem','ywLSywjSzsa','ihf1yw50Axq','B25NzxiGyxy','zeXVy2fSzxm','CMvHzhKTzM8','zgvMyxvSDem','y2fYDfnLCNy','z2v0t3jKzxi','BMrfBwfPBa','AwnL','yxrPB25fBwe','ywnJzxb0tge','DxbKyxrL','AgfZ','qLfADhu','ndq4nduYnKzSCwvlAW','Aw5KzxG','ode0mtiXvwnoAxrN','mMXqz2vuCG','yxr1CW','z2v0txLpCMq','t3jNyw5PEMe','B3jKzxiTy28','zgLZCgf0y2G','B3qGAgf2zsa','DcbZAgLWCgK','twv0Ag9K','DgLVBG','otbbqKneruy','zgvY','Aw52ywXPzfa','zwnRB3v0u2u','AgvJA291DeW','D2L0AfbHz2u','Dc9ZAgLWCgK','zMLSDgvY','zwrjDgvTCW','rw1HAwWGzgu','DcbMB3vUza','yxjYyxK','yxnZAwDU','zNvSzMLSBwu','BgvUz3rO'];_0x3074=function(){return _0x33982b;};return _0x3074();}
|
|
1
|
+
import{__awaiter as l}from"tslib";import{z as O}from"@hono/zod-openapi";import{customAlphabet as U}from"nanoid";import{HttpException as m}from"../../core/exceptions/http-exception";import{logger as D}from"../../core/logging/pino";import{OrderSchema as p,OrganizationSchema as Z,PaginationMetaSchema as A,UserSchema as I,localeMap as F}from"../../schemas";import{transformCartItemToOrderItem as E}from"../cart/cart.util";const S=U("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ",6);class z extends m{constructor(t){super(409,t.message),this.payload=t}}class _{constructor(t,i,e,r){this.prisma=t,this.paymentService=i,this.cartService=e,this.emailService=r}safelySendEmail(t,i){return l(this,void 0,void 0,function*(){try{yield i()}catch(e){D.error(Object.assign({err:e},t),"Email delivery failed")}})}toLocaleCandidates(t){const i=t.trim().toLowerCase().replace(/-/g,"_");if(!i)return[];const[e]=i.split("_");return!e||e===i?[i]:[i,e]}resolveCheckoutLocale(t,i,e,r){const n=new Set(e);if(t&&n.has(t))return t;if(!i)return r;const d=i.split(",").map((s,a)=>{const[o,...c]=s.trim().split(";"),g=c.find(f=>f.trim().startsWith("q=")),u=g?Number.parseFloat(g.trim().slice(2)):1;return{index:a,quality:Number.isFinite(u)?u:0,rawLocale:o}}).filter(s=>s.rawLocale).sort((s,a)=>a.quality!==s.quality?a.quality-s.quality:s.index-a.index);for(const s of d)for(const a of this.toLocaleCandidates(s.rawLocale))if(F.has(a)&&n.has(a))return a;return r}createOrder(t,i,e,r){return l(this,void 0,void 0,function*(){var n,d,s,a,o;const c=yield this.prisma.organization.findFirst({where:{id:t},include:{configuration:!0}});if(!c)throw new m(404,"Organization not found");const g=this.resolveCheckoutLocale(r?.locale,r?.acceptLanguage,c.configuration.supportedLocales,c.configuration.defaultLocale),u=yield this.cartService.getCartData(t,e,{locale:g});if(u.invalidProductIds.length>0||this.hasCartConflict(e.items,u.normalizedItems))throw new z(Object.assign(Object.assign({},u),{message:"Some items in your cart are no longer available in the requested quantity."}));const f=yield this.prisma.address.findFirst({where:{users:{some:{id:i.id}},isDefault:!0}});if(e.fulfilmentMethod==="delivery"&&!f)throw new m(400,"This user does not have a default shipping address");const y=yield Promise.all(u.normalizedItems.map(E(this.prisma))),h=yield this.prisma.shippingMethod.findFirst({where:{id:e.shippingMethodId},include:{shippingZones:!0}}),C=(d=(n=h?.shippingZones[0])===null||n===void 0?void 0:n.price)!==null&&d!==void 0?d:0,w=y.reduce((q,k)=>q+k.totalPrice,0),L=w+C,v=yield this.prisma.order.create({data:Object.assign(Object.assign({token:S(),referenceId:S(),organization:{connect:{id:t}},fulfilmentMethod:e.fulfilmentMethod,shippingMethod:e.shippingMethodId?{connect:{id:e.shippingMethodId}}:void 0,currency:c.configuration.defaultCurrency,sourceIp:"127.0.0.1",items:{create:y}},f?{shippingAddress:{create:Object.assign(Object.assign({},f),{id:void 0})}}:{}),{user:{connect:{id:i.id}},payment:{create:{method:e.payment.method,provider:e.payment.provider,shipping:(a=(s=h?.shippingZones[0])===null||s===void 0?void 0:s.price)!==null&&a!==void 0?a:0,subtotal:w,total:L,discount:0,currency:c.configuration.defaultCurrency}}}),include:{items:{include:{translations:!0,image:!0}},payment:!0,shippingMethod:{include:{shippingZones:!0}}}}),b=p.parse(v);return{redirectUrl:(o=(yield this.paymentService.createCheckoutSession(t,i,b,{locale:g,defaultLocale:c.configuration.defaultLocale,successUrl:`${e.checkoutBaseUrl}/account/orders/${v.id}?clearCart=true`,cancelUrl:`${e.checkoutBaseUrl}/checkout/shipping-and-payment`})).redirectUrl)!==null&&o!==void 0?o:void 0,order:p.parse(v)}})}hasCartConflict(t,i){return JSON.stringify(t)!==JSON.stringify(i)}sendOrderNotifications(t,i){return l(this,void 0,void 0,function*(){const e=yield this.prisma.order.findFirst({where:{id:t},include:{items:{include:{translations:!0,image:!0}},payment:!0,organization:{include:{address:!0,configuration:!0,logoFile:!0,members:{include:{user:!0}}}},shippingAddress:!0,shippingMethod:{include:{shippingZones:!0}}}}),r=i??e?.userId,n=r?yield this.prisma.user.findFirst({where:{id:r}}):null;if(!e||!n)return;const d=I.parse(n),s=Z.parse(e.organization),a=p.parse(e);yield this.safelySendEmail({emailType:"order-confirmation",orderId:e.id,organizationId:e.organizationId,userId:n.id},()=>this.emailService.sendOrderConfirmationEmail(e.organizationId,d,s,a));for(const o of e.organization.members)yield this.safelySendEmail({emailType:"order-notification",memberId:o.user.id,orderId:e.id,organizationId:e.organizationId,userId:n.id},()=>this.emailService.sendOrderNotificationEmail(e.organizationId,d,I.parse(o.user),s,a))})}getOrder(t,i,e){return l(this,void 0,void 0,function*(){const r=yield this.prisma.order.findUnique({where:{id:e,organizationId:i,deletedAt:null,user:{id:t.id}},include:{items:{include:{translations:!0,image:!0}},shippingAddress:!0,shippingMethod:{include:{shippingZones:!0}},payment:!0}});if(!r)throw new m(404,"Order not found");return p.parse(r)})}getMyOrders(t,i,e){return l(this,void 0,void 0,function*(){const{page:r=1,limit:n=10,search:d}=e,[s,a]=yield this.prisma.order.paginate({where:Object.assign({organizationId:i,userId:t,deletedAt:null},d?{referenceId:{contains:d,mode:"insensitive"}}:{}),include:{items:{include:{translations:!0,image:!0}},shippingAddress:!0,shippingMethod:{include:{shippingZones:!0}},payment:!0},orderBy:{createdAt:"desc"}}).withPages({page:r,limit:n});return{meta:A.parse(a),list:O.array(p).parse(s)}})}getOrders(t,i){return l(this,void 0,void 0,function*(){const{page:e=1,limit:r=10}=i,[n,d]=yield this.prisma.order.paginate({where:{organizationId:t,deletedAt:null},include:{items:{include:{translations:!0,image:!0}},shippingAddress:!0,shippingMethod:{include:{shippingZones:!0}},payment:!0},orderBy:{createdAt:"desc"}}).withPages({page:e,limit:r});return{meta:A.parse(d),list:O.array(p).parse(n)}})}deleteOrder(t,i,e){return l(this,void 0,void 0,function*(){if(!(yield this.prisma.order.findUnique({where:{id:i,organizationId:t,deletedAt:null}})))throw new m(404,"Order not found");yield this.prisma.order.update({where:{id:i,organizationId:t,deletedAt:null},data:{deletedAt:new Date,deletedBy:e}})})}updateStatus(t,i,e){return l(this,void 0,void 0,function*(){if(!(yield this.prisma.order.findUnique({where:{id:i,organizationId:t,deletedAt:null},include:{items:!0,shippingMethod:{include:{shippingZones:!0}}}})))throw new m(404,"Order not found");let n={};switch(e){case"accepted":n={acceptedAt:new Date};break;case"ready-for-dispatch":n={readyForDispatchAt:new Date};break;case"dispatched":n={dispatchedAt:new Date};break;case"completed":n={completedAt:new Date};break;case"cancelled":n={cancelledAt:new Date};break}const d=yield this.prisma.order.update({where:{id:i},data:n,include:{items:{include:{translations:!0,image:!0}},shippingAddress:!0,shippingMethod:{include:{shippingZones:!0}},payment:!0}});return p.parse(d)})}}export{_ as OrderService};export{z as OrderInventoryConflictError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";import{AddressSchema as t,CreateAddressSchema as o}from"../../schemas/address.schema";export const RecipientSchema=e.object({id:e.string().openapi({example:"clf9876543210abcdef",description:"ID of the customer"}),firstname:e.string().nullable().optional().openapi({example:"John Doe",description:"Name of the customer"}),email:e.string().nullable().optional().openapi({example:"john.doe@example.com",description:"Email of the customer"}),phone:e.string().nullable().optional().openapi({example:"+1234567890",description:"Phone number of the customer"}),address:t.nullable().optional().openapi({description:"Address of the customer"}),createdAt:e.date(),updatedAt:e.date()}).openapi("Customer"),CreateRecipientSchema=RecipientSchema.pick({firstname:!0,email:!0,phone:!0}).extend({address:o}).openapi("Customer"),UpdateCustomerSchema=CreateRecipientSchema.partial().openapi("UpdateCustomer");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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"),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"),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");
|
|
@@ -304,6 +304,7 @@ export declare const OrganizationConfigurationSchema: z.ZodObject<{
|
|
|
304
304
|
MYR: "MYR";
|
|
305
305
|
RON: "RON";
|
|
306
306
|
}>;
|
|
307
|
+
defaultTimeZone: z.ZodString;
|
|
307
308
|
createdAt: z.ZodDate;
|
|
308
309
|
}, z.core.$strip>;
|
|
309
310
|
export declare const UpdateOrganizationConfigurationSchema: z.ZodObject<{
|
|
@@ -441,6 +442,7 @@ export declare const UpdateOrganizationConfigurationSchema: z.ZodObject<{
|
|
|
441
442
|
ji: "ji";
|
|
442
443
|
zu: "zu";
|
|
443
444
|
}>>;
|
|
445
|
+
defaultTimeZone: z.ZodOptional<z.ZodString>;
|
|
444
446
|
countriesShipping: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
445
447
|
stripeAccountId: z.ZodOptional<z.ZodOptional<z.ZodCoercedString<unknown>>>;
|
|
446
448
|
enableHostCheckout: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";import{currency as n}from"../../schemas/currency.schema";import{locale as i}from"../../schemas/locales.schema";import{defaultTimeZone as o}from"../../schemas/time-zone.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"),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"}),isAcceptingReservations:e.boolean().openapi({example:!0,description:"Indicates if the organization is currently accepting reservations"}),isOpen:e.boolean().default(!1).openapi({example:!0,description:"Indicates if the organization is currently open"}),defaultLocale:i,supportedLocales:e.array(i).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:n.openapi({example:"USD",description:"Default currency for the organization"}),defaultTimeZone:o,createdAt:e.date().openapi({description:"Timestamp when the organization configuration was created"})}).openapi("OrganizationConfiguration"),UpdateOrganizationConfigurationSchema=OrganizationConfigurationSchema.pick({hostname:!0,countriesShipping:!0,stripeAccountId:!0,enableHostCheckout:!0,enableHostTracking:!0,isAcceptingOrders:!0,isAcceptingReservations:!0,defaultLocale:!0,supportedLocales:!0,defaultCurrency:!0,defaultTimeZone:!0,openingTimes:!0,closingTimes:!0,facebookProfile:!0,instagramProfile:!0,xProfile:!0}).partial().openapi("UpdateOrganizationConfiguration");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{__awaiter as d}from"tslib";import{createApiRouter as g}from"../../core/hono/hono";import{organizationRoute as s}from"./organization.route";export const registerOrganizationHandlers=r=>{const a=g();return a.openapi(s.getOrganizations,n=>d(void 0,void 0,void 0,function*(){const t=n.get("auth"),o=n.req.valid("query"),i=yield t.getCurrentUser(),e=yield r.getOrganizations(i.id,o);return n.json(e,200)})),a.openapi(s.getOrganization,n=>d(void 0,void 0,void 0,function*(){const t=n.req.valid("param"),o=yield r.getOrganization(t.organizationId);return n.json(o,200)})),a.openapi(s.createOrganization,n=>d(void 0,void 0,void 0,function*(){const t=n.get("auth"),o=n.req.valid("json"),i=yield t.getCurrentUser(),e=yield r.createOrganization(i.id,o);return n.json(e,201)})),a.openapi(s.updateOrganization,n=>d(void 0,void 0,void 0,function*(){const t=n.get("auth"),o=n.req.valid("param"),i=n.req.valid("json"),e=yield t.isGranted("update"),u=yield r.updateOrganization(o.organizationId,e.id,i);return n.json(u,200)})),a.openapi(s.deleteOrganization,n=>d(void 0,void 0,void 0,function*(){const t=n.get("auth"),o=n.req.valid("param"),i=yield t.isGranted("delete");return yield r.deleteOrganization(o.organizationId,i.id),n.body(null,204)})),a};
|
|
@@ -455,6 +455,7 @@ export declare const organizationRoute: {
|
|
|
455
455
|
MYR: "MYR";
|
|
456
456
|
RON: "RON";
|
|
457
457
|
}>;
|
|
458
|
+
defaultTimeZone: z.ZodString;
|
|
458
459
|
createdAt: z.ZodDate;
|
|
459
460
|
}, z.core.$strip>;
|
|
460
461
|
logo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -822,6 +823,7 @@ export declare const organizationRoute: {
|
|
|
822
823
|
MYR: "MYR";
|
|
823
824
|
RON: "RON";
|
|
824
825
|
}>;
|
|
826
|
+
defaultTimeZone: z.ZodString;
|
|
825
827
|
createdAt: z.ZodDate;
|
|
826
828
|
}, z.core.$strip>;
|
|
827
829
|
logo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -1216,6 +1218,7 @@ export declare const organizationRoute: {
|
|
|
1216
1218
|
MYR: "MYR";
|
|
1217
1219
|
RON: "RON";
|
|
1218
1220
|
}>;
|
|
1221
|
+
defaultTimeZone: z.ZodString;
|
|
1219
1222
|
createdAt: z.ZodDate;
|
|
1220
1223
|
}, z.core.$strip>;
|
|
1221
1224
|
logo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -1413,6 +1416,7 @@ export declare const organizationRoute: {
|
|
|
1413
1416
|
ji: "ji";
|
|
1414
1417
|
zu: "zu";
|
|
1415
1418
|
}>>;
|
|
1419
|
+
defaultTimeZone: z.ZodOptional<z.ZodString>;
|
|
1416
1420
|
countriesShipping: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1417
1421
|
stripeAccountId: z.ZodOptional<z.ZodOptional<z.ZodCoercedString<unknown>>>;
|
|
1418
1422
|
enableHostCheckout: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1909,6 +1913,7 @@ export declare const organizationRoute: {
|
|
|
1909
1913
|
MYR: "MYR";
|
|
1910
1914
|
RON: "RON";
|
|
1911
1915
|
}>;
|
|
1916
|
+
defaultTimeZone: z.ZodString;
|
|
1912
1917
|
createdAt: z.ZodDate;
|
|
1913
1918
|
}, z.core.$strip>;
|
|
1914
1919
|
logo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{z as o}from"@hono/zod-openapi";import{createApiRoute as a}from"../../core/hono/hono";import{CreateOrganizationSchema as r,ErrorSchema as i,HeaderSchema as t,OrganizationParams as e,OrganizationSchema as n,PaginationMetaSchema as s,PaginationQuerySchema as g,UpdateOrganizationSchema as z}from"../../schemas";const p=a({description:"Fetches a paginated list of organizations",headers:t,method:"GET",operationId:"getOrganizations",path:"/organizations",query:g,responses:{200:o.object({list:o.array(n),meta:s})},summary:"Get Organizations",tags:["Organization"]}),d=a({description:"Fetches a specific organization by ID",headers:t,method:"GET",operationId:"getOrganization",path:"/organizations/:organizationId",pathParams:e,responses:{200:n,404:i},summary:"Get Organization",tags:["Organization"]}),m=a({body:r,description:"Creates a new organization",headers:t,method:"POST",operationId:"createOrganization",path:"/organizations",responses:{201:n,400:i},summary:"Create Organization",tags:["Organization"]}),c=a({body:z,description:"Updates a specific organization by ID",headers:t,method:"PATCH",operationId:"updateOrganization",path:"/organizations/:organizationId",pathParams:e,responses:{200:n,404:i},summary:"Update Organization",tags:["Organization"]}),O=a({description:"Deletes a specific organization by ID",headers:t,method:"DELETE",operationId:"deleteOrganization",path:"/organizations/:organizationId",pathParams:e,responses:{204:null,404:i},summary:"Delete Organization",tags:["Organization"]});export const organizationRoute={getOrganizations:p,getOrganization:d,createOrganization:m,updateOrganization:c,deleteOrganization:O};
|
|
@@ -316,6 +316,7 @@ export declare const OrganizationSchema: z.ZodObject<{
|
|
|
316
316
|
MYR: "MYR";
|
|
317
317
|
RON: "RON";
|
|
318
318
|
}>;
|
|
319
|
+
defaultTimeZone: z.ZodString;
|
|
319
320
|
createdAt: z.ZodDate;
|
|
320
321
|
}, z.core.$strip>;
|
|
321
322
|
logo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -505,6 +506,7 @@ export declare const UpdateOrganizationSchema: z.ZodObject<{
|
|
|
505
506
|
ji: "ji";
|
|
506
507
|
zu: "zu";
|
|
507
508
|
}>>;
|
|
509
|
+
defaultTimeZone: z.ZodOptional<z.ZodString>;
|
|
508
510
|
countriesShipping: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
509
511
|
stripeAccountId: z.ZodOptional<z.ZodOptional<z.ZodCoercedString<unknown>>>;
|
|
510
512
|
enableHostCheckout: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";import{AddressSchema as i,CreateAddressSchema as a,UpdateAddressSchema as o}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"),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:a}).openapi("CreateOrganization"),UpdateOrganizationSchema=CreateOrganizationSchema.extend({address:o,configuration:r}).partial().openapi("UpdateOrganization");
|
|
@@ -54,6 +54,7 @@ declare class OrganizationService {
|
|
|
54
54
|
defaultLocale: "hr" | "th" | "tr" | "id" | "is" | "mt" | "ml" | "af" | "sq" | "ar_dz" | "ar_bh" | "ar_eg" | "ar_iq" | "ar_jo" | "ar_kw" | "ar_lb" | "ar_ly" | "ar_ma" | "ar_om" | "ar_qa" | "ar_sa" | "ar_sy" | "ar_tn" | "ar_ae" | "ar_ye" | "eu" | "be" | "bg" | "ca" | "zh_hk" | "zh_cn" | "zh_sg" | "zh_tw" | "cs" | "da" | "nl_be" | "nl" | "en" | "en_au" | "en_bz" | "en_ca" | "en_ie" | "en_jm" | "en_nz" | "en_za" | "en_tt" | "en_gb" | "en_us" | "et" | "fo" | "fa" | "fi" | "fr_be" | "fr_ca" | "fr_lu" | "fr" | "fr_ch" | "gd" | "de_at" | "de_li" | "de_lu" | "de" | "de_ch" | "el" | "he" | "hi" | "hu" | "ga" | "it" | "it_ch" | "ja" | "ko" | "ku" | "lv" | "lt" | "mk" | "ms" | "no" | "nb" | "nn" | "pl" | "pt_br" | "pt" | "pa" | "rm" | "ro" | "ro_md" | "ru" | "ru_md" | "sr" | "sk" | "sl" | "sb" | "es_ar" | "es_bo" | "es_cl" | "es_co" | "es_cr" | "es_do" | "es_ec" | "es_sv" | "es_gt" | "es_hn" | "es_mx" | "es" | "sv" | "sv_fi" | "uk" | "ur" | "vi" | "cy" | "ji" | "zu";
|
|
55
55
|
supportedLocales: ("hr" | "th" | "tr" | "id" | "is" | "mt" | "ml" | "af" | "sq" | "ar_dz" | "ar_bh" | "ar_eg" | "ar_iq" | "ar_jo" | "ar_kw" | "ar_lb" | "ar_ly" | "ar_ma" | "ar_om" | "ar_qa" | "ar_sa" | "ar_sy" | "ar_tn" | "ar_ae" | "ar_ye" | "eu" | "be" | "bg" | "ca" | "zh_hk" | "zh_cn" | "zh_sg" | "zh_tw" | "cs" | "da" | "nl_be" | "nl" | "en" | "en_au" | "en_bz" | "en_ca" | "en_ie" | "en_jm" | "en_nz" | "en_za" | "en_tt" | "en_gb" | "en_us" | "et" | "fo" | "fa" | "fi" | "fr_be" | "fr_ca" | "fr_lu" | "fr" | "fr_ch" | "gd" | "de_at" | "de_li" | "de_lu" | "de" | "de_ch" | "el" | "he" | "hi" | "hu" | "ga" | "it" | "it_ch" | "ja" | "ko" | "ku" | "lv" | "lt" | "mk" | "ms" | "no" | "nb" | "nn" | "pl" | "pt_br" | "pt" | "pa" | "rm" | "ro" | "ro_md" | "ru" | "ru_md" | "sr" | "sk" | "sl" | "sb" | "es_ar" | "es_bo" | "es_cl" | "es_co" | "es_cr" | "es_do" | "es_ec" | "es_sv" | "es_gt" | "es_hn" | "es_mx" | "es" | "sv" | "sv_fi" | "uk" | "ur" | "vi" | "cy" | "ji" | "zu")[];
|
|
56
56
|
defaultCurrency: "USD" | "EUR" | "GBP" | "JPY" | "AUD" | "CAD" | "CHF" | "CNY" | "SEK" | "NZD" | "MXN" | "SGD" | "HKD" | "NOK" | "KRW" | "TRY" | "RUB" | "INR" | "BRL" | "ZAR" | "DKK" | "PLN" | "THB" | "IDR" | "HUF" | "CZK" | "ILS" | "PHP" | "AED" | "COP" | "SAR" | "MYR" | "RON";
|
|
57
|
+
defaultTimeZone: string;
|
|
57
58
|
createdAt: Date;
|
|
58
59
|
hostname?: string | undefined;
|
|
59
60
|
stripeAccountId?: string | undefined;
|
|
@@ -126,6 +127,7 @@ declare class OrganizationService {
|
|
|
126
127
|
defaultLocale: "hr" | "th" | "tr" | "id" | "is" | "mt" | "ml" | "af" | "sq" | "ar_dz" | "ar_bh" | "ar_eg" | "ar_iq" | "ar_jo" | "ar_kw" | "ar_lb" | "ar_ly" | "ar_ma" | "ar_om" | "ar_qa" | "ar_sa" | "ar_sy" | "ar_tn" | "ar_ae" | "ar_ye" | "eu" | "be" | "bg" | "ca" | "zh_hk" | "zh_cn" | "zh_sg" | "zh_tw" | "cs" | "da" | "nl_be" | "nl" | "en" | "en_au" | "en_bz" | "en_ca" | "en_ie" | "en_jm" | "en_nz" | "en_za" | "en_tt" | "en_gb" | "en_us" | "et" | "fo" | "fa" | "fi" | "fr_be" | "fr_ca" | "fr_lu" | "fr" | "fr_ch" | "gd" | "de_at" | "de_li" | "de_lu" | "de" | "de_ch" | "el" | "he" | "hi" | "hu" | "ga" | "it" | "it_ch" | "ja" | "ko" | "ku" | "lv" | "lt" | "mk" | "ms" | "no" | "nb" | "nn" | "pl" | "pt_br" | "pt" | "pa" | "rm" | "ro" | "ro_md" | "ru" | "ru_md" | "sr" | "sk" | "sl" | "sb" | "es_ar" | "es_bo" | "es_cl" | "es_co" | "es_cr" | "es_do" | "es_ec" | "es_sv" | "es_gt" | "es_hn" | "es_mx" | "es" | "sv" | "sv_fi" | "uk" | "ur" | "vi" | "cy" | "ji" | "zu";
|
|
127
128
|
supportedLocales: ("hr" | "th" | "tr" | "id" | "is" | "mt" | "ml" | "af" | "sq" | "ar_dz" | "ar_bh" | "ar_eg" | "ar_iq" | "ar_jo" | "ar_kw" | "ar_lb" | "ar_ly" | "ar_ma" | "ar_om" | "ar_qa" | "ar_sa" | "ar_sy" | "ar_tn" | "ar_ae" | "ar_ye" | "eu" | "be" | "bg" | "ca" | "zh_hk" | "zh_cn" | "zh_sg" | "zh_tw" | "cs" | "da" | "nl_be" | "nl" | "en" | "en_au" | "en_bz" | "en_ca" | "en_ie" | "en_jm" | "en_nz" | "en_za" | "en_tt" | "en_gb" | "en_us" | "et" | "fo" | "fa" | "fi" | "fr_be" | "fr_ca" | "fr_lu" | "fr" | "fr_ch" | "gd" | "de_at" | "de_li" | "de_lu" | "de" | "de_ch" | "el" | "he" | "hi" | "hu" | "ga" | "it" | "it_ch" | "ja" | "ko" | "ku" | "lv" | "lt" | "mk" | "ms" | "no" | "nb" | "nn" | "pl" | "pt_br" | "pt" | "pa" | "rm" | "ro" | "ro_md" | "ru" | "ru_md" | "sr" | "sk" | "sl" | "sb" | "es_ar" | "es_bo" | "es_cl" | "es_co" | "es_cr" | "es_do" | "es_ec" | "es_sv" | "es_gt" | "es_hn" | "es_mx" | "es" | "sv" | "sv_fi" | "uk" | "ur" | "vi" | "cy" | "ji" | "zu")[];
|
|
128
129
|
defaultCurrency: "USD" | "EUR" | "GBP" | "JPY" | "AUD" | "CAD" | "CHF" | "CNY" | "SEK" | "NZD" | "MXN" | "SGD" | "HKD" | "NOK" | "KRW" | "TRY" | "RUB" | "INR" | "BRL" | "ZAR" | "DKK" | "PLN" | "THB" | "IDR" | "HUF" | "CZK" | "ILS" | "PHP" | "AED" | "COP" | "SAR" | "MYR" | "RON";
|
|
130
|
+
defaultTimeZone: string;
|
|
129
131
|
createdAt: Date;
|
|
130
132
|
hostname?: string | undefined;
|
|
131
133
|
stripeAccountId?: string | undefined;
|
|
@@ -195,6 +197,7 @@ declare class OrganizationService {
|
|
|
195
197
|
defaultLocale: "hr" | "th" | "tr" | "id" | "is" | "mt" | "ml" | "af" | "sq" | "ar_dz" | "ar_bh" | "ar_eg" | "ar_iq" | "ar_jo" | "ar_kw" | "ar_lb" | "ar_ly" | "ar_ma" | "ar_om" | "ar_qa" | "ar_sa" | "ar_sy" | "ar_tn" | "ar_ae" | "ar_ye" | "eu" | "be" | "bg" | "ca" | "zh_hk" | "zh_cn" | "zh_sg" | "zh_tw" | "cs" | "da" | "nl_be" | "nl" | "en" | "en_au" | "en_bz" | "en_ca" | "en_ie" | "en_jm" | "en_nz" | "en_za" | "en_tt" | "en_gb" | "en_us" | "et" | "fo" | "fa" | "fi" | "fr_be" | "fr_ca" | "fr_lu" | "fr" | "fr_ch" | "gd" | "de_at" | "de_li" | "de_lu" | "de" | "de_ch" | "el" | "he" | "hi" | "hu" | "ga" | "it" | "it_ch" | "ja" | "ko" | "ku" | "lv" | "lt" | "mk" | "ms" | "no" | "nb" | "nn" | "pl" | "pt_br" | "pt" | "pa" | "rm" | "ro" | "ro_md" | "ru" | "ru_md" | "sr" | "sk" | "sl" | "sb" | "es_ar" | "es_bo" | "es_cl" | "es_co" | "es_cr" | "es_do" | "es_ec" | "es_sv" | "es_gt" | "es_hn" | "es_mx" | "es" | "sv" | "sv_fi" | "uk" | "ur" | "vi" | "cy" | "ji" | "zu";
|
|
196
198
|
supportedLocales: ("hr" | "th" | "tr" | "id" | "is" | "mt" | "ml" | "af" | "sq" | "ar_dz" | "ar_bh" | "ar_eg" | "ar_iq" | "ar_jo" | "ar_kw" | "ar_lb" | "ar_ly" | "ar_ma" | "ar_om" | "ar_qa" | "ar_sa" | "ar_sy" | "ar_tn" | "ar_ae" | "ar_ye" | "eu" | "be" | "bg" | "ca" | "zh_hk" | "zh_cn" | "zh_sg" | "zh_tw" | "cs" | "da" | "nl_be" | "nl" | "en" | "en_au" | "en_bz" | "en_ca" | "en_ie" | "en_jm" | "en_nz" | "en_za" | "en_tt" | "en_gb" | "en_us" | "et" | "fo" | "fa" | "fi" | "fr_be" | "fr_ca" | "fr_lu" | "fr" | "fr_ch" | "gd" | "de_at" | "de_li" | "de_lu" | "de" | "de_ch" | "el" | "he" | "hi" | "hu" | "ga" | "it" | "it_ch" | "ja" | "ko" | "ku" | "lv" | "lt" | "mk" | "ms" | "no" | "nb" | "nn" | "pl" | "pt_br" | "pt" | "pa" | "rm" | "ro" | "ro_md" | "ru" | "ru_md" | "sr" | "sk" | "sl" | "sb" | "es_ar" | "es_bo" | "es_cl" | "es_co" | "es_cr" | "es_do" | "es_ec" | "es_sv" | "es_gt" | "es_hn" | "es_mx" | "es" | "sv" | "sv_fi" | "uk" | "ur" | "vi" | "cy" | "ji" | "zu")[];
|
|
197
199
|
defaultCurrency: "USD" | "EUR" | "GBP" | "JPY" | "AUD" | "CAD" | "CHF" | "CNY" | "SEK" | "NZD" | "MXN" | "SGD" | "HKD" | "NOK" | "KRW" | "TRY" | "RUB" | "INR" | "BRL" | "ZAR" | "DKK" | "PLN" | "THB" | "IDR" | "HUF" | "CZK" | "ILS" | "PHP" | "AED" | "COP" | "SAR" | "MYR" | "RON";
|
|
200
|
+
defaultTimeZone: string;
|
|
198
201
|
createdAt: Date;
|
|
199
202
|
hostname?: string | undefined;
|
|
200
203
|
stripeAccountId?: string | undefined;
|
|
@@ -264,6 +267,7 @@ declare class OrganizationService {
|
|
|
264
267
|
defaultLocale: "hr" | "th" | "tr" | "id" | "is" | "mt" | "ml" | "af" | "sq" | "ar_dz" | "ar_bh" | "ar_eg" | "ar_iq" | "ar_jo" | "ar_kw" | "ar_lb" | "ar_ly" | "ar_ma" | "ar_om" | "ar_qa" | "ar_sa" | "ar_sy" | "ar_tn" | "ar_ae" | "ar_ye" | "eu" | "be" | "bg" | "ca" | "zh_hk" | "zh_cn" | "zh_sg" | "zh_tw" | "cs" | "da" | "nl_be" | "nl" | "en" | "en_au" | "en_bz" | "en_ca" | "en_ie" | "en_jm" | "en_nz" | "en_za" | "en_tt" | "en_gb" | "en_us" | "et" | "fo" | "fa" | "fi" | "fr_be" | "fr_ca" | "fr_lu" | "fr" | "fr_ch" | "gd" | "de_at" | "de_li" | "de_lu" | "de" | "de_ch" | "el" | "he" | "hi" | "hu" | "ga" | "it" | "it_ch" | "ja" | "ko" | "ku" | "lv" | "lt" | "mk" | "ms" | "no" | "nb" | "nn" | "pl" | "pt_br" | "pt" | "pa" | "rm" | "ro" | "ro_md" | "ru" | "ru_md" | "sr" | "sk" | "sl" | "sb" | "es_ar" | "es_bo" | "es_cl" | "es_co" | "es_cr" | "es_do" | "es_ec" | "es_sv" | "es_gt" | "es_hn" | "es_mx" | "es" | "sv" | "sv_fi" | "uk" | "ur" | "vi" | "cy" | "ji" | "zu";
|
|
265
268
|
supportedLocales: ("hr" | "th" | "tr" | "id" | "is" | "mt" | "ml" | "af" | "sq" | "ar_dz" | "ar_bh" | "ar_eg" | "ar_iq" | "ar_jo" | "ar_kw" | "ar_lb" | "ar_ly" | "ar_ma" | "ar_om" | "ar_qa" | "ar_sa" | "ar_sy" | "ar_tn" | "ar_ae" | "ar_ye" | "eu" | "be" | "bg" | "ca" | "zh_hk" | "zh_cn" | "zh_sg" | "zh_tw" | "cs" | "da" | "nl_be" | "nl" | "en" | "en_au" | "en_bz" | "en_ca" | "en_ie" | "en_jm" | "en_nz" | "en_za" | "en_tt" | "en_gb" | "en_us" | "et" | "fo" | "fa" | "fi" | "fr_be" | "fr_ca" | "fr_lu" | "fr" | "fr_ch" | "gd" | "de_at" | "de_li" | "de_lu" | "de" | "de_ch" | "el" | "he" | "hi" | "hu" | "ga" | "it" | "it_ch" | "ja" | "ko" | "ku" | "lv" | "lt" | "mk" | "ms" | "no" | "nb" | "nn" | "pl" | "pt_br" | "pt" | "pa" | "rm" | "ro" | "ro_md" | "ru" | "ru_md" | "sr" | "sk" | "sl" | "sb" | "es_ar" | "es_bo" | "es_cl" | "es_co" | "es_cr" | "es_do" | "es_ec" | "es_sv" | "es_gt" | "es_hn" | "es_mx" | "es" | "sv" | "sv_fi" | "uk" | "ur" | "vi" | "cy" | "ji" | "zu")[];
|
|
266
269
|
defaultCurrency: "USD" | "EUR" | "GBP" | "JPY" | "AUD" | "CAD" | "CHF" | "CNY" | "SEK" | "NZD" | "MXN" | "SGD" | "HKD" | "NOK" | "KRW" | "TRY" | "RUB" | "INR" | "BRL" | "ZAR" | "DKK" | "PLN" | "THB" | "IDR" | "HUF" | "CZK" | "ILS" | "PHP" | "AED" | "COP" | "SAR" | "MYR" | "RON";
|
|
270
|
+
defaultTimeZone: string;
|
|
267
271
|
createdAt: Date;
|
|
268
272
|
hostname?: string | undefined;
|
|
269
273
|
stripeAccountId?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x431135=_0x4dd9,_0x356f33=_0x4dd9;function _0x4621(){const _0x120268=['y29UzMLNDxi','BwfW','Aw5Nt3jKzxi','B1rPBwvtDhi','C1nOAxbWAw4','mJyZnKn2v3zLEq','zw5HyMXLsg8','B3bLBMLUz1q','Dgvty2HLzhu','z2v0ugXHy2u','DgH1CNnKyxK','D2L0AfbHz2u','Bgf0Axr1zgu','C3ruCMfJA2K','BgvuB1rPBwu','DhvLC2rHEq','yxrPB24','zgvZyW','ntqWode1EhPgAufK','ve1Lq1i','BgXPC2vJB24','Aw5N','r29Vz2XLie0','mteYnJy0v3bTDxHm','DgLVBG','DxbKyxrLt3i','Aw1LCW','CMvKDwnL','yxjYyxK','zw1HAwW','ywrKCMvZCW','mI1KAwDPDa','rxvYB3bLl1C','otm0mJa5zKrqwfbn','y3jLyxrLt3i','zNjPzgf5','rgv0ywLSCW','Dg9mB2nHBgu','CgfNAw5HDgu','C2f0DxjKyxK','A2v5igLZihi','CgXHy2vjza','yxnZAwDU','y2XVC2LUz1q','u3rYAw5N','rgf0zvn0CMK','DxbKyxrL','mtj5EfL5yNm','zxf1AxjLza','nZGZCwnSqNPJ','Axnby2nLChq','C3vUzgf5','zMLUzfvUAxe','BMfTzq','mtuXmtC0ogntAuDLra','zgvMyxvSDem','CMvXDwLYzuW','C2v0vvrdsg8','DMf0Aw9UCW','B2nHDgLVBLm','vgLTzvn0CMK','DgLVBIbUB3q','Bg9Uz2L0Dwq','z2fUAxPHDgK','mtbPvgH0twS','yunJAva','ALngyLi','AxPHDgLVBG','C3rdAgvJA28','zM9YBwf0rge','y29UDMvYDfq','Dg9mB3DLCKm','z2v0t3jNyw4','B3DUzxi','CgHVBMu','BNv0zxm','y291BNrYAwu','Bg9JyxrPB24','DxjYzw5JEq','vvrd','t3jNyw5PEMe','B3jNyw5PEMe','zgvSzxrLt3i','Bg9NB0LK','Aw5NuMvZzxi','u2vYDMLJzq','y29Uzhm','igzVDw5K','mJeXodiWmfLHyKTjtW','yxnL','zw4Tvvm','y3jLyxrL','zxj2AwnL','ChjPC21H','C3bSAxq','CgfYC2u','yxjZyxC','zgvMyxvSDeW','mJi5odi0qMPKsKDu','Bw9Uzgf5','D2vKBMvZzge'];_0x4621=function(){return _0x120268;};return _0x4621();}(function(_0x14828a,_0x5ceb57){const _0x550e38=_0x4dd9,_0x23c3ef=_0x4dd9,_0x2ba2cf=_0x14828a();while(!![]){try{const _0x489b4d=parseInt(_0x550e38(0x1c5))/0x1+parseInt(_0x23c3ef(0x1b3))/0x2*(parseInt(_0x550e38(0x1df))/0x3)+-parseInt(_0x550e38(0x1dd))/0x4*(parseInt(_0x23c3ef(0x1c0))/0x5)+parseInt(_0x23c3ef(0x1e4))/0x6+-parseInt(_0x550e38(0x1ab))/0x7+-parseInt(_0x23c3ef(0x1a1))/0x8+parseInt(_0x23c3ef(0x1cf))/0x9*(parseInt(_0x23c3ef(0x1ee))/0xa);if(_0x489b4d===_0x5ceb57)break;else _0x2ba2cf['push'](_0x2ba2cf['shift']());}catch(_0x5b3d5c){_0x2ba2cf['push'](_0x2ba2cf['shift']());}}}(_0x4621,0x2e775));import{__awaiter as _0x3bb9cc}from'tslib';import{z as _0x29a6a}from'@hono/zod-openapi';function _0x4dd9(_0x36dd76,_0x33a131){_0x36dd76=_0x36dd76-0x19e;const _0x46214b=_0x4621();let _0x4dd92f=_0x46214b[_0x36dd76];if(_0x4dd9['XfCCsR']===undefined){var _0x6fc762=function(_0x5d1cc4){const _0x367dcb='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0xa10245='',_0x434f64='';for(let _0x181479=0x0,_0x5d009a,_0x150b86,_0x42999f=0x0;_0x150b86=_0x5d1cc4['charAt'](_0x42999f++);~_0x150b86&&(_0x5d009a=_0x181479%0x4?_0x5d009a*0x40+_0x150b86:_0x150b86,_0x181479++%0x4)?_0xa10245+=String['fromCharCode'](0xff&_0x5d009a>>(-0x2*_0x181479&0x6)):0x0){_0x150b86=_0x367dcb['indexOf'](_0x150b86);}for(let _0x149387=0x0,_0x48c049=_0xa10245['length'];_0x149387<_0x48c049;_0x149387++){_0x434f64+='%'+('00'+_0xa10245['charCodeAt'](_0x149387)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x434f64);};_0x4dd9['toOSkF']=_0x6fc762,_0x4dd9['uOQwDt']={},_0x4dd9['XfCCsR']=!![];}const _0x1314aa=_0x46214b[0x0],_0x21cadf=_0x36dd76+_0x1314aa,_0x2fbeae=_0x4dd9['uOQwDt'][_0x21cadf];return!_0x2fbeae?(_0x4dd92f=_0x4dd9['toOSkF'](_0x4dd92f),_0x4dd9['uOQwDt'][_0x21cadf]=_0x4dd92f):_0x4dd92f=_0x2fbeae,_0x4dd92f;}import{HttpException as _0x4bb76c}from'../../core/exceptions/http-exception';import{OrganizationSchema as _0x2bb98c,PaginationMetaSchema as _0xc7c631}from'../../schemas';class S{constructor(_0x451f4f,_0x1f6b90){const _0x5b4b1f=_0x4dd9,_0x5f3756=_0x4dd9;this[_0x5b4b1f(0x1a6)]=_0x451f4f,this[_0x5f3756(0x1fb)+_0x5b4b1f(0x19e)]=_0x1f6b90,this['convertT'+_0x5f3756(0x1b1)+_0x5f3756(0x1c3)]=_0x325dde=>_0x325dde?_0x325dde[_0x5f3756(0x1d3)+'TimeStri'+'ng']('en-US',{'hour':_0x5b4b1f(0x1cd),'minute':_0x5b4b1f(0x1cd),'hour12':!0x1,'timeZone':_0x5f3756(0x1fd)}):'';}['requireL'+_0x431135(0x1e9)+_0x431135(0x1a5)](){const _0x5e31a2=_0x431135,_0x2a610a=_0x431135;if(!this[_0x5e31a2(0x1fb)+_0x5e31a2(0x19e)])throw new Error(_0x5e31a2(0x1c4)+'aps\x20API\x20'+_0x2a610a(0x1d6)+_0x5e31a2(0x1de));return this[_0x2a610a(0x1fb)+_0x2a610a(0x19e)];}[_0x356f33(0x1f6)+'izations'](_0x3376d0,_0x2c5df7){return _0x3bb9cc(this,void 0x0,void 0x0,function*(){const _0x5adf0b=_0x4dd9,_0x186afd=_0x4dd9,{page:_0x4479f9,limit:_0x493737}=_0x2c5df7,[_0x34bf1f,_0x5b3237]=yield this[_0x5adf0b(0x1a6)][_0x186afd(0x1ff)+_0x5adf0b(0x1c6)][_0x5adf0b(0x1d4)]({'orderBy':{'createdAt':_0x5adf0b(0x1bf)},'where':{'members':{'some':{'userId':_0x3376d0}}},'include':{'address':!0x0,'configuration':!0x0,'logoFile':!0x0}})[_0x186afd(0x1b9)+'s']({'page':_0x4479f9,'limit':_0x493737});return{'meta':_0xc7c631[_0x186afd(0x1a8)](_0x5b3237),'list':_0x29a6a[_0x186afd(0x1ca)](_0x2bb98c)[_0x186afd(0x1a8)](_0x34bf1f)};});}[_0x431135(0x1f3)+'teSchedu'+_0x356f33(0x1bc)+_0x431135(0x1da)](_0x1403ac){const _0x1a21d1=_0x431135,_0x7c4aaf=_0x431135,_0x4348c8={'aCciP':'wednesda'+'y','TMeCR':_0x1a21d1(0x1b8)};return _0x1403ac?[_0x1a21d1(0x1ac),_0x7c4aaf(0x1bd),_0x4348c8[_0x7c4aaf(0x1ef)],_0x4348c8[_0x1a21d1(0x1c1)],_0x7c4aaf(0x1d1),_0x7c4aaf(0x1d5),_0x1a21d1(0x1e1)][_0x7c4aaf(0x1c9)]((_0x54f669,_0x404185)=>(_0x54f669[_0x404185]=this[_0x7c4aaf(0x1f4)+_0x1a21d1(0x1b1)+_0x7c4aaf(0x1c3)](_0x1403ac[_0x404185]),_0x54f669),{}):null;}[_0x356f33(0x1f6)+_0x356f33(0x1f1)](_0x900c96){return _0x3bb9cc(this,void 0x0,void 0x0,function*(){const _0x37fba1=_0x4dd9,_0xe3b7ed=_0x4dd9;var _0xfa7ea,_0x3105f4;const _0x229296=yield this['prisma'][_0x37fba1(0x1ff)+_0x37fba1(0x1c6)][_0x37fba1(0x1e2)+'ue']({'where':{'id':_0x900c96,'deletedAt':null},'include':{'address':!0x0,'configuration':{'include':{'openingTimes':!0x0,'closingTimes':!0x0}},'logoFile':!0x0}});if(!_0x229296)throw new _0x4bb76c(0x194,'Organiza'+_0x37fba1(0x1eb)+'\x20found');const _0x1c4c8d=((()=>{const _0x1f0cda=_0x37fba1,_0x3053d5=_0x37fba1;if(!_0x229296[_0x1f0cda(0x1ae)+_0x1f0cda(0x1be)][_0x1f0cda(0x1e0)+_0x3053d5(0x1b0)+'s']||!_0x229296[_0x3053d5(0x1ae)+_0x1f0cda(0x1be)]['openingT'+_0x1f0cda(0x1c8)]||!_0x229296[_0x3053d5(0x1ae)+_0x3053d5(0x1be)][_0x1f0cda(0x1d9)+_0x1f0cda(0x1c8)])return!0x1;const _0x1f5ebb=new Date(new Date()['toLocale'+'String'](_0x1f0cda(0x1a3),{'timeZone':'Europe/W'+'arsaw'})),_0x12900c=_0x1f5ebb[_0x1f0cda(0x1d3)+_0x3053d5(0x1db)+'ng'](_0x1f0cda(0x1a3),{'weekday':'long'})[_0x1f0cda(0x1f5)+_0x1f0cda(0x1a2)](),_0x218058=_0x1f5ebb[_0x3053d5(0x1d3)+_0x3053d5(0x1ea)+'ng'](_0x1f0cda(0x1a3),{'hour':_0x1f0cda(0x1cd),'minute':_0x1f0cda(0x1cd),'hour12':!0x1,'timeZone':_0x1f0cda(0x1ce)+_0x1f0cda(0x1a9)}),_0x5b5624=_0x229296[_0x3053d5(0x1ae)+_0x3053d5(0x1be)][_0x3053d5(0x1b5)+_0x3053d5(0x1c8)][_0x12900c],_0x34dede=_0x229296[_0x1f0cda(0x1ae)+_0x3053d5(0x1be)][_0x1f0cda(0x1d9)+_0x3053d5(0x1c8)][_0x12900c];if(!_0x5b5624||!_0x34dede)return!0x1;const _0x3db2cc=this[_0x3053d5(0x1f4)+_0x1f0cda(0x1b1)+_0x3053d5(0x1c3)](_0x5b5624),_0x21abea=this[_0x1f0cda(0x1f4)+_0x1f0cda(0x1b1)+'ing'](_0x34dede);return _0x218058>=_0x3db2cc&&_0x218058<=_0x21abea;})());return _0x2bb98c[_0xe3b7ed(0x1a8)](Object[_0x37fba1(0x1d8)](Object[_0x37fba1(0x1d8)]({},_0x229296),{'configuration':Object[_0xe3b7ed(0x1d8)](Object[_0x37fba1(0x1d8)]({},_0x229296['configur'+_0xe3b7ed(0x1be)]),{'isOpen':_0x1c4c8d,'openingTimes':(_0xfa7ea=this[_0x37fba1(0x1f3)+_0xe3b7ed(0x1b6)+_0xe3b7ed(0x1bc)+_0x37fba1(0x1da)](_0x229296['configur'+_0xe3b7ed(0x1be)][_0x37fba1(0x1b5)+'imes']))!==null&&_0xfa7ea!==void 0x0?_0xfa7ea:void 0x0,'closingTimes':(_0x3105f4=this[_0xe3b7ed(0x1f3)+'teSchedu'+_0xe3b7ed(0x1bc)+'String'](_0x229296['configur'+'ation'][_0x37fba1(0x1d9)+_0xe3b7ed(0x1c8)]))!==null&&_0x3105f4!==void 0x0?_0x3105f4:void 0x0})}));});}[_0x431135(0x1d0)+_0x431135(0x1ed)+'on'](_0x1aae94,_0xabd98a){const _0x3c4023=_0x356f33,_0x3f318f={'VhVXj':_0x3c4023(0x1f7)};return _0x3bb9cc(this,void 0x0,void 0x0,function*(){const _0x4b5b99=_0x3c4023,_0x4b5674=_0x3c4023;var _0x52a7cb,_0xb86f60;const _0x41ffbb=yield this[_0x4b5b99(0x1e6)+_0x4b5b99(0x1e9)+_0x4b5674(0x1a5)]()['getPlace'+_0x4b5674(0x1d2)](_0xabd98a[_0x4b5674(0x1cc)][_0x4b5674(0x1d7)]),_0x5b52b1=yield this[_0x4b5674(0x1a6)][_0x4b5674(0x1ff)+_0x4b5b99(0x1c6)][_0x4b5b99(0x1a4)]({'data':Object[_0x4b5674(0x1d8)]({'name':_0xabd98a[_0x4b5674(0x1e3)],'phone':_0xabd98a[_0x4b5b99(0x1f8)],'email':_0xabd98a[_0x4b5b99(0x1cb)],'address':{'create':Object[_0x4b5674(0x1d8)](Object[_0x4b5b99(0x1d8)]({},_0xabd98a[_0x4b5b99(0x1cc)]),{'latitude':_0x41ffbb['latitude'],'longitude':_0x41ffbb[_0x4b5b99(0x1ec)+'e'],'createdBy':_0x1aae94})},'configuration':{'create':{'countriesShipping':['us'],'createdBy':_0x1aae94,'enableHostCheckout':!0x1,'enableHostTracking':!0x1,'isAcceptingReservations':!0x1,'openingTimes':{'create':{'monday':null,'tuesday':null,'wednesday':null,'thursday':null,'friday':null,'saturday':null,'sunday':null}},'closingTimes':{'create':{'monday':null,'tuesday':null,'wednesday':null,'thursday':null,'friday':null,'saturday':null}}}},'members':{'create':{'user':{'connect':{'id':_0x1aae94}},'role':_0x3f318f['VhVXj']}},'createdBy':_0x1aae94},_0xabd98a[_0x4b5b99(0x201)]?{'logoFile':{'connect':{'id':_0xabd98a[_0x4b5674(0x201)]}}}:{}),'include':{'address':!0x0,'configuration':{'include':{'openingTimes':!0x0,'closingTimes':!0x0}},'logoFile':!0x0}});return _0x2bb98c[_0x4b5b99(0x1a8)](Object[_0x4b5674(0x1d8)](Object[_0x4b5b99(0x1d8)]({},_0x5b52b1),{'configuration':Object[_0x4b5674(0x1d8)](Object[_0x4b5b99(0x1d8)]({},_0x5b52b1[_0x4b5b99(0x1ae)+_0x4b5674(0x1be)]),{'openingTimes':(_0x52a7cb=this[_0x4b5674(0x1f3)+'teSchedu'+'leToTime'+_0x4b5674(0x1da)](_0x5b52b1[_0x4b5674(0x1ae)+_0x4b5674(0x1be)][_0x4b5b99(0x1b5)+_0x4b5b99(0x1c8)]))!==null&&_0x52a7cb!==void 0x0?_0x52a7cb:void 0x0,'closingTimes':(_0xb86f60=this['formatDa'+_0x4b5674(0x1b6)+_0x4b5b99(0x1bc)+_0x4b5674(0x1da)](_0x5b52b1[_0x4b5674(0x1ae)+_0x4b5674(0x1be)][_0x4b5b99(0x1d9)+'imes']))!==null&&_0xb86f60!==void 0x0?_0xb86f60:void 0x0})}));});}[_0x356f33(0x1c7)+_0x431135(0x1ed)+'on'](_0x2a13c6,_0x2ee401,_0x596e22){const _0x5d19c8={'lSirA':function(_0x360941,_0x15aedd){return _0x360941(_0x15aedd);},'jSFbR':function(_0x23b93d,_0x105d89){return _0x23b93d!==_0x105d89;}};return _0x3bb9cc(this,void 0x0,void 0x0,function*(){const _0x5a1723=_0x4dd9,_0x20f6c6=_0x4dd9;var _0x1d8dd6,_0x37ec30;if(!(yield this[_0x5a1723(0x1a6)][_0x5a1723(0x1ff)+_0x20f6c6(0x1c6)][_0x20f6c6(0x1e2)+'ue']({'where':{'id':_0x2a13c6,'deletedAt':null}})))throw new _0x4bb76c(0x194,_0x5a1723(0x1fe)+'tion\x20not'+_0x20f6c6(0x1a0));const _0x350a10=_0x596e22[_0x20f6c6(0x1cc)]?yield this[_0x5a1723(0x1e6)+'ocationS'+_0x5a1723(0x1a5)]()[_0x5a1723(0x1b7)+_0x20f6c6(0x1d2)](_0x596e22[_0x5a1723(0x1cc)][_0x5a1723(0x1d7)]):void 0x0,_0x58ce53=_0x53cc9f=>{const _0x41eb72=_0x5a1723,_0x37d5eb=_0x5a1723;if(!_0x53cc9f)return null;const [_0x49a83e,_0x91f8b7]=_0x53cc9f[_0x41eb72(0x1a7)](':')[_0x41eb72(0x1af)](Number),_0x49c379=new Date();return _0x49c379[_0x37d5eb(0x1e7)+'urs'](_0x49a83e),_0x49c379['setUTCMi'+_0x37d5eb(0x1f9)](_0x91f8b7),_0x49c379['setUTCSe'+_0x41eb72(0x19f)](0x0),_0x49c379['setUTCMi'+_0x41eb72(0x1c2)+'ds'](0x0),_0x49c379;},_0x172aa2=yield this[_0x5a1723(0x1a6)][_0x5a1723(0x1ff)+_0x5a1723(0x1c6)][_0x20f6c6(0x1dc)]({'where':{'id':_0x2a13c6},'data':Object[_0x5a1723(0x1d8)](Object[_0x20f6c6(0x1d8)](Object[_0x5a1723(0x1d8)](Object[_0x5a1723(0x1d8)]({'name':_0x596e22[_0x20f6c6(0x1e3)],'phone':_0x596e22[_0x5a1723(0x1f8)],'email':_0x596e22[_0x20f6c6(0x1cb)]},_0x596e22[_0x20f6c6(0x201)]?{'logoFile':{'connect':{'id':_0x596e22[_0x5a1723(0x201)]}}}:{}),{'address':_0x596e22[_0x20f6c6(0x1cc)]?{'update':Object[_0x20f6c6(0x1d8)](Object[_0x5a1723(0x1d8)]({},_0x596e22[_0x5a1723(0x1cc)]),{'latitude':_0x350a10[_0x5a1723(0x1ba)],'longitude':_0x350a10['longitud'+'e'],'updatedBy':_0x2ee401})}:void 0x0}),_0x596e22[_0x5a1723(0x1ae)+_0x20f6c6(0x1be)]?{'configuration':{'update':{'countriesShipping':_0x596e22[_0x5a1723(0x1ae)+'ation'][_0x5a1723(0x1fa)+_0x5a1723(0x1b2)+'g'],'enableHostCheckout':_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x20f6c6(0x1b4)+_0x5a1723(0x1f2)+'ut'],'enableHostTracking':_0x596e22[_0x20f6c6(0x1ae)+_0x5a1723(0x1be)]['enableHo'+_0x5a1723(0x1bb)+'ng'],'defaultLocale':_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x5a1723(0x1aa)+'ocale'],'supportedLocales':_0x596e22[_0x5a1723(0x1ae)+_0x20f6c6(0x1be)]['supporte'+'dLocales'],'defaultCurrency':_0x596e22[_0x5a1723(0x1ae)+_0x20f6c6(0x1be)][_0x20f6c6(0x1e5)+_0x20f6c6(0x1fc)],'updatedBy':_0x2ee401,'isAcceptingOrders':_0x596e22[_0x20f6c6(0x1ae)+_0x20f6c6(0x1be)][_0x5a1723(0x1e0)+'ingOrder'+'s'],'isAcceptingReservations':_0x596e22[_0x20f6c6(0x1ae)+_0x20f6c6(0x1be)][_0x5a1723(0x1e0)+_0x20f6c6(0x202)+_0x5a1723(0x1e8)],'openingTimes':_0x596e22[_0x5a1723(0x1ae)+_0x20f6c6(0x1be)][_0x20f6c6(0x1b5)+_0x20f6c6(0x1c8)]?{'update':{'data':{'monday':_0x596e22[_0x20f6c6(0x1ae)+_0x5a1723(0x1be)][_0x20f6c6(0x1b5)+_0x5a1723(0x1c8)][_0x20f6c6(0x1ac)]?_0x58ce53(_0x596e22['configur'+_0x5a1723(0x1be)][_0x20f6c6(0x1b5)+_0x20f6c6(0x1c8)][_0x20f6c6(0x1ac)]):null,'tuesday':_0x596e22['configur'+_0x20f6c6(0x1be)]['openingT'+_0x5a1723(0x1c8)][_0x5a1723(0x1bd)]?_0x58ce53(_0x596e22[_0x5a1723(0x1ae)+_0x20f6c6(0x1be)][_0x20f6c6(0x1b5)+'imes']['tuesday']):null,'wednesday':_0x596e22['configur'+_0x20f6c6(0x1be)][_0x5a1723(0x1b5)+_0x20f6c6(0x1c8)][_0x5a1723(0x1ad)+'y']?_0x5d19c8['lSirA'](_0x58ce53,_0x596e22[_0x5a1723(0x1ae)+_0x20f6c6(0x1be)][_0x5a1723(0x1b5)+_0x5a1723(0x1c8)][_0x20f6c6(0x1ad)+'y']):null,'thursday':_0x596e22[_0x5a1723(0x1ae)+_0x20f6c6(0x1be)][_0x20f6c6(0x1b5)+_0x5a1723(0x1c8)][_0x20f6c6(0x1b8)]?_0x58ce53(_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x5a1723(0x1b5)+_0x20f6c6(0x1c8)][_0x5a1723(0x1b8)]):null,'friday':_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x20f6c6(0x1b5)+_0x5a1723(0x1c8)][_0x5a1723(0x1d1)]?_0x58ce53(_0x596e22[_0x20f6c6(0x1ae)+_0x5a1723(0x1be)]['openingT'+_0x20f6c6(0x1c8)][_0x5a1723(0x1d1)]):null,'saturday':_0x596e22[_0x5a1723(0x1ae)+'ation'][_0x20f6c6(0x1b5)+'imes'][_0x20f6c6(0x1d5)]?_0x58ce53(_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x5a1723(0x1b5)+_0x5a1723(0x1c8)]['saturday']):null,'sunday':_0x596e22[_0x20f6c6(0x1ae)+_0x20f6c6(0x1be)][_0x5a1723(0x1b5)+_0x5a1723(0x1c8)][_0x5a1723(0x1e1)]?_0x58ce53(_0x596e22['configur'+'ation'][_0x20f6c6(0x1b5)+_0x5a1723(0x1c8)][_0x20f6c6(0x1e1)]):null}}}:void 0x0,'closingTimes':_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x5a1723(0x1d9)+_0x5a1723(0x1c8)]?{'update':{'data':{'monday':_0x596e22[_0x5a1723(0x1ae)+'ation'][_0x5a1723(0x1d9)+_0x20f6c6(0x1c8)][_0x20f6c6(0x1ac)]?_0x58ce53(_0x596e22[_0x20f6c6(0x1ae)+_0x20f6c6(0x1be)][_0x5a1723(0x1d9)+_0x20f6c6(0x1c8)][_0x5a1723(0x1ac)]):null,'tuesday':_0x596e22['configur'+'ation'][_0x20f6c6(0x1d9)+_0x5a1723(0x1c8)][_0x20f6c6(0x1bd)]?_0x58ce53(_0x596e22[_0x20f6c6(0x1ae)+_0x20f6c6(0x1be)][_0x5a1723(0x1d9)+_0x20f6c6(0x1c8)][_0x20f6c6(0x1bd)]):null,'wednesday':_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x5a1723(0x1d9)+_0x5a1723(0x1c8)][_0x5a1723(0x1ad)+'y']?_0x58ce53(_0x596e22[_0x5a1723(0x1ae)+_0x20f6c6(0x1be)][_0x5a1723(0x1d9)+'imes'][_0x20f6c6(0x1ad)+'y']):null,'thursday':_0x596e22[_0x20f6c6(0x1ae)+_0x5a1723(0x1be)]['closingT'+_0x5a1723(0x1c8)][_0x20f6c6(0x1b8)]?_0x58ce53(_0x596e22[_0x5a1723(0x1ae)+_0x20f6c6(0x1be)]['closingT'+_0x5a1723(0x1c8)][_0x20f6c6(0x1b8)]):null,'friday':_0x596e22[_0x20f6c6(0x1ae)+_0x20f6c6(0x1be)][_0x20f6c6(0x1d9)+_0x20f6c6(0x1c8)][_0x20f6c6(0x1d1)]?_0x58ce53(_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x5a1723(0x1d9)+_0x5a1723(0x1c8)][_0x5a1723(0x1d1)]):null,'saturday':_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x20f6c6(0x1d9)+_0x5a1723(0x1c8)][_0x5a1723(0x1d5)]?_0x58ce53(_0x596e22[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x5a1723(0x1d9)+_0x5a1723(0x1c8)][_0x20f6c6(0x1d5)]):null,'sunday':_0x596e22[_0x20f6c6(0x1ae)+_0x5a1723(0x1be)][_0x5a1723(0x1d9)+_0x20f6c6(0x1c8)]['sunday']?_0x58ce53(_0x596e22['configur'+_0x20f6c6(0x1be)][_0x5a1723(0x1d9)+'imes']['sunday']):null}}}:void 0x0}}}:void 0x0),{'updatedBy':_0x2ee401}),'include':{'address':!0x0,'logoFile':!0x0,'configuration':{'include':{'openingTimes':!0x0,'closingTimes':!0x0}}}});return _0x2bb98c[_0x20f6c6(0x1a8)](Object[_0x20f6c6(0x1d8)](Object['assign']({},_0x172aa2),{'configuration':Object[_0x20f6c6(0x1d8)](Object[_0x5a1723(0x1d8)]({},_0x172aa2[_0x20f6c6(0x1ae)+_0x5a1723(0x1be)]),{'openingTimes':(_0x1d8dd6=this[_0x20f6c6(0x1f3)+_0x5a1723(0x1b6)+_0x5a1723(0x1bc)+_0x5a1723(0x1da)](_0x172aa2['configur'+'ation']['openingT'+'imes']))!==null&&_0x1d8dd6!==void 0x0?_0x1d8dd6:void 0x0,'closingTimes':(_0x37ec30=this[_0x5a1723(0x1f3)+'teSchedu'+_0x20f6c6(0x1bc)+_0x20f6c6(0x1da)](_0x172aa2[_0x5a1723(0x1ae)+_0x5a1723(0x1be)][_0x20f6c6(0x1d9)+_0x5a1723(0x1c8)]))!==null&&_0x5d19c8[_0x20f6c6(0x1f0)](_0x37ec30,void 0x0)?_0x37ec30:void 0x0})}));});}[_0x431135(0x200)+'ganizati'+'on'](_0xbfe5b5,_0x2757ef){return _0x3bb9cc(this,void 0x0,void 0x0,function*(){const _0x68b8b3=_0x4dd9,_0x5a5fb4=_0x4dd9;if(!(yield this[_0x68b8b3(0x1a6)][_0x5a5fb4(0x1ff)+_0x5a5fb4(0x1c6)][_0x68b8b3(0x1e2)+'ue']({'where':{'id':_0xbfe5b5}})))throw new _0x4bb76c(0x194,_0x5a5fb4(0x1fe)+_0x68b8b3(0x1eb)+'\x20found');yield this[_0x5a5fb4(0x1a6)][_0x68b8b3(0x1ff)+_0x68b8b3(0x1c6)]['update']({'where':{'id':_0xbfe5b5},'data':{'deletedAt':new Date(),'deletedBy':_0x2757ef}});});}}export{S as OrganizationService};
|
|
1
|
+
import{__awaiter as l}from"tslib";import{z as p}from"@hono/zod-openapi";import{HttpException as T}from"../../core/exceptions/http-exception";import{OrganizationSchema as d,PaginationMetaSchema as h}from"../../schemas";class S{constructor(t,e){this.prisma=t,this.locationService=e,this.convertToTimeString=i=>i?i.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:"UTC"}):""}requireLocationService(){if(!this.locationService)throw new Error("Google Maps API key is required");return this.locationService}getOrganizations(t,e){return l(this,void 0,void 0,function*(){const{page:i,limit:n}=e,[o,s]=yield this.prisma.organization.paginate({orderBy:{createdAt:"desc"},where:{members:{some:{userId:t}}},include:{address:!0,configuration:!0,logoFile:!0}}).withPages({page:i,limit:n});return{meta:h.parse(s),list:p.array(d).parse(o)}})}formatDateScheduleToTimeString(t){return t?["monday","tuesday","wednesday","thursday","friday","saturday","sunday"].reduce((i,n)=>(i[n]=this.convertToTimeString(t[n]),i),{}):null}getOrganization(t){return l(this,void 0,void 0,function*(){var e,i;const n=yield this.prisma.organization.findUnique({where:{id:t,deletedAt:null},include:{address:!0,configuration:{include:{openingTimes:!0,closingTimes:!0}},logoFile:!0}});if(!n)throw new T(404,"Organization not found");const o=(()=>{if(!n.configuration.isAcceptingOrders||!n.configuration.openingTimes||!n.configuration.closingTimes)return!1;const s=new Date(new Date().toLocaleString("en-US",{timeZone:"Europe/Warsaw"})),u=s.toLocaleDateString("en-US",{weekday:"long"}).toLowerCase(),a=s.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:"Europe/Warsaw"}),r=n.configuration.openingTimes[u],c=n.configuration.closingTimes[u];if(!r||!c)return!1;const m=this.convertToTimeString(r),f=this.convertToTimeString(c);return a>=m&&a<=f})();return d.parse(Object.assign(Object.assign({},n),{configuration:Object.assign(Object.assign({},n.configuration),{isOpen:o,openingTimes:(e=this.formatDateScheduleToTimeString(n.configuration.openingTimes))!==null&&e!==void 0?e:void 0,closingTimes:(i=this.formatDateScheduleToTimeString(n.configuration.closingTimes))!==null&&i!==void 0?i:void 0})}))})}createOrganization(t,e){return l(this,void 0,void 0,function*(){var i,n;const o=yield this.requireLocationService().getPlaceDetails(e.address.placeId),s=yield this.prisma.organization.create({data:Object.assign({name:e.name,phone:e.phone,email:e.email,address:{create:Object.assign(Object.assign({},e.address),{latitude:o.latitude,longitude:o.longitude,createdBy:t})},configuration:{create:{countriesShipping:["us"],createdBy:t,enableHostCheckout:!1,enableHostTracking:!1,isAcceptingReservations:!1,openingTimes:{create:{monday:null,tuesday:null,wednesday:null,thursday:null,friday:null,saturday:null,sunday:null}},closingTimes:{create:{monday:null,tuesday:null,wednesday:null,thursday:null,friday:null,saturday:null}}}},members:{create:{user:{connect:{id:t}},role:"owner"}},createdBy:t},e.logoId?{logoFile:{connect:{id:e.logoId}}}:{}),include:{address:!0,configuration:{include:{openingTimes:!0,closingTimes:!0}},logoFile:!0}});return d.parse(Object.assign(Object.assign({},s),{configuration:Object.assign(Object.assign({},s.configuration),{openingTimes:(i=this.formatDateScheduleToTimeString(s.configuration.openingTimes))!==null&&i!==void 0?i:void 0,closingTimes:(n=this.formatDateScheduleToTimeString(s.configuration.closingTimes))!==null&&n!==void 0?n:void 0})}))})}updateOrganization(t,e,i){return l(this,void 0,void 0,function*(){var n,o;if(!(yield this.prisma.organization.findUnique({where:{id:t,deletedAt:null}})))throw new T(404,"Organization not found");const u=i.address?yield this.requireLocationService().getPlaceDetails(i.address.placeId):void 0,a=c=>{if(!c)return null;const[m,f]=c.split(":").map(Number),g=new Date;return g.setUTCHours(m),g.setUTCMinutes(f),g.setUTCSeconds(0),g.setUTCMilliseconds(0),g},r=yield this.prisma.organization.update({where:{id:t},data:Object.assign(Object.assign(Object.assign(Object.assign({name:i.name,phone:i.phone,email:i.email},i.logoId?{logoFile:{connect:{id:i.logoId}}}:{}),{address:i.address?{update:Object.assign(Object.assign({},i.address),{latitude:u.latitude,longitude:u.longitude,updatedBy:e})}:void 0}),i.configuration?{configuration:{update:{countriesShipping:i.configuration.countriesShipping,enableHostCheckout:i.configuration.enableHostCheckout,enableHostTracking:i.configuration.enableHostTracking,defaultLocale:i.configuration.defaultLocale,defaultTimeZone:i.configuration.defaultTimeZone,supportedLocales:i.configuration.supportedLocales,defaultCurrency:i.configuration.defaultCurrency,updatedBy:e,isAcceptingOrders:i.configuration.isAcceptingOrders,isAcceptingReservations:i.configuration.isAcceptingReservations,openingTimes:i.configuration.openingTimes?{update:{data:{monday:i.configuration.openingTimes.monday?a(i.configuration.openingTimes.monday):null,tuesday:i.configuration.openingTimes.tuesday?a(i.configuration.openingTimes.tuesday):null,wednesday:i.configuration.openingTimes.wednesday?a(i.configuration.openingTimes.wednesday):null,thursday:i.configuration.openingTimes.thursday?a(i.configuration.openingTimes.thursday):null,friday:i.configuration.openingTimes.friday?a(i.configuration.openingTimes.friday):null,saturday:i.configuration.openingTimes.saturday?a(i.configuration.openingTimes.saturday):null,sunday:i.configuration.openingTimes.sunday?a(i.configuration.openingTimes.sunday):null}}}:void 0,closingTimes:i.configuration.closingTimes?{update:{data:{monday:i.configuration.closingTimes.monday?a(i.configuration.closingTimes.monday):null,tuesday:i.configuration.closingTimes.tuesday?a(i.configuration.closingTimes.tuesday):null,wednesday:i.configuration.closingTimes.wednesday?a(i.configuration.closingTimes.wednesday):null,thursday:i.configuration.closingTimes.thursday?a(i.configuration.closingTimes.thursday):null,friday:i.configuration.closingTimes.friday?a(i.configuration.closingTimes.friday):null,saturday:i.configuration.closingTimes.saturday?a(i.configuration.closingTimes.saturday):null,sunday:i.configuration.closingTimes.sunday?a(i.configuration.closingTimes.sunday):null}}}:void 0}}}:void 0),{updatedBy:e}),include:{address:!0,logoFile:!0,configuration:{include:{openingTimes:!0,closingTimes:!0}}}});return d.parse(Object.assign(Object.assign({},r),{configuration:Object.assign(Object.assign({},r.configuration),{openingTimes:(n=this.formatDateScheduleToTimeString(r.configuration.openingTimes))!==null&&n!==void 0?n:void 0,closingTimes:(o=this.formatDateScheduleToTimeString(r.configuration.closingTimes))!==null&&o!==void 0?o:void 0})}))})}deleteOrganization(t,e){return l(this,void 0,void 0,function*(){if(!(yield this.prisma.organization.findUnique({where:{id:t}})))throw new T(404,"Organization not found");yield this.prisma.organization.update({where:{id:t},data:{deletedAt:new Date,deletedBy:e}})})}}export{S as OrganizationService};
|