This commit is contained in:
2024-09-26 03:52:26 +04:00
parent cd9dc319eb
commit 99dc3c86e7
4 changed files with 11 additions and 6 deletions

View File

@@ -82,6 +82,7 @@ export class ScheduleController {
}
@ApiExtraModels(SiteMainPageDto)
@ApiExtraModels(CacheStatusDto)
@ApiOperation({
summary: "Обновление данных основной страницы политехникума",
tags: ["schedule"],
@@ -90,12 +91,12 @@ export class ScheduleController {
@ApiNotAcceptableResponse({
description: "Передан некорректный код страницы",
})
@ResultDto(null)
@ResultDto(CacheStatusDto)
@HttpCode(HttpStatus.OK)
@Post("update-site-main-page")
async updateSiteMainPage(
@Body() siteMainPageDto: SiteMainPageDto,
): Promise<void> {
): Promise<CacheStatusDto> {
return await this.scheduleService.updateSiteMainPage(siteMainPageDto);
}

View File

@@ -127,12 +127,16 @@ export class ScheduleService {
return groupNames;
}
async updateSiteMainPage(siteMainPageDto: SiteMainPageDto): Promise<void> {
async updateSiteMainPage(
siteMainPageDto: SiteMainPageDto,
): Promise<CacheStatusDto> {
await this.scheduleParser
.getXlsDownloader()
.setPreparedData(siteMainPageDto.mainPage);
await this.cacheManager.reset();
await this.getSourceSchedule();
return this.getCacheStatus();
}
}