mirror of
https://github.com/detleph/server.git
synced 2026-09-06 16:06:18 +02:00
FIX: Event endpoints are now using the correct format
This commit is contained in:
@@ -13,8 +13,13 @@ export const getAllEvents = async (req: Request, res: Response) => {
|
|||||||
id: false,
|
id: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (events.length > 0) res.status(200).json(events);
|
if (events.length > 0)
|
||||||
else res.status(200).json([]);
|
res.status(200).json({
|
||||||
|
type: "success",
|
||||||
|
payload: {
|
||||||
|
events,
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getEvent = async (req: Request, res: Response) => {
|
export const getEvent = async (req: Request, res: Response) => {
|
||||||
@@ -42,7 +47,12 @@ export const getEvent = async (req: Request, res: Response) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
res.status(200).json(event);
|
res.status(200).json({
|
||||||
|
type: "success",
|
||||||
|
payload: {
|
||||||
|
event,
|
||||||
|
},
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof Prisma.PrismaClientKnownRequestError) {
|
if (e instanceof Prisma.PrismaClientKnownRequestError) {
|
||||||
res.status(500).json({
|
res.status(500).json({
|
||||||
@@ -102,7 +112,7 @@ export const addEvent = async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
res.status(201).json({
|
res.status(201).json({
|
||||||
type: "succes",
|
type: "success",
|
||||||
payload: {
|
payload: {
|
||||||
event,
|
event,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user