TASK22102: slice1 api contract helper + email/admin pilot

This commit is contained in:
2026-03-17 12:50:54 +00:00
parent 7d06bc7bfa
commit 9ae8ce7136
7 changed files with 98 additions and 9 deletions
+27
View File
@@ -0,0 +1,27 @@
export const respondSuccess = (res, data, status = 200) => {
return res.status(status).json(data);
};
export const respondError = (
res,
{
status = 500,
code = "INTERNAL_SERVER_ERROR",
message = "Request failed",
details
} = {}
) => {
const payload = {
success: false,
error: {
code,
message
}
};
if (typeof details !== "undefined") {
payload.error.details = details;
}
return res.status(status).json(payload);
};