This commit is contained in:
Nawaz Dhandala 2022-04-15 12:06:18 +01:00
parent c4591531e4
commit 13306dec36
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
37 changed files with 320 additions and 271 deletions

View File

@ -90,6 +90,7 @@
"react/no-is-mounted": "error",
"react/no-find-dom-node": "error",
"one-var-declaration-per-line": "error",
"arrow-body-style": ["error", "always"],
"@typescript-eslint/typedef": [
"error",
{

View File

@ -55,7 +55,7 @@ router.get(
getUser,
isAuthorized,
getSubProjects,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const subProjectIds: $TSFixMe = req.user.subProjects
? req.user.subProjects.map((project: $TSFixMe) => project._id)
@ -74,7 +74,7 @@ router.get(
'/:projectId/alert',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const projectId: $TSFixMe = req.params.projectId;
const populateAlert: $TSFixMe = [
@ -215,7 +215,7 @@ router.get(
'/:projectId/alert/charges',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const projectId: $TSFixMe = req.params.projectId;

View File

@ -116,7 +116,7 @@ router.get(
'/:projectId/:componentId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const componentId: $TSFixMe = req.params.componentId;
if (!componentId) {
@ -175,7 +175,7 @@ router.delete(
router.post(
'/:applicationLogId/log',
isApplicationLogValid,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const applicationLogId: $TSFixMe = req.params.applicationLogId;

View File

@ -40,7 +40,7 @@ router.get(
router.post(
'/scanning',
isAuthorizedApplicationScanner,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const security: $TSFixMe = req.body.security;
const applicationSecurity: $TSFixMe =
@ -64,7 +64,7 @@ router.post(
router.post(
'/failed',
isAuthorizedApplicationScanner,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const security: $TSFixMe = req.body;
const applicationSecurity: $TSFixMe =

View File

@ -200,7 +200,7 @@ router.post(
'/:projectId/routingNumber',
getUser,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const { projectId }: $TSFixMe = req.params;
@ -217,7 +217,7 @@ router.put(
'/:projectId/:callRoutingId',
getUser,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { callRoutingId }: $TSFixMe = req.params;
const data: $TSFixMe = req.body;

View File

@ -45,7 +45,7 @@ router.post(
getUser,
isAuthorized,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const projectId: $TSFixMe = req.params.projectId;
@ -144,7 +144,7 @@ router.get(
getUser,
isAuthorized,
getSubProjects,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { limit, skip }: $TSFixMe = req.query;
@ -168,7 +168,7 @@ router.get(
'/:projectId/paginated',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId }: $TSFixMe = req.params;
const { limit, skip }: $TSFixMe = req.query;
@ -191,7 +191,7 @@ router.get(
'/:projectId/slug/:slug',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { slug }: $TSFixMe = req.params;
const populateComponent: $TSFixMe = [

View File

@ -21,7 +21,7 @@ import ProjectService from '../services/projectService';
router.get(
'/containerSecurities',
isAuthorizedContainerScanner,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const response: $TSFixMe =
await ContainerSecurityService.getSecuritiesToScan();
@ -34,7 +34,7 @@ router.get(
router.post(
'/scanning',
isAuthorizedContainerScanner,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const security: $TSFixMe = req.body.security;
const containerSecurity: $TSFixMe =

View File

@ -105,7 +105,7 @@ router.put(
'/:projectId/:customFieldId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, customFieldId }: $TSFixMe = req.params;
const { fieldName, fieldType, uniqueField }: $TSFixMe = req.body;

View File

@ -113,7 +113,7 @@ router.put(
'/:emailLogsId',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const emailLogsId: $TSFixMe = req.params.emailLogsId;

View File

@ -185,7 +185,7 @@ router.put(
'/:projectId/:emailSmtpId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const emailSmtpId: $TSFixMe = req.params.emailSmtpId;
@ -256,7 +256,7 @@ router.delete(
'/:projectId/:emailSmtpId',
getUser,
isUserOwner,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
data.deleted = true;

View File

@ -119,7 +119,7 @@ router.get(
'/:projectId/:componentId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const componentId: $TSFixMe = req.params.componentId;
if (!componentId) {
@ -344,7 +344,7 @@ router.put(
router.post(
'/:errorTrackerId/track',
isErrorTrackerValid,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const errorTrackerId: $TSFixMe = req.params.errorTrackerId;

View File

@ -316,7 +316,7 @@ router.get(
getUser,
isAuthorized,
getSubProjects,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
// const subProjectIds: $TSFixMe = req.user.subProjects
// ? req.user.subProjects.map((project: $TSFixMe) => project._id)
@ -383,7 +383,7 @@ router.get(
'/:projectId/incident',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const projectId: $TSFixMe = req.params.projectId;
const populate: $TSFixMe = [
@ -1714,7 +1714,7 @@ router.delete(
'/:projectId/:incidentId',
getUser,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, incidentId }: $TSFixMe = req.params;
const incident: $TSFixMe = await IncidentService.deleteBy(

View File

@ -120,7 +120,7 @@ router.put(
'/:projectId/:incidentSlaId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, incidentSlaId }: $TSFixMe = req.params;
const { name, handleDefault, alertTime, duration }: $TSFixMe =

View File

@ -87,7 +87,7 @@ router.put(
'/:projectId/:templateId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, templateId }: $TSFixMe = req.params;
const { name, incidentNote, incidentState }: $TSFixMe = req.body;
@ -134,7 +134,7 @@ router.delete(
'/:projectId/:templateId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, templateId }: $TSFixMe = req.params;

View File

@ -31,7 +31,7 @@ router.get(
'/:projectId/default',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId }: $TSFixMe = req.params;
if (!projectId) {
@ -127,7 +127,7 @@ router.put(
'/:projectId/:templateId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
const { projectId, templateId }: $TSFixMe = req.params;
const {
title,
@ -214,7 +214,7 @@ router.delete(
'/:projectId/:templateId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, templateId }: $TSFixMe = req.params;

View File

@ -46,7 +46,7 @@ router.post(
getUser,
isAuthorized,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const projectId: $TSFixMe = req.params.projectId;
@ -447,7 +447,7 @@ router.get(
getUser,
isAuthorized,
getSubProjects,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const subProjectIds: $TSFixMe = req.user.subProjects
? req.user.subProjects.map((project: $TSFixMe) => project._id)
@ -472,7 +472,7 @@ router.get(
'/:projectId/paginated',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
// const { projectId }: $TSFixMe = req.params;
const { skip, limit, componentSlug }: $TSFixMe = req.query;
@ -948,7 +948,7 @@ router.post(
'/:projectId/addseat',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const seatresponse: $TSFixMe = await MonitorService.addSeat({
_id: req.params.projectId,

View File

@ -108,7 +108,7 @@ router.put(
'/:projectId/:customFieldId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, customFieldId }: $TSFixMe = req.params;
const { fieldName, fieldType, uniqueField }: $TSFixMe = req.body;

View File

@ -135,7 +135,7 @@ router.put(
'/:projectId/:monitorSlaId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, monitorSlaId }: $TSFixMe = req.params;
const { name, handleDefault, frequency, monitorUptime }: $TSFixMe =

View File

@ -22,7 +22,7 @@ router.get(
getUser,
isAuthorized,
getSubProjects,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const subProjectIds: $TSFixMe = req.user.subProjects
? req.user.subProjects.map((project: $TSFixMe) => project._id)
@ -161,7 +161,7 @@ router.put(
'/:projectId/:notificationId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const notificationId: $TSFixMe = req.params.notificationId;
const updateObject: $TSFixMe = req.body;

View File

@ -78,7 +78,7 @@ router.get(
'/:projectId/:componentId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { componentId }: $TSFixMe = req.params;
const { limit, skip }: $TSFixMe = req.query;

View File

@ -120,7 +120,7 @@ router.get(
router.get(
'/:appId/key/:key/throughput',
isValidAPIKey,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { appId }: $TSFixMe = req.params;
let { startDate, endDate }: $TSFixMe = req.query;
@ -350,7 +350,7 @@ router.get(
router.delete(
'/:appId/key/:key/:metricId',
isValidAPIKey,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { metricId }: $TSFixMe = req.params;
const deletedMetric: $TSFixMe =

View File

@ -862,7 +862,7 @@ router.get(
'/:projectId/probes',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const limit: $TSFixMe = req.query['limit'] || null;
const skip: $TSFixMe = req.query['skip'] || null;

View File

@ -310,7 +310,7 @@ router.get(
'/:projectId/balance',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const projectId: $TSFixMe = req.params.projectId;
if (!projectId) {
@ -337,7 +337,7 @@ router.get(
'/:projectId/resetToken',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const projectId: $TSFixMe = req.params.projectId;
@ -887,7 +887,7 @@ router.post(
'/:projectId/subProject',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const userId: $TSFixMe = req.user ? req.user.id : null;
const parentProjectId: $TSFixMe = req.params.projectId;
@ -980,7 +980,7 @@ router.get(
'/:projectId/subProjects',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
// Call the ProjectService
try {
const parentProjectId: $TSFixMe = req.params.projectId;
@ -1017,7 +1017,7 @@ router.get(
'/projects/user/:userId',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const userId: $TSFixMe = req.params.userId;
const skip: $TSFixMe = req.query['skip'] || 0;
@ -1035,7 +1035,7 @@ router.get(
'/projects/allProjects',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const skip: $TSFixMe = req.query['skip'] || 0;
const limit: $TSFixMe = req.query['limit'] || 10;
@ -1057,7 +1057,7 @@ router.get(
'/projects/:slug',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const slug: $TSFixMe = req.params.slug;
const populate: $TSFixMe = [
@ -1195,7 +1195,7 @@ router.put(
'/:projectId/:subProjectId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const parentProjectId: $TSFixMe = req.params.projectId;
const subProjectId: $TSFixMe = req.params.subProjectId;
@ -1242,7 +1242,7 @@ router.post(
'/:projectId/addNote',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const projectId: $TSFixMe = req.params.projectId;
if (Array.isArray(req.body)) {
@ -1297,7 +1297,7 @@ router.post(
'/projects/search',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const filter: $TSFixMe = req.body.filter;
const skip: $TSFixMe = req.query['skip'] || 0;

View File

@ -29,7 +29,7 @@ router.post(
getUser,
isAuthorized,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const resourceCategoryName: $TSFixMe =
req.body.resourceCategoryName;

View File

@ -23,7 +23,7 @@ router.post(
getUser,
isAuthorized,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
@ -120,7 +120,7 @@ router.get(
'/:projectId/schedule',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const projectId: $TSFixMe = req.params.projectId;
const populate: $TSFixMe = [

View File

@ -113,7 +113,7 @@ router.put(
'/:projectId/:eventId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const { eventId, projectId }: $TSFixMe = req.params;
@ -279,7 +279,7 @@ router.delete(
'/:projectId/:eventId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const userId: $TSFixMe = req.user ? req.user.id : null;
const { eventId }: $TSFixMe = req.params;
@ -301,7 +301,7 @@ router.put(
'/:projectId/:eventId/cancel',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const userId: $TSFixMe = req.user ? req.user.id : null;
const { eventId }: $TSFixMe = req.params;
@ -378,7 +378,7 @@ router.get(
'/:projectId/ongoingEvent',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId }: $TSFixMe = req.params;
const currentDate: $TSFixMe = moment();
@ -467,7 +467,7 @@ router.get(
'/:projectId/:eventId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, eventId }: $TSFixMe = req.params;
@ -691,7 +691,7 @@ router.post(
'/:projectId/:eventId/notes',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { eventId, projectId }: $TSFixMe = req.params;
@ -788,7 +788,7 @@ router.get(
'/:projectId/:eventId/notes',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { eventId }: $TSFixMe = req.params;
@ -944,7 +944,7 @@ router.get(
'/:projectId/slug/:slug',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { slug }: $TSFixMe = req.params;
const populate: $TSFixMe = [

View File

@ -80,7 +80,7 @@ router.put(
'/:projectId/:smsSmtpId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const smsSmtpId: $TSFixMe = req.params.smsSmtpId;
@ -102,7 +102,7 @@ router.delete(
'/:projectId/:smsSmtpId',
getUser,
isUserOwner,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const smsSmtpId: $TSFixMe = req.params.smsSmtpId;
const payload: $TSFixMe = {

View File

@ -116,7 +116,7 @@ router.get(
'/:projectId/ssos',
getUser,
isScaleOrMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const skip: $TSFixMe = req.query['skip'] || 0;
const limit: $TSFixMe = req.query['limit'] || 10;

View File

@ -516,7 +516,7 @@ router.put(
getUser,
isAuthorized,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
const data: $TSFixMe = req.body;
const upload: $TSFixMe = multer({
storage,
@ -790,7 +790,7 @@ router.get(
'/:projectId/dashboard',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
const projectId: $TSFixMe = req.params.projectId;
try {
// Call the StatusPageService.
@ -840,7 +840,7 @@ router.get(
'/:projectId/StatusPages',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { data, count }: $TSFixMe =
await StatusPageService.getStatusPagesByProjectId({
@ -859,7 +859,7 @@ router.get(
'/:projectId/statuspage',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
const projectId: $TSFixMe = req.params.projectId;
try {
@ -908,7 +908,7 @@ router.get(
'/:statusPageSlug',
checkUser,
ipWhitelist,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
const statusPageSlug: $TSFixMe = req.params.statusPageSlug;
const url: $TSFixMe = req.query.url;
@ -1177,7 +1177,7 @@ router.get(
router.get(
'/:projectId/incident/:incidentSlug',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { incidentSlug }: $TSFixMe = req.params;
@ -1199,7 +1199,7 @@ router.get(
router.get(
'/:projectId/:incidentSlug/incidentNotes',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { incidentSlug }: $TSFixMe = req.params;
@ -1225,7 +1225,7 @@ router.get(
router.get(
'/:projectId/:monitorId/individualnotes',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
let date: $TSFixMe = req.query.date;
date = new Date(date);
@ -1407,7 +1407,7 @@ const fetchNotes: Function = async (events: $TSFixMe, limit: PositiveNumber): vo
router.get(
'/:projectId/notes/:scheduledEventSlug',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
const { scheduledEventSlug }: $TSFixMe = req.params;
const { skip, limit }: $TSFixMe = req.query;
@ -1434,7 +1434,7 @@ router.get(
router.get(
'/:projectId/:monitorId/individualevents',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
let date: $TSFixMe = req.query.date;
date = moment(date).endOf('day').format();
@ -1509,7 +1509,7 @@ router.get(
router.post(
'/:projectId/:monitorId/monitorStatuses',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { startDate, endDate }: $TSFixMe = req.body;
const monitorId: $TSFixMe = req.params.monitorId;
@ -1528,7 +1528,7 @@ router.post(
router.post(
'/:projectId/:monitorId/monitorLogs',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { monitorId }: $TSFixMe = req.params;
const endDate: $TSFixMe = moment(Date.now());
@ -1621,7 +1621,7 @@ router.delete(
router.get(
'/:projectId/timeline/:incidentSlug',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { incidentSlug }: $TSFixMe = req.params;
@ -1684,7 +1684,7 @@ router.get(
router.get(
'/:projectId/monitor/:statusPageId',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { statusPageId }: $TSFixMe = req.params;
const skip: $TSFixMe = req.query['skip'] || 0;
@ -2017,7 +2017,7 @@ router.post(
router.post(
'/:projectId/announcement/:statusPageId',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, statusPageId }: $TSFixMe = req.params;
const { data }: $TSFixMe = req.body;
@ -2200,7 +2200,7 @@ router.get(
router.get(
'/:projectId/announcement/:statusPageId',
checkUser,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { projectId, statusPageId }: $TSFixMe = req.params;
const { skip, limit, show }: $TSFixMe = req.query;

View File

@ -165,7 +165,7 @@ router.get(
'/:projectId/:statusPageId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { statusPageId }: $TSFixMe = req.params;
const { limit, skip }: $TSFixMe = req.query;

View File

@ -78,7 +78,7 @@ router.get(
'/:projectId/:teamMemberId',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
const projectId: $TSFixMe = req.params.projectId;
const teamMemberUserId: $TSFixMe = req.params.teamMemberId;
@ -124,7 +124,7 @@ router.post(
getUser,
isAuthorized,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
const data: $TSFixMe = req.body;
const userId: $TSFixMe = req.user ? req.user : null;

View File

@ -122,7 +122,7 @@ router.post(
'/sms/sendVerificationToken',
getUser,
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const { to }: $TSFixMe = req.body;

View File

@ -1182,7 +1182,7 @@ router.put(
'/profile/:userId',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const upload: $TSFixMe = multer({
storage,
@ -1518,7 +1518,7 @@ router.get(
'/users/:userId',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const userId: $TSFixMe = req.params.userId;
const select: $TSFixMe =
@ -1569,7 +1569,7 @@ router.put(
'/:userId/restoreUser',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const userId: $TSFixMe = req.params.userId;
@ -1597,7 +1597,7 @@ router.put(
'/:userId/blockUser',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const userId: $TSFixMe = req.params.userId;
@ -1625,7 +1625,7 @@ router.put(
'/:userId/unblockUser',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const userId: $TSFixMe = req.params.userId;
@ -1717,7 +1717,7 @@ router.post(
'/:userId/addNote',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const userId: $TSFixMe = req.params.userId;
if (Array.isArray(req.body)) {
@ -1772,7 +1772,7 @@ router.post(
'/users/search',
getUser,
isUserMasterAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const filter: $TSFixMe = req.body.filter;
const skip: $TSFixMe = req.query['skip'] || 0;

View File

@ -18,7 +18,7 @@ router.post(
'/:projectId/create',
getUser,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const projectId: $TSFixMe = req.params.projectId;
const body: $TSFixMe = req.body;
@ -152,7 +152,7 @@ router.put(
'/:projectId/:integrationId',
getUser,
isUserAdmin,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const data: $TSFixMe = req.body;
const integrationId: $TSFixMe = req.params.integrationId;

View File

@ -162,7 +162,7 @@ router.get(
router.post(
'/incident/resolveLastIncident',
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const monitors: $TSFixMe = req.body.monitors || [];
const incident: $TSFixMe = await ZapierService.resolveLastIncident(
@ -182,7 +182,7 @@ router.post(
router.post(
'/incident/resolveAllIncidents',
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const monitors: $TSFixMe = req.body.monitors || [];
const incidents: $TSFixMe = await ZapierService.resolveAllIncidents(
@ -203,7 +203,7 @@ router.post(
router.post(
'/incident/resolveIncident',
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const incidents: $TSFixMe = req.body.incidents || [];
const resolvedIncidents: $TSFixMe =
@ -249,7 +249,7 @@ router.get(
router.post(
'/incident/acknowledgeLastIncident',
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const monitors: $TSFixMe = req.body.monitors || [];
const incident: $TSFixMe =
@ -268,7 +268,7 @@ router.post(
router.post(
'/incident/acknowledgeAllIncidents',
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const monitors: $TSFixMe = req.body.monitors || [];
const incidents: $TSFixMe =
@ -288,7 +288,7 @@ router.post(
router.post(
'/incident/acknowledgeIncident',
isAuthorized,
async (req, res): void => {
async (req: $TSFixMe, res: $TSFixMe) void => {
try {
const incidents: $TSFixMe = req.body.incidents || [];
const acknowledgedIncidents: $TSFixMe =

View File

@ -367,13 +367,15 @@ describe('Capture Exception', (): void => {
let event: $TSFixMe, newEvent: $TSFixMe;
const errorMessage: string = 'Error Found';
const errorMessageObj: string = 'Object Error Found';
await tracker.captureMessage(errorMessage).then(evt => {
await tracker.captureMessage(errorMessage).then((evt: $TSFixMe) => {
event = evt.data;
});
await tracker.captureException(new Error(errorMessageObj)).then(evt => {
newEvent = evt.data;
});
await tracker
.captureException(new Error(errorMessageObj))
.then((evt: $TSFixMe) => {
newEvent = evt.data;
});
// ensure that the first event have a type message, same error message
@ -404,15 +406,17 @@ describe('Capture Exception', (): void => {
// add a timelie action to the first event
tracker.addToTimeline(customTimeline);
await tracker.captureMessage(errorMessage).then(evt => {
await tracker.captureMessage(errorMessage).then((evt: $TSFixMe) => {
event = evt.data;
});
// add a tag to the second event
tracker.setTag('test', 'content');
await tracker.captureException(new Error(errorMessageObj)).then(evt => {
newEvent = evt.data;
});
await tracker
.captureException(new Error(errorMessageObj))
.then((evt: $TSFixMe) => {
newEvent = evt.data;
});
// ensure that the first event have a type message, same error message and two timeline (the custom and the generic one)
@ -462,9 +466,11 @@ describe('Code Capture Snippet', (): void => {
);
let event: $TSFixMe = null;
const errorMessageObj: string = 'Object Error Found';
await tracker.captureException(new Error(errorMessageObj)).then(evt => {
event = evt.data;
});
await tracker
.captureException(new Error(errorMessageObj))
.then((evt: $TSFixMe) => {
event = evt.data;
});
const incidentFrame: $TSFixMe = event.content.stacktrace.frames[0];
expect(incidentFrame).to.have.property('linesBeforeError');
@ -482,9 +488,11 @@ describe('Code Capture Snippet', (): void => {
);
let event: $TSFixMe = null;
const errorMessageObj: string = 'Object Error Found';
await tracker.captureException(new Error(errorMessageObj)).then(evt => {
event = evt.data;
});
await tracker
.captureException(new Error(errorMessageObj))
.then((evt: $TSFixMe) => {
event = evt.data;
});
const incidentFrame: $TSFixMe = event.content.stacktrace.frames[0];
expect(incidentFrame.errorLine).to.be.a('string');
@ -502,9 +510,11 @@ describe('Code Capture Snippet', (): void => {
);
let event: $TSFixMe = null;
const errorMessageObj: string = 'Object Error Found';
await tracker.captureException(new Error(errorMessageObj)).then(evt => {
event = evt.data;
});
await tracker
.captureException(new Error(errorMessageObj))
.then((evt: $TSFixMe) => {
event = evt.data;
});
const incidentFrame: $TSFixMe = event.content.stacktrace.frames[0];
expect(incidentFrame).to.not.have.property('linesBeforeError');
@ -522,9 +532,11 @@ describe('Code Capture Snippet', (): void => {
);
let event: $TSFixMe = null;
const errorMessageObj: string = 'Object Error Found';
await tracker.captureException(new Error(errorMessageObj)).then(evt => {
event = evt.data;
});
await tracker
.captureException(new Error(errorMessageObj))
.then((evt: $TSFixMe) => {
event = evt.data;
});
const incidentFrame: $TSFixMe = event.content.stacktrace.frames[0];
expect(incidentFrame).to.have.property('linesBeforeError');

View File

@ -60,9 +60,9 @@ export default {
const healthyPods: $TSFixMe = [],
healthyPodData: $TSFixMe = [],
unhealthyPods: $TSFixMe = [],
unhealthyPodData : $TSFixMe= [],
allPods : $TSFixMe= [],
allPodData : $TSFixMe= [];
unhealthyPodData: $TSFixMe = [],
allPods: $TSFixMe = [],
allPodData: $TSFixMe = [];
let runningPods: $TSFixMe = 0,
completedPods: $TSFixMe = 0,
failedPods: $TSFixMe = 0;
@ -233,9 +233,9 @@ export default {
// handle job output
const runningJobs: $TSFixMe = [],
succeededJobs : $TSFixMe= [],
failedJobs : $TSFixMe= [],
runningJobData : $TSFixMe= [],
succeededJobs: $TSFixMe = [],
failedJobs: $TSFixMe = [],
runningJobData: $TSFixMe = [],
succeededJobData: $TSFixMe = [],
failedJobData: $TSFixMe = [];
@ -408,20 +408,97 @@ export default {
healthyDeploymentData = [],
allDeploymentData = [];
deploymentOutput.items.forEach((item: $TSFixMe) => {
if (item.status.readyReplicas) {
readyDeployment +=
item.status.readyReplicas;
} else {
readyDeployment += 0;
}
desiredDeployment += item.status.replicas;
deploymentOutput.items.forEach(
(item: $TSFixMe) => {
if (item.status.readyReplicas) {
readyDeployment +=
item.status.readyReplicas;
} else {
readyDeployment += 0;
}
desiredDeployment +=
item.status.replicas;
if (
item.status.readyReplicas !==
item.status.replicas
) {
unhealthyDeployments.push({
if (
item.status.readyReplicas !==
item.status.replicas
) {
unhealthyDeployments.push({
deploymentName:
item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
deploymentCreationTimestamp:
item.metadata
.creationTimestamp,
readyDeployment:
item.status.readyReplicas ||
0,
desiredDeployment:
item.status.replicas,
deploymentResourceVersion:
item.metadata
.resourceVersion,
deploymentUid:
item.metadata.uid,
deploymentSelfLink:
item.metadata.selfLink,
deploymentConditions:
item.status.conditions,
});
unhealthyDeploymentData.push({
deploymentName:
item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
deploymentCreationTimestamp:
item.metadata
.creationTimestamp,
readyDeployment:
item.status.readyReplicas ||
0,
desiredDeployment:
item.status.replicas,
});
} else {
healthyDeployments.push({
deploymentName:
item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
deploymentCreationTimestamp:
item.metadata
.creationTimestamp,
readyDeployment:
item.status.readyReplicas,
desiredDeployment:
item.status.replicas,
deploymentResourceVersion:
item.metadata
.resourceVersion,
deploymentUid:
item.metadata.uid,
deploymentSelfLink:
item.metadata.selfLink,
deploymentConditions:
item.status.conditions,
});
healthyDeploymentData.push({
deploymentName:
item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
deploymentCreationTimestamp:
item.metadata
.creationTimestamp,
readyDeployment:
item.status.readyReplicas,
desiredDeployment:
item.status.replicas,
});
}
allDeployments.push({
deploymentName: item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
@ -439,7 +516,7 @@ export default {
deploymentConditions:
item.status.conditions,
});
unhealthyDeploymentData.push({
allDeploymentData.push({
deploymentName: item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
@ -450,66 +527,8 @@ export default {
desiredDeployment:
item.status.replicas,
});
} else {
healthyDeployments.push({
deploymentName: item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
deploymentCreationTimestamp:
item.metadata.creationTimestamp,
readyDeployment:
item.status.readyReplicas,
desiredDeployment:
item.status.replicas,
deploymentResourceVersion:
item.metadata.resourceVersion,
deploymentUid: item.metadata.uid,
deploymentSelfLink:
item.metadata.selfLink,
deploymentConditions:
item.status.conditions,
});
healthyDeploymentData.push({
deploymentName: item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
deploymentCreationTimestamp:
item.metadata.creationTimestamp,
readyDeployment:
item.status.readyReplicas,
desiredDeployment:
item.status.replicas,
});
}
allDeployments.push({
deploymentName: item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
deploymentCreationTimestamp:
item.metadata.creationTimestamp,
readyDeployment:
item.status.readyReplicas || 0,
desiredDeployment: item.status.replicas,
deploymentResourceVersion:
item.metadata.resourceVersion,
deploymentUid: item.metadata.uid,
deploymentSelfLink:
item.metadata.selfLink,
deploymentConditions:
item.status.conditions,
});
allDeploymentData.push({
deploymentName: item.metadata.name,
deploymentNamespace:
item.metadata.namespace,
deploymentCreationTimestamp:
item.metadata.creationTimestamp,
readyDeployment:
item.status.readyReplicas || 0,
desiredDeployment: item.status.replicas,
});
});
);
const deploymentData: $TSFixMe = {
desiredDeployment,
readyDeployment,
@ -540,20 +559,93 @@ export default {
unhealthyStatefulsetData = [],
allStatefulsetData = [];
statefulsetOutput.items.forEach((item: $TSFixMe) => {
if (item.status.readyReplicas) {
readyStatefulsets +=
item.status.readyReplicas;
} else {
readyStatefulsets += 0;
}
desiredStatefulsets += item.status.replicas;
statefulsetOutput.items.forEach(
(item: $TSFixMe) => {
if (item.status.readyReplicas) {
readyStatefulsets +=
item.status.readyReplicas;
} else {
readyStatefulsets += 0;
}
desiredStatefulsets +=
item.status.replicas;
if (
item.status.readyReplicas !==
item.status.replicas
) {
unhealthyStatefulsets.push({
if (
item.status.readyReplicas !==
item.status.replicas
) {
unhealthyStatefulsets.push({
statefulsetName:
item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
statefulsetCreationTimestamp:
item.metadata
.creationTimestamp,
readyStatefulsets:
item.status.readyReplicas ||
0,
desiredStatefulsets:
item.status.replicas,
statefulsetResourceVersion:
item.metadata
.resourceVersion,
statefulsetUid:
item.metadata.uid,
statefulsetSelfLink:
item.metadata.selfLink,
});
unhealthyStatefulsetData.push({
statefulsetName:
item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
statefulsetCreationTimestamp:
item.metadata
.creationTimestamp,
readyStatefulsets:
item.status.readyReplicas ||
0,
desiredStatefulsets:
item.status.replicas,
});
} else {
healthyStatefulsets.push({
statefulsetName:
item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
statefulsetCreationTimestamp:
item.metadata
.creationTimestamp,
readyStatefulsets:
item.status.readyReplicas,
desiredStatefulsets:
item.status.replicas,
statefulsetResourceVersion:
item.metadata
.resourceVersion,
statefulsetUid:
item.metadata.uid,
statefulsetSelfLink:
item.metadata.selfLink,
});
healthyStatefulsetData.push({
statefulsetName:
item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
statefulsetCreationTimestamp:
item.metadata
.creationTimestamp,
readyStatefulsets:
item.status.readyReplicas,
desiredStatefulsets:
item.status.replicas,
});
}
allStatefulset.push({
statefulsetName: item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
@ -569,7 +661,7 @@ export default {
statefulsetSelfLink:
item.metadata.selfLink,
});
unhealthyStatefulsetData.push({
allStatefulsetData.push({
statefulsetName: item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
@ -580,64 +672,8 @@ export default {
desiredStatefulsets:
item.status.replicas,
});
} else {
healthyStatefulsets.push({
statefulsetName: item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
statefulsetCreationTimestamp:
item.metadata.creationTimestamp,
readyStatefulsets:
item.status.readyReplicas,
desiredStatefulsets:
item.status.replicas,
statefulsetResourceVersion:
item.metadata.resourceVersion,
statefulsetUid: item.metadata.uid,
statefulsetSelfLink:
item.metadata.selfLink,
});
healthyStatefulsetData.push({
statefulsetName: item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
statefulsetCreationTimestamp:
item.metadata.creationTimestamp,
readyStatefulsets:
item.status.readyReplicas,
desiredStatefulsets:
item.status.replicas,
});
}
allStatefulset.push({
statefulsetName: item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
statefulsetCreationTimestamp:
item.metadata.creationTimestamp,
readyStatefulsets:
item.status.readyReplicas || 0,
desiredStatefulsets:
item.status.replicas,
statefulsetResourceVersion:
item.metadata.resourceVersion,
statefulsetUid: item.metadata.uid,
statefulsetSelfLink:
item.metadata.selfLink,
});
allStatefulsetData.push({
statefulsetName: item.metadata.name,
statefulsetNamespace:
item.metadata.namespace,
statefulsetCreationTimestamp:
item.metadata.creationTimestamp,
readyStatefulsets:
item.status.readyReplicas || 0,
desiredStatefulsets:
item.status.replicas,
});
});
);
const statefulsetData: $TSFixMe = {
readyStatefulsets,
desiredStatefulsets,