@shophost/rest-api 2.0.68 → 2.0.70
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 +2 -0
- package/src/core/db/__generated__/client/internal/class.js +19 -17
- package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +2 -0
- package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -1
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.d.ts +2 -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/__generated__/client/models/Reservation.d.ts +42 -1
- package/src/features/customer/customer.route.d.ts +1 -0
- package/src/features/customer/customer.schema.d.ts +1 -0
- package/src/features/customer/customer.service.d.ts +1 -0
- 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.route.d.ts +5 -0
- package/src/features/organization/organization.schema.d.ts +2 -0
- package/src/features/organization/organization.service.d.ts +4 -0
- package/src/features/organization/organization.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.d.ts +10 -1
- package/src/features/reservation/reservation.route.js +1 -1
- package/src/features/reservation/reservation.schema.d.ts +5 -0
- package/src/features/reservation/reservation.schema.js +1 -1
- package/src/features/reservation/reservation.service.d.ts +9 -2
- package/src/features/reservation/reservation.service.js +1 -1
- package/src/schemas/index.d.ts +1 -0
- package/src/schemas/index.js +1 -1
- package/src/schemas/time-zone.schema.d.ts +9 -0
- package/src/schemas/time-zone.schema.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DEFAULT_ORGANIZATION_TIME_ZONE as o,isValidTimeZone as m}from"../../../schemas/time-zone.schema";function s(e){return!e||!m(e)?o:e}function n(e,r,t){const a=new Intl.DateTimeFormat("en-GB",Object.assign(Object.assign({},r),{timeZone:s(t)})).formatToParts(new Date(e));return Object.fromEntries(a.filter(i=>i.type!=="literal").map(i=>[i.type,i.value]))}export function formatReservationEmailDate(e,r){const t=n(e,{year:"numeric",month:"2-digit",day:"2-digit"},r);return`${t.day}.${t.month}.${t.year}`}export function formatReservationEmailDateTime(e,r){const t=n(e,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"},r);return`${t.day}.${t.month}.${t.year} at ${t.hour}:${t.minute}`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Body as v,Button as k,Column as s,Container as f,Head as A,Heading as T,Hr as j,Html as P,Img as i,Link as c,Preview as C,Row as d,Section as n,Tailwind as R,Text as t}from"../../../core/email/components";import{formatReservationEmailDate as F,formatReservationEmailDateTime as D}from"./reservation-email-date";const u=({user:x,member:N,organization:l,reservation:r})=>{var m,o,h,g,p,b;const w=`New reservation request for ${l.name}`,y=D(r.date);return a(P,{children:[e(A,{}),e(C,{children:w}),e(R,{children:a(v,{className:"bg-gray-50 font-sans",children:[a(f,{className:"bg-gray-50 p-6 max-w-[600px]",children:[e(n,{className:"mb-6",children:a(d,{children:[e(s,{className:"w-[80%]",children:e(i,{alt:`${l.name} logo`,height:"100",src:(m=l.logoFile)===null||m===void 0?void 0:m.url,className:"rounded-lg"})}),e(s,{align:"right",children:a(d,{align:"right",children:[e(s,{children:e(c,{href:"https://www.instagram.com/madrasbistro/",children:e(i,{alt:"Instagram",className:"mx-[4px]",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})}),e(s,{children:e(c,{href:"https://www.facebook.com/madrasBistro/",children:e(i,{alt:"Facebook",className:"mx-[4px]",height:"36",src:"https://react.email/static/facebook-logo.png",width:"36"})})})]})})]})}),a(n,{children:[a(T,{className:"text-3xl font-bold text-gray-800 mb-0",children:["Hi ",N.firstname,","]}),e(t,{className:"text-gray-600 mb-2 text-lg",children:"You have received a new reservation request."})]})]}),a(f,{className:"mx-auto max-w-[600px] rounded-xl bg-white px-6",children:[e(n,{className:"mb-6",children:a(d,{children:[a(s,{className:"w-[60%]",children:[e(t,{className:"text-gray-500 mb-0",children:"Reservation details"}),a(t,{className:"font-semibold text-gray-800 my-0",children:[r.firstname," ",r.lastname]}),a(t,{className:"font-semibold text-gray-800 my-0",children:["Reference: ",r.referenceId]}),a(t,{className:"font-semibold text-gray-800 my-0",children:["Date and Time: ",y]}),a(t,{className:"font-semibold text-gray-800 my-0",children:["Number of Guests: ",r.guests]}),e(t,{className:"text-gray-500 mb-0",children:"Phone"}),e(t,{className:"font-semibold text-gray-800 my-0",children:r.phone}),e(t,{className:"text-gray-500 mb-0",children:"Email"}),e(t,{className:"font-semibold text-gray-800 my-0",children:x.email})]}),e(s,{className:"w-[40%] p-0 mt-0",align:"right",valign:"top",children:e(t,{className:"text-gray-500 mb-0 pt-1",children:F(new Date)})})]})}),e(j,{className:"border-gray-200 mt-4"}),a(n,{className:"mb-6",children:[e(t,{className:"text-gray-700",children:"Please review and respond to this reservation request as soon as possible."}),e(k,{href:`https://admin.${(o=l.configuration)===null||o===void 0?void 0:o.hostname}/admin/reservations/${r.id}`,className:"bg-blue-600 rounded py-3 px-5 text-white text-center block mt-4",children:"View Reservation Details"})]})]}),e(n,{className:"text-center bg-gray-50 py-5",children:a("table",{className:"w-full",children:[e("tr",{className:"w-full",children:e("td",{align:"center",children:((h=l.logoFile)===null||h===void 0?void 0:h.url)&&e(i,{alt:`${l.name} logo`,height:"100",src:l.logoFile.url,className:"rounded-lg"})})}),e("tr",{className:"w-full",children:a("td",{align:"center",children:[e(t,{className:"my-[8px] text-[16px] font-semibold text-xl pt-2 text-gray-900",children:l.name}),a(t,{className:"my-[8px] text-[16px] leading-[24px] text-gray-500",children:[(g=l.address)===null||g===void 0?void 0:g.addressLineOne,","," ",(p=l.address)===null||p===void 0?void 0:p.zipCode," ",(b=l.address)===null||b===void 0?void 0:b.city]}),e(t,{className:"mb-0 mt-[4px] text-[16px] leading-[24px] text-gray-500",children:l.phone})]})}),e("tr",{children:e("td",{align:"center",children:a(d,{className:"table-cell h-[44px] w-[56px] align-bottom pt-5",children:[e(s,{className:"pr-[8px]",children:e(c,{href:"https://www.facebook.com/madrasBistro/",children:e(i,{alt:"Facebook",height:"36",src:"https://react.email/static/facebook-logo.png",width:"36"})})}),e(s,{children:e(c,{href:"https://www.instagram.com/madrasbistro/",children:e(i,{alt:"Instagram",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})})]})})})]})})]})})]})},I={user:{id:"VD0OJ52f0mdAnm5YePP6BAW6hdbaCjAJ",name:"Abhishek Shaji",email:"kontakt@abhishek.pl",emailVerified:!0,image:"https://lh3.googleusercontent.com/a/ACg8ocKbkCAMTNvMizjXNxcm1aYtBiWnYpCYmU-7aE2Ft_M_uiHheZ5f=s96-c",createdAt:"2025-03-22T22:54:40.260Z",updatedAt:"2025-03-22T22:54:40.260Z",firstname:"Abhishek",lastname:"Shaji"},member:{id:"KL9MN52f0mdOnp8YeQR7CAX5hdbdDkBP",name:"John Doe",email:"john@madrasbistro.pl",emailVerified:!0,image:null,createdAt:"2025-03-20T10:30:15.123Z",updatedAt:"2025-03-20T10:30:15.123Z",firstname:"John",lastname:"Doe"},reservation:{id:"cm94wbpbm0000itx1iv9k2mqr",referenceId:"PH6LD6",firstname:"Abhishek",lastname:"Shaji",phone:"+48570135862",guests:4,date:new Date("2025-04-07T19:30:00.000Z"),createdAt:"2025-03-22T22:54:40.260Z",acceptedAt:null,cancelledAt:null},organization:{id:"cm8kthfdq0001lg03b59mdy7b",name:"Madras Bistro",phone:"+48570135862",email:"contact@madrasbistro.pl",createdAt:"2025-03-22T23:05:14.271Z",legalEntityId:null,address:{id:"cm8kthfdr0002lg0350ijialt",firstname:null,lastname:null,phone:null,addressLineOne:"Plac Bohater\xF3w Getta 2",doorNumber:null,addressLineTwo:"3",zipCode:"33-332",city:"Krak\xF3w",country:"PL",placeId:"ChIJf-nsRkRbFkcR21gtObFSSSA",deliveryInstructions:null},configuration:{id:"cm8kthfdr0003lg03ghgs262n",hostname:"madrasbistro.pl",countriesShipping:["us"],stripeAccountId:"null",enableHostCheckout:!1,enableHostTracking:!1,isAcceptingOrders:!1,isAcceptingReservations:!1,defaultLocale:"en",supportedLocales:["en","pl"],defaultCurrency:"PLN",createdAt:"2025-03-22T23:05:14.271Z"},logo:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",logoFile:{id:"cm8ktmu890005lg0356gwclfk",url:"https://z3liuyatqnepss3d.public.blob.vercel-storage.com/logo-zeJymFRMFCIKPlvjxYm2af3SAWvBOj.png",mimeType:"image/png",size:1652289,filename:"logo.png"}}};u.PreviewProps=I;export default u;export{u as ReservationNotificationEmail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Body as y,Column as s,Container as x,Head as N,Heading as v,Hr as k,Html as A,Img as r,Link as c,Preview as T,Row as n,Section as i,Tailwind as j,Text as a}from"../../../core/email/components";import{formatReservationEmailDate as B,formatReservationEmailDateTime as I}from"./reservation-email-date";const u=({user:b,organization:l,reservation:d})=>{var m,o,h,g,p;const f=`Your reservation with ${l.name} has been updated`,w=I(d.date);return t(A,{children:[e(N,{}),e(T,{children:f}),e(j,{children:t(y,{className:"bg-gray-50 font-sans",children:[t(x,{className:"bg-gray-50 p-6 max-w-[600px]",children:[e(i,{className:"mb-6",children:t(n,{children:[e(s,{className:"w-[80%]",children:e(r,{alt:`${l.name} logo`,height:"100",src:(m=l.logoFile)===null||m===void 0?void 0:m.url,className:"rounded-lg"})}),e(s,{align:"right",children:t(n,{align:"right",children:[e(s,{children:e(c,{href:"https://www.instagram.com/madrasbistro/",children:e(r,{alt:"Instagram",className:"mx-[4px]",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})}),e(s,{children:e(c,{href:"https://www.facebook.com/madrasBistro/",children:e(r,{alt:"Facebook",className:"mx-[4px]",height:"36",src:"https://react.email/static/facebook-logo.png",width:"36"})})})]})})]})}),t(i,{children:[t(v,{className:"text-3xl font-bold text-gray-800 mb-0",children:["Hi ",b.firstname,","]}),e(a,{className:"text-gray-600 mb-2 text-lg",children:"Your reservation details have been updated."})]})]}),t(x,{className:"mx-auto max-w-[600px] rounded-xl bg-white px-6",children:[e(i,{className:"mb-6",children:t(n,{children:[t(s,{className:"w-[60%]",children:[e(a,{className:"text-gray-500 mb-0",children:"Updated reservation details"}),t(a,{className:"font-semibold text-gray-800 my-0",children:[d.firstname," ",d.lastname]}),t(a,{className:"font-semibold text-gray-800 my-0",children:["Reference: ",d.referenceId]}),t(a,{className:"font-semibold text-gray-800 my-0",children:["Date and Time: ",w]}),t(a,{className:"font-semibold text-gray-800 my-0",children:["Number of Guests: ",d.guests]}),e(a,{className:"text-gray-500 mb-0",children:"Phone"}),e(a,{className:"font-semibold text-gray-800 my-0",children:d.phone})]}),e(s,{className:"w-[40%] p-0 mt-0",align:"right",valign:"top",children:e(a,{className:"text-gray-500 mb-0 pt-1",children:B(new Date)})})]})}),e(k,{className:"border-gray-200 mt-4"}),t(i,{className:"mb-6",children:[t(a,{className:"text-gray-700",children:["Your updated reservation is now scheduled with"," ",l.name,". If anything still needs to change, please contact us directly at ",l.phone,"."]}),e(a,{className:"text-gray-700",children:"We look forward to welcoming you."})]})]}),e(i,{className:"text-center bg-gray-50 py-5",children:t("table",{className:"w-full",children:[e("tr",{className:"w-full",children:e("td",{align:"center",children:((o=l.logoFile)===null||o===void 0?void 0:o.url)&&e(r,{alt:`${l.name} logo`,height:"100",src:l.logoFile.url,className:"rounded-lg"})})}),e("tr",{className:"w-full",children:t("td",{align:"center",children:[e(a,{className:"my-[8px] text-[16px] font-semibold text-xl pt-2 text-gray-900",children:l.name}),t(a,{className:"my-[8px] text-[16px] leading-[24px] text-gray-500",children:[(h=l.address)===null||h===void 0?void 0:h.addressLineOne,","," ",(g=l.address)===null||g===void 0?void 0:g.zipCode," ",(p=l.address)===null||p===void 0?void 0:p.city]}),e(a,{className:"mb-0 mt-[4px] text-[16px] leading-[24px] text-gray-500",children:l.phone})]})}),e("tr",{children:e("td",{align:"center",children:t(n,{className:"table-cell h-[44px] w-[56px] align-bottom pt-5",children:[e(s,{className:"pr-[8px]",children:e(c,{href:"https://www.facebook.com/madrasBistro/",children:e(r,{alt:"Facebook",height:"36",src:"https://react.email/static/facebook-logo.png",width:"36"})})}),e(s,{children:e(c,{href:"https://www.instagram.com/madrasbistro/",children:e(r,{alt:"Instagram",height:"36",src:"https://react.email/static/instagram-logo.png",width:"36"})})})]})})})]})})]})})]})},P={user:{id:"VD0OJ52f0mdAnm5YePP6BAW6hdbaCjAJ",name:"Abhishek Shaji",email:"kontakt@abhishek.pl",emailVerified:!0,image:"https://lh3.googleusercontent.com/a/ACg8ocKbkCAMTNvMizjXNxcm1aYtBiWnYpCYmU-7aE2Ft_M_uiHheZ5f=s96-c",createdAt:"2025-03-22T22:54:40.260Z",updatedAt:"2025-03-22T22:54:40.260Z",firstname:"Abhishek",lastname:"Shaji"},reservation:{id:"cm94wbpbm0000itx1iv9k2mqr",referenceId:"PH6LD6",firstname:"Abhishek",lastname:"Shaji",phone:"+48570135862",guests:6,date:new Date("2025-04-08T20:00:00.000Z"),createdAt:"2025-03-22T22:54:40.260Z",acceptedAt:"2025-03-22T23:00:23.456Z",cancelledAt:null},organization:{id:"cm8kthfdq0001lg03b59mdy7b",name:"Madras Bistro",phone:"+48570135862",email:"contact@madrasbistro.pl",createdAt:"2025-03-22T23:05:14.271Z",legalEntityId:null,address:{id:"cm8kthfdr0002lg0350ijialt",firstname:null,lastname:null,phone:null,addressLineOne:"Plac Bohater\xF3w Getta 2",doorNumber:null,addressLineTwo:"3",zipCode:"33-332",city:"Krak\xF3w",country:"PL",latitude:50.04647,longitude:19.95508,isDefault:!1,deliveryInstructions:null,placeId:"ChIJJ0oJ4wdbFkcRzM2QfH7O49o",createdAt:"2025-03-22T23:05:14.271Z",createdBy:null,updatedAt:"2025-03-22T23:05:14.271Z",updatedBy:null,deletedAt:null,deletedBy:null},configurationId:"cm8kthfdr0003lg03zmxz6v4j",logo:null,logoId:"cm8kthfdq0000lg0351daejow",updatedAt:"2025-03-22T23:05:14.271Z",updatedBy:null,deletedAt:null,deletedBy:null,slug:"madras-bistro"}};u.PreviewProps=P;export default u;export{u as ReservationUpdatedEmail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as s}from"tslib";import{createApiRouter as u}from"../../core/hono/hono";import{reservationRoute as d}from"./reservation.route";export const registerReservationHandlers=i=>{const n=u();return n.openapi(d.createReservation,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("json"),a=e.req.valid("param");let r=null;try{r=yield o.getCurrentUser()}catch{}const v=yield i.createReservation(a.organizationId,r,t);return e.json(v,201)})),n.openapi(d.getMyReservations,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param"),a=e.req.valid("query"),r=yield o.getCurrentUser(),v=yield i.getMyReservations(r.id,t.organizationId,a);return e.json(v,200)})),n.openapi(d.getReservation,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param"),a=yield o.getCurrentUser(),r=yield i.getReservation(a,t.organizationId,t.reservationId);return e.json(r,200)})),n.openapi(d.getReservations,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param"),a=e.req.valid("query");yield o.isGranted("read");const r=yield i.getReservations(t.organizationId,a);return e.json(r,200)})),n.openapi(d.getUserReservations,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param");yield o.isGranted("read");const a=yield i.getUserReservations(t.userId,t.organizationId);return e.json(a,200)})),n.openapi(d.updateReservation,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param"),a=e.req.valid("json");yield o.isGranted("update");const r=yield i.updateReservation(t.organizationId,t.reservationId,a);return e.json(r,200)})),n.openapi(d.updateReservationStatus,e=>s(void 0,void 0,void 0,function*(){const
|
|
1
|
+
import{__awaiter as s}from"tslib";import{createApiRouter as u}from"../../core/hono/hono";import{reservationRoute as d}from"./reservation.route";export const registerReservationHandlers=i=>{const n=u();return n.openapi(d.createReservation,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("json"),a=e.req.valid("param");let r=null;try{r=yield o.getCurrentUser()}catch{}const v=yield i.createReservation(a.organizationId,r,t);return e.json(v,201)})),n.openapi(d.getMyReservations,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param"),a=e.req.valid("query"),r=yield o.getCurrentUser(),v=yield i.getMyReservations(r.id,t.organizationId,a);return e.json(v,200)})),n.openapi(d.getReservation,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param"),a=yield o.getCurrentUser(),r=yield i.getReservation(a,t.organizationId,t.reservationId);return e.json(r,200)})),n.openapi(d.getReservations,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param"),a=e.req.valid("query");yield o.isGranted("read");const r=yield i.getReservations(t.organizationId,a);return e.json(r,200)})),n.openapi(d.getUserReservations,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param");yield o.isGranted("read");const a=yield i.getUserReservations(t.userId,t.organizationId);return e.json(a,200)})),n.openapi(d.updateReservation,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param"),a=e.req.valid("json");yield o.isGranted("update");const r=yield i.updateReservation(t.organizationId,t.reservationId,a);return e.json(r,200)})),n.openapi(d.updateReservationStatus,e=>s(void 0,void 0,void 0,function*(){var o;const t=e.get("auth"),a=e.req.valid("param"),r=(o=e.req.valid("json"))!==null&&o!==void 0?o:{};yield t.isGranted("update");const v=yield i.updateStatus(a.organizationId,a.reservationId,a.operation,r);return e.json(v,200)})),n.openapi(d.deleteReservation,e=>s(void 0,void 0,void 0,function*(){const o=e.get("auth"),t=e.req.valid("param");return yield o.isGranted("delete"),yield i.deleteReservation(t.organizationId,t.reservationId),e.body(null,204)})),n};
|
|
@@ -44,6 +44,7 @@ export declare const reservationRoute: {
|
|
|
44
44
|
referenceId: z.ZodString;
|
|
45
45
|
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
46
46
|
cancelledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
47
|
+
cancellationMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
48
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
48
49
|
}, z.core.$strip>;
|
|
49
50
|
};
|
|
@@ -119,6 +120,7 @@ export declare const reservationRoute: {
|
|
|
119
120
|
referenceId: z.ZodString;
|
|
120
121
|
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
121
122
|
cancelledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
123
|
+
cancellationMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
122
124
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
123
125
|
}, z.core.$strip>;
|
|
124
126
|
};
|
|
@@ -329,6 +331,7 @@ export declare const reservationRoute: {
|
|
|
329
331
|
referenceId: z.ZodString;
|
|
330
332
|
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
331
333
|
cancelledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
334
|
+
cancellationMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
332
335
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
333
336
|
}, z.core.$strip>>;
|
|
334
337
|
meta: z.ZodObject<{
|
|
@@ -536,6 +539,7 @@ export declare const reservationRoute: {
|
|
|
536
539
|
referenceId: z.ZodString;
|
|
537
540
|
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
538
541
|
cancelledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
542
|
+
cancellationMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
539
543
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
540
544
|
}, z.core.$strip>>;
|
|
541
545
|
meta: z.ZodObject<{
|
|
@@ -621,6 +625,7 @@ export declare const reservationRoute: {
|
|
|
621
625
|
referenceId: z.ZodString;
|
|
622
626
|
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
623
627
|
cancelledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
628
|
+
cancellationMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
624
629
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
625
630
|
}, z.core.$strip>>;
|
|
626
631
|
};
|
|
@@ -721,6 +726,7 @@ export declare const reservationRoute: {
|
|
|
721
726
|
referenceId: z.ZodString;
|
|
722
727
|
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
723
728
|
cancelledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
729
|
+
cancellationMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
724
730
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
725
731
|
}, z.core.$strip>;
|
|
726
732
|
};
|
|
@@ -786,7 +792,9 @@ export declare const reservationRoute: {
|
|
|
786
792
|
body: {
|
|
787
793
|
content: {
|
|
788
794
|
"application/json": {
|
|
789
|
-
schema: z.
|
|
795
|
+
schema: z.ZodObject<{
|
|
796
|
+
message: z.ZodOptional<z.ZodString>;
|
|
797
|
+
}, z.core.$strip>;
|
|
790
798
|
};
|
|
791
799
|
};
|
|
792
800
|
required: boolean;
|
|
@@ -820,6 +828,7 @@ export declare const reservationRoute: {
|
|
|
820
828
|
referenceId: z.ZodString;
|
|
821
829
|
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
822
830
|
cancelledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
831
|
+
cancellationMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
823
832
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
824
833
|
}, z.core.$strip>;
|
|
825
834
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as a}from"@hono/zod-openapi";import{createApiRoute as t}from"../../core/hono/hono";import{CreateReservationSchema as p,ErrorSchema as e,HeaderSchema as r,OrganizationParams as n,PaginationMetaSchema as i,PaginationQuerySchema as d,ReservationListQuerySchema as v,ReservationSchema as
|
|
1
|
+
import{z as a}from"@hono/zod-openapi";import{createApiRoute as t}from"../../core/hono/hono";import{CreateReservationSchema as p,ErrorSchema as e,HeaderSchema as r,OrganizationParams as n,PaginationMetaSchema as i,PaginationQuerySchema as d,ReservationListQuerySchema as v,ReservationSchema as s,UpdateReservationSchema as m,UpdateReservationStatusSchema as c}from"../../schemas";const o=a.object({organizationId:a.string().openapi({description:"Organization ID",example:"clj1234567890abcdef",param:{in:"path",name:"organizationId"}}),reservationId:a.string().openapi({description:"Reservation ID",example:"clj1234567890abcdef",param:{in:"path",name:"reservationId"}})}),R=a.object({organizationId:a.string().openapi({description:"Organization ID",example:"clj1234567890abcdef",param:{in:"path",name:"organizationId"}}),userId:a.string().openapi({description:"User ID",example:"clj1234567890abcdef",param:{in:"path",name:"userId"}})}),h=o.extend({operation:a.enum(["accept","cancel"]).openapi({description:"Operation",example:"accept",param:{in:"path",name:"operation"}})}),u=t({body:p,description:"Create a new reservation",headers:r,method:"POST",operationId:"createReservation",path:"/:organizationId/reservations",pathParams:n,responses:{201:s,400:e,401:e,500:e},summary:"Create Reservation",tags:["Reservation"]}),g=t({description:"Get a specific reservation by ID",headers:r,method:"GET",operationId:"getReservation",path:"/:organizationId/reservations/:reservationId",pathParams:o,responses:{200:s,400:e,401:e,404:e,500:e},summary:"Get Reservation",tags:["Reservation"]}),I=t({description:"Get all reservations for an organization",headers:r,method:"GET",operationId:"getReservations",path:"/:organizationId/reservations",pathParams:n,query:v,responses:{200:a.object({list:a.array(s),meta:i}),400:e,401:e,500:e},summary:"Get Reservations",tags:["Reservation"]}),l=t({description:"Get paginated reservations for the authenticated user",headers:r,method:"GET",operationId:"getMyReservations",path:"/:organizationId/reservations/me",pathParams:n,query:d,responses:{200:a.object({list:a.array(s),meta:i}),400:e,401:e,500:e},summary:"Get My Reservations",tags:["Reservation"]}),y=t({description:"Get all reservations for a user",headers:r,method:"GET",operationId:"getUserReservations",path:"/:organizationId/reservations/user/:userId",pathParams:R,responses:{200:a.array(s),400:e,401:e,404:e,500:e},summary:"Get User Reservations",tags:["Reservation"]}),z=t({body:m,description:"Update an existing reservation",headers:r,method:"PATCH",operationId:"updateReservation",path:"/:organizationId/reservations/:reservationId",pathParams:o,responses:{200:s,400:e,401:e,404:e,500:e},summary:"Update Reservation",tags:["Reservation"]}),P=t({body:c,bodyRequired:!1,description:"Update the status of a reservation",headers:r,method:"PATCH",operationId:"updateReservationStatus",path:"/:organizationId/reservations/:reservationId/:operation",pathParams:h,responses:{200:s,400:e,401:e,404:e,500:e},summary:"Update Reservation Status",tags:["Reservation"]}),b=t({body:a.object({}).optional(),bodyRequired:!1,description:"Delete a reservation",headers:r,method:"DELETE",operationId:"deleteReservation",path:"/:organizationId/reservations/:reservationId",pathParams:o,responses:{204:null,400:e,401:e,404:e,500:e},summary:"Delete Reservation",tags:["Reservation"]});export const reservationRoute={createReservation:u,getReservation:g,getReservations:I,getMyReservations:l,getUserReservations:y,updateReservation:z,updateReservationStatus:P,deleteReservation:b};
|
|
@@ -9,6 +9,7 @@ export declare const ReservationSchema: z.ZodObject<{
|
|
|
9
9
|
referenceId: z.ZodString;
|
|
10
10
|
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
11
11
|
cancelledAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
12
|
+
cancellationMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
13
|
createdAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
13
14
|
}, z.core.$strip>;
|
|
14
15
|
export declare const CreateReservationSchema: z.ZodObject<{
|
|
@@ -24,6 +25,9 @@ export declare const UpdateReservationSchema: z.ZodObject<{
|
|
|
24
25
|
firstname: z.ZodPipe<z.ZodAny, z.ZodTransform<string, any>>;
|
|
25
26
|
lastname: z.ZodPipe<z.ZodAny, z.ZodTransform<string, any>>;
|
|
26
27
|
}, z.core.$strip>;
|
|
28
|
+
export declare const UpdateReservationStatusSchema: z.ZodObject<{
|
|
29
|
+
message: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>;
|
|
27
31
|
export declare const ReservationListQuerySchema: z.ZodObject<{
|
|
28
32
|
page: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
29
33
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
@@ -150,4 +154,5 @@ export declare const ReservationListQuerySchema: z.ZodObject<{
|
|
|
150
154
|
export type Reservation = z.infer<typeof ReservationSchema>;
|
|
151
155
|
export type CreateReservation = z.infer<typeof CreateReservationSchema>;
|
|
152
156
|
export type UpdateReservation = z.infer<typeof UpdateReservationSchema>;
|
|
157
|
+
export type UpdateReservationStatus = z.infer<typeof UpdateReservationStatusSchema>;
|
|
153
158
|
export type ReservationListQuery = z.infer<typeof ReservationListQuerySchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as
|
|
1
|
+
import{z as e}from"@hono/zod-openapi";import{requiredNumber as r}from"../../schemas/number.schema";import{PaginationQuerySchema as i}from"../../schemas/pagination.schema";const n=t=>e.any().transform(a=>typeof a=="string"?a.trim():"").refine(a=>a.length>0,{message:`${t} is required`}),o=e.any().transform(t=>t==null||t===""?Number.NaN:Number(t)).refine(t=>Number.isFinite(t)&&t>0,{message:"Number of guests is required"}),s=e.any().refine(t=>t!=null&&t!=="",{message:"Reservation date is required"}).transform(t=>new Date(t)).refine(t=>!Number.isNaN(t.getTime()),{message:"Reservation date is required"});export const ReservationSchema=e.object({id:e.string().openapi({description:"Unique identifier for the order",example:"clj1234567890abcdef"}),firstname:e.string().openapi({description:"Customer's first name",example:"John"}),lastname:e.string().openapi({description:"Customer's last name",example:"Doe"}),guests:r,phone:e.string().openapi({description:"Customer's phone number",example:"+1234567890"}),date:e.coerce.date().openapi({description:"Reservation date and time",example:"2023-06-14T16:20:00Z"}),referenceId:e.string().openapi({description:"External reference ID for the order",example:"ORD-12345"}),acceptedAt:e.date().nullable().optional().openapi({description:"Date when the order was accepted",example:"2023-06-15T14:30:00Z"}),cancelledAt:e.date().nullable().optional().openapi({description:"Date when the order was cancelled",example:"2023-06-14T16:20:00Z"}),cancellationMessage:e.string().nullable().optional().openapi({description:"Optional cancellation message sent to the user",example:"We need to close early tonight."}),createdAt:e.date().nullable().optional().openapi({description:"Date when the order was created",example:"2023-06-14T16:20:00Z"})}).openapi("Reservation"),CreateReservationSchema=ReservationSchema.pick({firstname:!0,lastname:!0,guests:!0,phone:!0,date:!0}).extend({firstname:n("First name").openapi({description:"Customer's first name",example:"John"}),lastname:n("Last name").openapi({description:"Customer's last name",example:"Doe"}),guests:o.openapi({description:"Number of guests included in the reservation",example:2}),phone:n("Phone number").openapi({description:"Customer's phone number",example:"+1234567890"}),date:s.openapi({description:"Reservation date and time",example:"2023-06-14T16:20:00Z"})}).openapi("CreateReservation"),UpdateReservationSchema=CreateReservationSchema.pick({firstname:!0,lastname:!0,guests:!0,date:!0}).openapi("UpdateReservation"),UpdateReservationStatusSchema=e.object({message:e.string().trim().min(1,"Message cannot be empty").max(1e3,"Message must be 1000 characters or fewer").optional().openapi({description:"Optional message sent to the user when cancelling a reservation",example:"We need to close early tonight. Please book another slot."})}).openapi("UpdateReservationStatus"),ReservationListQuerySchema=i.extend({from:e.coerce.date().optional().openapi({description:"Filter reservations scheduled from this date and time",example:"2026-03-01T00:00:00.000Z"}),to:e.coerce.date().optional().openapi({description:"Filter reservations scheduled up to this date and time",example:"2026-03-31T23:59:59.999Z"})}).openapi("ReservationListQuery");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import { PrismaClientType } from "../../core/lib/prisma";
|
|
3
3
|
import { EmailService } from "../../core/notifications/email.service";
|
|
4
|
-
import { CreateReservationSchema, ReservationListQuery, UpdateReservationSchema, User } from "../../schemas";
|
|
4
|
+
import { CreateReservationSchema, ReservationListQuery, UpdateReservationSchema, UpdateReservationStatusSchema, User } from "../../schemas";
|
|
5
5
|
declare class ReservationService {
|
|
6
6
|
private readonly prisma;
|
|
7
7
|
private readonly emailService;
|
|
@@ -20,6 +20,7 @@ declare class ReservationService {
|
|
|
20
20
|
referenceId: string;
|
|
21
21
|
acceptedAt?: Date | null | undefined;
|
|
22
22
|
cancelledAt?: Date | null | undefined;
|
|
23
|
+
cancellationMessage?: string | null | undefined;
|
|
23
24
|
createdAt?: Date | null | undefined;
|
|
24
25
|
}>;
|
|
25
26
|
/**
|
|
@@ -35,6 +36,7 @@ declare class ReservationService {
|
|
|
35
36
|
referenceId: string;
|
|
36
37
|
acceptedAt?: Date | null | undefined;
|
|
37
38
|
cancelledAt?: Date | null | undefined;
|
|
39
|
+
cancellationMessage?: string | null | undefined;
|
|
38
40
|
createdAt?: Date | null | undefined;
|
|
39
41
|
}>;
|
|
40
42
|
/**
|
|
@@ -60,6 +62,7 @@ declare class ReservationService {
|
|
|
60
62
|
referenceId: string;
|
|
61
63
|
acceptedAt?: Date | null | undefined;
|
|
62
64
|
cancelledAt?: Date | null | undefined;
|
|
65
|
+
cancellationMessage?: string | null | undefined;
|
|
63
66
|
createdAt?: Date | null | undefined;
|
|
64
67
|
}[];
|
|
65
68
|
}>;
|
|
@@ -87,6 +90,7 @@ declare class ReservationService {
|
|
|
87
90
|
referenceId: string;
|
|
88
91
|
acceptedAt?: Date | null | undefined;
|
|
89
92
|
cancelledAt?: Date | null | undefined;
|
|
93
|
+
cancellationMessage?: string | null | undefined;
|
|
90
94
|
createdAt?: Date | null | undefined;
|
|
91
95
|
}[];
|
|
92
96
|
}>;
|
|
@@ -103,6 +107,7 @@ declare class ReservationService {
|
|
|
103
107
|
referenceId: string;
|
|
104
108
|
acceptedAt?: Date | null | undefined;
|
|
105
109
|
cancelledAt?: Date | null | undefined;
|
|
110
|
+
cancellationMessage?: string | null | undefined;
|
|
106
111
|
createdAt?: Date | null | undefined;
|
|
107
112
|
}[]>;
|
|
108
113
|
/**
|
|
@@ -118,12 +123,13 @@ declare class ReservationService {
|
|
|
118
123
|
referenceId: string;
|
|
119
124
|
acceptedAt?: Date | null | undefined;
|
|
120
125
|
cancelledAt?: Date | null | undefined;
|
|
126
|
+
cancellationMessage?: string | null | undefined;
|
|
121
127
|
createdAt?: Date | null | undefined;
|
|
122
128
|
}>;
|
|
123
129
|
/**
|
|
124
130
|
* Update reservation status
|
|
125
131
|
*/
|
|
126
|
-
updateStatus(organizationId: string, reservationId: string, operation: "accept" | "cancel"): Promise<{
|
|
132
|
+
updateStatus(organizationId: string, reservationId: string, operation: "accept" | "cancel", body?: z.infer<typeof UpdateReservationStatusSchema>): Promise<{
|
|
127
133
|
id: string;
|
|
128
134
|
firstname: string;
|
|
129
135
|
lastname: string;
|
|
@@ -133,6 +139,7 @@ declare class ReservationService {
|
|
|
133
139
|
referenceId: string;
|
|
134
140
|
acceptedAt?: Date | null | undefined;
|
|
135
141
|
cancelledAt?: Date | null | undefined;
|
|
142
|
+
cancellationMessage?: string | null | undefined;
|
|
136
143
|
createdAt?: Date | null | undefined;
|
|
137
144
|
}>;
|
|
138
145
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as
|
|
1
|
+
import{__awaiter as o}from"tslib";import{z as m}from"@hono/zod-openapi";import{customAlphabet as g}from"nanoid";import{HttpException as c}from"../../core/exceptions/http-exception";import{logger as w}from"../../core/logging/pino";import{PaginationMetaSchema as p,ReservationSchema as l}from"../../schemas";const y=g("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ",6);class R{constructor(e,t){this.prisma=e,this.emailService=t}safelySendEmail(e,t){return o(this,void 0,void 0,function*(){try{yield t()}catch(i){w.error(Object.assign({err:i},e),"Email delivery failed")}})}createReservation(e,t,i){return o(this,void 0,void 0,function*(){var r;const n=yield this.prisma.organization.findFirst({where:{id:e},include:{configuration:!0}});if(!n)throw new c(404,"Organization not found");if(!(!((r=n.configuration)===null||r===void 0)&&r.isAcceptingReservations))throw new c(400,"This organization is not accepting reservations at the moment");const a=yield this.prisma.reservation.create({data:Object.assign({referenceId:y(),firstname:i.firstname,lastname:i.lastname,guests:i.guests,phone:i.phone,date:i.date,organization:{connect:{id:e}}},t?{user:{connect:{id:t.id}}}:{}),include:{organization:{include:{address:!0,configuration:!0,logoFile:!0,members:{include:{user:!0}}}},user:!0}});for(const s of a.organization.members)yield this.safelySendEmail({emailType:"reservation-notification",memberId:s.user.id,organizationId:e,reservationId:a.id},()=>this.emailService.sendReservationNotificationEmail(e,s.user,a));return l.parse(a)})}getReservation(e,t,i){return o(this,void 0,void 0,function*(){const r=yield this.prisma.reservation.findUnique({where:{id:i,organizationId:t,user:{id:e.id}}});if(!r)throw new c(404,"Reservation not found");return l.parse(r)})}getReservations(e,t){return o(this,void 0,void 0,function*(){const{page:i=1,limit:r=10,search:n,from:a,to:s}=t,[d,h]=yield this.prisma.reservation.paginate({orderBy:{createdAt:"desc"},where:Object.assign(Object.assign({organizationId:e},a||s?{date:Object.assign(Object.assign({},a?{gte:a}:{}),s?{lte:s}:{})}:{}),n&&{OR:[{firstname:{contains:n,mode:"insensitive"}},{lastname:{contains:n,mode:"insensitive"}},{referenceId:{contains:n,mode:"insensitive"}}]}),include:{user:!0}}).withPages({page:i,limit:r});return m.object({meta:p,list:m.array(l)}).parse({meta:h,list:d})})}getMyReservations(e,t,i){return o(this,void 0,void 0,function*(){const{page:r=1,limit:n=10,search:a}=i,[s,d]=yield this.prisma.reservation.paginate({orderBy:{createdAt:"desc"},where:Object.assign({organizationId:t,userId:e},a&&{referenceId:{contains:a,mode:"insensitive"}})}).withPages({page:r,limit:n});return m.object({meta:p,list:m.array(l)}).parse({meta:d,list:s})})}getUserReservations(e,t){return o(this,void 0,void 0,function*(){const i=yield this.prisma.reservation.findMany({where:{organizationId:t,userId:e}});return m.array(l).parse(i)})}updateReservation(e,t,i){return o(this,void 0,void 0,function*(){const r=yield this.prisma.reservation.findUnique({where:{id:t,organizationId:e}});if(!r)throw new c(404,"Reservation not found");if(r.cancelledAt)throw new c(400,"Cancelled reservations cannot be edited");const n=yield this.prisma.reservation.update({where:{id:t},data:{firstname:i.firstname,lastname:i.lastname,guests:i.guests,date:i.date},include:{organization:{include:{address:!0,configuration:!0,logoFile:!0,members:{include:{user:!0}}}},user:!0}});return yield this.safelySendEmail({emailType:"reservation-updated",organizationId:e,reservationId:n.id},()=>this.emailService.sendReservationUpdatedEmail(e,n)),l.parse(n)})}updateStatus(e,t,i){return o(this,arguments,void 0,function*(r,n,a,s={}){var d;if(!(yield this.prisma.reservation.findUnique({where:{id:n,organizationId:r}})))throw new c(404,"Reservation not found");const v=((d=s.message)===null||d===void 0?void 0:d.trim())||void 0;let f={};switch(a){case"accept":f={acceptedAt:new Date};break;case"cancel":f={cancelledAt:new Date,cancellationMessage:v??null};break}const u=yield this.prisma.reservation.update({where:{id:n},data:f,include:{organization:{include:{address:!0,configuration:!0,logoFile:!0,members:{include:{user:!0}}}},user:!0}});return a==="cancel"&&(yield this.safelySendEmail({emailType:"reservation-cancelled",organizationId:r,reservationId:u.id},()=>this.emailService.sendReservationCancellationEmail(r,u))),a==="accept"&&(yield this.safelySendEmail({emailType:"reservation-confirmed",organizationId:r,reservationId:u.id},()=>this.emailService.sendReservationConfirmationEmail(r,u))),l.parse(u)})}deleteReservation(e,t){return o(this,void 0,void 0,function*(){if(!(yield this.prisma.reservation.findUnique({where:{id:t,organizationId:e}})))throw new c(404,"Reservation not found");yield this.prisma.reservation.delete({where:{id:t}})})}}export{R as ReservationService};
|
package/src/schemas/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from "../features/order/fulfilment.schema";
|
|
|
22
22
|
export * from "../features/file/file.schema";
|
|
23
23
|
export * from "../features/order/recipient.schema";
|
|
24
24
|
export * from "./currency.schema";
|
|
25
|
+
export * from "./time-zone.schema";
|
|
25
26
|
export * from "../core/auth/auth.schema";
|
|
26
27
|
export * from "./address.schema";
|
|
27
28
|
export * from "./params.schema";
|
package/src/schemas/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"../features/analytics/analytics.schema";export*from"../features/access/access.schema";export*from"../features/cart/cart.schema";export*from"./error.schema";export*from"../core/auth/headers.schema";export*from"../features/integration/integration.schema";export*from"../features/product/product.schema";export*from"../core/auth/user.schema";export*from"./pagination.schema";export*from"../features/order/order.schema";export*from"../features/organization/organization.schema";export*from"../features/shipping-method/shipping-method.schema";export*from"../features/product-category/product-category.schema";export*from"../features/shipping-method/shipping-zone.schema";export*from"../features/product/product-modifier.schema";export*from"../features/organization/organization-configuration.schema";export*from"./number.schema";export*from"../features/manufacturer/manufacturer.schema";export*from"./locales.schema";export*from"../features/organization/legal-entity.schema";export*from"../features/order/fulfilment.schema";export*from"../features/file/file.schema";export*from"../features/order/recipient.schema";export*from"./currency.schema";export*from"../core/auth/auth.schema";export*from"./address.schema";export*from"./params.schema";export*from"../features/location/location.schema";export*from"../features/payment/payment.schema";export*from"../features/reservation/reservation.schema";export*from"../features/customer/customer.schema";
|
|
1
|
+
export*from"../features/analytics/analytics.schema";export*from"../features/access/access.schema";export*from"../features/cart/cart.schema";export*from"./error.schema";export*from"../core/auth/headers.schema";export*from"../features/integration/integration.schema";export*from"../features/product/product.schema";export*from"../core/auth/user.schema";export*from"./pagination.schema";export*from"../features/order/order.schema";export*from"../features/organization/organization.schema";export*from"../features/shipping-method/shipping-method.schema";export*from"../features/product-category/product-category.schema";export*from"../features/shipping-method/shipping-zone.schema";export*from"../features/product/product-modifier.schema";export*from"../features/organization/organization-configuration.schema";export*from"./number.schema";export*from"../features/manufacturer/manufacturer.schema";export*from"./locales.schema";export*from"../features/organization/legal-entity.schema";export*from"../features/order/fulfilment.schema";export*from"../features/file/file.schema";export*from"../features/order/recipient.schema";export*from"./currency.schema";export*from"./time-zone.schema";export*from"../core/auth/auth.schema";export*from"./address.schema";export*from"./params.schema";export*from"../features/location/location.schema";export*from"../features/payment/payment.schema";export*from"../features/reservation/reservation.schema";export*from"../features/customer/customer.schema";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const DEFAULT_ORGANIZATION_TIME_ZONE = "Europe/Warsaw";
|
|
3
|
+
export declare const supportedTimeZones: readonly ["UTC", "Europe/Warsaw", "Europe/London", "Europe/Dublin", "Europe/Lisbon", "Europe/Madrid", "Europe/Paris", "Europe/Amsterdam", "Europe/Brussels", "Europe/Berlin", "Europe/Zurich", "Europe/Rome", "Europe/Prague", "Europe/Vienna", "Europe/Budapest", "Europe/Copenhagen", "Europe/Stockholm", "Europe/Oslo", "Europe/Helsinki", "Europe/Athens", "Europe/Bucharest", "Europe/Sofia", "Europe/Istanbul", "Europe/Kyiv", "Europe/Vilnius", "Europe/Riga", "Europe/Tallinn", "Europe/Moscow", "America/St_Johns", "America/Halifax", "America/New_York", "America/Toronto", "America/Chicago", "America/Winnipeg", "America/Denver", "America/Phoenix", "America/Edmonton", "America/Los_Angeles", "America/Vancouver", "America/Anchorage", "Pacific/Honolulu", "America/Mexico_City", "America/Bogota", "America/Lima", "America/Santiago", "America/Sao_Paulo", "America/Argentina/Buenos_Aires", "Africa/Casablanca", "Africa/Cairo", "Africa/Johannesburg", "Asia/Dubai", "Asia/Riyadh", "Asia/Jerusalem", "Asia/Tehran", "Asia/Karachi", "Asia/Kolkata", "Asia/Dhaka", "Asia/Bangkok", "Asia/Singapore", "Asia/Hong_Kong", "Asia/Shanghai", "Asia/Taipei", "Asia/Seoul", "Asia/Tokyo", "Australia/Perth", "Australia/Adelaide", "Australia/Sydney", "Pacific/Auckland"];
|
|
4
|
+
export declare const timeZoneOptions: {
|
|
5
|
+
value: "Europe/Warsaw" | "UTC" | "Europe/London" | "Europe/Dublin" | "Europe/Lisbon" | "Europe/Madrid" | "Europe/Paris" | "Europe/Amsterdam" | "Europe/Brussels" | "Europe/Berlin" | "Europe/Zurich" | "Europe/Rome" | "Europe/Prague" | "Europe/Vienna" | "Europe/Budapest" | "Europe/Copenhagen" | "Europe/Stockholm" | "Europe/Oslo" | "Europe/Helsinki" | "Europe/Athens" | "Europe/Bucharest" | "Europe/Sofia" | "Europe/Istanbul" | "Europe/Kyiv" | "Europe/Vilnius" | "Europe/Riga" | "Europe/Tallinn" | "Europe/Moscow" | "America/St_Johns" | "America/Halifax" | "America/New_York" | "America/Toronto" | "America/Chicago" | "America/Winnipeg" | "America/Denver" | "America/Phoenix" | "America/Edmonton" | "America/Los_Angeles" | "America/Vancouver" | "America/Anchorage" | "Pacific/Honolulu" | "America/Mexico_City" | "America/Bogota" | "America/Lima" | "America/Santiago" | "America/Sao_Paulo" | "America/Argentina/Buenos_Aires" | "Africa/Casablanca" | "Africa/Cairo" | "Africa/Johannesburg" | "Asia/Dubai" | "Asia/Riyadh" | "Asia/Jerusalem" | "Asia/Tehran" | "Asia/Karachi" | "Asia/Kolkata" | "Asia/Dhaka" | "Asia/Bangkok" | "Asia/Singapore" | "Asia/Hong_Kong" | "Asia/Shanghai" | "Asia/Taipei" | "Asia/Seoul" | "Asia/Tokyo" | "Australia/Perth" | "Australia/Adelaide" | "Australia/Sydney" | "Pacific/Auckland";
|
|
6
|
+
label: string;
|
|
7
|
+
}[];
|
|
8
|
+
export declare const isValidTimeZone: (value: string) => boolean;
|
|
9
|
+
export declare const defaultTimeZone: z.ZodString;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as r}from"@hono/zod-openapi";export const DEFAULT_ORGANIZATION_TIME_ZONE="Europe/Warsaw",supportedTimeZones=["UTC","Europe/Warsaw","Europe/London","Europe/Dublin","Europe/Lisbon","Europe/Madrid","Europe/Paris","Europe/Amsterdam","Europe/Brussels","Europe/Berlin","Europe/Zurich","Europe/Rome","Europe/Prague","Europe/Vienna","Europe/Budapest","Europe/Copenhagen","Europe/Stockholm","Europe/Oslo","Europe/Helsinki","Europe/Athens","Europe/Bucharest","Europe/Sofia","Europe/Istanbul","Europe/Kyiv","Europe/Vilnius","Europe/Riga","Europe/Tallinn","Europe/Moscow","America/St_Johns","America/Halifax","America/New_York","America/Toronto","America/Chicago","America/Winnipeg","America/Denver","America/Phoenix","America/Edmonton","America/Los_Angeles","America/Vancouver","America/Anchorage","Pacific/Honolulu","America/Mexico_City","America/Bogota","America/Lima","America/Santiago","America/Sao_Paulo","America/Argentina/Buenos_Aires","Africa/Casablanca","Africa/Cairo","Africa/Johannesburg","Asia/Dubai","Asia/Riyadh","Asia/Jerusalem","Asia/Tehran","Asia/Karachi","Asia/Kolkata","Asia/Dhaka","Asia/Bangkok","Asia/Singapore","Asia/Hong_Kong","Asia/Shanghai","Asia/Taipei","Asia/Seoul","Asia/Tokyo","Australia/Perth","Australia/Adelaide","Australia/Sydney","Pacific/Auckland"];const i=new Set(supportedTimeZones);export const timeZoneOptions=supportedTimeZones.map(e=>({value:e,label:e.replace(/_/g," ")})),isValidTimeZone=e=>{const a=e.trim();if(!a)return!1;if(i.has(a))return!0;try{return new Intl.DateTimeFormat("en-US",{timeZone:a}).format(new Date),!0}catch{return!1}},defaultTimeZone=r.string().trim().min(1,"Time zone is required").refine(isValidTimeZone,"Invalid time zone").openapi({example:DEFAULT_ORGANIZATION_TIME_ZONE,description:"Default IANA time zone for the organization"});
|