@mac777/project-pinecone-schema 1.0.14 → 1.1.0

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.
@@ -1781,13 +1781,29 @@ export declare const approvedEventEditSchema: z.ZodObject<{
1781
1781
  tickets: z.ZodOptional<z.ZodArray<z.ZodObject<{
1782
1782
  _id: z.ZodOptional<z.ZodString>;
1783
1783
  name: z.ZodString;
1784
- price: z.ZodNumber;
1784
+ description: z.ZodOptional<z.ZodString>;
1785
+ price: z.ZodObject<{
1786
+ amount: z.ZodNumber;
1787
+ currency: z.ZodDefault<z.ZodString>;
1788
+ }, "strip", z.ZodTypeAny, {
1789
+ amount: number;
1790
+ currency: string;
1791
+ }, {
1792
+ amount: number;
1793
+ currency?: string | undefined;
1794
+ }>;
1785
1795
  quantity: z.ZodNumber;
1796
+ tier: z.ZodDefault<z.ZodString>;
1786
1797
  benefits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1787
1798
  wristbandColor: z.ZodDefault<z.ZodString>;
1799
+ accentColor: z.ZodDefault<z.ZodString>;
1800
+ isDark: z.ZodDefault<z.ZodBoolean>;
1801
+ glassMode: z.ZodDefault<z.ZodBoolean>;
1802
+ cornerRadius: z.ZodDefault<z.ZodNumber>;
1803
+ perforationStyle: z.ZodDefault<z.ZodEnum<["solid", "dashed", "dotted"]>>;
1788
1804
  isVisible: z.ZodDefault<z.ZodBoolean>;
1789
1805
  isActive: z.ZodDefault<z.ZodBoolean>;
1790
- limits: z.ZodOptional<z.ZodObject<{
1806
+ limits: z.ZodEffects<z.ZodOptional<z.ZodObject<{
1791
1807
  minPerOrder: z.ZodNumber;
1792
1808
  maxPerOrder: z.ZodNumber;
1793
1809
  }, "strip", z.ZodTypeAny, {
@@ -1796,15 +1812,31 @@ export declare const approvedEventEditSchema: z.ZodObject<{
1796
1812
  }, {
1797
1813
  minPerOrder: number;
1798
1814
  maxPerOrder: number;
1799
- }>>;
1815
+ }>>, {
1816
+ minPerOrder: number;
1817
+ maxPerOrder: number;
1818
+ } | undefined, {
1819
+ minPerOrder: number;
1820
+ maxPerOrder: number;
1821
+ } | undefined>;
1800
1822
  }, "strip", z.ZodTypeAny, {
1801
1823
  name: string;
1802
- price: number;
1824
+ price: {
1825
+ amount: number;
1826
+ currency: string;
1827
+ };
1803
1828
  quantity: number;
1804
1829
  wristbandColor: string;
1830
+ accentColor: string;
1831
+ isDark: boolean;
1832
+ glassMode: boolean;
1833
+ cornerRadius: number;
1834
+ perforationStyle: "solid" | "dashed" | "dotted";
1805
1835
  isVisible: boolean;
1806
1836
  isActive: boolean;
1837
+ tier: string;
1807
1838
  _id?: string | undefined;
1839
+ description?: string | undefined;
1808
1840
  limits?: {
1809
1841
  minPerOrder: number;
1810
1842
  maxPerOrder: number;
@@ -1812,17 +1844,27 @@ export declare const approvedEventEditSchema: z.ZodObject<{
1812
1844
  benefits?: string[] | undefined;
1813
1845
  }, {
1814
1846
  name: string;
1815
- price: number;
1847
+ price: {
1848
+ amount: number;
1849
+ currency?: string | undefined;
1850
+ };
1816
1851
  quantity: number;
1817
1852
  _id?: string | undefined;
1853
+ description?: string | undefined;
1818
1854
  limits?: {
1819
1855
  minPerOrder: number;
1820
1856
  maxPerOrder: number;
1821
1857
  } | undefined;
1822
1858
  wristbandColor?: string | undefined;
1859
+ accentColor?: string | undefined;
1860
+ isDark?: boolean | undefined;
1861
+ glassMode?: boolean | undefined;
1862
+ cornerRadius?: number | undefined;
1863
+ perforationStyle?: "solid" | "dashed" | "dotted" | undefined;
1823
1864
  isVisible?: boolean | undefined;
1824
1865
  isActive?: boolean | undefined;
1825
1866
  benefits?: string[] | undefined;
1867
+ tier?: string | undefined;
1826
1868
  }>, "many">>;
1827
1869
  schedule: z.ZodEffects<z.ZodOptional<z.ZodObject<{
1828
1870
  startDate: z.ZodDate;
@@ -1864,12 +1906,22 @@ export declare const approvedEventEditSchema: z.ZodObject<{
1864
1906
  } | undefined;
1865
1907
  tickets?: {
1866
1908
  name: string;
1867
- price: number;
1909
+ price: {
1910
+ amount: number;
1911
+ currency: string;
1912
+ };
1868
1913
  quantity: number;
1869
1914
  wristbandColor: string;
1915
+ accentColor: string;
1916
+ isDark: boolean;
1917
+ glassMode: boolean;
1918
+ cornerRadius: number;
1919
+ perforationStyle: "solid" | "dashed" | "dotted";
1870
1920
  isVisible: boolean;
1871
1921
  isActive: boolean;
1922
+ tier: string;
1872
1923
  _id?: string | undefined;
1924
+ description?: string | undefined;
1873
1925
  limits?: {
1874
1926
  minPerOrder: number;
1875
1927
  maxPerOrder: number;
@@ -1901,17 +1953,27 @@ export declare const approvedEventEditSchema: z.ZodObject<{
1901
1953
  } | undefined;
1902
1954
  tickets?: {
1903
1955
  name: string;
1904
- price: number;
1956
+ price: {
1957
+ amount: number;
1958
+ currency?: string | undefined;
1959
+ };
1905
1960
  quantity: number;
1906
1961
  _id?: string | undefined;
1962
+ description?: string | undefined;
1907
1963
  limits?: {
1908
1964
  minPerOrder: number;
1909
1965
  maxPerOrder: number;
1910
1966
  } | undefined;
1911
1967
  wristbandColor?: string | undefined;
1968
+ accentColor?: string | undefined;
1969
+ isDark?: boolean | undefined;
1970
+ glassMode?: boolean | undefined;
1971
+ cornerRadius?: number | undefined;
1972
+ perforationStyle?: "solid" | "dashed" | "dotted" | undefined;
1912
1973
  isVisible?: boolean | undefined;
1913
1974
  isActive?: boolean | undefined;
1914
1975
  benefits?: string[] | undefined;
1976
+ tier?: string | undefined;
1915
1977
  }[] | undefined;
1916
1978
  languages?: string[] | undefined;
1917
1979
  }>;
@@ -1973,13 +2035,23 @@ export declare const publishedEventEditSchema: z.ZodObject<{
1973
2035
  }>>;
1974
2036
  tickets: z.ZodOptional<z.ZodArray<z.ZodObject<{
1975
2037
  _id: z.ZodString;
1976
- price: z.ZodOptional<z.ZodNumber>;
2038
+ price: z.ZodOptional<z.ZodObject<{
2039
+ amount: z.ZodNumber;
2040
+ currency: z.ZodDefault<z.ZodString>;
2041
+ }, "strip", z.ZodTypeAny, {
2042
+ amount: number;
2043
+ currency: string;
2044
+ }, {
2045
+ amount: number;
2046
+ currency?: string | undefined;
2047
+ }>>;
1977
2048
  quantity: z.ZodOptional<z.ZodNumber>;
1978
2049
  benefits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1979
- wristbandColor: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1980
- isVisible: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1981
- isActive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1982
- limits: z.ZodOptional<z.ZodObject<{
2050
+ wristbandColor: z.ZodOptional<z.ZodString>;
2051
+ accentColor: z.ZodOptional<z.ZodString>;
2052
+ isVisible: z.ZodOptional<z.ZodBoolean>;
2053
+ isActive: z.ZodOptional<z.ZodBoolean>;
2054
+ limits: z.ZodEffects<z.ZodOptional<z.ZodObject<{
1983
2055
  minPerOrder: z.ZodOptional<z.ZodNumber>;
1984
2056
  maxPerOrder: z.ZodOptional<z.ZodNumber>;
1985
2057
  }, "strip", z.ZodTypeAny, {
@@ -1988,28 +2060,42 @@ export declare const publishedEventEditSchema: z.ZodObject<{
1988
2060
  }, {
1989
2061
  minPerOrder?: number | undefined;
1990
2062
  maxPerOrder?: number | undefined;
1991
- }>>;
2063
+ }>>, {
2064
+ minPerOrder?: number | undefined;
2065
+ maxPerOrder?: number | undefined;
2066
+ } | undefined, {
2067
+ minPerOrder?: number | undefined;
2068
+ maxPerOrder?: number | undefined;
2069
+ } | undefined>;
1992
2070
  }, "strip", z.ZodTypeAny, {
1993
2071
  _id: string;
1994
- wristbandColor: string;
1995
- isVisible: boolean;
1996
- isActive: boolean;
1997
- price?: number | undefined;
2072
+ price?: {
2073
+ amount: number;
2074
+ currency: string;
2075
+ } | undefined;
1998
2076
  quantity?: number | undefined;
1999
2077
  limits?: {
2000
2078
  minPerOrder?: number | undefined;
2001
2079
  maxPerOrder?: number | undefined;
2002
2080
  } | undefined;
2081
+ wristbandColor?: string | undefined;
2082
+ accentColor?: string | undefined;
2083
+ isVisible?: boolean | undefined;
2084
+ isActive?: boolean | undefined;
2003
2085
  benefits?: string[] | undefined;
2004
2086
  }, {
2005
2087
  _id: string;
2006
- price?: number | undefined;
2088
+ price?: {
2089
+ amount: number;
2090
+ currency?: string | undefined;
2091
+ } | undefined;
2007
2092
  quantity?: number | undefined;
2008
2093
  limits?: {
2009
2094
  minPerOrder?: number | undefined;
2010
2095
  maxPerOrder?: number | undefined;
2011
2096
  } | undefined;
2012
2097
  wristbandColor?: string | undefined;
2098
+ accentColor?: string | undefined;
2013
2099
  isVisible?: boolean | undefined;
2014
2100
  isActive?: boolean | undefined;
2015
2101
  benefits?: string[] | undefined;
@@ -2033,15 +2119,19 @@ export declare const publishedEventEditSchema: z.ZodObject<{
2033
2119
  highlights?: string[] | undefined;
2034
2120
  tickets?: {
2035
2121
  _id: string;
2036
- wristbandColor: string;
2037
- isVisible: boolean;
2038
- isActive: boolean;
2039
- price?: number | undefined;
2122
+ price?: {
2123
+ amount: number;
2124
+ currency: string;
2125
+ } | undefined;
2040
2126
  quantity?: number | undefined;
2041
2127
  limits?: {
2042
2128
  minPerOrder?: number | undefined;
2043
2129
  maxPerOrder?: number | undefined;
2044
2130
  } | undefined;
2131
+ wristbandColor?: string | undefined;
2132
+ accentColor?: string | undefined;
2133
+ isVisible?: boolean | undefined;
2134
+ isActive?: boolean | undefined;
2045
2135
  benefits?: string[] | undefined;
2046
2136
  }[] | undefined;
2047
2137
  languages?: string[] | undefined;
@@ -2064,13 +2154,17 @@ export declare const publishedEventEditSchema: z.ZodObject<{
2064
2154
  highlights?: string[] | undefined;
2065
2155
  tickets?: {
2066
2156
  _id: string;
2067
- price?: number | undefined;
2157
+ price?: {
2158
+ amount: number;
2159
+ currency?: string | undefined;
2160
+ } | undefined;
2068
2161
  quantity?: number | undefined;
2069
2162
  limits?: {
2070
2163
  minPerOrder?: number | undefined;
2071
2164
  maxPerOrder?: number | undefined;
2072
2165
  } | undefined;
2073
2166
  wristbandColor?: string | undefined;
2167
+ accentColor?: string | undefined;
2074
2168
  isVisible?: boolean | undefined;
2075
2169
  isActive?: boolean | undefined;
2076
2170
  benefits?: string[] | undefined;
@@ -2081,6 +2175,33 @@ export declare const liveEventEditSchema: z.ZodObject<{
2081
2175
  eventId: z.ZodString;
2082
2176
  hostId: z.ZodString;
2083
2177
  liveUpdate: z.ZodOptional<z.ZodString>;
2178
+ media: z.ZodOptional<z.ZodObject<{
2179
+ gallery: z.ZodArray<z.ZodObject<{
2180
+ url: z.ZodString;
2181
+ caption: z.ZodOptional<z.ZodString>;
2182
+ order: z.ZodOptional<z.ZodNumber>;
2183
+ }, "strip", z.ZodTypeAny, {
2184
+ url: string;
2185
+ order?: number | undefined;
2186
+ caption?: string | undefined;
2187
+ }, {
2188
+ url: string;
2189
+ order?: number | undefined;
2190
+ caption?: string | undefined;
2191
+ }>, "many">;
2192
+ }, "strip", z.ZodTypeAny, {
2193
+ gallery: {
2194
+ url: string;
2195
+ order?: number | undefined;
2196
+ caption?: string | undefined;
2197
+ }[];
2198
+ }, {
2199
+ gallery: {
2200
+ url: string;
2201
+ order?: number | undefined;
2202
+ caption?: string | undefined;
2203
+ }[];
2204
+ }>>;
2084
2205
  tickets: z.ZodOptional<z.ZodArray<z.ZodObject<{
2085
2206
  _id: z.ZodString;
2086
2207
  quantity: z.ZodOptional<z.ZodNumber>;
@@ -2097,6 +2218,13 @@ export declare const liveEventEditSchema: z.ZodObject<{
2097
2218
  }, "strip", z.ZodTypeAny, {
2098
2219
  eventId: string;
2099
2220
  hostId: string;
2221
+ media?: {
2222
+ gallery: {
2223
+ url: string;
2224
+ order?: number | undefined;
2225
+ caption?: string | undefined;
2226
+ }[];
2227
+ } | undefined;
2100
2228
  tickets?: {
2101
2229
  _id: string;
2102
2230
  quantity?: number | undefined;
@@ -2106,6 +2234,13 @@ export declare const liveEventEditSchema: z.ZodObject<{
2106
2234
  }, {
2107
2235
  eventId: string;
2108
2236
  hostId: string;
2237
+ media?: {
2238
+ gallery: {
2239
+ url: string;
2240
+ order?: number | undefined;
2241
+ caption?: string | undefined;
2242
+ }[];
2243
+ } | undefined;
2109
2244
  tickets?: {
2110
2245
  _id: string;
2111
2246
  quantity?: number | undefined;
@@ -2117,17 +2252,55 @@ export declare const endedEventEditSchema: z.ZodObject<{
2117
2252
  eventId: z.ZodString;
2118
2253
  hostId: z.ZodString;
2119
2254
  recap: z.ZodOptional<z.ZodString>;
2120
- eventPhotos: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2255
+ media: z.ZodOptional<z.ZodObject<{
2256
+ gallery: z.ZodArray<z.ZodObject<{
2257
+ url: z.ZodString;
2258
+ caption: z.ZodOptional<z.ZodString>;
2259
+ order: z.ZodOptional<z.ZodNumber>;
2260
+ }, "strip", z.ZodTypeAny, {
2261
+ url: string;
2262
+ order?: number | undefined;
2263
+ caption?: string | undefined;
2264
+ }, {
2265
+ url: string;
2266
+ order?: number | undefined;
2267
+ caption?: string | undefined;
2268
+ }>, "many">;
2269
+ }, "strip", z.ZodTypeAny, {
2270
+ gallery: {
2271
+ url: string;
2272
+ order?: number | undefined;
2273
+ caption?: string | undefined;
2274
+ }[];
2275
+ }, {
2276
+ gallery: {
2277
+ url: string;
2278
+ order?: number | undefined;
2279
+ caption?: string | undefined;
2280
+ }[];
2281
+ }>>;
2121
2282
  }, "strip", z.ZodTypeAny, {
2122
2283
  eventId: string;
2123
2284
  hostId: string;
2285
+ media?: {
2286
+ gallery: {
2287
+ url: string;
2288
+ order?: number | undefined;
2289
+ caption?: string | undefined;
2290
+ }[];
2291
+ } | undefined;
2124
2292
  recap?: string | undefined;
2125
- eventPhotos?: string[] | undefined;
2126
2293
  }, {
2127
2294
  eventId: string;
2128
2295
  hostId: string;
2296
+ media?: {
2297
+ gallery: {
2298
+ url: string;
2299
+ order?: number | undefined;
2300
+ caption?: string | undefined;
2301
+ }[];
2302
+ } | undefined;
2129
2303
  recap?: string | undefined;
2130
- eventPhotos?: string[] | undefined;
2131
2304
  }>;
2132
2305
  export declare const submitEventSchema: z.ZodObject<{
2133
2306
  title: z.ZodString;
@@ -120,34 +120,48 @@ exports.approvedEventEditSchema = zod_1.z.object({
120
120
  media: media_schema_1.mediaSchema.optional(),
121
121
  // Tickets (full control, no sales yet)
122
122
  tickets: zod_1.z.array(zod_1.z.object({
123
- _id: zod_1.z.string().optional(), // Undefined = new tier
124
- name: zod_1.z.string({ required_error: 'Ticket name is required' }),
125
- price: zod_1.z.number({ required_error: 'Ticket price is required' }).min(0, 'Ticket price cannot be negative'),
126
- quantity: zod_1.z.number({ required_error: 'Ticket quantity is required' }).min(1, 'Ticket quantity must be at least 1'),
127
- benefits: zod_1.z.array(zod_1.z.string()).optional(),
128
- wristbandColor: zod_1.z.string().default('#000000'),
123
+ _id: zod_1.z.string().regex(/^[0-9a-fA-F]{24}$/, 'Invalid ticket ID').optional(), // Undefined = new tier
124
+ name: zod_1.z.string({ required_error: 'Ticket name is required' }).min(1).max(100),
125
+ description: zod_1.z.string().max(500).optional(),
126
+ price: zod_1.z.object({
127
+ amount: zod_1.z.number({ required_error: 'Ticket price amount is required' }).min(0, 'Price cannot be negative').max(1000000, 'Price exceeds maximum'),
128
+ currency: zod_1.z.string().default('BDT')
129
+ }),
130
+ quantity: zod_1.z.number({ required_error: 'Ticket quantity is required' }).int('Quantity must be an integer').min(1, 'Ticket quantity must be at least 1').max(100000, 'Quantity exceeds maximum'),
131
+ tier: zod_1.z.string().min(1).max(50).default('regular'),
132
+ benefits: zod_1.z.array(zod_1.z.string().max(200)).max(20).optional(),
133
+ wristbandColor: zod_1.z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Invalid color format').default('#4f46e5'),
134
+ accentColor: zod_1.z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Invalid color format').default('#4f46e5'),
135
+ isDark: zod_1.z.boolean().default(false),
136
+ glassMode: zod_1.z.boolean().default(false),
137
+ cornerRadius: zod_1.z.number().min(0).max(50).default(32),
138
+ perforationStyle: zod_1.z.enum(['solid', 'dashed', 'dotted']).default('solid'),
129
139
  isVisible: zod_1.z.boolean().default(true),
130
140
  isActive: zod_1.z.boolean().default(true),
131
141
  limits: zod_1.z.object({
132
- minPerOrder: zod_1.z.number({ required_error: 'Min per order is required' }).min(1, 'Min per order must be at least 1'),
133
- maxPerOrder: zod_1.z.number({ required_error: 'Max per order is required' }).min(1, 'Max per order must be at least 1')
134
- }).optional()
142
+ minPerOrder: zod_1.z.number({ required_error: 'Min per order is required' }).int().min(1, 'Min per order must be at least 1').max(100),
143
+ maxPerOrder: zod_1.z.number({ required_error: 'Max per order is required' }).int().min(1, 'Max per order must be at least 1').max(100)
144
+ }).optional().refine((data) => {
145
+ if (!data)
146
+ return true;
147
+ return data.maxPerOrder >= data.minPerOrder;
148
+ }, {
149
+ message: 'Max per order must be greater than or equal to min per order',
150
+ path: ['maxPerOrder']
151
+ })
135
152
  })).optional(),
136
153
  // Minor date adjustments (±2 hours)
137
154
  schedule: zod_1.z.object({
138
- startDate: zod_1.z.date(),
139
- endDate: zod_1.z.date()
140
- }).optional().superRefine((data, ctx) => {
155
+ startDate: zod_1.z.coerce.date({ required_error: 'Start date is required' }),
156
+ endDate: zod_1.z.coerce.date({ required_error: 'End date is required' })
157
+ }).optional().refine((data) => {
141
158
  if (!data)
142
- return;
143
- const diff = Math.abs(data.startDate.getTime() - data.endDate.getTime());
144
- if (diff > 2 * 60 * 60 * 1000) {
145
- ctx.addIssue({
146
- path: ['endDate'],
147
- message: 'Schedule must be within 2 hours of original',
148
- code: zod_1.z.ZodIssueCode.custom,
149
- });
150
- }
159
+ return true;
160
+ // Ensure end date is after start date
161
+ return data.endDate > data.startDate;
162
+ }, {
163
+ message: 'End date must be after start date',
164
+ path: ['endDate']
151
165
  })
152
166
  });
153
167
  // Published
@@ -162,22 +176,33 @@ exports.publishedEventEditSchema = zod_1.z.object({
162
176
  media: media_schema_1.mediaSchema.optional(),
163
177
  // Ticket updates (complex validation)
164
178
  tickets: zod_1.z.array(zod_1.z.object({
165
- _id: zod_1.z.string(),
179
+ _id: zod_1.z.string().regex(/^[0-9a-fA-F]{24}$/, 'Invalid ticket ID'),
166
180
  // Price change validation happens in controller
167
- price: zod_1.z.number().min(0).optional(),
181
+ price: zod_1.z.object({
182
+ amount: zod_1.z.number().min(0, 'Price cannot be negative').max(1000000, 'Price exceeds maximum'),
183
+ currency: zod_1.z.string().default('BDT')
184
+ }).optional(),
168
185
  // Quantity increase only (unless sold = 0)
169
- quantity: zod_1.z.number().min(1).optional(),
186
+ quantity: zod_1.z.number().int('Quantity must be an integer').min(1, 'Quantity must be at least 1').max(100000, 'Quantity exceeds maximum').optional(),
170
187
  // Can add benefits, not remove
171
- benefits: zod_1.z.array(zod_1.z.string()).optional(),
188
+ benefits: zod_1.z.array(zod_1.z.string().max(200)).max(20).optional(),
172
189
  // Operational controls
173
- wristbandColor: zod_1.z.string().optional().default('#000000'),
174
- isVisible: zod_1.z.boolean().optional().default(true),
175
- isActive: zod_1.z.boolean().optional().default(true),
176
- // Cannot change limits if sales exist
190
+ wristbandColor: zod_1.z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Invalid color format').optional(),
191
+ accentColor: zod_1.z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Invalid color format').optional(),
192
+ isVisible: zod_1.z.boolean().optional(),
193
+ isActive: zod_1.z.boolean().optional(),
194
+ // Cannot change limits if sales exist (validated in service)
177
195
  limits: zod_1.z.object({
178
- minPerOrder: zod_1.z.number().min(1, 'Min per order must be at least 1').optional(),
179
- maxPerOrder: zod_1.z.number().min(1, 'Max per order must be at least 1').optional()
180
- }).optional()
196
+ minPerOrder: zod_1.z.number().int().min(1).max(100).optional(),
197
+ maxPerOrder: zod_1.z.number().int().min(1).max(100).optional()
198
+ }).optional().refine((data) => {
199
+ if (!data)
200
+ return true;
201
+ return data.maxPerOrder >= data.minPerOrder;
202
+ }, {
203
+ message: 'Max per order must be >= min per order',
204
+ path: ['maxPerOrder']
205
+ })
181
206
  })).optional(),
182
207
  });
183
208
  // Live
@@ -185,11 +210,19 @@ exports.liveEventEditSchema = zod_1.z.object({
185
210
  eventId: zod_1.z.string({ required_error: 'Event not found' }).regex(/^[0-9a-fA-F]{24}$/),
186
211
  hostId: zod_1.z.string({ required_error: 'Unauthorized' }).regex(/^[0-9a-fA-F]{24}$/),
187
212
  // Live update only
188
- liveUpdate: zod_1.z.string().max(500, 'Live update cannot exceed 500 characters').optional(),
213
+ liveUpdate: zod_1.z.string().min(1).max(500, 'Live update cannot exceed 500 characters').optional(),
214
+ // Gallery updates (can add event photos)
215
+ media: zod_1.z.object({
216
+ gallery: zod_1.z.array(zod_1.z.object({
217
+ url: zod_1.z.string().url('Invalid image URL'),
218
+ caption: zod_1.z.string().max(200).optional(),
219
+ order: zod_1.z.number().int().min(0).optional()
220
+ })).max(50, 'Cannot have more than 50 gallery images')
221
+ }).optional(),
189
222
  // Ticket operational controls
190
223
  tickets: zod_1.z.array(zod_1.z.object({
191
- _id: zod_1.z.string(),
192
- quantity: zod_1.z.number().min(1).optional(), // Increase only
224
+ _id: zod_1.z.string().regex(/^[0-9a-fA-F]{24}$/, 'Invalid ticket ID'),
225
+ quantity: zod_1.z.number().int('Quantity must be an integer').min(1).max(100000).optional(), // Increase only
193
226
  isActive: zod_1.z.boolean().optional() // Pause sales
194
227
  })).optional()
195
228
  });
@@ -198,8 +231,15 @@ exports.endedEventEditSchema = zod_1.z.object({
198
231
  eventId: zod_1.z.string({ required_error: 'Event not found' }).regex(/^[0-9a-fA-F]{24}$/),
199
232
  hostId: zod_1.z.string({ required_error: 'Unauthorized' }).regex(/^[0-9a-fA-F]{24}$/),
200
233
  // Post-event content
201
- recap: zod_1.z.string().max(2000, 'Recap cannot exceed 2000 characters').optional(),
202
- eventPhotos: zod_1.z.array(zod_1.z.string()).max(20, 'Cannot have more than 20 event photos').optional()
234
+ recap: zod_1.z.string().min(10, 'Recap must be at least 10 characters').max(2000, 'Recap cannot exceed 2000 characters').optional(),
235
+ // Event photos (gallery)
236
+ media: zod_1.z.object({
237
+ gallery: zod_1.z.array(zod_1.z.object({
238
+ url: zod_1.z.string().url('Invalid image URL'),
239
+ caption: zod_1.z.string().max(200).optional(),
240
+ order: zod_1.z.number().int().min(0).optional()
241
+ })).max(50, 'Cannot have more than 50 event photos')
242
+ }).optional()
203
243
  });
204
244
  // =============================================================================
205
245
  // COMPOSITE SCHEMAS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mac777/project-pinecone-schema",
3
- "version": "1.0.14",
3
+ "version": "1.1.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -134,38 +134,47 @@ export const approvedEventEditSchema = z.object({
134
134
 
135
135
  // Tickets (full control, no sales yet)
136
136
  tickets: z.array(z.object({
137
- _id: z.string().optional(), // Undefined = new tier
138
- name: z.string({ required_error: 'Ticket name is required' }),
139
- price: z.number({ required_error: 'Ticket price is required' }).min(0, 'Ticket price cannot be negative'),
140
- quantity: z.number({ required_error: 'Ticket quantity is required' }).min(1, 'Ticket quantity must be at least 1'),
141
- benefits: z.array(z.string()).optional(),
142
- wristbandColor: z.string().default('#000000'),
137
+ _id: z.string().regex(/^[0-9a-fA-F]{24}$/, 'Invalid ticket ID').optional(), // Undefined = new tier
138
+ name: z.string({ required_error: 'Ticket name is required' }).min(1).max(100),
139
+ description: z.string().max(500).optional(),
140
+ price: z.object({
141
+ amount: z.number({ required_error: 'Ticket price amount is required' }).min(0, 'Price cannot be negative').max(1000000, 'Price exceeds maximum'),
142
+ currency: z.string().default('BDT')
143
+ }),
144
+ quantity: z.number({ required_error: 'Ticket quantity is required' }).int('Quantity must be an integer').min(1, 'Ticket quantity must be at least 1').max(100000, 'Quantity exceeds maximum'),
145
+ tier: z.string().min(1).max(50).default('regular'),
146
+ benefits: z.array(z.string().max(200)).max(20).optional(),
147
+ wristbandColor: z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Invalid color format').default('#4f46e5'),
148
+ accentColor: z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Invalid color format').default('#4f46e5'),
149
+ isDark: z.boolean().default(false),
150
+ glassMode: z.boolean().default(false),
151
+ cornerRadius: z.number().min(0).max(50).default(32),
152
+ perforationStyle: z.enum(['solid', 'dashed', 'dotted']).default('solid'),
143
153
  isVisible: z.boolean().default(true),
144
154
  isActive: z.boolean().default(true),
145
155
  limits: z.object({
146
- minPerOrder: z.number({ required_error: 'Min per order is required' }).min(1, 'Min per order must be at least 1'),
147
- maxPerOrder: z.number({ required_error: 'Max per order is required' }).min(1, 'Max per order must be at least 1')
148
- }).optional()
156
+ minPerOrder: z.number({ required_error: 'Min per order is required' }).int().min(1, 'Min per order must be at least 1').max(100),
157
+ maxPerOrder: z.number({ required_error: 'Max per order is required' }).int().min(1, 'Max per order must be at least 1').max(100)
158
+ }).optional().refine((data) => {
159
+ if (!data) return true;
160
+ return data.maxPerOrder >= data.minPerOrder;
161
+ }, {
162
+ message: 'Max per order must be greater than or equal to min per order',
163
+ path: ['maxPerOrder']
164
+ })
149
165
  })).optional(),
150
166
 
151
167
  // Minor date adjustments (±2 hours)
152
168
  schedule: z.object({
153
- startDate: z.date(),
154
- endDate: z.date()
155
- }).optional().superRefine((data, ctx) => {
156
- if (!data) return;
157
-
158
- const diff = Math.abs(
159
- data.startDate.getTime() - data.endDate.getTime()
160
- );
161
-
162
- if (diff > 2 * 60 * 60 * 1000) {
163
- ctx.addIssue({
164
- path: ['endDate'],
165
- message: 'Schedule must be within 2 hours of original',
166
- code: z.ZodIssueCode.custom,
167
- });
168
- }
169
+ startDate: z.coerce.date({ required_error: 'Start date is required' }),
170
+ endDate: z.coerce.date({ required_error: 'End date is required' })
171
+ }).optional().refine((data) => {
172
+ if (!data) return true;
173
+ // Ensure end date is after start date
174
+ return data.endDate > data.startDate;
175
+ }, {
176
+ message: 'End date must be after start date',
177
+ path: ['endDate']
169
178
  })
170
179
  });
171
180
 
@@ -184,27 +193,37 @@ export const publishedEventEditSchema = z.object({
184
193
 
185
194
  // Ticket updates (complex validation)
186
195
  tickets: z.array(z.object({
187
- _id: z.string(),
196
+ _id: z.string().regex(/^[0-9a-fA-F]{24}$/, 'Invalid ticket ID'),
188
197
 
189
198
  // Price change validation happens in controller
190
- price: z.number().min(0).optional(),
199
+ price: z.object({
200
+ amount: z.number().min(0, 'Price cannot be negative').max(1000000, 'Price exceeds maximum'),
201
+ currency: z.string().default('BDT')
202
+ }).optional(),
191
203
 
192
204
  // Quantity increase only (unless sold = 0)
193
- quantity: z.number().min(1).optional(),
205
+ quantity: z.number().int('Quantity must be an integer').min(1, 'Quantity must be at least 1').max(100000, 'Quantity exceeds maximum').optional(),
194
206
 
195
207
  // Can add benefits, not remove
196
- benefits: z.array(z.string()).optional(),
208
+ benefits: z.array(z.string().max(200)).max(20).optional(),
197
209
 
198
210
  // Operational controls
199
- wristbandColor: z.string().optional().default('#000000'),
200
- isVisible: z.boolean().optional().default(true),
201
- isActive: z.boolean().optional().default(true),
211
+ wristbandColor: z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Invalid color format').optional(),
212
+ accentColor: z.string().regex(/^#[0-9A-Fa-f]{6}$/, 'Invalid color format').optional(),
213
+ isVisible: z.boolean().optional(),
214
+ isActive: z.boolean().optional(),
202
215
 
203
- // Cannot change limits if sales exist
216
+ // Cannot change limits if sales exist (validated in service)
204
217
  limits: z.object({
205
- minPerOrder: z.number().min(1, 'Min per order must be at least 1').optional(),
206
- maxPerOrder: z.number().min(1, 'Max per order must be at least 1').optional()
207
- }).optional()
218
+ minPerOrder: z.number().int().min(1).max(100).optional(),
219
+ maxPerOrder: z.number().int().min(1).max(100).optional()
220
+ }).optional().refine((data) => {
221
+ if (!data) return true;
222
+ return data.maxPerOrder! >= data.minPerOrder!;
223
+ }, {
224
+ message: 'Max per order must be >= min per order',
225
+ path: ['maxPerOrder']
226
+ })
208
227
  })).optional(),
209
228
  });
210
229
 
@@ -214,12 +233,21 @@ export const liveEventEditSchema = z.object({
214
233
  hostId: z.string({ required_error: 'Unauthorized' }).regex(/^[0-9a-fA-F]{24}$/),
215
234
 
216
235
  // Live update only
217
- liveUpdate: z.string().max(500, 'Live update cannot exceed 500 characters').optional(),
236
+ liveUpdate: z.string().min(1).max(500, 'Live update cannot exceed 500 characters').optional(),
237
+
238
+ // Gallery updates (can add event photos)
239
+ media: z.object({
240
+ gallery: z.array(z.object({
241
+ url: z.string().url('Invalid image URL'),
242
+ caption: z.string().max(200).optional(),
243
+ order: z.number().int().min(0).optional()
244
+ })).max(50, 'Cannot have more than 50 gallery images')
245
+ }).optional(),
218
246
 
219
247
  // Ticket operational controls
220
248
  tickets: z.array(z.object({
221
- _id: z.string(),
222
- quantity: z.number().min(1).optional(), // Increase only
249
+ _id: z.string().regex(/^[0-9a-fA-F]{24}$/, 'Invalid ticket ID'),
250
+ quantity: z.number().int('Quantity must be an integer').min(1).max(100000).optional(), // Increase only
223
251
  isActive: z.boolean().optional() // Pause sales
224
252
  })).optional()
225
253
  });
@@ -230,8 +258,16 @@ export const endedEventEditSchema = z.object({
230
258
  hostId: z.string({ required_error: 'Unauthorized' }).regex(/^[0-9a-fA-F]{24}$/),
231
259
 
232
260
  // Post-event content
233
- recap: z.string().max(2000, 'Recap cannot exceed 2000 characters').optional(),
234
- eventPhotos: z.array(z.string()).max(20, 'Cannot have more than 20 event photos').optional()
261
+ recap: z.string().min(10, 'Recap must be at least 10 characters').max(2000, 'Recap cannot exceed 2000 characters').optional(),
262
+
263
+ // Event photos (gallery)
264
+ media: z.object({
265
+ gallery: z.array(z.object({
266
+ url: z.string().url('Invalid image URL'),
267
+ caption: z.string().max(200).optional(),
268
+ order: z.number().int().min(0).optional()
269
+ })).max(50, 'Cannot have more than 50 event photos')
270
+ }).optional()
235
271
  });
236
272
 
237
273
  // =============================================================================