Team Ai
Apppublic

oex2003/evolution-api

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
settings.schema.ts39 linesDownload Raw Back to validate
1import { JSONSchema7 } from 'json-schema';2import { v4 } from 'uuid';3 4const isNotEmpty = (...propertyNames: string[]): JSONSchema7 => {5  const properties = {};6  propertyNames.forEach(7    (property) =>8      (properties[property] = {9        minLength: 1,10        description: `The "${property}" cannot be empty`,11      }),12  );13  return {14    if: {15      propertyNames: {16        enum: [...propertyNames],17      },18    },19    then: { properties },20  };21};22 23export const settingsSchema: JSONSchema7 = {24  $id: v4(),25  type: 'object',26  properties: {27    rejectCall: { type: 'boolean' },28    msgCall: { type: 'string' },29    groupsIgnore: { type: 'boolean' },30    alwaysOnline: { type: 'boolean' },31    readMessages: { type: 'boolean' },32    readStatus: { type: 'boolean' },33    syncFullHistory: { type: 'boolean' },34    wavoipToken: { type: 'string' },35  },36  required: ['rejectCall', 'groupsIgnore', 'alwaysOnline', 'readMessages', 'readStatus', 'syncFullHistory'],37  ...isNotEmpty('rejectCall', 'groupsIgnore', 'alwaysOnline', 'readMessages', 'readStatus', 'syncFullHistory'),38};39