mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-08 13:38:47 +00:00
installed minIO and added Endpoints for creating posts and retrieving a post with the ID
This commit is contained in:
parent
38e796ca22
commit
ece95c7130
12 changed files with 962 additions and 71 deletions
26
code/backend/src/schemas/postSchemas.ts
Normal file
26
code/backend/src/schemas/postSchemas.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { z } from "zod";
|
||||
|
||||
export const PostStatusEnum = z.enum([
|
||||
"HIDDEN",
|
||||
"PUBLIC",
|
||||
"PRIVATE",
|
||||
"ARCHIVED",
|
||||
]);
|
||||
|
||||
export const uploadPostSchema = z.object({
|
||||
description: z.string(),
|
||||
status: PostStatusEnum,
|
||||
// this is hilarious but it works
|
||||
// if the value is a string, convert it to an array
|
||||
// if the value is an array, return it as is
|
||||
// this is just a workaround for the fact that swagger is not fucking able to handle arrays
|
||||
tags: z.preprocess((val) => {
|
||||
if (typeof val === "string") {
|
||||
return [val]; // Single tag string
|
||||
} else if (Array.isArray(val)) {
|
||||
return val; // Multiple tags
|
||||
} else {
|
||||
return []; // Optional: fallback for undefined/null
|
||||
}
|
||||
}, z.array(z.string())),
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue