Compare commits

..

No commits in common. "d333ba03a7186aa38909fdef5d41b89414b9a626" and "e32a7c2eafdfef7a60b8eec243d50b4b98dd5251" have entirely different histories.

4 changed files with 11 additions and 15 deletions

View File

@ -1,4 +1,5 @@
import { HttpStatus, UnprocessableEntityException } from '@nestjs/common'; import { HttpStatus, UnprocessableEntityException } from '@nestjs/common';
import { Brackets } from 'typeorm';
import * as _ from 'lodash'; import * as _ from 'lodash';
// function ini bergungsi untuk validasi season period yang sama // function ini bergungsi untuk validasi season period yang sama

View File

@ -13,16 +13,14 @@ import { ValidateSeasonPeriodHelper } from './helpers/validate.helper';
@Injectable() @Injectable()
export class UpdateSeasonPeriodManager extends BaseUpdateManager<SeasonPeriodEntity> { export class UpdateSeasonPeriodManager extends BaseUpdateManager<SeasonPeriodEntity> {
async validateProcess(): Promise<void> { async validateProcess(): Promise<void> {
if (!this.data.isUpdatePrice) { const priority = await ValidateSeasonPeriodHelper(
const priority = await ValidateSeasonPeriodHelper( this.dataService,
this.dataService, this.data,
this.data, );
);
Object.assign(this.data, { Object.assign(this.data, {
priority: priority, priority: priority,
}); });
}
return; return;
} }

View File

@ -43,11 +43,8 @@ export class SeasonPeriodDataOrchestrator extends BaseDataTransactionOrchestrato
return this.createManager.getResult(); return this.createManager.getResult();
} }
async update(dataId, data, updatePrice = false): Promise<SeasonPeriodEntity> { async update(dataId, data): Promise<SeasonPeriodEntity> {
this.updateManager.setData(dataId, { this.updateManager.setData(dataId, data);
...data,
isUpdatePrice: updatePrice
});
this.updateManager.setService(this.serviceData, TABLE_NAME.SEASON_PERIOD); this.updateManager.setService(this.serviceData, TABLE_NAME.SEASON_PERIOD);
await this.updateManager.execute(); await this.updateManager.execute();
return this.updateManager.getResult(); return this.updateManager.getResult();

View File

@ -86,7 +86,7 @@ export class SeasonPeriodDataController {
@Param('id') dataId: string, @Param('id') dataId: string,
@Body() data: UpdateSeasonPeriodItemDto, @Body() data: UpdateSeasonPeriodItemDto,
): Promise<SeasonPeriodEntity> { ): Promise<SeasonPeriodEntity> {
return await this.orchestrator.update(dataId, data, true); return await this.orchestrator.update(dataId, data);
} }
@Delete(':id') @Delete(':id')