start on repond to message (basic input and builder for dm)

This commit is contained in:
grimhilt
2023-04-14 18:37:33 +02:00
parent 5b62fce48a
commit 7ad22e55c1
14 changed files with 2389 additions and 61 deletions

View File

@@ -0,0 +1,21 @@
{
"type": "object",
"properties": {
"user": {
"type": "string"
},
"roomId": {
"type": "number"
},
"text": {
"type": "string"
},
"html": {
"type": "string"
}
},
"required": [
"user", "roomId", "text", "html"
],
"additionalProperties": false
}

View File

@@ -9,6 +9,7 @@ import getRoomSchema from "./schemas/getRooms-schema.json";
import getMessagesSchema from "./schemas/getMessages-schema.json";
import getMembersSchema from "./schemas/getMembers-schema.json";
import setFlagSchema from "./schemas/setFlag-schema.json";
import responseSchema from "./schemas/response-schema.json";
import { Request, Response } from "express";
import statusCodes from "../utils/statusCodes";
import logger from "../system/Logger";
@@ -20,6 +21,7 @@ class Validator {
validateGetMessages: any;
validateGetMembers: any;
validateSetFlag: any;
validateResponse: any;
constructor() {
this.validateCreateAccount = ajv.compile(createAccountSchema);
@@ -28,6 +30,7 @@ class Validator {
this.validateGetMessages = ajv.compile(getMessagesSchema);
this.validateGetMembers = ajv.compile(getMembersSchema);
this.validateSetFlag = ajv.compile(setFlagSchema);
this.validateResponse = ajv.compile(responseSchema);
}
_getSchema(name: string): any {
@@ -45,6 +48,8 @@ class Validator {
case "addFlag":
case "removeFlag":
return this.validateSetFlag;
case "response":
return this.validateResponse;
default:
logger.err(`Schema ${name} not found`);
break;