/* 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_member_list( rest_subject : lib_plankton.rest.type_rest ) : void { register< null, Array< { id : int; preview : { membership_number : string; name_real_value : string; name_real_index : int; }; } > >( rest_subject, lib_plankton.http.enum_method.get, "/member/list", { "description": "listet alle Mitglieder auf", "query_parameters": [ { "name": "search_term", "required": false, "description": "search term", } ], "output_schema": () => ({ "type": "array", "items": { "type": "object", "nullable": false, "additionalProperties": false, "properties": { "id": { "type": "number", "nullable": false, }, "preview": { "type": "object", "additionalProperties": false, "properties": { "membership_number": { "type": "string", "nullable": false, }, "name_real_value": { "type": "string", "nullable": false, }, "name_real_index": { "type": "number", "nullable": false, }, }, "required": [ "membership_number", "name_real_value", "name_real_index", ] } }, "required": [ "id", "preview", ], } }), "restriction": restriction_logged_in, "execution": ({"query_parameters": query_parameters}) => ( _espe.service.member.list(query_parameters["search_term"] ?? null) .then( data => Promise.resolve({ "status_code": 200, "data": data, }) ) ) } ); } }