[fix] api actions

This commit is contained in:
fenris 2025-09-25 16:48:16 +02:00
parent a08f7f3bf4
commit 3d7ba02b78
17 changed files with 38 additions and 35 deletions

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_calendar_add(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<
@ -64,7 +64,8 @@ namespace _zeitbild.api
else {
// TODO move logic to calendar service
let resource_object : _zeitbild.type_resource_object;
switch (stuff.input.resource.kind) {
switch (stuff.input.resource.kind)
{
case "local": {
resource_object = {
"kind": "local",

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_calendar_change(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_calendar_event_add(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_calendar_event_change(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_calendar_event_get(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_calendar_event_remove(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_calendar_get(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_calendar_list(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_calendar_remove(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_events(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,10 +5,10 @@ namespace _zeitbild.api
/**
*/
export function register_meta_ping(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
lib_plankton.rest.register<
lib_plankton.rest_http.register<
null,
string
>
@ -17,7 +17,7 @@ namespace _zeitbild.api
lib_plankton.http.enum_method.get,
_zeitbild.conf.get().server.path_base + "/meta/ping",
{
"description": "sendet ein 'pong' zurück; gedacht um die Erreichbarkeit des Backends zu prüfen",
"description": () => "sendet ein 'pong' zurück; gedacht um die Erreichbarkeit des Backends zu prüfen",
"input_schema": () => ({
"nullable": true,
}),
@ -25,8 +25,10 @@ namespace _zeitbild.api
"nullable": false,
"type": "string",
}),
"restriction": restriction_none,
"execution": () => {
"response_body_encode": () => (body) => Promise.resolve<string>(body),
"response_body_mimetype": () => "text/plain",
"restriction": () => restriction_none,
"execution": () => () => {
return Promise.resolve({
"status_code": 200,
"data": "pong",

View file

@ -5,10 +5,10 @@ namespace _zeitbild.api
/**
*/
export function register_meta_spec(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
lib_plankton.rest.register<
lib_plankton.rest_http.register<
null,
any
>
@ -17,17 +17,17 @@ namespace _zeitbild.api
lib_plankton.http.enum_method.get,
_zeitbild.conf.get().server.path_base + "/meta/spec",
{
"description": "gibt die API-Spezifikation im OpenAPI-Format aus",
"description": () => "gibt die API-Spezifikation im OpenAPI-Format aus",
"input_schema": () => ({
"nullable": true,
}),
"output_schema": () => ({
}),
"restriction": restriction_none,
"execution": () => {
"restriction": () => restriction_none,
"execution": () => () => {
return Promise.resolve({
"status_code": 200,
"data": lib_plankton.rest.to_oas(rest_subject),
"data": lib_plankton.rest_http.to_oas(rest_subject),
});
},
}

View file

@ -5,10 +5,10 @@ namespace _zeitbild.api
/**
*/
export function register_session_begin(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
lib_plankton.rest.register<
lib_plankton.rest_http.register<
{
name : string;
password : string;
@ -23,7 +23,7 @@ namespace _zeitbild.api
lib_plankton.http.enum_method.post,
"/session/begin",
{
"description": "führt die Anmeldung am System aus um geschützte Aktionen nutzen zu können",
"description": () => "führt die Anmeldung am System aus um geschützte Aktionen nutzen zu können",
"input_schema": () => ({
"type": "object",
"properties": {
@ -44,8 +44,8 @@ namespace _zeitbild.api
"type": "string",
"description": "der Sitzungs-Schlüssel, der als Header 'X-Session-Key' gesetzt werden muss um Erlaubnis zur Ausführung geschützter Aktionen zu erhalten",
}),
"restriction": restriction_none,
"execution": async ({"input": input}) => {
"restriction": () => restriction_none,
"execution": () => async ({"input": input}) => {
if (input === null) {
return Promise.reject(new Error("impossible"));
}

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_session_end(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<null, null>(

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_session_oidc(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<

View file

@ -5,10 +5,10 @@ namespace _zeitbild.api
/**
*/
export function register_session_prepare(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
lib_plankton.rest.register<
lib_plankton.rest_http.register<
any,
{
kind : string;
@ -19,15 +19,15 @@ namespace _zeitbild.api
lib_plankton.http.enum_method.post,
"/session/prepare",
{
"description": "gibt die nötigen Werkzeuge für eine Anmeldung aus",
"description": () => "gibt die nötigen Werkzeuge für eine Anmeldung aus",
"input_schema": () => ({
"nullable": true,
}),
"output_schema": () => ({
"nullable": false
}),
"restriction": restriction_none,
"execution": async (stuff) => {
"restriction": () => restriction_none,
"execution": () => async (stuff) => {
const preparation = await _zeitbild.auth.prepare(stuff.input);
return Promise.resolve({
"status_code": 200,

View file

@ -5,7 +5,7 @@ namespace _zeitbild.api
/**
*/
export function register_users(
rest_subject : lib_plankton.rest.type_rest
rest_subject : lib_plankton.rest_http.type_rest
) : void
{
register<