mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-23 15:49:10 +00:00
fix api
This commit is contained in:
parent
0dfa3d4b81
commit
8860559005
5
Common/Types/API/EmptyResponse.ts
Normal file
5
Common/Types/API/EmptyResponse.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { JSONObject } from "../JSON";
|
||||
|
||||
export default interface EmptyResponseData extends JSONObject {
|
||||
|
||||
}
|
@ -146,7 +146,7 @@ export default class BaseAPI<
|
||||
|
||||
const item: TBaseModel = BaseModel.fromJSON<TBaseModel>(
|
||||
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<TBaseModel>(
|
||||
body['data'] as JSONObject
|
||||
);
|
||||
) as TBaseModel;
|
||||
|
||||
const savedItem: BaseModel = await this.service.createByRole(
|
||||
oneuptimeRequest.role,
|
||||
|
@ -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<HTTPResponse> {
|
||||
): Promise<HTTPResponse<EmptyResponseData>> {
|
||||
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<EmptyResponseData>(
|
||||
new URL(
|
||||
HttpProtocol,
|
||||
MailHostname,
|
||||
|
@ -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<HTTPResponse> {
|
||||
return await this.api.post(
|
||||
): Promise<HTTPResponse<EmptyResponse>> {
|
||||
return await this.api.post<EmptyResponse>(
|
||||
new Route(`/send-created-incident`),
|
||||
{
|
||||
projectId,
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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';
|
||||
|
Loading…
Reference in New Issue
Block a user