installed minIO and added Endpoints for creating posts and retrieving a post with the ID

This commit is contained in:
Kai Ritthaler 2025-05-23 21:52:20 +02:00 committed by Rudi Regentonne
parent 38e796ca22
commit ece95c7130
12 changed files with 962 additions and 71 deletions

View 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())),
});