Compare commits

...

10 Commits

Author SHA1 Message Date
Firman Ramdhani ce6343dfa2 feat: add privilege configuration report tenant 2024-07-05 13:29:43 +07:00
aswin 5f3e05a9e3 Merge pull request 'fix(SPG-590) Pemesanan - Konfirmasi dari status draft muncul error' (#13) from fix/transaction into development
continuous-integration/drone/tag Build is passing Details
Reviewed-on: #13
2024-07-04 23:52:28 +00:00
Aswin Ashar Abdullah cafbb82af6 fix(SPG-590) Pemesanan - Konfirmasi dari status draft muncul error 2024-07-05 06:50:33 +07:00
firmanr b9c5cb17d3 Merge pull request 'feat/report' (#12) from feat/report into development
continuous-integration/drone/tag Build is passing Details
Reviewed-on: #12
2024-07-04 11:33:08 +00:00
Aswin Ashar Abdullah d4d4101d69 fix(SPG-544) BE-Validasi Tenant dan Item Tenant
continuous-integration/drone/tag Build is passing Details
2024-07-04 08:19:02 +07:00
Aswin Ashar Abdullah 5ab14f5c62 fix(SPG-566) BE - Validasi season periode tipe range date 2024-07-03 23:07:27 +07:00
firmanr 0410b481e1 Merge pull request 'feat/report' (#11) from feat/report into development
continuous-integration/drone/tag Build is passing Details
Reviewed-on: #11
2024-07-03 11:11:21 +00:00
firmanr 6bb8c928c0 Merge pull request 'feat: setup api for get label history on bookmark' (#10) from feat/report into development
Reviewed-on: #10
2024-07-03 05:22:18 +00:00
firmanr dba03ff81c Merge pull request 'feat: create migration for add column type on report-bookmark table' (#9) from feat/report into development
Reviewed-on: #9
2024-07-03 05:02:48 +00:00
firmanr fec27cf294 Merge pull request 'feat/report' (#8) from feat/report into development
Reviewed-on: #8
2024-07-03 04:57:21 +00:00
12 changed files with 132 additions and 40 deletions

View File

@ -63,7 +63,7 @@ export class ValidateRelationHelper<Entity> {
)
)
throw new UnprocessableEntityException(message);
} else if (data[`total_${relation.relation} `])
} else if (data[`total_${relation.relation}`] > 0)
throw new UnprocessableEntityException(message);
}
}

View File

@ -128,14 +128,24 @@ export const PrivilegeAdminConstant = [
{
menu: 'LAPORAN',
menu_label: 'Laporan',
sub_menu: 'LAPORAN',
sub_menu_label: 'Laporan',
actions: [PrivilegeAction.VIEW],
index: 12,
},
{
menu: 'LAPORAN',
menu_label: 'Laporan',
sub_menu: 'LAPORAN_TENANT',
sub_menu_label: 'Laporan Tenant',
actions: [PrivilegeAction.VIEW],
index: 13,
},
{
menu: 'DISKON_CODE',
menu_label: 'Generate Diskon Kode',
actions: [PrivilegeAction.CREATE],
index: 13,
index: 14,
},
];

View File

@ -31,4 +31,31 @@ export class ConstantController {
async paymentMethodType(): Promise<any> {
return Object.values(PaymentMethodType);
}
@Get('transaction-user-type')
async userType(): Promise<any> {
return [
'group',
'vip'
];
}
@Get('transaction-payment-type')
async transactionPaymentType(): Promise<any> {
return [
'midtrans',
'bank transfer',
'qris',
'counter',
];
}
@Get('transaction-type')
async transactionType(): Promise<any> {
return [
'counter',
'admin',
'online'
]
}
}

View File

@ -68,6 +68,20 @@ export class IndexItemRatesManager extends BaseIndexManager<ItemRateEntity> {
itemIds: this.filterParam.item_ids,
});
}
if (this.filterParam.start_date) {
queryBuilder.andWhere(`season_period.start_date BETWEEN :from AND :to`, {
from: this.filterParam.start_date,
to: this.filterParam.end_date,
});
}
if (this.filterParam.end_date) {
queryBuilder.andWhere(`season_period.end_date BETWEEN :from AND :to`, {
from: this.filterParam.start_date,
to: this.filterParam.end_date,
});
}
return queryBuilder;
}
}

View File

