Feat: Update backend Joi validation
This commit is contained in:
1 parent
94a85f8bbb
commit
c95db26437
2 files changed
+11
-5
No files matched your search
@@ -41,6 +41,8 @@ import jwt from "jsonwebtoken";
|
|||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
import { games, GameDig } from "gamedig";
|
import { games, GameDig } from "gamedig";
|
||||||
import jmespath from "jmespath";
|
import jmespath from "jmespath";
|
||||||
|
import * as grpc from "@grpc/grpc-js";
|
||||||
|
import * as protoLoader from "@grpc/proto-loader";
|
||||||
|
|
||||||
// repositories
|
// repositories
|
||||||
import {
|
import {
|
||||||
@@ -148,6 +150,8 @@ export const initializeServices = async ({
|
|||||||
Docker,
|
Docker,
|
||||||
net,
|
net,
|
||||||
settingsService,
|
settingsService,
|
||||||
|
grpc,
|
||||||
|
protoLoader,
|
||||||
});
|
});
|
||||||
const emailService = new EmailService(settingsService, fs, path, compile, mjml2html, nodemailer, logger);
|
const emailService = new EmailService(settingsService, fs, path, compile, mjml2html, nodemailer, logger);
|
||||||
|
|
||||||
|
|||||||
@@ -120,8 +120,8 @@ const getMonitorsByTeamIdQueryValidation = joi.object({
|
|||||||
type: joi
|
type: joi
|
||||||
.alternatives()
|
.alternatives()
|
||||||
.try(
|
.try(
|
||||||
joi.string().valid("http", "ping", "pagespeed", "docker", "hardware", "port", "game"),
|
joi.string().valid("http", "ping", "pagespeed", "docker", "hardware", "port", "game", "grpc"),
|
||||||
joi.array().items(joi.string().valid("http", "ping", "pagespeed", "docker", "hardware", "port", "game"))
|
joi.array().items(joi.string().valid("http", "ping", "pagespeed", "docker", "hardware", "port", "game", "grpc"))
|
||||||
),
|
),
|
||||||
filter: joi.string().allow("", null),
|
filter: joi.string().allow("", null),
|
||||||
});
|
});
|
||||||
@@ -136,8 +136,8 @@ const getMonitorsWithChecksQueryValidation = joi.object({
|
|||||||
type: joi
|
type: joi
|
||||||
.alternatives()
|
.alternatives()
|
||||||
.try(
|
.try(
|
||||||
joi.string().valid("http", "ping", "pagespeed", "docker", "hardware", "port", "game"),
|
joi.string().valid("http", "ping", "pagespeed", "docker", "hardware", "port", "game", "grpc"),
|
||||||
joi.array().items(joi.string().valid("http", "ping", "pagespeed", "docker", "hardware", "port", "game"))
|
joi.array().items(joi.string().valid("http", "ping", "pagespeed", "docker", "hardware", "port", "game", "grpc"))
|
||||||
)
|
)
|
||||||
.optional(),
|
.optional(),
|
||||||
explain: joi.boolean().optional(),
|
explain: joi.boolean().optional(),
|
||||||
@@ -170,6 +170,7 @@ const createMonitorBodyValidation = joi.object({
|
|||||||
expectedValue: joi.string().allow(""),
|
expectedValue: joi.string().allow(""),
|
||||||
matchMethod: joi.string().allow(null, ""),
|
matchMethod: joi.string().allow(null, ""),
|
||||||
gameId: joi.string().allow(""),
|
gameId: joi.string().allow(""),
|
||||||
|
grpcServiceName: joi.string().allow("").default(""),
|
||||||
selectedDisks: joi.array().items(joi.string()).optional(),
|
selectedDisks: joi.array().items(joi.string()).optional(),
|
||||||
group: joi.string().max(50).trim().allow(null, "").optional(),
|
group: joi.string().max(50).trim().allow(null, "").optional(),
|
||||||
});
|
});
|
||||||
@@ -201,6 +202,7 @@ const editMonitorBodyValidation = joi
|
|||||||
diskAlertThreshold: joi.number(),
|
diskAlertThreshold: joi.number(),
|
||||||
tempAlertThreshold: joi.number(),
|
tempAlertThreshold: joi.number(),
|
||||||
gameId: joi.string().allow(""),
|
gameId: joi.string().allow(""),
|
||||||
|
grpcServiceName: joi.string().allow(""),
|
||||||
selectedDisks: joi.array().items(joi.string()).optional(),
|
selectedDisks: joi.array().items(joi.string()).optional(),
|
||||||
group: joi.string().max(50).trim().allow(null, "").optional(),
|
group: joi.string().max(50).trim().allow(null, "").optional(),
|
||||||
})
|
})
|
||||||
@@ -301,7 +303,7 @@ const getChecksParamValidation = joi.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const getChecksQueryValidation = joi.object({
|
const getChecksQueryValidation = joi.object({
|
||||||
type: joi.string().valid("http", "ping", "pagespeed", "hardware", "docker", "port", "game"),
|
type: joi.string().valid("http", "ping", "pagespeed", "hardware", "docker", "port", "game", "grpc"),
|
||||||
sortOrder: joi.string().valid("asc", "desc"),
|
sortOrder: joi.string().valid("asc", "desc"),
|
||||||
limit: joi.number(),
|
limit: joi.number(),
|
||||||
dateRange: joi.string().valid("recent", "hour", "day", "week", "month", "all"),
|
dateRange: joi.string().valid("recent", "hour", "day", "week", "month", "all"),
|
||||||
|
|||||||
Reference in new issue
Block a user