diff --git a/Common/Types/API/EmptyResponse.ts b/Common/Types/API/EmptyResponse.ts new file mode 100644 index 0000000000..e41f3c6d40 --- /dev/null +++ b/Common/Types/API/EmptyResponse.ts @@ -0,0 +1,5 @@ +import { JSONObject } from "../JSON"; + +export default interface EmptyResponseData extends JSONObject { + +} \ No newline at end of file diff --git a/CommonServer/API/BaseAPI.ts b/CommonServer/API/BaseAPI.ts index 49a598d6d0..90e1cef068 100644 --- a/CommonServer/API/BaseAPI.ts +++ b/CommonServer/API/BaseAPI.ts @@ -146,7 +146,7 @@ export default class BaseAPI< const item: TBaseModel = BaseModel.fromJSON( body['data'] as JSONObject - ); + ) as TBaseModel; await this.service.updateByRole(oneuptimeRequest.role, { query: { @@ -167,7 +167,7 @@ export default class BaseAPI< const item: TBaseModel = BaseModel.fromJSON( body['data'] as JSONObject - ); + ) as TBaseModel; const savedItem: BaseModel = await this.service.createByRole( oneuptimeRequest.role, diff --git a/CommonServer/Services/MailService.ts b/CommonServer/Services/MailService.ts index 51b722ff66..c10e9888c4 100644 --- a/CommonServer/Services/MailService.ts +++ b/CommonServer/Services/MailService.ts @@ -1,4 +1,5 @@ -import HTTPResponse from 'Common/Types/API/Response'; +import EmptyResponseData from 'Common/Types/API/EmptyResponse'; +import HTTPResponse from 'Common/Types/API/HTTPResponse'; import Route from 'Common/Types/API/Route'; import URL from 'Common/Types/API/URL'; import Dictionary from 'Common/Types/Dictionary'; @@ -19,7 +20,7 @@ export default class MailService { projectId?: ObjectID; forceSendFromGlobalMailServer?: boolean; } - ): Promise { + ): Promise> { const body: JSONObject = { toEmail: to.toString(), subject, @@ -35,7 +36,7 @@ export default class MailService { options.forceSendFromGlobalMailServer; } - return await API.post( + return await API.post( new URL( HttpProtocol, MailHostname, diff --git a/CommonServer/Services/RealTimeService.ts b/CommonServer/Services/RealTimeService.ts index 7f363b4bb1..e2f3955cf1 100755 --- a/CommonServer/Services/RealTimeService.ts +++ b/CommonServer/Services/RealTimeService.ts @@ -4,7 +4,8 @@ import { JSONObjectOrArray } from 'Common/Types/JSON'; import Route from 'Common/Types/API/Route'; import Headers from 'Common/Types/API/Headers'; import ObjectID from 'Common/Types/ObjectID'; -import HTTPResponse from 'Common/Types/API/Response'; +import HTTPResponse from 'Common/Types/API/HTTPResponse'; +import EmptyResponse from 'Common/Types/API/EmptyResponse'; class Service { private api: API; @@ -21,8 +22,8 @@ class Service { projectId: ObjectID, eventType: string, data: JSONObjectOrArray - ): Promise { - return await this.api.post( + ): Promise> { + return await this.api.post( new Route(`/send-created-incident`), { projectId, diff --git a/CommonServer/Utils/Response.ts b/CommonServer/Utils/Response.ts index 65f1d4cf42..c1a5e176ae 100644 --- a/CommonServer/Utils/Response.ts +++ b/CommonServer/Utils/Response.ts @@ -13,6 +13,7 @@ import ListData from 'Common/Types/ListData'; import PositiveNumber from 'Common/Types/PositiveNumber'; import URL from 'Common/Types/API/URL'; import BaseModel from 'Common/Models/BaseModel'; +import EmptyResponse from 'Common/Types/API/EmptyResponse'; export default class Response { private static logResponse( @@ -64,7 +65,7 @@ export default class Response { ); oneUptimeResponse.set('Pod-Id', process.env['POD_NAME']); - oneUptimeResponse.status(200).send(); + oneUptimeResponse.status(200).send({} as EmptyResponse); return this.logResponse(req, res, undefined); } diff --git a/CommonUI/src/Utils/API/BaseAPI.ts b/CommonUI/src/Utils/API/BaseAPI.ts index 42acae6840..4ef360a4dd 100644 --- a/CommonUI/src/Utils/API/BaseAPI.ts +++ b/CommonUI/src/Utils/API/BaseAPI.ts @@ -3,7 +3,7 @@ import history from '../History'; import Headers from 'Common/Types/API/Headers'; import API from 'Common/Utils/API'; import APIException from 'Common/Types/Exception/ApiException'; -import HTTPErrorResponse from 'Common/Types/API/ErrorResponse'; +import HTTPErrorResponse from 'Common/Types/API/HTTPErrorResponse'; import Cookies from 'universal-cookie'; import Protocol from 'Common/Types/API/Protocol'; import Hostname from 'Common/Types/API/Hostname';