Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bahram1249 committed Mar 19, 2024
1 parent 9d28182 commit ac23602
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import {
ConditionValueResInterface,
ConditionValueSourceInterface,
} from './provider/interface';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import {
ApiBearerAuth,
ApiOperation,
ApiQuery,
ApiTags,
} from '@nestjs/swagger';
import { JwtGuard } from '@rahino/auth/guard';
import { JsonResponseTransformInterceptor } from '@rahino/response/interceptor';
import { GetConditionValueDto } from './dto';
Expand All @@ -39,6 +44,12 @@ export class DiscountConditionValueController {
@ApiOperation({
description: 'show all discount condition values based conditionTypeId',
})
@ApiQuery({
name: 'filter',
type: GetConditionValueDto,
style: 'deepObject',
explode: true,
})
@CheckPermission({ permissionSymbol: 'ecommerce.admin.discounts.create' })
@Get('/')
@HttpCode(HttpStatus.OK)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import { Type } from 'class-transformer';
import { IsInt } from 'class-validator';

export class ConditionTypeDto {
@IsInt()
@Type(() => Number)
conditionTypeId: number;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export class KeyValueInterface {
key: bigint;
key: number;
value: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class EntityTypeMiddleService implements ConditionValueSourceInterface {
const res = await this.entityTypeService.findAll(filter);
return {
result: res.result.map<KeyValueInterface>((item) => {
return { key: BigInt(item.id), value: item.name };
return { key: item.id, value: item.name };
}),
total: res.total,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class InventoryMiddleService implements ConditionValueSourceInterface {
return {
result: res.result.map<KeyValueInterface>((item) => {
return {
key: item.id,
key: Number(item.id),
value: item.product.title + `(شناسه موجودی:‌ ${item.id})`,
};
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ProductMiddleService implements ConditionValueSourceInterface {
const res = await this.service.findAll(user, filter);
return {
result: res.result.map<KeyValueInterface>((item) => {
return { key: BigInt(item.id), value: item.title };
return { key: Number(item.id), value: item.title };
}),
total: res.total,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class VendorMiddleService implements ConditionValueSourceInterface {
const res = await this.service.findAll(user, filter);
return {
result: res.result.map<KeyValueInterface>((item) => {
return { key: BigInt(item.id), value: item.name };
return { key: item.id, value: item.name };
}),
total: res.total,
};
Expand Down
1 change: 1 addition & 0 deletions apps/e-commerce/src/admin/discount/discount.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class DiscountController {
style: 'deepObject',
explode: true,
})
@CheckPermission({ permissionSymbol: 'ecommerce.admin.discounts.getall' })
@HttpCode(HttpStatus.OK)
async findAll(@Query() filter: GetDiscountDto) {
return await this.service.findAll(filter);
Expand Down

0 comments on commit ac23602

Please sign in to comment.