This commit is contained in:
Nawaz Dhandala
2022-04-12 15:51:38 +01:00
parent 634ffb0a6e
commit e4514ae16a
11 changed files with 40 additions and 40 deletions

View File

@@ -27,11 +27,11 @@ export default ({
isResourceInProject,
friendlyResourceName,
service,
}: $TSFixMe) => {
}: $TSFixMe): void => {
const getItemMiddleware = async (
req: ExpressRequest,
res: ExpressResponse
) => {
): void => {
try {
let item = null;
@@ -70,7 +70,7 @@ export default ({
const listItemMiddleware = async (
req: ExpressRequest,
res: ExpressResponse
) => {
): void => {
try {
let query = req.data.query;
let skip = req.data.skip;
@@ -152,7 +152,7 @@ export default ({
const createItemMiddleware = async (
req: ExpressRequest,
res: ExpressResponse
) => {
): void => {
try {
const data = req.body;
@@ -171,7 +171,7 @@ export default ({
const deleteItemMiddleware = async (
req: ExpressRequest,
res: ExpressResponse
) => {
): void => {
try {
if (!req.apiProps.authorizedByRole.includes(req.role)) {
return sendErrorResponse(req, res, {

View File

@@ -15,7 +15,7 @@ import { isValidMonitor } from '../middlewares/api';
const incomingHttpRequest = async (
req: ExpressRequest,
res: ExpressResponse
) => {
): void => {
try {
const monitor = req.monitor;
const body = req.body;

View File

@@ -105,7 +105,7 @@ const getComponents = async (
projectIds: $TSFixMe,
val: $TSFixMe,
parentProjectId: string
) => {
): void => {
const populateComponent = [
{ path: 'projectId', select: 'name' },
{ path: 'componentCategoryId', select: 'name' },
@@ -148,7 +148,7 @@ const getMonitors = async (
projectIds: $TSFixMe,
val: $TSFixMe,
parentProjectId: string
) => {
): void => {
const query = {
projectId: { $in: projectIds },
deleted: false,
@@ -197,7 +197,7 @@ const getStatusPages = async (
projectIds: $TSFixMe,
val: $TSFixMe,
parentProjectId: string
) => {
): void => {
const populateStatusPage = [
{
path: 'projectId',
@@ -295,7 +295,7 @@ const getOnCallDuty = async (
projectIds: $TSFixMe,
val: $TSFixMe,
parentProjectId: string
) => {
): void => {
const populate = [
{ path: 'userIds', select: 'name' },
{ path: 'createdById', select: 'name' },
@@ -349,7 +349,7 @@ const getSchedultEvent = async (
projectIds: $TSFixMe,
val: $TSFixMe,
parentProjectId: string
) => {
): void => {
const populateScheduledEvent = [
{ path: 'resolvedBy', select: 'name' },
{ path: 'projectId', select: 'name slug' },
@@ -397,7 +397,7 @@ const getIncidents = async (
projectIds: $TSFixMe,
val: $TSFixMe,
parentProjectId: string
) => {
): void => {
const isNumber = Number(val);
if (isNumber) {
const populate = [
@@ -461,7 +461,7 @@ const getErrorTrackers = async (
projectIds: $TSFixMe,
val: $TSFixMe,
parentProjectId: string
) => {
): void => {
const components = await ComponentService.findBy({
query: { projectId: { $in: projectIds }, deleted: false },
select: '_id',
@@ -513,7 +513,7 @@ const getLogContainers = async (
projectIds: $TSFixMe,
val: $TSFixMe,
parentProjectId: string
) => {
): void => {
const components = await ComponentService.findBy({
query: { projectId: { $in: projectIds }, deleted: false },
select: '_id',
@@ -569,7 +569,7 @@ const getPerformanceTrackers = async (
projectIds: $TSFixMe,
val: $TSFixMe,
parentProjectId: string
) => {
): void => {
const components = await ComponentService.findBy({
query: { projectId: { $in: projectIds }, deleted: false },
select: 'id',

View File

@@ -8,7 +8,7 @@ import AlertService from '../Services/alertService';
import { IS_SAAS_SERVICE } from '../config/server';
const handleFetchingUnpaidSubscriptions = async startAfter => {
const handleFetchingUnpaidSubscriptions = async (startAfter): void => {
if (startAfter) {
return await stripe.subscriptions.list({
status: 'unpaid',

View File

@@ -5,12 +5,12 @@ export default class Domain {
public get domain(): string {
return this._domain;
}
public set domain (v: string):void {
public set domain(v: string) {
this._domain = v;
}
public static isValidDomain(domain: string): boolean {
if (!domain.includes ('.')):void {
if (!domain.includes('.')) {
return false;
}
@@ -27,22 +27,22 @@ export default class Domain {
const lastItem: string = parts[parts.length - 1] as string;
const beforeLastItem: string = parts[parts.length - 2] as string;
if (firstTLDs.includes (lastItem)):void {
if (secondTLDs.includes (beforeLastItem)):void {
if (firstTLDs.includes(lastItem)) {
if (secondTLDs.includes(beforeLastItem)) {
return true;
}
return true;
} else if (secondTLDs.includes (lastItem)):void {
} else if (secondTLDs.includes(lastItem)) {
return true;
}
return false;
}
constructor (domain: string):void {
constructor(domain: string) {
const isValid: boolean = Domain.isValidDomain(domain);
if (!isValid):void {
if (!isValid) {
throw new BadDataException('Domain is not in valid format.');
}
this.domain = domain;

View File

@@ -5,7 +5,7 @@ export default class EmailWithName {
public get email(): Email {
return this._email;
}
public set email (v: Email):void {
public set email(v: Email) {
this._email = v;
}
@@ -13,16 +13,16 @@ export default class EmailWithName {
public get name(): string {
return this._name;
}
public set name (v: string):void {
public set name(v: string) {
this._name = v;
}
constructor (name: string, email: string | Email):void {
if (typeof email === 'string'):void {
constructor(name: string, email: string | Email) {
if (typeof email === 'string') {
this.email = new Email(email);
}
if (email instanceof Email):void {
if (email instanceof Email) {
this.email = email;
}

View File

@@ -1,5 +1,5 @@
export default class Cache {
public static getItem() {}
public static getItem(): void {}
public static setItem() {}
public static setItem(): void {}
}

View File

@@ -28,7 +28,7 @@ export default class Service {
jobRole,
createdAt,
source,
}: $TSFixMe) {
}: $TSFixMe): void {
if (!base) return;
return base('User').create({
@@ -53,7 +53,7 @@ export default class Service {
type,
volume,
website,
}: $TSFixMe) {
}: $TSFixMe): void {
if (!base) return;
return base('Leads').create({
@@ -70,7 +70,7 @@ export default class Service {
});
}
deleteUser(airtableId: $TSFixMe) {
deleteUser(airtableId: $TSFixMe): void {
if (!base) return;
return base('User').destroy(airtableId);
@@ -80,7 +80,7 @@ export default class Service {
//Params:
//Param 1: data: Feedback data (message, name, email, project, page).
//Returns: promise
logFeedback({ message, name, email, project, page }: $TSFixMe) {
logFeedback({ message, name, email, project, page }: $TSFixMe): void {
if (!base) return;
return base('Feedback').create({
@@ -92,7 +92,7 @@ export default class Service {
});
}
deleteFeedback(airtableId: $TSFixMe) {
deleteFeedback(airtableId: $TSFixMe): void {
if (!base) return;
if (!airtableId) {

View File

@@ -174,7 +174,7 @@ export default class Service {
triggeredBy,
resources,
stackSize = 0,
}: $TSFixMe) {
}: $TSFixMe): void {
if (stackSize === 3) {
const resource = resources[0];
if (resource) {
@@ -231,12 +231,12 @@ export default class Service {
return Promise.all(eventPromises);
}
async runAutomatedScript({
\ async runAutomatedScript({
automatedScriptId,
triggeredId,
triggeredBy = 'script',
stackSize,
}: $TSFixMe) {
}: $TSFixMe): void {
const selectScript =
'name script scriptType slug projectId successEvent failureEvent';
const populateScript = [{ path: 'createdById', select: 'name' }];

View File

@@ -30,7 +30,7 @@ const initialState = {
export default function incidentCommunicationSla(
state = initialState,
action: Action
): void {
): void {
switch (action.type) {
case types.CREATE_COMMUNICATION_SLA_REQUEST:
return {

View File

@@ -3690,7 +3690,7 @@ const checkOr = (
queryParams,
headers
) : void => {
): void => {
let validity = false;
if (con && con.criteria && con.criteria.length > 0) {
for (let i = 0; i < con.criteria.length; i++) {