update: change user discount route
This commit is contained in:
@@ -29,7 +29,7 @@ export class BlogCategoriesRepository extends Repository<BlogCategory> {
|
|||||||
async getCategories(queryDto: CategoryListSearchQueryDto) {
|
async getCategories(queryDto: CategoryListSearchQueryDto) {
|
||||||
const { limit, skip } = PaginationUtils(queryDto);
|
const { limit, skip } = PaginationUtils(queryDto);
|
||||||
|
|
||||||
const query = this.createQueryBuilder("blogCategory").where("blogCategory.deletedAt IS NULL");
|
const query = this.createQueryBuilder("blogCategory");
|
||||||
|
|
||||||
if (queryDto.q) {
|
if (queryDto.q) {
|
||||||
query.andWhere("blogCategory.title ILIKE :q OR blogCategory.slug ILIKE :q", { q: `%${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" })
|
@ApiOperation({ summary: "Get discount list for user" })
|
||||||
@Get("user")
|
@Get("user-discounts")
|
||||||
getDiscountListForUser(@Query() queryDto: SearchDiscountQueryDto) {
|
getDiscountListForUser(@Query() queryDto: SearchDiscountQueryDto) {
|
||||||
return this.discountsService.getDiscountListForUser(queryDto);
|
return this.discountsService.getDiscountListForUser(queryDto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ export class DiscountsService {
|
|||||||
await queryRunner.release();
|
await queryRunner.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//************************************************************ */
|
||||||
async getDiscountListForUser(queryDto: SearchDiscountQueryDto) {
|
async getDiscountListForUser(queryDto: SearchDiscountQueryDto) {
|
||||||
const [discounts, count] = await this.discountRepository.findDiscountForUser(queryDto);
|
const [discounts, count] = await this.discountRepository.findDiscountForUser(queryDto);
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export class DiscountRepository extends Repository<Discount> {
|
|||||||
.andWhere("discount.isActive = true")
|
.andWhere("discount.isActive = true")
|
||||||
.andWhere("discount.startDate <= :now", { now: new Date() })
|
.andWhere("discount.startDate <= :now", { now: new Date() })
|
||||||
.andWhere("discount.endDate >= :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) {
|
if (queryDto.q) {
|
||||||
queryBuilder.andWhere("discount.title ILIKE :query", { query: `%${queryDto.q}%` });
|
queryBuilder.andWhere("discount.title ILIKE :query", { query: `%${queryDto.q}%` });
|
||||||
|
|||||||
Reference in New Issue
Block a user