@mac777/project-pinecone-schema 1.0.15 → 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.
@@ -2035,13 +2035,23 @@ export declare const publishedEventEditSchema: z.ZodObject<{
2035
2035
  }>>;
2036
2036
  tickets: z.ZodOptional<z.ZodArray<z.ZodObject<{
2037
2037
  _id: z.ZodString;
2038
- 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
+ }>>;
2039
2048
  quantity: z.ZodOptional<z.ZodNumber>;
2040
2049
  benefits: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2041
- wristbandColor: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2042
- isVisible: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2043
- isActive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
2044
- 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<{
2045
2055
  minPerOrder: z.ZodOptional<z.ZodNumber>;
2046
2056
  maxPerOrder: z.ZodOptional<z.ZodNumber>;
2047
2057
  }, "strip", z.ZodTypeAny, {
@@ -2050,28 +2060,42 @@ export declare const publishedEventEditSchema: z.ZodObject<{
2050
2060
  }, {
2051
2061
  minPerOrder?: number | undefined;
2052
2062
  maxPerOrder?: number | undefined;
2053
- }>>;
2063
+ }>>, {
2064
+ minPerOrder?: number | undefined;
2065
+ maxPerOrder?: number | undefined;
2066
+ } | undefined, {
2067
+ minPerOrder?: number | undefined;
2068
+ maxPerOrder?: number | undefined;
2069
+ } | undefined>;
2054
2070
  }, "strip", z.ZodTypeAny, {
2055
2071
  _id: string;
2056
- wristbandColor: string;
2057
- isVisible: boolean;
2058
- isActive: boolean;
2059
- price?: number | undefined;
2072
+ price?: {
2073
+ amount: number;
2074
+ currency: string;
2075
+ } | undefined;
2060
2076
  quantity?: number | undefined;
2061
2077
  limits?: {
2062
2078
  minPerOrder?: number | undefined;
2063
2079
  maxPerOrder?: number | undefined;
2064
2080
  } | undefined;
2081
+ wristbandColor?: string | undefined;
2082
+ accentColor?: string | undefined;
2083
+ isVisible?: boolean | undefined;
2084
+ isActive?: boolean | undefined;
2065
2085
  benefits?: string[] | undefined;
2066
2086
  }, {
2067
2087
  _id: string;
2068
- price?: number | undefined;
2088
+ price?: {
2089
+ amount: number;
2090
+ currency?: string | undefined;
2091
+ } | undefined;
2069
2092
  quantity?: number | undefined;
2070
2093
  limits?: {
2071
2094
  minPerOrder?: number | undefined;
2072
2095
  maxPerOrder?: number | undefined;
2073
2096
  } | undefined;
2074
2097
  wristbandColor?: string | undefined;
2098
+ accentColor?: string | undefined;
2075
2099
  isVisible?: boolean | undefined;
2076
2100
  isActive?: boolean | undefined;
2077
2101
  benefits?: string[] | undefined;
@@ -2095,15 +2119,19 @@ export declare const publishedEventEditSchema: z.ZodObject<{
2095
2119
  highlights?: string[] | undefined;
2096
2120
  tickets?: {
2097
2121
  _id: string;
2098
- wristbandColor: string;
2099
- isVisible: boolean;
2100
- isActive: boolean;
2101
- price?: number | undefined;
2122
+ price?: {
2123
+ amount: number;
2124
+ currency: string;
2125
+ } | undefined;
2102
2126
  quantity?: number | undefined;
2103
2127
  limits?: {
2104
2128
  minPerOrder?: number | undefined;
2105
2129
  maxPerOrder?: number | undefined;
2106
2130
  } | undefined;
2131
+ wristbandColor?: string | undefined;
2132
+ accentColor?: string | undefined;
2133
+ isVisible?: boolean | undefined;
2134
+ isActive?: boolean | undefined;
2107
2135
  benefits?: string[] | undefined;
2108
2136
  }[] | undefined;
2109
2137
  languages?: string[] | undefined;
@@ -2126,13 +2154,17 @@ export declare const publishedEventEditSchema: z.ZodObject<{
2126
2154
  highlights?: string[] | undefined;
2127
2155
  tickets?: {
2128
2156
  _id: string;
2129
- price?: number | undefined;
2157
+ price?: {
2158
+ amount: number;
2159
+ currency?: string | undefined;
2160
+ } | undefined;
2130
2161
  quantity?: number | undefined;
2131
2162
  limits?: {
2132
2163
  minPerOrder?: number | undefined;
2133
2164
  maxPerOrder?: number | undefined;
2134
2165
  } | undefined;
2135
2166
  wristbandColor?: string | undefined;
2167
+ accentColor?: string | undefined;
2136
2168
  isVisible?: boolean | undefined;
2137
2169
  isActive?: boolean | undefined;
2138
2170
  benefits?: string[] | undefined;
@@ -2143,6 +2175,33 @@ export declare const liveEventEditSchema: z.ZodObject<{
2143
2175
  eventId: z.ZodString;
2144
2176
  hostId: z.ZodString;
2145
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
+ }>>;
2146
2205
  tickets: z.ZodOptional<z.ZodArray<z.ZodObject<{
2147
2206
  _id: z.ZodString;
2148
2207
  quantity: z.ZodOptional<z.ZodNumber>;
@@ -2159,6 +2218,13 @@ export declare const liveEventEditSchema: z.ZodObject<{
2159
2218
  }, "strip", z.ZodTypeAny, {
2160
2219
  eventId: string;
2161
2220
  hostId: string;
2221
+ media?: {
2222
+ gallery: {
2223
+ url: string;
2224
+ order?: number | undefined;
2225
+ caption?: string | undefined;
2226
+ }[];
2227
+ } | undefined;
2162
2228
  tickets?: {
2163
2229
  _id: string;
2164
2230
  quantity?: number | undefined;
@@ -2168,6 +2234,13 @@ export declare const liveEventEditSchema: z.ZodObject<{
2168
2234
  }, {
2169
2235
  eventId: string;
2170
2236
  hostId: string;
2237
+ media?: {
2238
+ gallery: {
2239
+ url: string;
2240
+ order?: number | undefined;
2241
+ caption?: string | undefined;
2242
+ }[];
2243
+ } | undefined;
2171
2244
  tickets?: {
2172
2245
  _id: string;
2173
2246
  quantity?: number | undefined;
@@ -2179,17 +2252,55 @@ export declare const endedEventEditSchema: z.ZodObject<{
2179
2252
  eventId: z.ZodString;
2180
2253
  hostId: z.ZodString;
2181
2254
  recap: z.ZodOptional<z.ZodString>;
2182
- 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
+ }>>;
2183
2282
  }, "strip", z.ZodTypeAny, {
2184
2283
  eventId: string;
2185
2284
  hostId: string;
2285
+ media?: {
2286
+ gallery: {
2287
+ url: string;
2288
+ order?: number | undefined;
2289
+ caption?: string | undefined;
2290
+ }[];
2291
+ } | undefined;
2186
2292
  recap?: string | undefined;
2187
- eventPhotos?: string[] | undefined;
2188
2293
  }, {
2189
2294
  eventId: string;
2190
2295
  hostId: string;
2296
+ media?: {
2297
+ gallery: {
2298
+ url: string;
2299
+ order?: number | undefined;
2300
+ caption?: string | undefined;
2301
+ }[];
2302
+ } | undefined;
2191
2303
  recap?: string | undefined;
2192
- eventPhotos?: string[] | undefined;
2193
2304
  }>;
2194
2305
  export declare const submitEventSchema: z.ZodObject<{
2195
2306
  title: z.ZodString;
@@ -176,22 +176,33 @@ exports.publishedEventEditSchema = zod_1.z.object({
176
176
  media: media_schema_1.mediaSchema.optional(),
177
177
  // Ticket updates (complex validation)
178
178
  tickets: zod_1.z.array(zod_1.z.object({
179
- _id: zod_1.z.string(),
179
+ _id: zod_1.z.string().regex(/^[0-9a-fA-F]{24}$/, 'Invalid ticket ID'),
180
180
  // Price change validation happens in controller
181
- 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(),
182
185
  // Quantity increase only (unless sold = 0)
183
- 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(),
184
187
  // Can add benefits, not remove
185
- 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(),
186
189
  // Operational controls
187
- wristbandColor: zod_1.z.string().optional().default('#000000'),
188
- isVisible: zod_1.z.boolean().optional().default(true),
189
- isActive: zod_1.z.boolean().optional().default(true),
190
- // 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)
191
195
  limits: zod_1.z.object({
192
- minPerOrder: zod_1.z.number().min(1, 'Min per order must be at least 1').optional(),
193
- maxPerOrder: zod_1.z.number().min(1, 'Max per order must be at least 1').optional()
194
- }).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
+ })
195
206
  })).optional(),
196
207
  });
197
208
  // Live
@@ -199,11 +210,19 @@ exports.liveEventEditSchema = zod_1.z.object({
199
210
  eventId: zod_1.z.string({ required_error: 'Event not found' }).regex(/^[0-9a-fA-F]{24}$/),
200
211
  hostId: zod_1.z.string({ required_error: 'Unauthorized' }).regex(/^[0-9a-fA-F]{24}$/),
201
212
  // Live update only
202
- 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(),
203
222
  // Ticket operational controls
204
223
  tickets: zod_1.z.array(zod_1.z.object({
205
- _id: zod_1.z.string(),
206
- 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
207
226
  isActive: zod_1.z.boolean().optional() // Pause sales
208
227
  })).optional()
209
228
  });
@@ -212,8 +231,15 @@ exports.endedEventEditSchema = zod_1.z.object({
212
231
  eventId: zod_1.z.string({ required_error: 'Event not found' }).regex(/^[0-9a-fA-F]{24}$/),
213
232
  hostId: zod_1.z.string({ required_error: 'Unauthorized' }).regex(/^[0-9a-fA-F]{24}$/),
214
233
  // Post-event content
215
- recap: zod_1.z.string().max(2000, 'Recap cannot exceed 2000 characters').optional(),
216
- 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()
217
243
  });
218
244
  // =============================================================================
219
245
  // COMPOSITE SCHEMAS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mac777/project-pinecone-schema",
3
- "version": "1.0.15",
3
+ "version": "1.1.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -193,27 +193,37 @@ export const publishedEventEditSchema = z.object({
193
193
 
194
194
  // Ticket updates (complex validation)
195
195
  tickets: z.array(z.object({
196
- _id: z.string(),
196
+ _id: z.string().regex(/^[0-9a-fA-F]{24}$/, 'Invalid ticket ID'),
197
197
 
198
198
  // Price change validation happens in controller
199
- 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(),
200
203
 
201
204
  // Quantity increase only (unless sold = 0)
202
- 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(),
203
206
 
204
207
  // Can add benefits, not remove
205
- benefits: z.array(z.string()).optional(),
208
+ benefits: z.array(z.string().max(200)).max(20).optional(),
206
209
 
207
210
  // Operational controls
208
- wristbandColor: z.string().optional().default('#000000'),
209
- isVisible: z.boolean().optional().default(true),
210
- 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(),
211
215
 
212
- // Cannot change limits if sales exist
216
+ // Cannot change limits if sales exist (validated in service)
213
217
  limits: z.object({
214
- minPerOrder: z.number().min(1, 'Min per order must be at least 1').optional(),
215
- maxPerOrder: z.number().min(1, 'Max per order must be at least 1').optional()
216
- }).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
+ })
217
227
  })).optional(),
218
228
  });
219
229
 
@@ -223,12 +233,21 @@ export const liveEventEditSchema = z.object({
223
233
  hostId: z.string({ required_error: 'Unauthorized' }).regex(/^[0-9a-fA-F]{24}$/),
224
234
 
225
235
  // Live update only
226
- 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(),
227
246
 
228
247
  // Ticket operational controls
229
248
  tickets: z.array(z.object({
230
- _id: z.string(),
231
- 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
232
251
  isActive: z.boolean().optional() // Pause sales
233
252
  })).optional()
234
253
  });
@@ -239,8 +258,16 @@ export const endedEventEditSchema = z.object({
239
258
  hostId: z.string({ required_error: 'Unauthorized' }).regex(/^[0-9a-fA-F]{24}$/),
240
259
 
241
260
  // Post-event content
242
- recap: z.string().max(2000, 'Recap cannot exceed 2000 characters').optional(),
243
- 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()
244
271
  });
245
272
 
246
273
  // =============================================================================