Files
certd/packages/ui/certd-server/src/modules/basic/controller/settings-controller.ts
T

38 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-09-24 02:42:08 +08:00
import { Config, Controller, Get, Inject, Provide } from '@midwayjs/core';
2024-07-15 00:30:33 +08:00
import { BaseController } from '../../../basic/base-controller.js';
import { Constants } from '../../../basic/constants.js';
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
2024-09-23 11:27:53 +08:00
import { SysInstallInfo, SysPublicSettings, SysSiteInfo } from '../../system/service/models.js';
2024-09-24 02:42:08 +08:00
import { AppKey } from '@certd/pipeline';
/**
*/
@Provide()
@Controller('/api/basic/settings')
export class BasicSettingsController extends BaseController {
@Inject()
sysSettingsService: SysSettingsService;
2024-09-24 02:42:08 +08:00
@Config('account.server.baseUrl')
accountServerBaseUrl: any;
@Get('/public', { summary: Constants.per.guest })
public async getSysPublic() {
2024-08-02 23:59:08 +08:00
const settings = await this.sysSettingsService.getSetting(SysPublicSettings);
return this.ok(settings);
}
2024-08-25 01:55:34 +08:00
@Get('/install', { summary: Constants.per.guest })
public async getInstallInfo() {
2024-09-24 02:42:08 +08:00
const settings: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
settings.accountServerBaseUrl = this.accountServerBaseUrl;
settings.appKey = AppKey;
2024-08-25 01:55:34 +08:00
return this.ok(settings);
}
2024-09-23 11:27:53 +08:00
@Get('/siteInfo', { summary: Constants.per.guest })
public async getSiteInfo() {
2024-09-24 02:42:08 +08:00
const settings: SysSiteInfo = await this.sysSettingsService.getSetting(SysSiteInfo);
2024-09-23 11:27:53 +08:00
return this.ok(settings);
}
}