update: change user discount route

This commit is contained in:
mahyargdz
2025-04-23 15:08:48 +03:30
parent d69755a690
commit b04d3183b7
4 changed files with 4 additions and 4 deletions
@@ -29,7 +29,7 @@ export class BlogCategoriesRepository extends Repository<BlogCategory> {
async getCategories(queryDto: CategoryListSearchQueryDto) {
const { limit, skip } = PaginationUtils(queryDto);
const query = this.createQueryBuilder("blogCategory").where("blogCategory.deletedAt IS NULL");
const query = this.createQueryBuilder("blogCategory");
if (queryDto.q) {
query.andWhere("blogCategory.title ILIKE :q OR blogCategory.slug ILIKE :q", { q: `%${queryDto.q}%` });
@@ -69,7 +69,7 @@ export class DiscountsController {
}
@ApiOperation({ summary: "Get discount list for user" })
@Get("user")
@Get("user-discounts")
getDiscountListForUser(@Query() queryDto: SearchDiscountQueryDto) {
return this.discountsService.getDiscountListForUser(queryDto);
}
@@ -166,7 +166,7 @@ export class DiscountsService {
await queryRunner.release();
}
}
//************************************************************ */
async getDiscountListForUser(queryDto: SearchDiscountQueryDto) {
const [discounts, count] = await this.discountRepository.findDiscountForUser(queryDto);
@@ -69,7 +69,7 @@ export class DiscountRepository extends Repository<Discount> {
.andWhere("discount.isActive = true")
.andWhere("discount.startDate <= :now", { now: new Date() })
.andWhere("discount.endDate >= :now", { now: new Date() })
.andWhere("discount.type = :type", { type: DiscountApplicationType.CODE_BASED });
.andWhere("discount.applicationType = :type", { type: DiscountApplicationType.CODE_BASED });
if (queryDto.q) {
queryBuilder.andWhere("discount.title ILIKE :query", { query: `%${queryDto.q}%` });