oneuptime/CommonServer/API/GlobalConfigAPI.ts

48 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-09-13 10:23:04 +00:00
import GlobalConfigService, {
Service as GlobalConfigServiceType,
} from "../Services/GlobalConfigService";
2023-09-13 06:52:17 +00:00
import {
ExpressRequest,
ExpressResponse,
NextFunction,
} from "../Utils/Express";
import Response from "../Utils/Response";
import BaseAPI from "./BaseAPI";
import GlobalConfig from "Model/Models/GlobalConfig";
2023-09-29 11:24:45 +00:00
// import ObjectID from 'Common/Types/ObjectID';
2023-09-13 06:52:17 +00:00
2023-09-13 11:00:52 +00:00
export default class GlobalConfigAPI extends BaseAPI<
GlobalConfig,
GlobalConfigServiceType
2023-09-13 11:00:52 +00:00
> {
public constructor() {
super(GlobalConfig, GlobalConfigService);
2023-09-13 06:52:17 +00:00
this.router.get(
`${new this.entityType().getCrudApiPath()?.toString()}/vars`,
async (req: ExpressRequest, res: ExpressResponse, next: NextFunction) => {
try {
// const globalConfig: GlobalConfig | null =
// await GlobalConfigService.findOneById({
// id: ObjectID.getZeroObjectID(),
// select: {
// useHttps: true,
// },
// props: {
// isRoot: true,
// },
// });
2023-09-13 06:52:17 +00:00
return Response.sendJsonObjectResponse(req, res, {
// USE_HTTPS:
// globalConfig?.useHttps?.toString() || 'false',
});
} catch (err) {
next(err);
}
},
);
}
2023-09-13 06:52:17 +00:00
}