@zyacreatives/shared 1.4.7 → 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.
@@ -177,93 +177,6 @@ export declare const API_ROUTES: {
177
177
  readonly getProjectUser: "/:projectId/user";
178
178
  };
179
179
  };
180
- export declare const FRONTEND_API_ROUTES: {
181
- readonly healthCheck: "health";
182
- readonly username: {
183
- readonly base: "usernames";
184
- readonly checkAvailability: (username: string) => string;
185
- };
186
- readonly personal: {
187
- readonly base: "me";
188
- readonly getUser: "";
189
- readonly getProfile: "profile";
190
- readonly getProjects: "projects";
191
- readonly getProjectBookmarks: "project-bookmarks";
192
- readonly getFollowers: "followers";
193
- readonly getFollowing: "following";
194
- };
195
- readonly user: {
196
- readonly base: "users";
197
- readonly getUser: (value: string) => string;
198
- readonly getProfile: (value: string) => string;
199
- readonly getProjects: (value: string) => string;
200
- readonly getFollowers: (userId: string) => string;
201
- readonly getFollowing: (userId: string) => string;
202
- readonly followUser: (userId: string) => string;
203
- readonly unfollowUser: (userId: string) => string;
204
- readonly reserveUsername: "reserve-username";
205
- };
206
- readonly redirect: {
207
- readonly base: "redirect";
208
- readonly passwordReset: "password-reset";
209
- readonly verifiedUser: "verified-user";
210
- readonly googleProfile: "google-profile";
211
- readonly newGoogleProfile: "new-google-profile";
212
- };
213
- readonly file: {
214
- readonly base: "files";
215
- readonly getPresignedUploadUrl: "get-upload-url";
216
- readonly getPresignedDownloadUrl: (fileId: string) => string;
217
- readonly getPublicUrl: (fileId: string) => string;
218
- readonly createFile: "";
219
- readonly deleteFile: (fileId: string) => string;
220
- };
221
- readonly disciplines: {
222
- readonly base: "disciplines";
223
- readonly getDisciplines: "";
224
- readonly getSingleDiscipline: (slug: string) => string;
225
- readonly addDisciplines: "";
226
- readonly deleteDiscipline: (slug: string) => string;
227
- };
228
- readonly creatives: {
229
- readonly base: "creatives";
230
- readonly createCreative: "";
231
- readonly getCreative: (value: string) => string;
232
- readonly updateCreative: "";
233
- };
234
- readonly brands: {
235
- readonly base: "brands";
236
- readonly createBrand: "";
237
- readonly getBrand: (value: string) => string;
238
- readonly updateBrand: "";
239
- };
240
- readonly investors: {
241
- readonly base: "investors";
242
- readonly createInvestor: "";
243
- readonly getInvestor: (value: string) => string;
244
- readonly updateInvestor: "";
245
- };
246
- readonly projects: {
247
- readonly base: "projects";
248
- readonly createProject: "";
249
- readonly updateProject: "";
250
- readonly listProjects: "";
251
- readonly getProject: (projectId: string) => string;
252
- readonly deleteProject: (projectId: string) => string;
253
- readonly commentOnProject: (projectId: string) => string;
254
- readonly deleteCommentOnProject: (projectId: string, commentId: string) => string;
255
- readonly bookmarkProject: (projectId: string) => string;
256
- readonly unbookmarkProject: (projectId: string) => string;
257
- readonly likeProject: (projectId: string) => string;
258
- readonly unlikeProject: (projectId: string) => string;
259
- readonly viewProject: (projectId: string) => string;
260
- readonly getProjectComments: (projectId: string) => string;
261
- readonly getProjectLikes: (projectId: string) => string;
262
- readonly getProjectBookmarks: (projectId: string) => string;
263
- readonly getProjectViews: (projectId: string) => string;
264
- readonly getProjectUser: (projectId: string) => string;
265
- };
266
- };
267
180
  export declare const DEFAULT_DISCIPLINES: {
268
181
  name: string;
269
182
  slug: string;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_DISCIPLINES = exports.FRONTEND_API_ROUTES = exports.API_ROUTES = exports.INVESTOR_VERIFICATION_DOCUMENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_STATUSES = exports.GEOGRAPHIC_FOCUS = exports.INVESTMENT_SIZES = exports.INVESTOR_TYPES = exports.ONBOARDING_PAGES = exports.EXPERIENCE_LEVELS = exports.CLIENT_TYPES = exports.USER_STATUSES = exports.ROLES = void 0;
3
+ exports.DEFAULT_DISCIPLINES = exports.API_ROUTES = exports.INVESTOR_VERIFICATION_DOCUMENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_STATUSES = exports.GEOGRAPHIC_FOCUS = exports.INVESTMENT_SIZES = exports.INVESTOR_TYPES = exports.ONBOARDING_PAGES = exports.EXPERIENCE_LEVELS = exports.CLIENT_TYPES = exports.USER_STATUSES = exports.ROLES = void 0;
4
4
  exports.ROLES = {
5
5
  CREATIVE: "CREATIVE",
6
6
  BRAND: "BRAND",
@@ -170,93 +170,6 @@ exports.API_ROUTES = {
170
170
  getProjectUser: "/:projectId/user",
171
171
  },
172
172
  };
173
- exports.FRONTEND_API_ROUTES = {
174
- healthCheck: "health",
175
- username: {
176
- base: "usernames",
177
- checkAvailability: (username) => `${username}/availability`,
178
- },
179
- personal: {
180
- base: "me",
181
- getUser: "",
182
- getProfile: "profile",
183
- getProjects: "projects",
184
- getProjectBookmarks: "project-bookmarks",
185
- getFollowers: "followers",
186
- getFollowing: "following",
187
- },
188
- user: {
189
- base: "users",
190
- getUser: (value) => `${value}`,
191
- getProfile: (value) => `${value}/profile`,
192
- getProjects: (value) => `${value}/projects`,
193
- getFollowers: (userId) => `${userId}/followers`,
194
- getFollowing: (userId) => `${userId}/following`,
195
- followUser: (userId) => `${userId}/follow`,
196
- unfollowUser: (userId) => `${userId}/unfollow`,
197
- reserveUsername: "reserve-username",
198
- },
199
- redirect: {
200
- base: "redirect",
201
- passwordReset: "password-reset",
202
- verifiedUser: "verified-user",
203
- googleProfile: "google-profile",
204
- newGoogleProfile: "new-google-profile",
205
- },
206
- file: {
207
- base: "files",
208
- getPresignedUploadUrl: "get-upload-url",
209
- getPresignedDownloadUrl: (fileId) => `${fileId}/download-url`,
210
- getPublicUrl: (fileId) => `${fileId}/public-url`,
211
- createFile: "",
212
- deleteFile: (fileId) => `${fileId}`,
213
- },
214
- disciplines: {
215
- base: "disciplines",
216
- getDisciplines: "",
217
- getSingleDiscipline: (slug) => `${slug}`,
218
- addDisciplines: "",
219
- deleteDiscipline: (slug) => `${slug}`,
220
- },
221
- creatives: {
222
- base: "creatives",
223
- createCreative: "",
224
- getCreative: (value) => `${value}`,
225
- updateCreative: "",
226
- },
227
- brands: {
228
- base: "brands",
229
- createBrand: "",
230
- getBrand: (value) => `${value}`,
231
- updateBrand: "",
232
- },
233
- investors: {
234
- base: "investors",
235
- createInvestor: "",
236
- getInvestor: (value) => `${value}`,
237
- updateInvestor: "",
238
- },
239
- projects: {
240
- base: "projects",
241
- createProject: "",
242
- updateProject: "",
243
- listProjects: "",
244
- getProject: (projectId) => `${projectId}`,
245
- deleteProject: (projectId) => `${projectId}`,
246
- commentOnProject: (projectId) => `${projectId}/comment`,
247
- deleteCommentOnProject: (projectId, commentId) => `${projectId}/comments/${commentId}`,
248
- bookmarkProject: (projectId) => `${projectId}/bookmark`,
249
- unbookmarkProject: (projectId) => `${projectId}/unbookmark`,
250
- likeProject: (projectId) => `${projectId}/like`,
251
- unlikeProject: (projectId) => `${projectId}/unlike`,
252
- viewProject: (projectId) => `${projectId}/view`,
253
- getProjectComments: (projectId) => `${projectId}/comments`,
254
- getProjectLikes: (projectId) => `${projectId}/likes`,
255
- getProjectBookmarks: (projectId) => `${projectId}/bookmarks`,
256
- getProjectViews: (projectId) => `${projectId}/views`,
257
- getProjectUser: (projectId) => `${projectId}/user`,
258
- },
259
- };
260
173
  exports.DEFAULT_DISCIPLINES = [
261
174
  { name: "Painting", slug: "painting" },
262
175
  { name: "Drawing", slug: "drawing" },
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/constants.ts CHANGED
@@ -195,95 +195,6 @@ export const API_ROUTES = {
195
195
  },
196
196
  } as const;
197
197
 
198
- export const FRONTEND_API_ROUTES = {
199
- healthCheck: "health",
200
- username: {
201
- base: "usernames",
202
- checkAvailability: (username: string) => `${username}/availability`,
203
- },
204
- personal: {
205
- base: "me",
206
- getUser: "",
207
- getProfile: "profile",
208
- getProjects: "projects",
209
- getProjectBookmarks: "project-bookmarks",
210
- getFollowers: "followers",
211
- getFollowing: "following",
212
- },
213
- user: {
214
- base: "users",
215
- getUser: (value: string) => `${value}`,
216
- getProfile: (value: string) => `${value}/profile`,
217
- getProjects: (value: string) => `${value}/projects`,
218
- getFollowers: (userId: string) => `${userId}/followers`,
219
- getFollowing: (userId: string) => `${userId}/following`,
220
- followUser: (userId: string) => `${userId}/follow`,
221
- unfollowUser: (userId: string) => `${userId}/unfollow`,
222
- reserveUsername: "reserve-username",
223
- },
224
- redirect: {
225
- base: "redirect",
226
- passwordReset: "password-reset",
227
- verifiedUser: "verified-user",
228
- googleProfile: "google-profile",
229
- newGoogleProfile: "new-google-profile",
230
- },
231
- file: {
232
- base: "files",
233
- getPresignedUploadUrl: "get-upload-url",
234
- getPresignedDownloadUrl: (fileId: string) => `${fileId}/download-url`,
235
- getPublicUrl: (fileId: string) => `${fileId}/public-url`,
236
- createFile: "",
237
- deleteFile: (fileId: string) => `${fileId}`,
238
- },
239
- disciplines: {
240
- base: "disciplines",
241
- getDisciplines: "",
242
- getSingleDiscipline: (slug: string) => `${slug}`,
243
- addDisciplines: "",
244
- deleteDiscipline: (slug: string) => `${slug}`,
245
- },
246
- creatives: {
247
- base: "creatives",
248
- createCreative: "",
249
- getCreative: (value: string) => `${value}`,
250
- updateCreative: "",
251
- },
252
- brands: {
253
- base: "brands",
254
- createBrand: "",
255
- getBrand: (value: string) => `${value}`,
256
- updateBrand: "",
257
- },
258
- investors: {
259
- base: "investors",
260
- createInvestor: "",
261
- getInvestor: (value: string) => `${value}`,
262
- updateInvestor: "",
263
- },
264
- projects: {
265
- base: "projects",
266
- createProject: "",
267
- updateProject: "",
268
- listProjects: "",
269
- getProject: (projectId: string) => `${projectId}`,
270
- deleteProject: (projectId: string) => `${projectId}`,
271
- commentOnProject: (projectId: string) => `${projectId}/comment`,
272
- deleteCommentOnProject: (projectId: string, commentId: string) =>
273
- `${projectId}/comments/${commentId}`,
274
- bookmarkProject: (projectId: string) => `${projectId}/bookmark`,
275
- unbookmarkProject: (projectId: string) => `${projectId}/unbookmark`,
276
- likeProject: (projectId: string) => `${projectId}/like`,
277
- unlikeProject: (projectId: string) => `${projectId}/unlike`,
278
- viewProject: (projectId: string) => `${projectId}/view`,
279
- getProjectComments: (projectId: string) => `${projectId}/comments`,
280
- getProjectLikes: (projectId: string) => `${projectId}/likes`,
281
- getProjectBookmarks: (projectId: string) => `${projectId}/bookmarks`,
282
- getProjectViews: (projectId: string) => `${projectId}/views`,
283
- getProjectUser: (projectId: string) => `${projectId}/user`,
284
- },
285
- } as const;
286
-
287
198
  export const DEFAULT_DISCIPLINES = [
288
199
  { name: "Painting", slug: "painting" },
289
200
  { name: "Drawing", slug: "drawing" },
@@ -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.",