Compare commits
No commits in common. "7be4c26ef26666651ef46b4db24bc159f29417cc" and "b96d24de1a6c253cad3b0aeeda5802fff9980414" have entirely different histories.
7be4c26ef2
...
b96d24de1a
|
@ -55,7 +55,7 @@ export class ValidateRelationHelper<Entity> {
|
||||||
const relationColumn =
|
const relationColumn =
|
||||||
data[relation.relation]?.[`${relation.singleQuery[0]}`];
|
data[relation.relation]?.[`${relation.singleQuery[0]}`];
|
||||||
if (
|
if (
|
||||||
// !!relationColumn &&
|
!!relationColumn &&
|
||||||
this.mappingValidator(
|
this.mappingValidator(
|
||||||
relationColumn,
|
relationColumn,
|
||||||
relation.singleQuery[1],
|
relation.singleQuery[1],
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
||||||
|
|
||||||
export class RemoveItemNameUnique1750834308368 implements MigrationInterface {
|
|
||||||
name = 'RemoveItemNameUnique1750834308368';
|
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.query(
|
|
||||||
`ALTER TABLE "items" DROP CONSTRAINT "UQ_213736582899b3599acaade2cd1"`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.query(
|
|
||||||
`ALTER TABLE "items" ADD CONSTRAINT "UQ_213736582899b3599acaade2cd1" UNIQUE ("name")`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -57,7 +57,6 @@ export class CreateBookingManager extends CreateTransactionManager {
|
||||||
time: this.data.booking_date,
|
time: this.data.booking_date,
|
||||||
id: this.data.id,
|
id: this.data.id,
|
||||||
},
|
},
|
||||||
this.data.payment_total,
|
|
||||||
`snap/v4/redirection/${this.data.payment_midtrans_token}`,
|
`snap/v4/redirection/${this.data.payment_midtrans_token}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ export class ItemModel
|
||||||
extends BaseStatusModel<ItemEntity>
|
extends BaseStatusModel<ItemEntity>
|
||||||
implements ItemEntity
|
implements ItemEntity
|
||||||
{
|
{
|
||||||
@Column('varchar', { name: 'name' })
|
@Column('varchar', { name: 'name', unique: true })
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@Column('text', { name: 'booking_description', nullable: true })
|
@Column('text', { name: 'booking_description', nullable: true })
|
||||||
|
|
|
@ -8,7 +8,6 @@ import { ItemEntity } from '../../entities/item.entity';
|
||||||
import { ItemModel } from '../../../data/models/item.model';
|
import { ItemModel } from '../../../data/models/item.model';
|
||||||
import { BaseCreateManager } from 'src/core/modules/domain/usecase/managers/base-create.manager';
|
import { BaseCreateManager } from 'src/core/modules/domain/usecase/managers/base-create.manager';
|
||||||
import { ItemCreatedEvent } from '../../entities/event/item-created.event';
|
import { ItemCreatedEvent } from '../../entities/event/item-created.event';
|
||||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CreateItemManager extends BaseCreateManager<ItemEntity> {
|
export class CreateItemManager extends BaseCreateManager<ItemEntity> {
|
||||||
|
@ -30,37 +29,11 @@ export class CreateItemManager extends BaseCreateManager<ItemEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
get validateRelations(): validateRelations[] {
|
get validateRelations(): validateRelations[] {
|
||||||
const timeGroupId = this.data.time_group_id ?? this.data.time_group?.id;
|
return [];
|
||||||
const relation =
|
|
||||||
this.data.bundling_items?.length > 0
|
|
||||||
? 'bundling_items'
|
|
||||||
: 'bundling_parents';
|
|
||||||
return timeGroupId != null
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
relation: relation,
|
|
||||||
singleQuery: ['time_group_id', '!=', timeGroupId],
|
|
||||||
message: `Gagal Update! Time group item dan bundling item tidak sama`,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get uniqueColumns(): columnUniques[] {
|
get uniqueColumns(): columnUniques[] {
|
||||||
const timeGroupId = this.data.time_group_id ?? this.data.time_group?.id;
|
return [{ column: 'name' }];
|
||||||
return timeGroupId != null
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
column: 'name',
|
|
||||||
query: `(status = '${STATUS.ACTIVE}' AND (${this.tableName}.time_group_id Is Null OR ${this.tableName}.time_group_id = '${timeGroupId}'))`,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
column: 'name',
|
|
||||||
query: `(status = '${STATUS.ACTIVE}')`,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get eventTopics(): EventTopics[] {
|
get eventTopics(): EventTopics[] {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
columnUniques,
|
columnUniques,
|
||||||
validateRelations,
|
validateRelations,
|
||||||
} from 'src/core/strings/constants/interface.constants';
|
} from 'src/core/strings/constants/interface.constants';
|
||||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UpdateItemManager extends BaseUpdateManager<ItemEntity> {
|
export class UpdateItemManager extends BaseUpdateManager<ItemEntity> {
|
||||||
|
@ -40,31 +39,11 @@ export class UpdateItemManager extends BaseUpdateManager<ItemEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
get validateRelations(): validateRelations[] {
|
get validateRelations(): validateRelations[] {
|
||||||
const timeGroupId = this.data.time_group_id ?? this.data.time_group?.id;
|
return [];
|
||||||
const relation =
|
|
||||||
this.data.bundling_items?.length > 0
|
|
||||||
? 'bundling_items'
|
|
||||||
: 'bundling_parents';
|
|
||||||
|
|
||||||
return timeGroupId != null
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
relation: relation,
|
|
||||||
singleQuery: ['time_group_id', '!=', timeGroupId],
|
|
||||||
message: `Gagal Update! Time group item dan bundling item tidak sama`,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get uniqueColumns(): columnUniques[] {
|
get uniqueColumns(): columnUniques[] {
|
||||||
const timeGroupId = this.data.time_group_id ?? this.data.time_group?.id;
|
return [];
|
||||||
return [
|
|
||||||
{
|
|
||||||
column: 'name',
|
|
||||||
query: `(status = '${STATUS.ACTIVE}' AND (${this.tableName}.time_group_id Is Null OR ${this.tableName}.time_group_id = '${timeGroupId}'))`,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get entityTarget(): any {
|
get entityTarget(): any {
|
||||||
|
|
|
@ -324,23 +324,10 @@ export class WhatsappService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async bookingRegister(
|
async bookingRegister(data: WhatsappBookingCreate, paymentUrl: string) {
|
||||||
data: WhatsappBookingCreate,
|
|
||||||
total: number,
|
|
||||||
paymentUrl: string,
|
|
||||||
) {
|
|
||||||
const momentDate = moment(data.time);
|
const momentDate = moment(data.time);
|
||||||
const fallbackValue = momentDate.locale('id').format('dddd, DD MMMM YYYY');
|
const fallbackValue = momentDate.locale('id').format('dddd, DD MMMM YYYY');
|
||||||
|
|
||||||
const formattedTotal = new Intl.NumberFormat('id-ID', {
|
|
||||||
style: 'currency',
|
|
||||||
currency: 'IDR',
|
|
||||||
minimumFractionDigits: 0,
|
|
||||||
maximumFractionDigits: 0,
|
|
||||||
})
|
|
||||||
.format(total)
|
|
||||||
.replace('IDR', 'Rp');
|
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
messaging_product: 'whatsapp',
|
messaging_product: 'whatsapp',
|
||||||
to: phoneNumberOnly(data.phone), // recipient's phone number
|
to: phoneNumberOnly(data.phone), // recipient's phone number
|
||||||
|
@ -364,16 +351,6 @@ export class WhatsappService {
|
||||||
parameter_name: 'booking_date',
|
parameter_name: 'booking_date',
|
||||||
text: fallbackValue,
|
text: fallbackValue,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: 'text',
|
|
||||||
parameter_name: 'booking_code',
|
|
||||||
text: data.code,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'text',
|
|
||||||
parameter_name: 'total',
|
|
||||||
text: formattedTotal,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue