backend/source/api/actions/verification_check.ts

49 lines
1.1 KiB
TypeScript

namespace _espe.api
{
/**
*/
export function register_verification_check(
rest_subject : lib_plankton.rest.type_rest
) : void
{
lib_plankton.rest.register<{data : any; verification : string;}, boolean>(
rest_subject,
lib_plankton.http.enum_method.post,
_espe.conf.get().server.path_base + "/verification/check",
{
"description": "untersucht ob ein Prüfwert zu einer Eingabe passt",
"input_schema": () => ({
"type": "object",
"nullable": true,
"properties": {
"data": {
"nullable": true
},
"verification": {
"type": "string",
"nullable": false
},
},
"additionalProperties": false,
"required": [
"input",
"verification",
]
}),
"output_schema": () => ({
"type": "boolean",
"nullable": false,
}),
"restriction": restriction_none,
"execution": async ({"input": input}) => {
return Promise.resolve({
"status_code": 200,
"data": await _espe.helpers.verification_check(input.data, input.verification),
});
},
}
);
}
}