chore: add new feature to the enum key for support plan

This commit is contained in:
mahyargdz
2025-05-07 10:01:40 +03:30
parent dd12b45db5
commit b41b3df19c
3 changed files with 9 additions and 2 deletions
@@ -2,6 +2,7 @@ import { Decimal } from "decimal.js";
import { Column, DeleteDateColumn, Entity, OneToMany } from "typeorm";
import { SupportPlanFeature } from "./support-plan-feature.entity";
import { UserSupportPlan } from "./user-support-plan.entity";
import { BaseEntity } from "../../../common/entities/base.entity";
import { DecimalTransformer } from "../../../common/transformers/decimal.transformer";
@Entity()
@@ -27,6 +28,9 @@ export class SupportPlan extends BaseEntity {
@OneToMany(() => SupportPlanFeature, (feature) => feature.supportPlan, { cascade: true })
features: SupportPlanFeature[];
@OneToMany(() => UserSupportPlan, (userSupportPlan) => userSupportPlan.supportPlan)
users: UserSupportPlan[];
@DeleteDateColumn({ nullable: true })
deletedAt?: Date;
}
@@ -1,11 +1,13 @@
export enum SupportPlanFeatureKey {
LEARNING_DOCS = "learning_docs", // راهنما و مستندات آموزشی
TICKET_SUPPORT = "ticket_support", // ارسال تیکت
TICKET_LIMIT = "ticket_limit", // ظرفیت ارسال تیکت
RESPONSE_TIME = "response_time", // زمان پاسخگویی به تیکت
PHONE_SUPPORT = "phone_support", // پاسخگویی تلفنی
BACKUP_VERSION = "backup_version", // نسخه بکاپ
TECHNICAL_ISSUE_RESOLUTION = "technical_issue_resolution", // رفع ایراد فنی
TECHNICAL_EXPERT_ACCESS = "technical_expert_access", // دسترسی به متخصصین فنی
BACKUP_VERSION = "backup_version", // نسخه بکاپ
SERVICE_FUNCTIONALITY_TEST = "service_functionality_test", // تست عملکرد سرویس
ON_SITE_SUPPORT = "on_site_support", // پشتیبانی در محل
ON_SITE_TRAINING = "on_site_training", // آموزش در محل
TICKET_LIMIT = "ticket_limit", // ظرفیت ارسال تیکت
}
@@ -16,6 +16,7 @@ export class SupportPlanRepository extends Repository<SupportPlan> {
async getSupportPlansListAdmin(queryDto: GetSupportPlanListQueryDto) {
const { limit, skip } = PaginationUtils(queryDto);
const query = this.createQueryBuilder("supportPlan").where("supportPlan.deletedAt IS NULL");
query.loadRelationCountAndMap("supportPlan.userCount", "supportPlan.users");
if (queryDto.q) {
query.andWhere("supportPlan.name ILIKE :q OR supportPlan.description ILIKE :q", { q: `%${queryDto.q}%` });