Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
fix: feedback for application to run
Browse files Browse the repository at this point in the history
  • Loading branch information
ArshiLamba committed Aug 1, 2024
2 parents 011e11b + f45582e commit c0df823
Show file tree
Hide file tree
Showing 34 changed files with 1,640 additions and 149 deletions.
22 changes: 22 additions & 0 deletions client/src/lib/api-types/notification.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* SPDX-FileCopyrightText: 2024 Ng Jun Xiang <[email protected]>
*
* SPDX-License-Identifier: GPL-3.0-only
*/

import * as z from 'zod';

import { notification } from './schemas';
import type { SuccessResponse, ErrorResponse } from './index';

/**
* Successful response for /v1/feedback endpoint
*/
export interface GetNotificationSuccAPI
extends SuccessResponse<z.infer<typeof notification.notificationSchema>> {}

/**
* Failure response for feedback-related endpoints
*/
export type GetNotificationFailAPI =
ErrorResponse<'An unexpected error occurred. Please try again later!'>;
3 changes: 2 additions & 1 deletion client/src/lib/api-types/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ import * as user from './user';
import * as event from './event';
import * as feedback from './feedback';
import * as dashboard from './dashboard';
import * as notification from './notification';

export { auth, food, user, event, feedback, dashboard };
export { auth, food, user, event, feedback, dashboard, notification };
23 changes: 23 additions & 0 deletions client/src/lib/api-types/schemas/notification.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { z } from 'zod';

export const notificationSchema = z.object({
id: z
.number({
invalid_type_error: 'ID must be a positive integer',
required_error: 'ID is required',
})
.int('ID must be an integer')
.positive('ID must be a positive integer'),
notificationMessage: z
.string({
invalid_type_error: 'Feedback message must be a string',
required_error: 'Feedback message is required',
})
.min(1, { message: 'Feedback message is required' }),
notificationType: z
.string({
invalid_type_error: 'Notification type must be a string',
required_error: 'Notification type is required',
})
.default('info'),
});
16 changes: 16 additions & 0 deletions client/src/lib/api-types/schemas/uploadthing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* SPDX-FileCopyrightText: 2024 Ng Jun Xiang <[email protected]>
*
* SPDX-License-Identifier: GPL-3.0-only
*/

import * as z from 'zod';

export const deleteImageSchema = z.object({
key: z
.string({
invalid_type_error: 'Please provide a key!',
required_error: 'Please provide a key!',
})
.min(1, { message: 'Please provide a key!' }),
});
14 changes: 14 additions & 0 deletions client/src/lib/api-types/uploadthing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* SPDX-FileCopyrightText: 2024 Ng Jun Xiang <[email protected]>
*
* SPDX-License-Identifier: GPL-3.0-only
*/

import type { SuccessResponse, ErrorResponse } from './index';

/**
* Successful response for /api/delete-uploadthing endpoint
*/
export interface DeleteUploadThingSuccAPI
extends SuccessResponse<{ deleted: true }> {}
export type DeleteUploadThingFailAPI = ErrorResponse<'Invalid key!'>;
Loading

0 comments on commit c0df823

Please sign in to comment.