86 lines
2.3 KiB
TypeScript
86 lines
2.3 KiB
TypeScript
/*
|
|
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
|
|
<https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
namespace _espe.api
|
|
{
|
|
|
|
/**
|
|
*/
|
|
export function register_member_project(
|
|
rest_subject : lib_plankton.rest.type_rest
|
|
) : void
|
|
{
|
|
register<
|
|
{
|
|
membership_number : string;
|
|
name_real_value : string;
|
|
email_address_private : (null | string);
|
|
},
|
|
_espe.type.member_id
|
|
>(
|
|
rest_subject,
|
|
lib_plankton.http.enum_method.post,
|
|
"/member/project",
|
|
{
|
|
"description": "erstellt ein neues Mitglied und gibt die erzeugte ID aus",
|
|
"input_schema": () => ({
|
|
"type": "object",
|
|
"nullable": false,
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"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",
|
|
]
|
|
}),
|
|
"output_schema": () => ({
|
|
"type": "number",
|
|
"nullable": false,
|
|
}),
|
|
"restriction": restriction_logged_in,
|
|
"execution": async ({"input": input}) => {
|
|
const member_id : _espe.type.member_id = await _espe.service.member.project(
|
|
{
|
|
"membership_number": input.membership_number,
|
|
"name_real_value": input.name_real_value,
|
|
"email_address_private": (input.email_address_private ?? null),
|
|
}
|
|
);
|
|
return Promise.resolve({
|
|
"status_code": 201,
|
|
"data": member_id
|
|
});
|
|
}
|
|
}
|
|
);
|
|
}
|
|
|
|
}
|