fix(format) perbaikan formatting
parent
bc25b9d020
commit
0df0f30de5
|
@ -34,28 +34,16 @@ export class ConstantController {
|
|||
|
||||
@Get('transaction-user-type')
|
||||
async userType(): Promise<any> {
|
||||
return [
|
||||
'group',
|
||||
'vip'
|
||||
];
|
||||
return ['group', 'vip'];
|
||||
}
|
||||
|
||||
@Get('transaction-payment-type')
|
||||
async transactionPaymentType(): Promise<any> {
|
||||
return [
|
||||
'midtrans',
|
||||
'bank transfer',
|
||||
'qris',
|
||||
'counter',
|
||||
];
|
||||
return ['midtrans', 'bank transfer', 'qris', 'counter'];
|
||||
}
|
||||
|
||||
|
||||
@Get('transaction-type')
|
||||
async transactionType(): Promise<any> {
|
||||
return [
|
||||
'counter',
|
||||
'admin',
|
||||
'online'
|
||||
]
|
||||
return ['counter', 'admin', 'online'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,10 @@ import { ItemModel } from 'src/modules/item-related/item/data/models/item.model'
|
|||
import { UserModel } from 'src/modules/user-related/user/data/models/user.model';
|
||||
import { UserDataService } from 'src/modules/user-related/user/data/services/user-data.service';
|
||||
import { ItemDataService } from 'src/modules/item-related/item/data/services/item-data.service';
|
||||
import { BookingDeletedEvent, BookingHandler } from './domain/managers/booking.handler';
|
||||
import {
|
||||
BookingDeletedEvent,
|
||||
BookingHandler,
|
||||
} from './domain/managers/booking.handler';
|
||||
import { TransactionDataService } from 'src/modules/transaction/transaction/data/services/transaction-data.service';
|
||||
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
|
||||
import { TransactionTaxModel } from 'src/modules/transaction/transaction/data/models/transaction-tax.model';
|
||||
|
|
|
@ -3,79 +3,84 @@ import { BaseIndexManager } from 'src/core/modules/domain/usecase/managers/base-
|
|||
import { SeasonPeriodEntity } from '../../entities/season-period.entity';
|
||||
import { SelectQueryBuilder } from 'typeorm';
|
||||
import {
|
||||
Param,
|
||||
RelationParam,
|
||||
Param,
|
||||
RelationParam,
|
||||
} from 'src/core/modules/domain/entities/base-filter.entity';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
|
||||
@Injectable()
|
||||
export class CurrentSeasonPeriodManager extends BaseIndexManager<SeasonPeriodEntity> {
|
||||
async prepareData(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
async prepareData(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
async beforeProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
async beforeProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
async afterProcess(): Promise<void> {
|
||||
Object.assign(this.result, {
|
||||
data: this.result.data.sort((a, b) => a.priority - b.priority)
|
||||
})
|
||||
return;
|
||||
}
|
||||
async afterProcess(): Promise<void> {
|
||||
Object.assign(this.result, {
|
||||
data: this.result.data.sort((a, b) => a.priority - b.priority),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
get relations(): RelationParam {
|
||||
return {
|
||||
// relation only join (for query purpose)
|
||||
joinRelations: ['season_type'],
|
||||
get relations(): RelationParam {
|
||||
return {
|
||||
// relation only join (for query purpose)
|
||||
joinRelations: ['season_type'],
|
||||
|
||||
// relation join and select (relasi yang ingin ditampilkan),
|
||||
selectRelations: [],
|
||||
// relation join and select (relasi yang ingin ditampilkan),
|
||||
selectRelations: [],
|
||||
|
||||
// relation yang hanya ingin dihitung (akan return number)
|
||||
countRelations: [],
|
||||
};
|
||||
}
|
||||
// relation yang hanya ingin dihitung (akan return number)
|
||||
countRelations: [],
|
||||
};
|
||||
}
|
||||
|
||||
get selects(): string[] {
|
||||
return [
|
||||
`${ this.tableName }.id`,
|
||||
`${ this.tableName }.priority`,
|
||||
`${ this.tableName }.created_at`,
|
||||
`${ this.tableName }.creator_name`,
|
||||
`${ this.tableName }.editor_name`,
|
||||
`${ this.tableName }.updated_at`,
|
||||
`${ this.tableName }.status`,
|
||||
`${ this.tableName }.start_date`,
|
||||
`${ this.tableName }.end_date`,
|
||||
`${ this.tableName }.days`,
|
||||
`${ this.tableName }.holiday_name`,
|
||||
get selects(): string[] {
|
||||
return [
|
||||
`${this.tableName}.id`,
|
||||
`${this.tableName}.priority`,
|
||||
`${this.tableName}.created_at`,
|
||||
`${this.tableName}.creator_name`,
|
||||
`${this.tableName}.editor_name`,
|
||||
`${this.tableName}.updated_at`,
|
||||
`${this.tableName}.status`,
|
||||
`${this.tableName}.start_date`,
|
||||
`${this.tableName}.end_date`,
|
||||
`${this.tableName}.days`,
|
||||
`${this.tableName}.holiday_name`,
|
||||
|
||||
'season_type.id',
|
||||
'season_type.name',
|
||||
];
|
||||
}
|
||||
'season_type.id',
|
||||
'season_type.name',
|
||||
];
|
||||
}
|
||||
|
||||
get specificFilter(): Param[] {
|
||||
return [
|
||||
{
|
||||
cols: `${ this.tableName }.holiday_name`,
|
||||
data: this.filterParam.holiday_names,
|
||||
},
|
||||
];
|
||||
}
|
||||
get specificFilter(): Param[] {
|
||||
return [
|
||||
{
|
||||
cols: `${this.tableName}.holiday_name`,
|
||||
data: this.filterParam.holiday_names,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
setQueryFilter(
|
||||
queryBuilder: SelectQueryBuilder<SeasonPeriodEntity>,
|
||||
): SelectQueryBuilder<SeasonPeriodEntity> {
|
||||
queryBuilder.andWhere(
|
||||
`${ this.tableName }.start_date BETWEEN :from AND :to`,
|
||||
{
|
||||
from: new Date().toLocaleDateString(),
|
||||
to: new Date().toLocaleDateString(),
|
||||
},
|
||||
);
|
||||
setQueryFilter(
|
||||
queryBuilder: SelectQueryBuilder<SeasonPeriodEntity>,
|
||||
): SelectQueryBuilder<SeasonPeriodEntity> {
|
||||
queryBuilder.andWhere(
|
||||
`${this.tableName}.start_date BETWEEN :from AND :to`,
|
||||
{
|
||||
from: new Date().toLocaleDateString(),
|
||||
to: new Date().toLocaleDateString(),
|
||||
},
|
||||
);
|
||||
|
||||
return queryBuilder;
|
||||
}
|
||||
queryBuilder.andWhere(`${this.tableName}.status In (:...statuses)`, {
|
||||
statuses: [STATUS.ACTIVE],
|
||||
});
|
||||
|
||||
return queryBuilder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,10 +42,13 @@ export class SeasonPeriodReadOrchestrator extends BaseReadOrchestrator<SeasonPer
|
|||
async currentPeriod(): Promise<SeasonPeriodEntity> {
|
||||
const params = new FilterSeasonPeriodDto();
|
||||
this.currentPeriodManager.setFilterParam(params);
|
||||
this.currentPeriodManager.setService(this.serviceData, TABLE_NAME.SEASON_PERIOD);
|
||||
this.currentPeriodManager.setService(
|
||||
this.serviceData,
|
||||
TABLE_NAME.SEASON_PERIOD,
|
||||
);
|
||||
await this.currentPeriodManager.execute();
|
||||
const data = this.currentPeriodManager.getResult();
|
||||
return data.data[0]
|
||||
return data.data[0];
|
||||
}
|
||||
|
||||
async indexItem(params): Promise<PaginationResponse<ItemRateEntity>> {
|
||||
|
|
Loading…
Reference in New Issue