@zyacreatives/shared 1.4.8 → 1.5.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.
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/project.js +27 -0
- package/dist/schemas/username.d.ts +4 -1
- package/dist/schemas/username.js +10 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/username.d.ts +3 -0
- package/dist/types/username.js +2 -0
- package/package.json +1 -1
- package/src/schemas/index.ts +1 -0
- package/src/schemas/project.ts +29 -0
- package/src/schemas/username.ts +10 -0
- package/src/types/index.ts +1 -0
- package/src/types/username.ts +4 -0
package/dist/schemas/index.d.ts
CHANGED
package/dist/schemas/index.js
CHANGED
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/dist/schemas/username.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsernameSchema = void 0;
|
|
4
|
+
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
|
+
exports.UsernameSchema = zod_openapi_1.z.object({
|
|
6
|
+
username: zod_openapi_1.z
|
|
7
|
+
.string()
|
|
8
|
+
.max(32, { message: "Username must be at most 32 characters" })
|
|
9
|
+
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
10
|
+
message: "Username may only contain letters, numbers, and underscores",
|
|
11
|
+
}),
|
|
12
|
+
});
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
package/package.json
CHANGED
package/src/schemas/index.ts
CHANGED
package/src/schemas/project.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
2
|
import { CLIENT_TYPES, ROLES } from "../constants";
|
|
3
3
|
import { CreateFileInputSchema, FileEntitySchema } from "./file";
|
|
4
|
+
|
|
4
5
|
export const ProjectEntitySchema = z
|
|
5
6
|
.object({
|
|
6
7
|
description: z.string().optional().openapi({
|
|
@@ -271,6 +272,34 @@ export const CreateProjectInputSchema = z
|
|
|
271
272
|
example: [],
|
|
272
273
|
}),
|
|
273
274
|
})
|
|
275
|
+
.superRefine(({ startDate, endDate }, ctx) => {
|
|
276
|
+
const today = new Date();
|
|
277
|
+
today.setHours(0, 0, 0, 0);
|
|
278
|
+
if (startDate > today) {
|
|
279
|
+
ctx.addIssue({
|
|
280
|
+
path: ["startDate"],
|
|
281
|
+
code: "custom",
|
|
282
|
+
message: "Start date cannot be in the future",
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
if (endDate) {
|
|
286
|
+
if (endDate > today) {
|
|
287
|
+
ctx.addIssue({
|
|
288
|
+
path: ["endDate"],
|
|
289
|
+
code: "custom",
|
|
290
|
+
message: "End date cannot be in the future",
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (startDate > endDate) {
|
|
295
|
+
ctx.addIssue({
|
|
296
|
+
path: ["startDate"],
|
|
297
|
+
code: "custom",
|
|
298
|
+
message: "Start date cannot be after end date",
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
})
|
|
274
303
|
.openapi({
|
|
275
304
|
title: "Create Project",
|
|
276
305
|
description: "Schema for creating a new project.",
|
package/src/schemas/username.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
export const UsernameSchema = z.object({
|
|
4
|
+
username: z
|
|
5
|
+
.string()
|
|
6
|
+
.max(32, { message: "Username must be at most 32 characters" })
|
|
7
|
+
.regex(/^[a-zA-Z0-9_]+$/, {
|
|
8
|
+
message: "Username may only contain letters, numbers, and underscores",
|
|
9
|
+
}),
|
|
10
|
+
});
|
package/src/types/index.ts
CHANGED