server-ts: Convert etapi/attachments

This commit is contained in:
Elian Doran
2024-04-07 15:13:34 +03:00
parent 3bd7231ba9
commit a6de065bf4
5 changed files with 34 additions and 24 deletions

View File

@@ -120,7 +120,7 @@ function getAndCheckAttribute(attributeId: string) {
}
}
function validateAndPatch(target: Record<string, string>, source: Record<string, string>, allowedProperties: Record<string, ((value: string) => boolean)[]>) {
function validateAndPatch(target: any, source: any, allowedProperties: ValidatorMap) {
for (const key of Object.keys(source)) {
if (!(key in allowedProperties)) {
throw new EtapiError(400, "PROPERTY_NOT_ALLOWED", `Property '${key}' is not allowed for this method.`);