Feed works with random testposts

This commit is contained in:
MisbehavedNinjaRadiator 2025-06-18 15:48:21 +02:00 committed by MisbehavedNinjaRadiator
parent e3e6649a51
commit 357f370b56
5 changed files with 141 additions and 44 deletions

View file

@ -13,6 +13,7 @@ export const uploadPost = async (req: Request, res: Response) => {
const user: JwtPayload = req.user!; // Get the user from the request
const { description, status, tags } = uploadPostSchema.parse(req.body);
const BUCKET = "images"; // Name of the bucket where the images are stored
try {
const uploads = await Promise.all(
files.map(async (file) => {
@ -57,16 +58,15 @@ export const uploadPost = async (req: Request, res: Response) => {
})),
},
},
}); // create a new post in the database
});
// create a new post in the database
res.status(StatusCodes.CREATED).json({
message: "Upload successful",
post: post,
});
} catch (err) {
console.error(err);
res
.status(StatusCodes.INTERNAL_SERVER_ERROR)
.json({ error: "Upload failed" });
res.status(StatusCodes.INTERNAL_SERVER_ERROR).json({ error: "Upload failed" });
}
};