From d2393e01e3c0817eca364d01999b7da037c39b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Fra=C3=9F?= Date: Tue, 21 May 2024 19:58:00 +0200 Subject: [PATCH] [add] api:action:meta_spec --- source/api/actions/member_project.ts | 6 ++-- source/api/actions/member_register.ts | 4 +++ source/api/actions/meta_spec.ts | 51 +++++++++++++++++++++++++++ source/api/functions.ts | 4 +++ tools/makefile | 1 + 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 source/api/actions/meta_spec.ts diff --git a/source/api/actions/member_project.ts b/source/api/actions/member_project.ts index bb9b5cb..9ebeaff 100644 --- a/source/api/actions/member_project.ts +++ b/source/api/actions/member_project.ts @@ -43,20 +43,22 @@ namespace _espe.api "membership_number": { "type": "string", "nullable": false, + "description": "Mitgliedsnummer" }, "name_real_value": { "type": "string", "nullable": false, + "description": "Klarname" }, "email_address_private": { "type": "string", "nullable": true, + "description": "private E-Mail-Adresse" }, }, "required": [ "membership_number", "name_real_value", - "email_address_private", ] }), "output_schema": () => ({ @@ -69,7 +71,7 @@ namespace _espe.api { "membership_number": input.membership_number, "name_real_value": input.name_real_value, - "email_address_private": input.email_address_private, + "email_address_private": (input.email_address_private ?? null), } ); return Promise.resolve({ diff --git a/source/api/actions/member_register.ts b/source/api/actions/member_register.ts index 02e2899..fb114cb 100644 --- a/source/api/actions/member_register.ts +++ b/source/api/actions/member_register.ts @@ -50,18 +50,22 @@ namespace _espe.api "email_use_veiled_address": { "type": "boolean", "nullable": false, + "description": "ob die nummern-basierte E-Mail-Adresse eingerichtet werden soll", }, "email_use_nominal_address": { "type": "boolean", "nullable": false, + "description": "ob die namens-basierte E-Mail-Adresse eingerichtet werden soll", }, "email_redirect_to_private_address": { "type": "boolean", "nullable": false, + "description": "ob auf die Partei-Adressen eingehende E-Mails zur privaten Adresse weitergeleitet werden sollen", }, "password": { "type": "string", "nullable": true, + "description": "Passwort für alle Netz-Dienste", }, }, "required": [ diff --git a/source/api/actions/meta_spec.ts b/source/api/actions/meta_spec.ts new file mode 100644 index 0000000..5dba331 --- /dev/null +++ b/source/api/actions/meta_spec.ts @@ -0,0 +1,51 @@ +/* +Espe | Ein schlichtes Werkzeug zur Mitglieder-Verwaltung | Backend +Copyright (C) 2024 Christian Fraß + +This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public +License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program. If not, see +. + */ + +namespace _espe.api +{ + + /** + */ + export function register_meta_spec( + rest_subject : lib_plankton.rest.type_rest + ) : void + { + lib_plankton.rest.register< + null, + any + > + ( + rest_subject, + lib_plankton.http.enum_method.get, + _espe.conf.get().server.path_base + "/meta/spec", + { + "description": "gibt die API-Spezifikation im OpenAPI-Format aus", + "input_schema": () => ({ + "nullable": true, + }), + "output_schema": () => ({ + }), + "restriction": restriction_none, + "execution": () => { + return Promise.resolve({ + "status_code": 200, + "data": lib_plankton.rest.to_oas(rest_subject), + }); + }, + } + ); + } + +} diff --git a/source/api/functions.ts b/source/api/functions.ts index d3e6131..05912a9 100644 --- a/source/api/functions.ts +++ b/source/api/functions.ts @@ -33,6 +33,10 @@ namespace _espe.api }, } ); + // meta + { + _espe.api.register_meta_spec(rest_subject); + } // session { _espe.api.register_session_begin(rest_subject); diff --git a/tools/makefile b/tools/makefile index cc26cdf..250395a 100644 --- a/tools/makefile +++ b/tools/makefile @@ -51,6 +51,7 @@ ${dir_temp}/espe-core.js ${dir_temp}/espe-core.d.ts: \ ${dir_source}/services/member.ts \ ${dir_source}/service-admin.ts \ ${dir_source}/api/base.ts \ + ${dir_source}/api/actions/meta_spec.ts \ ${dir_source}/api/actions/session_begin.ts \ ${dir_source}/api/actions/session_end.ts \ ${dir_source}/api/actions/member_project.ts \