Compare commits

...

3 Commits

Author SHA1 Message Date
Aswin Ashar Abdullah a63eaf0110 fix(season) update fix priority 2024-07-26 14:03:38 +07:00
Aswin Ashar Abdullah e32a7c2eaf fix(base) delete query transaction
continuous-integration/drone/tag Build is passing Details
2024-07-26 11:41:18 +07:00
aswin 07f379a6b0 Merge pull request 'fix/data' (#38) from fix/data into development
continuous-integration/drone/tag Build is passing Details
Reviewed-on: #38
2024-07-26 03:06:59 +00:00
5 changed files with 19 additions and 15 deletions

View File

@ -60,7 +60,7 @@ export abstract class BaseManager {
try { try {
this.setUser(); this.setUser();
this.queryRunner.startTransaction(); // this.queryRunner.startTransaction();
this.baseLog.verbose('prepareData'); this.baseLog.verbose('prepareData');
await this.prepareData(); await this.prepareData();
@ -80,10 +80,10 @@ export abstract class BaseManager {
this.baseLog.verbose('afterProcess'); this.baseLog.verbose('afterProcess');
await this.afterProcess(); await this.afterProcess();
this.baseLog.verbose('commitTransaction'); // this.baseLog.verbose('commitTransaction');
await this.queryRunner.commitTransaction(); // await this.queryRunner.commitTransaction();
await this.queryRunner.release(); // await this.queryRunner.release();
} catch (e) { } catch (e) {
if (e.response) throw new Error(JSON.stringify(e.response)); if (e.response) throw new Error(JSON.stringify(e.response));
else throw new Error(e.message); else throw new Error(e.message);

View File

@ -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

View File

@ -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;
} }

View File

@ -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();

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); return await this.orchestrator.update(dataId, data, true);
} }
@Delete(':id') @Delete(':id')