fix: order product
This commit is contained in:
@@ -12,7 +12,7 @@ export class CommissionService {
|
||||
private commissionRepository: Repository<CommissionSetting>,
|
||||
) {}
|
||||
|
||||
findAllRoles(page) {
|
||||
findAllCommission(page) {
|
||||
return this.commissionRepository.findAndCount({
|
||||
skip: page * 10,
|
||||
take: 10,
|
||||
@@ -22,6 +22,28 @@ export class CommissionService {
|
||||
});
|
||||
}
|
||||
|
||||
async findOne(role: string) {
|
||||
try {
|
||||
return await this.commissionRepository.findOneOrFail({
|
||||
where: {
|
||||
role: role,
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
if (e instanceof EntityNotFoundError) {
|
||||
throw new HttpException(
|
||||
{
|
||||
statusCode: HttpStatus.NOT_FOUND,
|
||||
error: 'Data not found',
|
||||
},
|
||||
HttpStatus.NOT_FOUND,
|
||||
);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async updateCommission(id: string, request) {
|
||||
try {
|
||||
await this.commissionRepository.findOneOrFail(id);
|
||||
|
||||
@@ -37,7 +37,7 @@ export class ConfigurableController {
|
||||
|
||||
@Get('/commission')
|
||||
async findCommission(@Query('page') page: number) {
|
||||
const [data, count] = await this.commissionService.findAllRoles(page);
|
||||
const [data, count] = await this.commissionService.findAllCommission(page);
|
||||
|
||||
return {
|
||||
data,
|
||||
|
||||
@@ -10,6 +10,6 @@ import { CommissionSetting } from './entities/commission_setting.entity';
|
||||
imports: [TypeOrmModule.forFeature([Roles, CommissionSetting])],
|
||||
controllers: [ConfigurableController],
|
||||
providers: [RoleService, CommissionService],
|
||||
exports: [RoleService],
|
||||
exports: [RoleService, CommissionService],
|
||||
})
|
||||
export class ConfigurableModule {}
|
||||
|
||||
Reference in New Issue
Block a user