This commit is contained in:
dreamhunter2333 committed 2025-06-21 19:30:54 +08:00
commit 90525cdfd8
22 files changed
+9590

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
import { z, ZodType } from 'zod';
export const CommonSuccessfulResponse = (
dataType: ZodType | null = null
) => {
return {
200: {
description: 'Successful Request',
content: {
'application/json': {
schema: z.object({
success: z.boolean(),
message: z.nullable(z.string()),
data: z.nullable(dataType || z.any()),
}),
}
},
}
}
}
export const CommonErrorResponse = {
400: {
description: 'Bad Request',
content: {
'text/plain': {
schema: z.string(),
}
},
},
401: {
description: 'Unauthorized',
content: {
'text/plain': {
schema: z.string(),
}
},
},
500: {
description: 'Internal Server Error',
content: {
'text/plain': {
schema: z.string(),
}
}
}
}