backend/source/api/actions/calendar_remove.ts
Fenris Wolf 9d1fd0b55f [int]
2024-10-30 07:20:13 +01:00

44 lines
994 B
TypeScript

namespace _zeitbild.api
{
/**
*/
export function register_calendar_remove(
rest_subject : lib_plankton.rest_caldav.type_rest
) : void
{
register<
null,
null
>(
rest_subject,
lib_plankton.http.enum_method.delete,
"/calendar/:calendar_id",
{
"description": "löscht einen Kalender",
"output_schema": () => ({
"type": "null",
}),
"restriction": restriction_logged_in,
"execution": async (stuff) => {
const session : {key : string; value : lib_plankton.session.type_session;} = await session_from_stuff(stuff);
const user_id : _zeitbild.type_user_id = await _zeitbild.service.user.identify(session.value.name);
const calendar_id : _zeitbild.type_calendar_id = parseInt(stuff.path_parameters["calendar_id"]);
await _zeitbild.service.calendar.remove(
calendar_id,
user_id
);
return Promise.resolve(
{
"status_code": 200,
"data": null,
}
);
}
}
);
}
}