import {Injectable} from "@angular/core"; import ApiService, {AvailableVersion} from "@api/api.service"; import {DatabaseRequest} from "@api/v1/databaseRequest"; import {CacheRequest} from "@api/v1/cacheRequest"; import {CreateUserRequest} from "@api/v1/createUserRequest"; import {LoggingRequest} from "@api/v1/loggingRequest"; import {EmailRequest} from "@api/v1/emailRequest"; import {ScheduleConfigurationRequest} from "@api/v1/scheduleConfigurationRequest"; import {DateOnly} from "@model/DateOnly"; @Injectable() export default class SetupService extends ApiService { protected basePath = 'Setup/'; public readonly version = AvailableVersion.v1; public checkToken(token: string) { return this.get('CheckToken', {token: token}); } public setPsql(data: DatabaseRequest) { return this.post('SetPsql', data); } public setMysql(data: DatabaseRequest) { return this.post('SetMysql', data); } public setSqlite(path: string | null = null) { return this.post('SetSqlite', null, {path: path}); } public setRedis(data: CacheRequest) { return this.post('SetRedis', data); } public setMemcached() { return this.post('SetMemcached', null); } public createAdmin(data: CreateUserRequest) { return this.post('CreateAdmin', data); } public setLogging(data: LoggingRequest | null = null) { return this.post('SetLogging', data); } public setEmail(data: EmailRequest | null = null) { return this.post('SetEmail', data); } public setSchedule(data: ScheduleConfigurationRequest) { data.startTerm = new DateOnly(data.startTerm).toString(); return this.post('SetSchedule', data); } public submit() { return this.post('Submit', null); } }