merge
commit
c120094087
|
@ -44,7 +44,10 @@ import { ItemRateModel } from './modules/item-related/item-rate/data/models/item
|
|||
import { GoogleCalendarModule } from './modules/configuration/google-calendar/google-calendar.module';
|
||||
import { TransactionModule } from './modules/transaction/transaction/transaction.module';
|
||||
import { TransactionModel } from './modules/transaction/transaction/data/models/transaction.model';
|
||||
import { TransactionItemModel } from './modules/transaction/transaction/data/models/transaction-item.model';
|
||||
import {
|
||||
TransactionItemBreakdownModel,
|
||||
TransactionItemModel,
|
||||
} from './modules/transaction/transaction/data/models/transaction-item.model';
|
||||
import { TransactionTaxModel } from './modules/transaction/transaction/data/models/transaction-tax.model';
|
||||
import { ReconciliationModule } from './modules/transaction/reconciliation/reconciliation.module';
|
||||
import { ReportModule } from './modules/reports/report/report.module';
|
||||
|
@ -71,6 +74,7 @@ import { BannerModel } from './modules/web-information/banner/data/models/banner
|
|||
import { MailModule } from './modules/configuration/mail/mail.module';
|
||||
import { PosLogModel } from './modules/configuration/log/data/models/pos-log.model';
|
||||
import { ExportModule } from './modules/configuration/export/export.module';
|
||||
import { TransactionDemographyModel } from './modules/transaction/transaction/data/models/transaction-demography.model';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
@ -109,6 +113,8 @@ import { ExportModule } from './modules/configuration/export/export.module';
|
|||
TransactionModel,
|
||||
TransactionItemModel,
|
||||
TransactionTaxModel,
|
||||
TransactionDemographyModel,
|
||||
TransactionItemBreakdownModel,
|
||||
UserModel,
|
||||
VipCategoryModel,
|
||||
VipCodeModel,
|
||||
|
|
|
@ -20,7 +20,9 @@ export enum TABLE_NAME {
|
|||
TENANT = 'tenants',
|
||||
TRANSACTION = 'transactions',
|
||||
TRANSACTION_ITEM = 'transaction_items',
|
||||
TRANSACTION_ITEM_BREAKDOWN = 'transaction_item_breakdowns',
|
||||
TRANSACTION_TAX = 'transaction_taxes',
|
||||
TRANSACTION_DEMOGRAPHY = 'transaction_demographies',
|
||||
USER = 'users',
|
||||
USER_PRIVILEGE = 'user_privileges',
|
||||
USER_PRIVILEGE_CONFIGURATION = 'user_privilege_configurations',
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddItemProfit1723706764654 implements MigrationInterface {
|
||||
name = 'AddItemProfit1723706764654';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "items" ADD "share_profit" numeric`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE "items" DROP COLUMN "share_profit"`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddItemProfit1723706764654 implements MigrationInterface {
|
||||
name = 'AddOtherType1723706764655';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" ADD "breakdown_bundling" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."item_categories_item_type_enum" RENAME TO "item_categories_item_type_enum_old"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "public"."item_categories_item_type_enum" AS ENUM('tiket masuk', 'wahana', 'bundling', 'free gift', 'other')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "item_categories" ALTER COLUMN "item_type" DROP DEFAULT`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "item_categories" ALTER COLUMN "item_type" TYPE "public"."item_categories_item_type_enum" USING "item_type"::"text"::"public"."item_categories_item_type_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "item_categories" ALTER COLUMN "item_type" SET DEFAULT 'tiket masuk'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "public"."item_categories_item_type_enum_old"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."items_item_type_enum" RENAME TO "items_item_type_enum_old"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "public"."items_item_type_enum" AS ENUM('tiket masuk', 'wahana', 'bundling', 'free gift', 'other')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" ALTER COLUMN "item_type" DROP DEFAULT`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" ALTER COLUMN "item_type" TYPE "public"."items_item_type_enum" USING "item_type"::"text"::"public"."items_item_type_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" ALTER COLUMN "item_type" SET DEFAULT 'tiket masuk'`,
|
||||
);
|
||||
await queryRunner.query(`DROP TYPE "public"."items_item_type_enum_old"`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "public"."items_item_type_enum_old" AS ENUM('bundling', 'free gift', 'tiket masuk', 'wahana')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" ALTER COLUMN "item_type" DROP DEFAULT`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" ALTER COLUMN "item_type" TYPE "public"."items_item_type_enum_old" USING "item_type"::"text"::"public"."items_item_type_enum_old"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" ALTER COLUMN "item_type" SET DEFAULT 'tiket masuk'`,
|
||||
);
|
||||
await queryRunner.query(`DROP TYPE "public"."items_item_type_enum"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."items_item_type_enum_old" RENAME TO "items_item_type_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "public"."item_categories_item_type_enum_old" AS ENUM('bundling', 'free gift', 'tiket masuk', 'wahana')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "item_categories" ALTER COLUMN "item_type" DROP DEFAULT`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "item_categories" ALTER COLUMN "item_type" TYPE "public"."item_categories_item_type_enum_old" USING "item_type"::"text"::"public"."item_categories_item_type_enum_old"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "item_categories" ALTER COLUMN "item_type" SET DEFAULT 'tiket masuk'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "public"."item_categories_item_type_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."item_categories_item_type_enum_old" RENAME TO "item_categories_item_type_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" DROP COLUMN "breakdown_bundling"`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddDemographyTransaction1723713873756
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'AddDemographyTransaction1723713873756';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "transaction_demographies" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "man" integer NOT NULL DEFAULT '0', "woman" integer NOT NULL DEFAULT '0', "teen" integer NOT NULL DEFAULT '0', "child" integer NOT NULL DEFAULT '0', "local" integer NOT NULL DEFAULT '0', "foreign" integer NOT NULL DEFAULT '0', "transaction_id" uuid, CONSTRAINT "PK_84083b782ebc2c6cb2a2dab8e2d" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ADD CONSTRAINT "FK_a2b705884bca06c148e3b35ab04" FOREIGN KEY ("transaction_id") REFERENCES "transactions"("id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" DROP CONSTRAINT "FK_a2b705884bca06c148e3b35ab04"`,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "transaction_demographies"`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class FixDemographyNationality1723716561482
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'FixDemographyNationality1723716561482';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" DROP COLUMN "local"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" DROP COLUMN "foreign"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "public"."transaction_demographies_nationality_enum" AS ENUM('local', 'foreign', 'mix')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ADD "nationality" "public"."transaction_demographies_nationality_enum" NOT NULL DEFAULT 'local'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" DROP CONSTRAINT "FK_a2b705884bca06c148e3b35ab04"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ADD CONSTRAINT "FK_a2b705884bca06c148e3b35ab04" FOREIGN KEY ("transaction_id") REFERENCES "transactions"("id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" DROP CONSTRAINT "FK_a2b705884bca06c148e3b35ab04"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ADD CONSTRAINT "FK_a2b705884bca06c148e3b35ab04" FOREIGN KEY ("transaction_id") REFERENCES "transactions"("id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" DROP COLUMN "nationality"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "public"."transaction_demographies_nationality_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ADD "foreign" integer NOT NULL DEFAULT '0'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ADD "local" integer NOT NULL DEFAULT '0'`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddEstimationToItem1723801180604 implements MigrationInterface {
|
||||
name = 'AddEstimationToItem1723801180604';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" ADD "play_estimation" integer`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "items" DROP COLUMN "play_estimation"`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddBreakdownItemTransaction1724127202672
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'AddBreakdownItemTransaction1724127202672';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "transaction_item_breakdowns" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "item_id" character varying NOT NULL, "item_name" character varying NOT NULL, "hpp" bigint, "base_price" bigint, "item_rates" bigint, "transaction_item_id" uuid, CONSTRAINT "PK_e04a30c648d3ba8778e9fb67fdd" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_item_breakdowns" ADD CONSTRAINT "FK_b8c63b1f3ecace500587da713ae" FOREIGN KEY ("transaction_item_id") REFERENCES "transaction_items"("id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_item_breakdowns" DROP CONSTRAINT "FK_b8c63b1f3ecace500587da713ae"`,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "transaction_item_breakdowns"`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddBreakdownToTransactionItem1724233193743
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'AddBreakdownToTransactionItem1724233193743';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_items" ADD "breakdown_bundling" boolean NOT NULL DEFAULT false`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_items" DROP COLUMN "breakdown_bundling"`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class AddValueToDemography1724240624025 implements MigrationInterface {
|
||||
name = 'AddValueToDemography1724240624025';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."transaction_demographies_nationality_enum" RENAME TO "transaction_demographies_nationality_enum_old"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "public"."transaction_demographies_nationality_enum" AS ENUM('local', 'foreign', 'mix', 'foreigner')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ALTER COLUMN "nationality" DROP DEFAULT`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ALTER COLUMN "nationality" TYPE "public"."transaction_demographies_nationality_enum" USING "nationality"::"text"::"public"."transaction_demographies_nationality_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ALTER COLUMN "nationality" SET DEFAULT 'local'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "public"."transaction_demographies_nationality_enum_old"`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TYPE "public"."transaction_demographies_nationality_enum_old" AS ENUM('local', 'foreign', 'mix')`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ALTER COLUMN "nationality" DROP DEFAULT`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ALTER COLUMN "nationality" TYPE "public"."transaction_demographies_nationality_enum_old" USING "nationality"::"text"::"public"."transaction_demographies_nationality_enum_old"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "transaction_demographies" ALTER COLUMN "nationality" SET DEFAULT 'local'`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`DROP TYPE "public"."transaction_demographies_nationality_enum"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TYPE "public"."transaction_demographies_nationality_enum_old" RENAME TO "transaction_demographies_nationality_enum"`,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -50,6 +50,7 @@ import {
|
|||
} from './domain/managers/season-type.handler';
|
||||
import { SeasonPeriodDataService } from 'src/modules/season-related/season-period/data/services/season-period-data.service';
|
||||
import { SeasonPeriodModel } from 'src/modules/season-related/season-period/data/models/season-period.model';
|
||||
import { TransactionDemographyModel } from 'src/modules/transaction/transaction/data/models/transaction-demography.model';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
@ -63,6 +64,7 @@ import { SeasonPeriodModel } from 'src/modules/season-related/season-period/data
|
|||
TransactionModel,
|
||||
TransactionTaxModel,
|
||||
TransactionItemModel,
|
||||
TransactionDemographyModel,
|
||||
],
|
||||
CONNECTION_NAME.DEFAULT,
|
||||
),
|
||||
|
|
|
@ -95,7 +95,7 @@ export class ChangeStatusBookingHandler
|
|||
where: {
|
||||
id: dataID,
|
||||
},
|
||||
relations: ['items'],
|
||||
relations: ['items', 'items.bundling_items'],
|
||||
});
|
||||
console.log('change status', { dataID, couchData, booking });
|
||||
mappingTransaction(booking);
|
||||
|
|
|
@ -3,4 +3,5 @@ export enum ItemType {
|
|||
WAHANA = 'wahana',
|
||||
BUNDLING = 'bundling',
|
||||
FREE_GIFT = 'free gift',
|
||||
OTHER = 'other',
|
||||
}
|
||||
|
|
|
@ -4,14 +4,64 @@ import { ItemRateEntity } from '../../domain/entities/item-rate.entity';
|
|||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { ItemRateModel } from '../models/item-rate.model';
|
||||
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
|
||||
import { Repository } from 'typeorm';
|
||||
import { In, Repository } from 'typeorm';
|
||||
import { ItemModel } from 'src/modules/item-related/item/data/models/item.model';
|
||||
|
||||
@Injectable()
|
||||
export class ItemRateDataService extends BaseDataService<ItemRateEntity> {
|
||||
constructor(
|
||||
@InjectRepository(ItemRateModel, CONNECTION_NAME.DEFAULT)
|
||||
private repo: Repository<ItemRateModel>,
|
||||
@InjectRepository(ItemModel, CONNECTION_NAME.DEFAULT)
|
||||
private itemRepo: Repository<ItemModel>,
|
||||
) {
|
||||
super(repo);
|
||||
}
|
||||
|
||||
async itemsRateTotal(season_id: string, items: string[]): Promise<number> {
|
||||
const rates = await this.repo.find({
|
||||
where: {
|
||||
season_period_id: season_id,
|
||||
item_id: In(items),
|
||||
},
|
||||
});
|
||||
|
||||
return rates.reduce((total, current) => total + Number(current.price), 0);
|
||||
}
|
||||
|
||||
async updateRatesBySeasonItem(
|
||||
season_id: string,
|
||||
item_id: string,
|
||||
price: number,
|
||||
): Promise<void> {
|
||||
this.repo.update(
|
||||
{
|
||||
season_period_id: season_id,
|
||||
item_id,
|
||||
},
|
||||
{ price },
|
||||
);
|
||||
}
|
||||
|
||||
async findBundlingByItem(item_id: string): Promise<ItemModel[]> {
|
||||
const bundlings = await this.itemRepo.find({
|
||||
where: {
|
||||
breakdown_bundling: true,
|
||||
bundling_items: {
|
||||
id: item_id,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return Promise.all(
|
||||
await bundlings.map(async (bundling) => {
|
||||
return await this.itemRepo.findOne({
|
||||
relations: ['bundling_items'],
|
||||
where: {
|
||||
id: bundling.id,
|
||||
},
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import { ItemRateEntity } from '../entities/item-rate.entity';
|
|||
import { DeleteItemRateManager } from './managers/delete-item-rate.manager';
|
||||
import { UpdateItemRateManager } from './managers/update-item-rate.manager';
|
||||
import { BaseDataOrchestrator } from 'src/core/modules/domain/usecase/orchestrators/base-data.orchestrator';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
import { BatchResult } from 'src/core/response/domain/ok-response.interface';
|
||||
import { BatchDeleteItemRateManager } from './managers/batch-delete-item-rate.manager';
|
||||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||
|
|
|
@ -91,6 +91,8 @@ export class IndexItemRateManager extends BaseIndexManager<ItemEntity> {
|
|||
`${this.tableName}.created_at`,
|
||||
`${this.tableName}.name`,
|
||||
`${this.tableName}.base_price`,
|
||||
`${this.tableName}.breakdown_bundling`,
|
||||
`${this.tableName}.share_profit`,
|
||||
|
||||
'tenant.id',
|
||||
'tenant.name',
|
||||
|
|
|
@ -20,6 +20,7 @@ export class UpdateItemRateManager extends BaseUpdateManager<ItemRateEntity> {
|
|||
}
|
||||
|
||||
async afterProcess(): Promise<void> {
|
||||
this.updateBundlingBreakdown(this.dataId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,4 +43,25 @@ export class UpdateItemRateManager extends BaseUpdateManager<ItemRateEntity> {
|
|||
},
|
||||
];
|
||||
}
|
||||
|
||||
async updateBundlingBreakdown(id: string) {
|
||||
const { item_id, season_period_id } =
|
||||
await this.dataService.getOneByOptions({
|
||||
where: { id },
|
||||
});
|
||||
const bundlings = await this.dataService.findBundlingByItem(item_id);
|
||||
|
||||
for (const bundling of bundlings) {
|
||||
const ids = bundling.bundling_items.map((item) => item.id);
|
||||
const totalRates = await this.dataService.itemsRateTotal(
|
||||
season_period_id,
|
||||
ids,
|
||||
);
|
||||
this.dataService.updateRatesBySeasonItem(
|
||||
season_period_id,
|
||||
bundling.id,
|
||||
totalRates,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import { Body, Controller, Delete, Param, Post, Put } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Param, Put } from '@nestjs/common';
|
||||
import { ItemRateDataOrchestrator } from '../domain/usecases/item-rate-data.orchestrator';
|
||||
import { ItemRateDto } from './dto/item-rate.dto';
|
||||
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
import { ItemRateEntity } from '../domain/entities/item-rate.entity';
|
||||
import { BatchResult } from 'src/core/response/domain/ok-response.interface';
|
||||
import { BatchIdsDto } from 'src/core/modules/infrastructure/dto/base-batch.dto';
|
||||
import { Public } from 'src/core/guards';
|
||||
|
||||
@ApiTags(`${MODULE_NAME.ITEM_RATE.split('-').join(' ')} - data`)
|
||||
|
|
|
@ -19,13 +19,14 @@ import { ItemRateModel } from './data/models/item-rate.model';
|
|||
import { SeasonPeriodHolidayHandler } from './domain/usecases/handlers/item-created.handler';
|
||||
import { SeasonPeriodDataService } from 'src/modules/season-related/season-period/data/services/season-period-data.service';
|
||||
import { SeasonPeriodModel } from 'src/modules/season-related/season-period/data/models/season-period.model';
|
||||
import { ItemModel } from '../item/data/models/item.model';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot(),
|
||||
TypeOrmModule.forFeature(
|
||||
[ItemRateModel, SeasonPeriodModel],
|
||||
[ItemRateModel, SeasonPeriodModel, ItemModel],
|
||||
CONNECTION_NAME.DEFAULT,
|
||||
),
|
||||
CqrsModule,
|
||||
|
|
|
@ -41,18 +41,27 @@ export class ItemModel
|
|||
@Column('decimal', { name: 'sales_margin', nullable: true })
|
||||
sales_margin: number;
|
||||
|
||||
@Column('decimal', { name: 'share_profit', nullable: true })
|
||||
share_profit: number;
|
||||
|
||||
@Column('bigint', { name: 'total_price', nullable: true })
|
||||
total_price: number;
|
||||
|
||||
@Column('bigint', { name: 'base_price', nullable: true })
|
||||
base_price: number;
|
||||
|
||||
@Column('int', { name: 'play_estimation', nullable: true })
|
||||
play_estimation: number;
|
||||
|
||||
@Column('boolean', { name: 'use_queue', default: false })
|
||||
use_queue: boolean;
|
||||
|
||||
@Column('boolean', { name: 'show_to_booking', default: false })
|
||||
show_to_booking: boolean;
|
||||
|
||||
@Column('boolean', { name: 'breakdown_bundling', default: false })
|
||||
breakdown_bundling: boolean;
|
||||
|
||||
@Column('enum', {
|
||||
name: 'limit_type',
|
||||
enum: LimitType,
|
||||
|
|
|
@ -6,6 +6,7 @@ import { ItemModel } from '../models/item.model';
|
|||
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
|
||||
import { Repository } from 'typeorm';
|
||||
import { ItemRateModel } from 'src/modules/item-related/item-rate/data/models/item-rate.model';
|
||||
import { ItemRateDataService } from 'src/modules/item-related/item-rate/data/services/item-rate-data.service';
|
||||
|
||||
@Injectable()
|
||||
export class ItemDataService extends BaseDataService<ItemEntity> {
|
||||
|
@ -15,6 +16,7 @@ export class ItemDataService extends BaseDataService<ItemEntity> {
|
|||
|
||||
@InjectRepository(ItemRateModel, CONNECTION_NAME.DEFAULT)
|
||||
private repoItemRate: Repository<ItemRateModel>,
|
||||
private rateService: ItemRateDataService,
|
||||
) {
|
||||
super(repo);
|
||||
}
|
||||
|
@ -31,4 +33,34 @@ export class ItemDataService extends BaseDataService<ItemEntity> {
|
|||
{ price: newPrice },
|
||||
);
|
||||
}
|
||||
|
||||
async updateBreakdownBundling(id: string): Promise<void> {
|
||||
const item_rates = await this.repoItemRate.find({
|
||||
where: {
|
||||
item_id: id,
|
||||
},
|
||||
});
|
||||
|
||||
for (const rate of item_rates) {
|
||||
const { item_id, season_period_id } = rate;
|
||||
const bundling = await this.repo.findOne({
|
||||
relations: ['bundling_items'],
|
||||
where: {
|
||||
id: item_id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(bundling.name);
|
||||
const ids = bundling.bundling_items.map((item) => item.id);
|
||||
const totalRates = await this.rateService.itemsRateTotal(
|
||||
season_period_id,
|
||||
ids,
|
||||
);
|
||||
this.rateService.updateRatesBySeasonItem(
|
||||
season_period_id,
|
||||
bundling.id,
|
||||
totalRates,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,4 +16,5 @@ export interface ItemEntity extends BaseStatusEntity {
|
|||
|
||||
use_queue: boolean;
|
||||
show_to_booking: boolean;
|
||||
breakdown_bundling?: boolean;
|
||||
}
|
||||
|
|
|
@ -42,10 +42,13 @@ export class DetailItemManager extends BaseDetailManager<ItemEntity> {
|
|||
`${this.tableName}.limit_value`,
|
||||
`${this.tableName}.hpp`,
|
||||
`${this.tableName}.sales_margin`,
|
||||
`${this.tableName}.share_profit`,
|
||||
`${this.tableName}.total_price`,
|
||||
`${this.tableName}.base_price`,
|
||||
`${this.tableName}.use_queue`,
|
||||
`${this.tableName}.show_to_booking`,
|
||||
`${this.tableName}.breakdown_bundling`,
|
||||
`${this.tableName}.play_estimation`,
|
||||
|
||||
`item_category.id`,
|
||||
`item_category.name`,
|
||||
|
|
|
@ -19,14 +19,29 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
|
|||
}
|
||||
|
||||
async afterProcess(): Promise<void> {
|
||||
this.result.data?.map((item) => {
|
||||
const period_ids = this.filterParam.season_period_ids;
|
||||
this.result.data?.map((rates) => {
|
||||
const item = rates['item'];
|
||||
const item_price =
|
||||
Number(item['item']?.total_price ?? 0) == 0
|
||||
? item['item']?.total_price
|
||||
: item['item']?.base_price;
|
||||
Number(item?.total_price ?? 0) == 0
|
||||
? item?.total_price
|
||||
: item?.base_price;
|
||||
|
||||
const bundlings = item?.bundling_items ?? [];
|
||||
const bundling_items = bundlings.map((bundling) => {
|
||||
const item_rates = bundling.item_rates?.find((rate) => {
|
||||
return period_ids?.includes(rate.season_period_id);
|
||||
});
|
||||
const rate = item_rates?.price ?? 0;
|
||||
return {
|
||||
...bundling,
|
||||
item_rates: rate,
|
||||
};
|
||||
});
|
||||
|
||||
Object.assign(item, {
|
||||
price: item.price ?? item_price,
|
||||
bundling_items,
|
||||
});
|
||||
});
|
||||
return;
|
||||
|
@ -38,7 +53,13 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
|
|||
joinRelations: [],
|
||||
|
||||
// relation join and select (relasi yang ingin ditampilkan),
|
||||
selectRelations: ['season_period', 'season_period.season_type', 'item'],
|
||||
selectRelations: [
|
||||
'season_period',
|
||||
'season_period.season_type',
|
||||
'item',
|
||||
'item.bundling_items',
|
||||
'bundling_items.item_rates',
|
||||
],
|
||||
|
||||
// relation yang hanya ingin dihitung (akan return number)
|
||||
countRelations: [],
|
||||
|
@ -54,6 +75,13 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
|
|||
'item.id',
|
||||
'item.total_price',
|
||||
'item.base_price',
|
||||
'item.breakdown_bundling',
|
||||
'bundling_items.base_price',
|
||||
'bundling_items.hpp',
|
||||
'bundling_items.id',
|
||||
'bundling_items.name',
|
||||
|
||||
'item_rates',
|
||||
|
||||
`season_period.id`,
|
||||
`season_period.priority`,
|
||||
|
|
|
@ -45,6 +45,9 @@ export class IndexItemManager extends BaseIndexManager<ItemEntity> {
|
|||
`${this.tableName}.limit_type`,
|
||||
`${this.tableName}.limit_value`,
|
||||
`${this.tableName}.base_price`,
|
||||
`${this.tableName}.share_profit`,
|
||||
`${this.tableName}.breakdown_bundling`,
|
||||
`${this.tableName}.play_estimation`,
|
||||
|
||||
`item_category.id`,
|
||||
`item_category.name`,
|
||||
|
|
|
@ -22,20 +22,25 @@ export class UpdateItemRatePriceManager extends BaseCustomManager<ItemEntity> {
|
|||
|
||||
async beforeProcess(): Promise<void> {
|
||||
let query;
|
||||
const bundling_items = [];
|
||||
const item_ids = this.data.items.map((item) => {
|
||||
if (item.item.bundling_items) {
|
||||
const bundlings = item.item.bundling_items.map(({ id }) => id);
|
||||
bundling_items.push(...bundlings);
|
||||
}
|
||||
return item.item.id;
|
||||
});
|
||||
|
||||
if (this.data.season_period_id) {
|
||||
query = {
|
||||
item_id: In(item_ids),
|
||||
item_id: In([...item_ids, ...bundling_items]),
|
||||
season_period: {
|
||||
id: this.data.season_period_id,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
query = {
|
||||
item_id: In(item_ids),
|
||||
item_id: In([...item_ids, ...bundling_items]),
|
||||
season_period: {
|
||||
start_date: MoreThanOrEqual(this.data.booking_date),
|
||||
end_date: LessThanOrEqual(this.data.booking_date),
|
||||
|
@ -54,6 +59,16 @@ export class UpdateItemRatePriceManager extends BaseCustomManager<ItemEntity> {
|
|||
const current_price = this.rates.find(
|
||||
(rate) => rate.item_id == item.item.id,
|
||||
);
|
||||
item.item.bundling_items = item.item.bundling_items?.map((bundling) => {
|
||||
const current_price = this.rates.find(
|
||||
(rate) => rate.item_id == bundling.id,
|
||||
);
|
||||
|
||||
return {
|
||||
...bundling,
|
||||
item_rates: current_price?.price ?? 0,
|
||||
};
|
||||
});
|
||||
|
||||
Object.assign(item, {
|
||||
total_price: current_price?.price ?? item.item.base_price,
|
||||
|
|
|
@ -31,6 +31,10 @@ export class UpdateItemManager extends BaseUpdateManager<ItemEntity> {
|
|||
newBasePrice,
|
||||
itemId,
|
||||
);
|
||||
|
||||
if (this.result.breakdown_bundling) {
|
||||
this.dataService.updateBreakdownBundling(itemId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ export class IndexSeasonPeriodeItemManager extends BaseIndexManager<ItemRateEnti
|
|||
`item.limit_type`,
|
||||
`item.limit_value`,
|
||||
`item.base_price`,
|
||||
`item.breakdown_bundling`,
|
||||
`item.share_profit`,
|
||||
|
||||
`item_category.id`,
|
||||
`item_category.name`,
|
||||
|
|
|
@ -28,6 +28,7 @@ export class DetailRefundManager extends BaseDetailManager<RefundEntity> {
|
|||
selectRelations: [
|
||||
'transaction',
|
||||
'transaction.items',
|
||||
'items.bundling_items',
|
||||
'items.refunds item_refunds',
|
||||
'item_refunds.refund item_refunds_refund',
|
||||
],
|
||||
|
@ -60,6 +61,7 @@ export class DetailRefundManager extends BaseDetailManager<RefundEntity> {
|
|||
|
||||
'transaction',
|
||||
'items',
|
||||
'bundling_items',
|
||||
'item_refunds',
|
||||
'item_refunds_refund.id',
|
||||
'item_refunds_refund.status',
|
||||
|
|
|
@ -29,3 +29,10 @@ export const TransactionModels = [
|
|||
TransactionItemModel,
|
||||
TransactionTaxModel,
|
||||
];
|
||||
|
||||
export enum DemographyNationality {
|
||||
LOCAL = 'local',
|
||||
FOREIGN = 'foreign',
|
||||
MIX = 'mix',
|
||||
FOREIGNER = 'foreigner',
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||
import { Column, Entity, JoinColumn, OneToOne } from 'typeorm';
|
||||
import { BaseCoreModel } from 'src/core/modules/data/model/base-core.model';
|
||||
import { TransactionModel } from './transaction.model';
|
||||
import { TransactionDemographyEntity } from '../../domain/entities/transaction-graphy.entity';
|
||||
import { DemographyNationality } from '../../constants';
|
||||
|
||||
@Entity(TABLE_NAME.TRANSACTION_DEMOGRAPHY)
|
||||
export class TransactionDemographyModel
|
||||
extends BaseCoreModel<TransactionDemographyEntity>
|
||||
implements TransactionDemographyEntity
|
||||
{
|
||||
@Column('int', { default: 0 })
|
||||
man: number;
|
||||
|
||||
@Column('int', { default: 0 })
|
||||
woman: number;
|
||||
|
||||
@Column('int', { default: 0 })
|
||||
teen: number;
|
||||
|
||||
@Column('int', { default: 0 })
|
||||
child: number;
|
||||
|
||||
@Column('enum', {
|
||||
name: 'nationality',
|
||||
enum: DemographyNationality,
|
||||
default: DemographyNationality.LOCAL,
|
||||
})
|
||||
nationality: DemographyNationality;
|
||||
|
||||
@Column('varchar', { name: 'transaction_id', nullable: true })
|
||||
transaction_id: string;
|
||||
|
||||
@OneToOne(() => TransactionModel, (model) => model.demographies, {
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'transaction_id' })
|
||||
transaction: TransactionModel;
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||
import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
|
||||
import { BaseCoreModel } from 'src/core/modules/data/model/base-core.model';
|
||||
import { TransactionItemEntity } from '../../domain/entities/transaction-item.entity';
|
||||
import {
|
||||
TransactionBundlingItemEntity,
|
||||
TransactionItemEntity,
|
||||
} from '../../domain/entities/transaction-item.entity';
|
||||
import { TransactionModel } from './transaction.model';
|
||||
import { RefundItemModel } from 'src/modules/transaction/refund/data/models/refund-item.model';
|
||||
|
||||
|
@ -86,4 +89,43 @@ export class TransactionItemModel
|
|||
onUpdate: 'CASCADE',
|
||||
})
|
||||
refunds: RefundItemModel[];
|
||||
|
||||
@Column('boolean', { name: 'breakdown_bundling', default: false })
|
||||
breakdown_bundling: boolean;
|
||||
|
||||
@OneToMany(
|
||||
() => TransactionItemBreakdownModel,
|
||||
(model) => model.transaction_item,
|
||||
{
|
||||
cascade: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
},
|
||||
)
|
||||
bundling_items: TransactionItemBreakdownModel[];
|
||||
}
|
||||
|
||||
@Entity(TABLE_NAME.TRANSACTION_ITEM_BREAKDOWN)
|
||||
export class TransactionItemBreakdownModel extends BaseCoreModel<TransactionBundlingItemEntity> {
|
||||
@Column('varchar')
|
||||
item_id: string;
|
||||
|
||||
@Column('varchar')
|
||||
item_name: string;
|
||||
|
||||
@Column('bigint', { nullable: true })
|
||||
hpp: number;
|
||||
|
||||
@Column('bigint', { nullable: true })
|
||||
base_price: number;
|
||||
|
||||
@Column('bigint', { nullable: true })
|
||||
item_rates: number;
|
||||
|
||||
@ManyToOne(() => TransactionItemModel, (model) => model.bundling_items, {
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'transaction_item_id' })
|
||||
transaction_item: TransactionItemModel;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||
import { TransactionEntity } from '../../domain/entities/transaction.entity';
|
||||
import { Column, Entity, OneToMany } from 'typeorm';
|
||||
import { Column, Entity, OneToMany, OneToOne } from 'typeorm';
|
||||
import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model';
|
||||
import {
|
||||
TransactionType,
|
||||
|
@ -12,6 +12,7 @@ import { TransactionItemModel } from './transaction-item.model';
|
|||
import { TransactionTaxModel } from './transaction-tax.model';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
import { RefundModel } from 'src/modules/transaction/refund/data/models/refund.model';
|
||||
import { TransactionDemographyModel } from './transaction-demography.model';
|
||||
|
||||
@Entity(TABLE_NAME.TRANSACTION)
|
||||
export class TransactionModel
|
||||
|
@ -242,6 +243,13 @@ export class TransactionModel
|
|||
})
|
||||
taxes: TransactionTaxModel[];
|
||||
|
||||
@OneToOne(() => TransactionDemographyModel, (model) => model.transaction, {
|
||||
cascade: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
demographies: TransactionDemographyModel;
|
||||
|
||||
// relations to refund
|
||||
@OneToMany(() => RefundModel, (model) => model.transaction, {
|
||||
cascade: true,
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { BaseCoreEntity } from 'src/core/modules/domain/entities/base-core.entity';
|
||||
import { DemographyNationality } from '../../constants';
|
||||
|
||||
export interface TransactionDemographyEntity extends BaseCoreEntity {
|
||||
man: number;
|
||||
woman: number;
|
||||
teen: number;
|
||||
child: number;
|
||||
nationality: DemographyNationality;
|
||||
}
|
|
@ -25,4 +25,13 @@ export interface TransactionItemEntity extends BaseCoreEntity {
|
|||
qty: number;
|
||||
qty_remaining: number;
|
||||
taxes: string;
|
||||
bundling_items?: TransactionBundlingItemEntity[];
|
||||
}
|
||||
|
||||
export interface TransactionBundlingItemEntity extends BaseCoreEntity {
|
||||
item_id: string;
|
||||
item_name: string;
|
||||
hpp: number;
|
||||
base_price: number;
|
||||
item_rates: number;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
TransactionUserType,
|
||||
} from '../../constants';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
import { TransactionItemEntity } from './transaction-item.entity';
|
||||
|
||||
export interface TransactionEntity extends BaseStatusEntity {
|
||||
// general info
|
||||
|
@ -84,4 +85,6 @@ export interface TransactionEntity extends BaseStatusEntity {
|
|||
|
||||
calendar_id?: string;
|
||||
calendar_link?: string;
|
||||
|
||||
items: TransactionItemEntity[];
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import { TransactionPaymentType } from '../../../constants';
|
|||
|
||||
@Injectable()
|
||||
export class ConfirmDataTransactionManager extends BaseUpdateStatusManager<TransactionEntity> {
|
||||
protected relations = ['items', 'items.bundling_items'];
|
||||
getResult(): string {
|
||||
return `Success active data ${this.result.invoice_code}`;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ export class DetailTransactionManager extends BaseDetailManager<TransactionEntit
|
|||
// relation join and select (relasi yang ingin ditampilkan),
|
||||
selectRelations: [
|
||||
'items',
|
||||
'items.bundling_items',
|
||||
'items.refunds item_refunds',
|
||||
'item_refunds.refund item_refunds_refund',
|
||||
'refunds',
|
||||
|
@ -84,6 +85,7 @@ export class DetailTransactionManager extends BaseDetailManager<TransactionEntit
|
|||
`${this.tableName}.payment_midtrans_url`,
|
||||
|
||||
'items',
|
||||
'bundling_items',
|
||||
'item_refunds',
|
||||
'item_refunds_refund.id',
|
||||
'item_refunds_refund.status',
|
||||
|
|
|
@ -3,6 +3,7 @@ import {
|
|||
TransactionPaymentType,
|
||||
TransactionType,
|
||||
} from 'src/modules/transaction/transaction/constants';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
export function mappingTransaction(data, refundId?: string) {
|
||||
try {
|
||||
|
@ -54,6 +55,8 @@ export function mappingTransaction(data, refundId?: string) {
|
|||
id: itemData.item_category_id,
|
||||
name: itemData.item_category_name,
|
||||
},
|
||||
breakdown_bundling: itemData.breakdown_bundling,
|
||||
bundling_items: itemData.bundling_items,
|
||||
},
|
||||
id: itemData.id,
|
||||
refund: refund,
|
||||
|
@ -187,6 +190,16 @@ export function mappingRevertTransaction(data, type) {
|
|||
item_bundlings: item.item.bundling_items?.map(
|
||||
(bundling) => bundling.name,
|
||||
),
|
||||
breakdown_bundling: item.item.breakdown_bundling,
|
||||
bundling_items: item.item.bundling_items?.map((bundling) => {
|
||||
if (bundling.item_id) return bundling;
|
||||
return {
|
||||
...bundling,
|
||||
item_id: bundling.id,
|
||||
item_name: bundling.name,
|
||||
id: uuidv4(),
|
||||
};
|
||||
}),
|
||||
|
||||
item_tenant_id: item.item.tenant?.id ?? null,
|
||||
item_tenant_name: item.item.tenant?.id ?? null,
|
||||
|
|
|
@ -18,7 +18,10 @@ import { DetailTransactionManager } from './domain/usecases/managers/detail-tran
|
|||
import { BatchDeleteTransactionManager } from './domain/usecases/managers/batch-delete-transaction.manager';
|
||||
import { BatchConfirmTransactionManager } from './domain/usecases/managers/batch-confirm-transaction.manager';
|
||||
import { TransactionModel } from './data/models/transaction.model';
|
||||
import { TransactionItemModel } from './data/models/transaction-item.model';
|
||||
import {
|
||||
TransactionItemBreakdownModel,
|
||||
TransactionItemModel,
|
||||
} from './data/models/transaction-item.model';
|
||||
import { TransactionTaxModel } from './data/models/transaction-tax.model';
|
||||
import { CancelTransactionManager } from './domain/usecases/managers/cancel-transaction.manager';
|
||||
import { BatchCancelTransactionManager } from './domain/usecases/managers/batch-cancel-transaction.manager';
|
||||
|
@ -35,6 +38,7 @@ import { MidtransCallbackHandler } from './domain/usecases/handlers/midtrans-tra
|
|||
import { PdfMakeManager } from 'src/modules/configuration/export/domain/managers/pdf-make.manager';
|
||||
import { PaymentMethodDataService } from '../payment-method/data/services/payment-method-data.service';
|
||||
import { PaymentMethodModel } from '../payment-method/data/models/payment-method.model';
|
||||
import { TransactionDemographyModel } from './data/models/transaction-demography.model';
|
||||
|
||||
@Module({
|
||||
exports: [TransactionReadService],
|
||||
|
@ -44,6 +48,8 @@ import { PaymentMethodModel } from '../payment-method/data/models/payment-method
|
|||
[
|
||||
TransactionModel,
|
||||
TransactionItemModel,
|
||||
TransactionDemographyModel,
|
||||
TransactionItemBreakdownModel,
|
||||
TransactionTaxModel,
|
||||
TaxModel,
|
||||
SalesPriceFormulaModel,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Body, Controller, Get, Param, Put, Query } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Put, Query } from '@nestjs/common';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
import { ExcludePrivilege, Public } from 'src/core/guards';
|
||||
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
|
||||
|
@ -28,6 +28,19 @@ export class UserPrivilegeConfigurationController {
|
|||
return await this.orchestrator.update(data);
|
||||
}
|
||||
|
||||
@Put('/bulk')
|
||||
async updateBulk(
|
||||
@Body() datum: UserPrivilegeConfigurationDto[],
|
||||
): Promise<UserPrivilegeConfigurationEntity[]> {
|
||||
const results = [];
|
||||
for (const data of datum) {
|
||||
const result = await this.orchestrator.update(data);
|
||||
results.push(result);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@Get()
|
||||
@Pagination()
|
||||
async index(
|
||||
|
|
Loading…
Reference in New Issue