Feat/monitor endpoint refactor (#463)
* Moved all methods to modules * removed old mongoDB file * Refactored endpoints to take query params, removed duplicate methods, updated routes, updated Client queries * Added comment * Add model differentiation * Add sort order, fix minor bug, add validation for query params
This commit is contained in:
1 parent
e47d3685ce
commit
477cad7cc9
11 files changed
+132
-166
No files matched your search
@@ -118,14 +118,32 @@ const inviteVerifciationBodyValidation = joi.object({
|
||||
// Monitors
|
||||
//****************************************
|
||||
|
||||
const getMonitorByIdValidation = joi.object({
|
||||
const getMonitorByIdParamValidation = joi.object({
|
||||
monitorId: joi.string().required(),
|
||||
});
|
||||
|
||||
const getMonitorByIdQueryValidation = joi.object({
|
||||
status: joi.boolean(),
|
||||
sortOrder: joi.string().valid("asc", "desc"),
|
||||
limit: joi.number(),
|
||||
});
|
||||
|
||||
const getMonitorsByUserIdValidation = joi.object({
|
||||
userId: joi.string().required(),
|
||||
});
|
||||
|
||||
const getMonitorsByUserIdQueryValidation = joi.object({
|
||||
status: joi.boolean(),
|
||||
sortOrder: joi.string().valid("asc", "desc"),
|
||||
limit: joi.number(),
|
||||
type: joi
|
||||
.alternatives()
|
||||
.try(
|
||||
joi.string().valid("http", "ping", "pagespeed"),
|
||||
joi.array().items(joi.string().valid("http", "ping", "pagespeed"))
|
||||
),
|
||||
});
|
||||
|
||||
const monitorValidation = joi.object({
|
||||
_id: joi.string(),
|
||||
userId: joi.string().required(),
|
||||
@@ -244,9 +262,10 @@ module.exports = {
|
||||
inviteRoleValidation,
|
||||
inviteBodyValidation,
|
||||
inviteVerifciationBodyValidation,
|
||||
getMonitorByIdValidation,
|
||||
getMonitorByIdParamValidation,
|
||||
getMonitorByIdQueryValidation,
|
||||
getMonitorsByUserIdValidation,
|
||||
monitorValidation,
|
||||
getMonitorsByUserIdQueryValidation,
|
||||
editMonitorBodyValidation,
|
||||
editUserParamValidation,
|
||||
editUserBodyValidation,
|
||||
|
||||
Reference in new issue
Block a user