backend/source/api/actions/calendar_list.ts

75 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-09-12 00:03:29 +02:00
namespace _zeitbild.api
{
/**
*/
export function register_calendar_list(
rest_subject : lib_plankton.rest.type_rest
) : void
{
register<
null,
Array<
{
id : _zeitbild.type.calendar_id;
preview : {
name : string;
};
}
>
>(
rest_subject,
lib_plankton.http.enum_method.get,
"/calendar/list",
{
"description": "listet alle Kalender auf",
"query_parameters": [
],
"output_schema": () => ({
"type": "array",
"items": {
"type": "object",
"nullable": false,
"additionalProperties": false,
"properties": {
"id": {
"type": "number",
"nullable": false,
},
"preview": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"nullable": false,
},
},
"required": [
"name",
]
}
},
"required": [
"id",
"preview",
],
}
}),
"restriction": restriction_none, // TODO
"execution": () => (
_zeitbild.service.calendar.list(null)
.then(
data => Promise.resolve({
"status_code": 200,
"data": data,
})
)
)
}
);
}
}