Merge pull request 'fix(season) update fix priority' (#39) from fix/data into development
Reviewed-on: #39pull/41/head
commit
d333ba03a7
|
@ -1,5 +1,4 @@
|
||||||
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
|
||||||
|
|
|
@ -13,14 +13,16 @@ 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> {
|
||||||
const priority = await ValidateSeasonPeriodHelper(
|
if (!this.data.isUpdatePrice) {
|
||||||
this.dataService,
|
const priority = await ValidateSeasonPeriodHelper(
|
||||||
this.data,
|
this.dataService,
|
||||||
);
|
this.data,
|
||||||
|
);
|
||||||
|
|
||||||
Object.assign(this.data, {
|
Object.assign(this.data, {
|
||||||
priority: priority,
|
priority: priority,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,11 @@ export class SeasonPeriodDataOrchestrator extends BaseDataTransactionOrchestrato
|
||||||
return this.createManager.getResult();
|
return this.createManager.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(dataId, data): Promise<SeasonPeriodEntity> {
|
async update(dataId, data, updatePrice = false): Promise<SeasonPeriodEntity> {
|
||||||
this.updateManager.setData(dataId, data);
|
this.updateManager.setData(dataId, {
|
||||||
|
...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();
|
||||||
|
|
|
@ -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);
|
return await this.orchestrator.update(dataId, data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
|
Loading…
Reference in New Issue