@ -38,36 +38,12 @@ export async function ValidateSeasonPeriodHelper(dataService, data) {
let datas = await query
.andWhere('data.priority = :priority', { priority: priority })
.andWhere(
new Brackets((query) => {
// contoh data tanggal 1 Agustus - 31 Agustus
query.orWhere(
new Brackets((q) => {
return q
.andWhere('data.start_date <= :inputStartDate ', {
inputStartDate: data.start_date,
})
.andWhere('data.end_date >= :inputEndDate', {
inputEndDate: data.end_date,
});
}),
);
query.orWhere(
new Brackets((q) => {
return q
.andWhere('data.start_date >= :inputStartDate ', {
inputStartDate: data.start_date,
})
.andWhere('data.end_date <= :inputEndDate', {
inputEndDate: data.end_date,
});
}),
);
return query;
}),
)
.andWhere(`data.start_date < :inputStartDate`, {
inputStartDate: data.end_date,
})
.andWhere(`data.end_date > :inputEndDate`, {
inputEndDate: data.start_date,
})
.getMany();
if (priority == 2) {

View File

@ -18,7 +18,7 @@ export class TransactionModel
implements TransactionEntity
{
// general info
@Column('bool', { name: 'is_recap_transaction', default: true })
@Column('bool', { name: 'is_recap_transaction', default: false })
is_recap_transaction: boolean;
@Column('enum', {

View File

@ -17,14 +17,43 @@ import { STATUS } from 'src/core/strings/constants/base.constants';
@Injectable()
export class BatchConfirmDataTransactionManager extends BaseBatchUpdateStatusManager<TransactionEntity> {
validateData(data: TransactionEntity): Promise<void> {
if (data.status != STATUS.DRAFT) {
if (
[STATUS.PENDING, STATUS.REJECTED, STATUS.EXPIRED].includes(data.status)
) {
throw new UnprocessableEntityException({
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
message: `Failed! only data booking with status ${STATUS.ACTIVE} can be confirm`,
message: `Failed! only data booking with status ${STATUS.PENDING}, ${STATUS.REJECTED}, ${STATUS.EXPIRED} can be confirm`,
error: 'Unprocessable Entity',
});
}
switch (data.status) {
// jika confirm status pending
// maka akan kebuat reconsiliasi
case STATUS.PENDING:
data.reconciliation_status = STATUS.PENDING;
break;
// jika confirm status rejected
case STATUS.REJECTED:
data.reconciliation_status = STATUS.PENDING;
break;
// jika confirm status expired
case STATUS.EXPIRED:
break;
default:
data.reconciliation_status = STATUS.PENDING;
break;
}
const freeTransaction = data.payment_total < 1;
Object.assign(data, {
status: freeTransaction ? STATUS.ACTIVE : STATUS.PENDING,
});
return;
}

View File

@ -7,11 +7,23 @@ import {
import { TransactionModel } from '../../../data/models/transaction.model';
import { TransactionChangeStatusEvent } from '../../entities/event/transaction-change-status.event';
import { BatchResult } from 'src/core/response/domain/ok-response.interface';
import { Injectable } from '@nestjs/common';
import {
HttpStatus,
Injectable,
UnprocessableEntityException,
} from '@nestjs/common';
import { STATUS } from 'src/core/strings/constants/base.constants';
@Injectable()
export class BatchConfirmTransactionManager extends BaseBatchUpdateStatusManager<TransactionEntity> {
validateData(data: TransactionEntity): Promise<void> {
if (data.status != STATUS.DRAFT) {
throw new UnprocessableEntityException({
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
message: `Failed! only data booking with status ${STATUS.ACTIVE} can be confirm`,
error: 'Unprocessable Entity',
});
}
return;
}

View File

@ -1,4 +1,8 @@
import { Injectable } from '@nestjs/common';
import {
HttpStatus,
Injectable,
UnprocessableEntityException,
} from '@nestjs/common';
import { BaseUpdateStatusManager } from 'src/core/modules/domain/usecase/managers/base-update-status.manager';
import { TransactionEntity } from '../../entities/transaction.entity';
import {
@ -22,6 +26,16 @@ export class ConfirmDataTransactionManager extends BaseUpdateStatusManager<Trans
async beforeProcess(): Promise<void> {
const old_status = this.oldData.status;
if (
[STATUS.PENDING, STATUS.REJECTED, STATUS.EXPIRED].includes(old_status)
) {
throw new UnprocessableEntityException({
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
message: `Failed! only data booking with status ${STATUS.PENDING}, ${STATUS.REJECTED}, ${STATUS.EXPIRED} can be confirm`,
error: 'Unprocessable Entity',
});
}
switch (old_status) {
// jika confirm status pending
// maka akan kebuat reconsiliasi

View File

@ -20,7 +20,7 @@ export class ConfirmTransactionManager extends BaseUpdateStatusManager<Transacti
}
async validateProcess(): Promise<void> {
if (this.data.status != STATUS.DRAFT) {
if (this.oldData.status != STATUS.DRAFT) {
throw new UnprocessableEntityException({
statusCode: HttpStatus.UNPROCESSABLE_ENTITY,
message: `Failed! only data booking with status ${STATUS.ACTIVE} can be confirm`,

View File

@ -57,8 +57,8 @@ export class DetailTransactionManager extends BaseDetailManager<TransactionEntit
name: itemData.item_category_name,
},
},
id: itemData.item_category_id,
name: itemData.item_category_name,
qty: itemData.qty,
total_price: itemData.total_price,
};
});
@ -118,12 +118,15 @@ export class DetailTransactionManager extends BaseDetailManager<TransactionEntit
`${this.tableName}.discount_percentage`,
`${this.tableName}.discount_value`,
`${this.tableName}.payment_type`,
`${this.tableName}.payment_date`,
`${this.tableName}.payment_total_pay`,
`${this.tableName}.payment_type_method_id`,
`${this.tableName}.payment_type_method_name`,
`${this.tableName}.payment_type_method_number`,
`${this.tableName}.payment_card_information`,
`${this.tableName}.payment_code_reference`,
`${this.tableName}.payment_sub_total`,
`${this.tableName}.payment_discount_total`,

View File

@ -54,6 +54,13 @@ export class IndexTransactionManager extends BaseIndexManager<TransactionEntity>
`${this.tableName}.creator_name`,
`${this.tableName}.editor_id`,
`${this.tableName}.editor_name`,
`${this.tableName}.payment_type`,
`${this.tableName}.payment_date`,
`${this.tableName}.payment_total_pay`,
`${this.tableName}.payment_type_method_id`,
`${this.tableName}.payment_type_method_name`,
`${this.tableName}.payment_type_method_number`,
];
}