@zyacreatives/shared 1.4.8 → 1.4.9
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/dist/schemas/project.js +27 -0
- package/package.json +1 -1
- package/src/schemas/project.ts +28 -0
package/dist/schemas/project.js
CHANGED
|
@@ -258,6 +258,33 @@ exports.CreateProjectInputSchema = zod_openapi_1.z
|
|
|
258
258
|
description: "Array of files/images for the project.",
|
|
259
259
|
example: [],
|
|
260
260
|
}),
|
|
261
|
+
})
|
|
262
|
+
.superRefine(({ startDate, endDate }, ctx) => {
|
|
263
|
+
const today = new Date();
|
|
264
|
+
today.setHours(0, 0, 0, 0);
|
|
265
|
+
if (startDate > today) {
|
|
266
|
+
ctx.addIssue({
|
|
267
|
+
path: ["startDate"],
|
|
268
|
+
code: "custom",
|
|
269
|
+
message: "Start date cannot be in the future",
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
if (endDate) {
|
|
273
|
+
if (endDate > today) {
|
|
274
|
+
ctx.addIssue({
|
|
275
|
+
path: ["endDate"],
|
|
276
|
+
code: "custom",
|
|
277
|
+
message: "End date cannot be in the future",
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
if (startDate > endDate) {
|
|
281
|
+
ctx.addIssue({
|
|
282
|
+
path: ["startDate"],
|
|
283
|
+
code: "custom",
|
|
284
|
+
message: "Start date cannot be after end date",
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
261
288
|
})
|
|
262
289
|
.openapi({
|
|
263
290
|
title: "Create Project",
|
package/package.json
CHANGED
package/src/schemas/project.ts
CHANGED
|
@@ -271,6 +271,34 @@ export const CreateProjectInputSchema = z
|
|
|
271
271
|
example: [],
|
|
272
272
|
}),
|
|
273
273
|
})
|
|
274
|
+
.superRefine(({ startDate, endDate }, ctx) => {
|
|
275
|
+
const today = new Date();
|
|
276
|
+
today.setHours(0, 0, 0, 0);
|
|
277
|
+
if (startDate > today) {
|
|
278
|
+
ctx.addIssue({
|
|
279
|
+
path: ["startDate"],
|
|
280
|
+
code: "custom",
|
|
281
|
+
message: "Start date cannot be in the future",
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
if (endDate) {
|
|
285
|
+
if (endDate > today) {
|
|
286
|
+
ctx.addIssue({
|
|
287
|
+
path: ["endDate"],
|
|
288
|
+
code: "custom",
|
|
289
|
+
message: "End date cannot be in the future",
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (startDate > endDate) {
|
|
294
|
+
ctx.addIssue({
|
|
295
|
+
path: ["startDate"],
|
|
296
|
+
code: "custom",
|
|
297
|
+
message: "Start date cannot be after end date",
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
})
|
|
274
302
|
.openapi({
|
|
275
303
|
title: "Create Project",
|
|
276
304
|
description: "Schema for creating a new project.",
|