fix(season) update fix priority
parent
e32a7c2eaf
commit
a63eaf0110
|
@ -1,5 +1,4 @@
|
|||
import { HttpStatus, UnprocessableEntityException } from '@nestjs/common';
|
||||
import { Brackets } from 'typeorm';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
// function ini bergungsi untuk validasi season period yang sama
|
||||
|
|
|
@ -13,14 +13,16 @@ import { ValidateSeasonPeriodHelper } from './helpers/validate.helper';
|
|||
@Injectable()
|
||||
export class UpdateSeasonPeriodManager extends BaseUpdateManager<SeasonPeriodEntity> {
|
||||
async validateProcess(): Promise<void> {
|
||||
const priority = await ValidateSeasonPeriodHelper(
|
||||
this.dataService,
|
||||
this.data,
|
||||
);
|
||||
if (!this.data.isUpdatePrice) {
|
||||
const priority = await ValidateSeasonPeriodHelper(
|
||||
this.dataService,
|
||||
this.data,
|
||||
);
|
||||
|
||||
Object.assign(this.data, {
|
||||
priority: priority,
|
||||
});
|
||||
Object.assign(this.data, {
|
||||
priority: priority,
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,11 @@ export class SeasonPeriodDataOrchestrator extends BaseDataTransactionOrchestrato
|
|||
return this.createManager.getResult();
|
||||
}
|
||||
|
||||
async update(dataId, data): Promise<SeasonPeriodEntity> {
|
||||
this.updateManager.setData(dataId, data);
|
||||
async update(dataId, data, updatePrice = false): Promise<SeasonPeriodEntity> {
|
||||
this.updateManager.setData(dataId, {
|
||||
...data,
|
||||
isUpdatePrice: updatePrice
|
||||
});
|
||||
this.updateManager.setService(this.serviceData, TABLE_NAME.SEASON_PERIOD);
|
||||
await this.updateManager.execute();
|
||||
return this.updateManager.getResult();
|
||||
|
|
|
@ -86,7 +86,7 @@ export class SeasonPeriodDataController {
|
|||
@Param('id') dataId: string,
|
||||
@Body() data: UpdateSeasonPeriodItemDto,
|
||||
): Promise<SeasonPeriodEntity> {
|
||||
return await this.orchestrator.update(dataId, data);
|
||||
return await this.orchestrator.update(dataId, data, true);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
|
|
Loading…
Reference in New Issue