ia-common 1.1.1-beta.5 → 1.1.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/enum/user/user-role.enum.d.ts +3 -1
- package/build/src/enum/user/user-role.enum.js +2 -0
- package/build/src/interface/api/index.d.ts +1 -0
- package/build/src/interface/api/index.js +1 -0
- package/build/src/interface/api/login.interface.d.ts +0 -1
- package/build/src/interface/api/pricing-plan-create.dto.interface.d.ts +2 -2
- package/build/src/interface/api/pricing-plan-update-dto.interface.d.ts +2 -2
- package/build/src/interface/api/role-user-mapping-create-dto.interface.d.ts +7 -0
- package/build/src/interface/api/role-user-mapping-create-dto.interface.js +2 -0
- package/build/src/interface/api/update-pricing-plan-by-id.interface.d.ts +2 -2
- package/build/src/interface/entity/entity-utils.interface.d.ts +6 -3
- package/build/src/interface/entity/entity-utils.interface.js +1 -0
- package/build/src/interface/entity/index.d.ts +1 -0
- package/build/src/interface/entity/index.js +1 -0
- package/build/src/interface/entity/permission.entity.interface.d.ts +0 -1
- package/build/src/interface/entity/role-user-mapping-entity.interface.d.ts +8 -0
- package/build/src/interface/entity/role-user-mapping-entity.interface.js +2 -0
- package/build/src/interface/entity/role.entity.interface.d.ts +0 -1
- package/build/src/interface/entity/user-entity.interface.d.ts +0 -2
- package/build/src/model/index.d.ts +1 -0
- package/build/src/model/index.js +1 -0
- package/build/src/model/interface/entity.model.interface.js +3 -0
- package/build/src/model/interface/pricing-plan-model.interface.d.ts +2 -2
- package/build/src/model/organization-entity-model.d.ts +0 -1
- package/build/src/model/organization-entity-model.js +13 -13
- package/build/src/model/permission-entity-model.d.ts +0 -1
- package/build/src/model/permission-entity-model.js +0 -1
- package/build/src/model/pricing-plan-entity-model.d.ts +1 -1
- package/build/src/model/pricing-plan-entity-model.js +4 -4
- package/build/src/model/pricing-plan-model.d.ts +2 -2
- package/build/src/model/pricing-plan-model.js +4 -4
- package/build/src/model/role-entity-model.d.ts +0 -1
- package/build/src/model/role-entity-model.js +0 -1
- package/build/src/model/role-user-mapping-entity-model.d.ts +15 -0
- package/build/src/model/role-user-mapping-entity-model.js +26 -0
- package/build/src/model/user-entity-model.d.ts +1 -3
- package/build/src/model/user-entity-model.js +2 -13
- package/build/src/utils/helper.fn.utils.d.ts +27 -0
- package/build/src/utils/helper.fn.utils.js +40 -93
- package/package.json +1 -1
|
@@ -10,4 +10,6 @@ var UserRoleEnum;
|
|
|
10
10
|
UserRoleEnum["PUBLIC_USER"] = "public_user";
|
|
11
11
|
UserRoleEnum["ADVISOR_CLIENT"] = "advisor_client";
|
|
12
12
|
UserRoleEnum["STAFF"] = "staff";
|
|
13
|
+
UserRoleEnum["OWNER"] = "owner";
|
|
14
|
+
UserRoleEnum["CLIENT"] = "client";
|
|
13
15
|
})(UserRoleEnum || (exports.UserRoleEnum = UserRoleEnum = {}));
|
|
@@ -62,3 +62,4 @@ export * from "./role.permission.mapping.create.dto.interface";
|
|
|
62
62
|
export * from "./role.permission.mapping.delete.dto.interface";
|
|
63
63
|
export * from "./role.permission.mapping.response";
|
|
64
64
|
export * from "./role.permission.mapping.update.dto.interface";
|
|
65
|
+
export * from "./role-user-mapping-create-dto.interface";
|
|
@@ -78,3 +78,4 @@ __exportStar(require("./role.permission.mapping.create.dto.interface"), exports)
|
|
|
78
78
|
__exportStar(require("./role.permission.mapping.delete.dto.interface"), exports);
|
|
79
79
|
__exportStar(require("./role.permission.mapping.response"), exports);
|
|
80
80
|
__exportStar(require("./role.permission.mapping.update.dto.interface"), exports);
|
|
81
|
+
__exportStar(require("./role-user-mapping-create-dto.interface"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IEntityCreateDto, IPricingPlanEntity, Modify } from "../../@type";
|
|
2
2
|
export interface ICreatePricingPlanRequest {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
effectiveFrom: number;
|
|
4
|
+
effectiveTo?: number;
|
|
5
5
|
basePrice: number;
|
|
6
6
|
billingCycle: IBillingCycle;
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EntityEnum, EnumEntityType, IEntityUpdateDto, IPricingPlanEntity, Modify } from "../../@type";
|
|
2
2
|
import { IBillingCycle } from "./pricing-plan-create.dto.interface";
|
|
3
3
|
export interface IUpdatePricingPlanRequest {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
effectiveFrom?: number;
|
|
5
|
+
effectiveTo?: number;
|
|
6
6
|
basePrice?: number;
|
|
7
7
|
billingCycle?: IBillingCycle;
|
|
8
8
|
}
|
|
@@ -6,8 +6,8 @@ export interface IUpdatePricingPlanByIdResponse extends Modify<IPricingPlanEntit
|
|
|
6
6
|
}> {
|
|
7
7
|
}
|
|
8
8
|
export interface IUpdatePricingPlanByIdRequest {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
effectiveFrom?: number;
|
|
10
|
+
effectiveTo?: number;
|
|
11
11
|
basePrice?: number;
|
|
12
12
|
billingCycle?: IBillingCycleDto;
|
|
13
13
|
}
|
|
@@ -6,6 +6,7 @@ import { MutualFundEntityModel } from "../../model/mutual-funds-entity.model";
|
|
|
6
6
|
import { PermissionEntityModel } from "../../model/permission-entity-model";
|
|
7
7
|
import { RegistrationEntityModel } from "../../model/registration-entity-model";
|
|
8
8
|
import { RoleEntityModel } from "../../model/role-entity-model";
|
|
9
|
+
import { RoleUserMappingEntityModel } from "../../model/role-user-mapping-entity-model";
|
|
9
10
|
import { IEquityAdviceEntity } from "./advice-entity.interface";
|
|
10
11
|
import { IAdvisorUserMappingEntity } from "./advisor-user-mapping-entity.interface";
|
|
11
12
|
import { IBankDetailEntity } from "./bank-details-entity.interface";
|
|
@@ -22,6 +23,7 @@ import { IOrganizationEntity } from "./organization-entity.interface";
|
|
|
22
23
|
import { IPermissionEntity } from "./permission.entity.interface";
|
|
23
24
|
import { IPricingPlanEntity } from "./pricing-plan-entity.interface";
|
|
24
25
|
import { IRegistrationEntity } from "./registration-entity";
|
|
26
|
+
import { IRoleUserMappingEntity } from "./role-user-mapping-entity.interface";
|
|
25
27
|
import { IRoleEntity } from "./role.entity.interface";
|
|
26
28
|
import { IRolePermissionMappingEntity } from "./role.permission.mapping.entity.interface";
|
|
27
29
|
import { ISubscriptionEntity } from "./subscription-entity.interface";
|
|
@@ -135,7 +137,8 @@ export declare enum EntityEnum {
|
|
|
135
137
|
CRON_JOBS = "cron_jobs",
|
|
136
138
|
ROLE = "role",
|
|
137
139
|
PERMISSION = "permissions",
|
|
138
|
-
ROLE_PERMISSION_MAPPING = "role_permission_mapping"
|
|
140
|
+
ROLE_PERMISSION_MAPPING = "role_permission_mapping",
|
|
141
|
+
ROLE_USER_MAPPING = "role_user_mapping"
|
|
139
142
|
}
|
|
140
143
|
/**
|
|
141
144
|
* EnumEntityType<T>
|
|
@@ -143,7 +146,7 @@ export declare enum EntityEnum {
|
|
|
143
146
|
* Maps each EntityEnum to its corresponding Interface.
|
|
144
147
|
* Ensures strict typing in services, repositories & generic functions.
|
|
145
148
|
*/
|
|
146
|
-
export type EnumEntityType<T extends EntityEnum> = (T extends EntityEnum.EQUITY_ADVICE ? IEquityAdviceEntity : T extends EntityEnum.BANK_DETAIL ? IBankDetailEntity : T extends EntityEnum.PRICING_PLAN ? IPricingPlanEntity : T extends EntityEnum.SUBSCRIPTION ? ISubscriptionEntity : T extends EntityEnum.ORGANIZATION ? IOrganizationEntity : T extends EntityEnum.REGISTRATION ? IRegistrationEntity : T extends EntityEnum.USER ? IUserEntity : T extends EntityEnum.ADVISOR_USER_MAPPING ? IAdvisorUserMappingEntity : T extends EntityEnum.MUTUAL_FUNDS ? IMutualFundsEntity : T extends EntityEnum.MUTUAL_FUND_ADVICE ? IMutualFundAdviceEntity : T extends EntityEnum.NFO ? INFOEntity : T extends EntityEnum.NFO_ADVICE ? INFOAdviceEntity : T extends EntityEnum.CORPORATE_ACTIONS ? ICorporateActionsEntity : T extends EntityEnum.CORPORATE_ACTIONS_ADVICE ? ICorporateActionsAdviceEntity : T extends EntityEnum.CONFIGURATION ? IConfigurationsEntity : T extends EntityEnum.CRON_JOBS ? ICronJobsEntity : T extends EntityEnum.ROLE ? IRoleEntity : T extends EntityEnum.PERMISSION ? IPermissionEntity : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : never) & {
|
|
149
|
+
export type EnumEntityType<T extends EntityEnum> = (T extends EntityEnum.EQUITY_ADVICE ? IEquityAdviceEntity : T extends EntityEnum.BANK_DETAIL ? IBankDetailEntity : T extends EntityEnum.PRICING_PLAN ? IPricingPlanEntity : T extends EntityEnum.SUBSCRIPTION ? ISubscriptionEntity : T extends EntityEnum.ORGANIZATION ? IOrganizationEntity : T extends EntityEnum.REGISTRATION ? IRegistrationEntity : T extends EntityEnum.USER ? IUserEntity : T extends EntityEnum.ADVISOR_USER_MAPPING ? IAdvisorUserMappingEntity : T extends EntityEnum.MUTUAL_FUNDS ? IMutualFundsEntity : T extends EntityEnum.MUTUAL_FUND_ADVICE ? IMutualFundAdviceEntity : T extends EntityEnum.NFO ? INFOEntity : T extends EntityEnum.NFO_ADVICE ? INFOAdviceEntity : T extends EntityEnum.CORPORATE_ACTIONS ? ICorporateActionsEntity : T extends EntityEnum.CORPORATE_ACTIONS_ADVICE ? ICorporateActionsAdviceEntity : T extends EntityEnum.CONFIGURATION ? IConfigurationsEntity : T extends EntityEnum.CRON_JOBS ? ICronJobsEntity : T extends EntityEnum.ROLE ? IRoleEntity : T extends EntityEnum.PERMISSION ? IPermissionEntity : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : T extends EntityEnum.ROLE_USER_MAPPING ? IRoleUserMappingEntity : never) & {
|
|
147
150
|
id: number;
|
|
148
151
|
};
|
|
149
152
|
export type EntityRelations = {
|
|
@@ -209,7 +212,7 @@ export type EntityModelIndexMap = {
|
|
|
209
212
|
export type EntityMap = {
|
|
210
213
|
[E in EntityEnum]?: EnumEntityType<E>[];
|
|
211
214
|
};
|
|
212
|
-
export type EnumToModel<T extends EntityEnum> = T extends EntityEnum.EQUITY_ADVICE ? EquityAdviceEntityModel : T extends EntityEnum.BANK_DETAIL ? BankDetailsEntityModel : T extends EntityEnum.PRICING_PLAN ? PricingPlanEntityModel : T extends EntityEnum.SUBSCRIPTION ? SubscriptionEntityModel : T extends EntityEnum.ORGANIZATION ? OrganizationEntityModel : T extends EntityEnum.REGISTRATION ? RegistrationEntityModel : T extends EntityEnum.USER ? UserEntityModel : T extends EntityEnum.ADVISOR_USER_MAPPING ? AdvisorUserMappingEntityModel : T extends EntityEnum.MUTUAL_FUNDS ? MutualFundEntityModel : T extends EntityEnum.MUTUAL_FUND_ADVICE ? MutualFundAdviceEntityModel : T extends EntityEnum.NFO ? NFOEntityModel : T extends EntityEnum.NFO_ADVICE ? NFOAdviceEntityModel : T extends EntityEnum.CORPORATE_ACTIONS ? CorporateActionsEntityModel : T extends EntityEnum.CORPORATE_ACTIONS_ADVICE ? CorporateActionsAdviceEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationsEntityModel : T extends EntityEnum.CRON_JOBS ? CronJobsEntityModel : T extends EntityEnum.ROLE ? RoleEntityModel : T extends EntityEnum.PERMISSION ? PermissionEntityModel : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? RolePermissionMappingEntityModel : never;
|
|
215
|
+
export type EnumToModel<T extends EntityEnum> = T extends EntityEnum.EQUITY_ADVICE ? EquityAdviceEntityModel : T extends EntityEnum.BANK_DETAIL ? BankDetailsEntityModel : T extends EntityEnum.PRICING_PLAN ? PricingPlanEntityModel : T extends EntityEnum.SUBSCRIPTION ? SubscriptionEntityModel : T extends EntityEnum.ORGANIZATION ? OrganizationEntityModel : T extends EntityEnum.REGISTRATION ? RegistrationEntityModel : T extends EntityEnum.USER ? UserEntityModel : T extends EntityEnum.ADVISOR_USER_MAPPING ? AdvisorUserMappingEntityModel : T extends EntityEnum.MUTUAL_FUNDS ? MutualFundEntityModel : T extends EntityEnum.MUTUAL_FUND_ADVICE ? MutualFundAdviceEntityModel : T extends EntityEnum.NFO ? NFOEntityModel : T extends EntityEnum.NFO_ADVICE ? NFOAdviceEntityModel : T extends EntityEnum.CORPORATE_ACTIONS ? CorporateActionsEntityModel : T extends EntityEnum.CORPORATE_ACTIONS_ADVICE ? CorporateActionsAdviceEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationsEntityModel : T extends EntityEnum.CRON_JOBS ? CronJobsEntityModel : T extends EntityEnum.ROLE ? RoleEntityModel : T extends EntityEnum.PERMISSION ? PermissionEntityModel : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? RolePermissionMappingEntityModel : T extends EntityEnum.ROLE_USER_MAPPING ? RoleUserMappingEntityModel : never;
|
|
213
216
|
export type IBaseEntityApiResponse<T> = {
|
|
214
217
|
baseEntities: T[];
|
|
215
218
|
relatedEntities?: {
|
|
@@ -126,5 +126,6 @@ var EntityEnum;
|
|
|
126
126
|
EntityEnum["ROLE"] = "role";
|
|
127
127
|
EntityEnum["PERMISSION"] = "permissions";
|
|
128
128
|
EntityEnum["ROLE_PERMISSION_MAPPING"] = "role_permission_mapping";
|
|
129
|
+
EntityEnum["ROLE_USER_MAPPING"] = "role_user_mapping";
|
|
129
130
|
// EQUITY_ADVICE_IN_PROCESS = "equity_advice_in_process",
|
|
130
131
|
})(EntityEnum || (exports.EntityEnum = EntityEnum = {}));
|
|
@@ -38,3 +38,4 @@ __exportStar(require("./relation-config.interface"), exports);
|
|
|
38
38
|
__exportStar(require("./role.entity.interface"), exports);
|
|
39
39
|
__exportStar(require("./permission.entity.interface"), exports);
|
|
40
40
|
__exportStar(require("./role.permission.mapping.entity.interface"), exports);
|
|
41
|
+
__exportStar(require("./role-user-mapping-entity.interface"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IAuditColumnEntity } from "./audit-column-entity.interface";
|
|
2
|
+
import { EntityEnum, IEntitySearch } from "./entity-utils.interface";
|
|
3
|
+
export interface IRoleUserMappingEntity extends IAuditColumnEntity {
|
|
4
|
+
id: number;
|
|
5
|
+
roleId: number;
|
|
6
|
+
userId: number;
|
|
7
|
+
}
|
|
8
|
+
export type IRoleUserMappingEntityFilterData = IEntitySearch<EntityEnum.ROLE_USER_MAPPING>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UserRoleEnum } from "../../@enum";
|
|
2
1
|
import { UserStatus } from "../../enum/user/user-status.enum";
|
|
3
2
|
import { IAuditColumnEntity } from "./audit-column-entity.interface";
|
|
4
3
|
export interface IUserEntity extends IAuditColumnEntity {
|
|
@@ -12,7 +11,6 @@ export interface IUserEntity extends IAuditColumnEntity {
|
|
|
12
11
|
isMobileVerified: boolean;
|
|
13
12
|
isAccountVerified: boolean;
|
|
14
13
|
requireNewPassword: boolean;
|
|
15
|
-
role: UserRoleEnum;
|
|
16
14
|
registrationId: number;
|
|
17
15
|
organizationId: number;
|
|
18
16
|
imageUrl: string | null;
|
package/build/src/model/index.js
CHANGED
|
@@ -51,3 +51,4 @@ __exportStar(require("./configurations-entity-model"), exports);
|
|
|
51
51
|
__exportStar(require("./permission-entity-model"), exports);
|
|
52
52
|
__exportStar(require("./role-entity-model"), exports);
|
|
53
53
|
__exportStar(require("./role-permission-entity-model"), exports);
|
|
54
|
+
__exportStar(require("./role-user-mapping-entity-model"), exports);
|
|
@@ -20,6 +20,7 @@ const pricing_plan_entity_model_1 = require("../pricing-plan-entity-model");
|
|
|
20
20
|
const registration_entity_model_1 = require("../registration-entity-model");
|
|
21
21
|
const role_entity_model_1 = require("../role-entity-model");
|
|
22
22
|
const role_permission_entity_model_1 = require("../role-permission-entity-model");
|
|
23
|
+
const role_user_mapping_entity_model_1 = require("../role-user-mapping-entity-model");
|
|
23
24
|
const subscription_entity_model_1 = require("../subscription-entity-model");
|
|
24
25
|
const user_entity_model_1 = require("../user-entity-model");
|
|
25
26
|
function mapToIndex(entityMap) {
|
|
@@ -76,6 +77,7 @@ function parseEntities(json, baseEntity, entityModelMap) {
|
|
|
76
77
|
[_type_1.EntityEnum.ROLE]: role_entity_model_1.RoleEntityModel.fromEntity,
|
|
77
78
|
[_type_1.EntityEnum.PERMISSION]: permission_entity_model_1.PermissionEntityModel.fromEntity,
|
|
78
79
|
[_type_1.EntityEnum.ROLE_PERMISSION_MAPPING]: role_permission_entity_model_1.RolePermissionMappingEntityModel.fromEntity,
|
|
80
|
+
[_type_1.EntityEnum.ROLE_USER_MAPPING]: role_user_mapping_entity_model_1.RoleUserMappingEntityModel.fromEntity,
|
|
79
81
|
};
|
|
80
82
|
if (!(baseEntity in entityFromJsonMappings)) {
|
|
81
83
|
throw new Error(`Unknown entity: ${baseEntity}`);
|
|
@@ -114,6 +116,7 @@ exports.entityEnumToEntityModel = {
|
|
|
114
116
|
[_type_1.EntityEnum.ROLE]: role_entity_model_1.RoleEntityModel.fromEntity,
|
|
115
117
|
[_type_1.EntityEnum.PERMISSION]: permission_entity_model_1.PermissionEntityModel.fromEntity,
|
|
116
118
|
[_type_1.EntityEnum.ROLE_PERMISSION_MAPPING]: role_permission_entity_model_1.RolePermissionMappingEntityModel.fromEntity,
|
|
119
|
+
[_type_1.EntityEnum.ROLE_USER_MAPPING]: role_user_mapping_entity_model_1.RoleUserMappingEntityModel.fromEntity,
|
|
117
120
|
};
|
|
118
121
|
function parseEntitiesWithoutModels(json, baseEntity, entityMap = {}) {
|
|
119
122
|
var _a;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IBillingCycleObj } from "../../interface/selected-billing-cycle.interface";
|
|
2
2
|
export interface IPricingPlanModel {
|
|
3
3
|
id: number;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
effectiveFrom: number;
|
|
5
|
+
effectiveTo: number;
|
|
6
6
|
basePrice: number;
|
|
7
7
|
billingCycle: {
|
|
8
8
|
[key: string]: IBillingCycleObj;
|
|
@@ -54,7 +54,6 @@ export declare class OrganizationEntityModel extends BaseEntityModel<EntityEnum.
|
|
|
54
54
|
* Find organization by registrationId
|
|
55
55
|
*/
|
|
56
56
|
static findByRegistrationId(organizationEntities: IOrganizationEntity[], registrationId: number): IOrganizationEntity | undefined;
|
|
57
|
-
validateOwnersCountByOrganizationType(): void;
|
|
58
57
|
getUsersModels(): UserEntityModel[];
|
|
59
58
|
static relationConfigs: RelationConfigs<[
|
|
60
59
|
EntityEnum.USER
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OrganizationEntityModel = void 0;
|
|
4
4
|
const _enum_1 = require("../@enum");
|
|
5
5
|
const relation_type_enum_1 = require("../enum/relation-type.enum");
|
|
6
|
-
const _model_1 = require("../@model");
|
|
7
6
|
const _type_1 = require("../@type");
|
|
8
7
|
const base_entity_model_1 = require("./base.entity.model");
|
|
9
8
|
class OrganizationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
@@ -144,18 +143,19 @@ class OrganizationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
144
143
|
// ): IOrganizationEntity {
|
|
145
144
|
// return OrganizationEntityModel.fromRegistrationModel(registrationEntity);
|
|
146
145
|
// }
|
|
147
|
-
validateOwnersCountByOrganizationType() {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
146
|
+
// validateOwnersCountByOrganizationType(): void {
|
|
147
|
+
// const noOfOwners = this.users?.filter(
|
|
148
|
+
// (user) => user.role === UserRoleEnum.ADVISOR
|
|
149
|
+
// ).length;
|
|
150
|
+
// if (this.type === OrganizationType.PARTNERSHIP && noOfOwners <= 1) {
|
|
151
|
+
// throw new AppBadRequestException({
|
|
152
|
+
// key: "organizationType",
|
|
153
|
+
// message: [
|
|
154
|
+
// "If the organization is a partnership, it must have a minimum of two owners.",
|
|
155
|
+
// ],
|
|
156
|
+
// });
|
|
157
|
+
// }
|
|
158
|
+
// }
|
|
159
159
|
getUsersModels() {
|
|
160
160
|
return this.users;
|
|
161
161
|
}
|
|
@@ -2,8 +2,8 @@ import { PricingPlanStatus } from "../@enum";
|
|
|
2
2
|
import { EntityEnum, IBillingCycle, IGetPricingPlanByDateResponse, IPricingPlanEntity } from "../@type";
|
|
3
3
|
import { BaseEntityModel } from "./base.entity.model";
|
|
4
4
|
export declare class PricingPlanEntityModel extends BaseEntityModel<EntityEnum.PRICING_PLAN> implements IPricingPlanEntity {
|
|
5
|
-
id: number;
|
|
6
5
|
effectiveFrom: number;
|
|
6
|
+
id: number;
|
|
7
7
|
effectiveTo: number;
|
|
8
8
|
status: PricingPlanStatus;
|
|
9
9
|
createdBy: number;
|
|
@@ -20,8 +20,8 @@ class PricingPlanEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
20
20
|
toObject() {
|
|
21
21
|
const responseObj = {
|
|
22
22
|
id: this.id,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
effectiveFrom: 0,
|
|
24
|
+
effectiveTo: 0,
|
|
25
25
|
basePrice: 0,
|
|
26
26
|
billingCycle: {},
|
|
27
27
|
};
|
|
@@ -36,8 +36,8 @@ class PricingPlanEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
36
36
|
key: billingArray.slice(3).join("-").toLowerCase().replace(/ /g, "-"),
|
|
37
37
|
};
|
|
38
38
|
});
|
|
39
|
-
responseObj.
|
|
40
|
-
responseObj.
|
|
39
|
+
responseObj.effectiveFrom = this.effectiveFrom;
|
|
40
|
+
responseObj.effectiveTo = this.effectiveTo;
|
|
41
41
|
responseObj.basePrice = this.basePrice;
|
|
42
42
|
return responseObj;
|
|
43
43
|
}
|
|
@@ -2,8 +2,8 @@ import { IGetPricingPlanByDateResponse, IPricingPlanModel, IBillingCycleObj, IPr
|
|
|
2
2
|
import { BaseEntityModel } from "./base.entity.model";
|
|
3
3
|
export declare class PricingPlanModel extends BaseEntityModel<EntityEnum.PRICING_PLAN> implements IPricingPlanModel {
|
|
4
4
|
id: number;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
effectiveFrom: number;
|
|
6
|
+
effectiveTo: number;
|
|
7
7
|
basePrice: number;
|
|
8
8
|
billingCycle: {
|
|
9
9
|
[key: string]: IBillingCycleObj;
|
|
@@ -9,8 +9,8 @@ class PricingPlanModel extends base_entity_model_1.BaseEntityModel {
|
|
|
9
9
|
constructor(data) {
|
|
10
10
|
super(_type_1.EntityEnum.PRICING_PLAN);
|
|
11
11
|
this.id = 0;
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
12
|
+
this.effectiveFrom = 0;
|
|
13
|
+
this.effectiveTo = 0;
|
|
14
14
|
this.basePrice = 0;
|
|
15
15
|
this.billingCycle = {};
|
|
16
16
|
if (data)
|
|
@@ -75,8 +75,8 @@ class PricingPlanModel extends base_entity_model_1.BaseEntityModel {
|
|
|
75
75
|
exports.PricingPlanModel = PricingPlanModel;
|
|
76
76
|
// export class PricingPlanModel implements IPricingPlanModel {
|
|
77
77
|
// id: number;
|
|
78
|
-
//
|
|
79
|
-
//
|
|
78
|
+
// effectiveFrom: number;
|
|
79
|
+
// effectiveTo: number;
|
|
80
80
|
// basePrice: number;
|
|
81
81
|
// billingCycle: {
|
|
82
82
|
// [key: string]: IBillingCycleObj;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EntityEnum } from "../@type";
|
|
2
|
+
import { IRoleUserMappingEntity } from "../interface/entity/role-user-mapping-entity.interface";
|
|
3
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
export declare class RoleUserMappingEntityModel extends BaseEntityModel<EntityEnum.ROLE_USER_MAPPING> implements IRoleUserMappingEntity {
|
|
5
|
+
id: number;
|
|
6
|
+
roleId: number;
|
|
7
|
+
userId: number;
|
|
8
|
+
createdOn: number;
|
|
9
|
+
updatedOn: number;
|
|
10
|
+
createdBy: number;
|
|
11
|
+
updatedBy: number;
|
|
12
|
+
constructor();
|
|
13
|
+
static fromEntity(entity: IRoleUserMappingEntity): RoleUserMappingEntityModel;
|
|
14
|
+
getRelationConfigs(): any;
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoleUserMappingEntityModel = void 0;
|
|
4
|
+
const _type_1 = require("../@type");
|
|
5
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
class RoleUserMappingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(_type_1.EntityEnum.ROLE_USER_MAPPING);
|
|
9
|
+
this.id = 0;
|
|
10
|
+
this.roleId = 0;
|
|
11
|
+
this.userId = 0;
|
|
12
|
+
this.createdOn = 0;
|
|
13
|
+
this.updatedOn = 0;
|
|
14
|
+
this.createdBy = 0;
|
|
15
|
+
this.updatedBy = 0;
|
|
16
|
+
}
|
|
17
|
+
static fromEntity(entity) {
|
|
18
|
+
const result = new RoleUserMappingEntityModel();
|
|
19
|
+
Object.assign(result, entity);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
getRelationConfigs() {
|
|
23
|
+
return this.constructor.prototype.constructor.relationConfigs;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.RoleUserMappingEntityModel = RoleUserMappingEntityModel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UserStatus } from "../@enum";
|
|
2
2
|
import { EntityEnum, IOrganizationEntity, IRegistrationEntity, IUserEntity } from "../@type";
|
|
3
3
|
import { BaseEntityModel } from "./base.entity.model";
|
|
4
4
|
export declare class UserEntityModel extends BaseEntityModel<EntityEnum.USER> implements IUserEntity {
|
|
@@ -12,7 +12,6 @@ export declare class UserEntityModel extends BaseEntityModel<EntityEnum.USER> im
|
|
|
12
12
|
isMobileVerified: boolean;
|
|
13
13
|
isAccountVerified: boolean;
|
|
14
14
|
requireNewPassword: boolean;
|
|
15
|
-
role: UserRoleEnum;
|
|
16
15
|
registrationId: number;
|
|
17
16
|
organizationId: number;
|
|
18
17
|
imageUrl: string | null;
|
|
@@ -28,5 +27,4 @@ export declare class UserEntityModel extends BaseEntityModel<EntityEnum.USER> im
|
|
|
28
27
|
static filterByOrganizationId(userEntities: IUserEntity[], organizationId: number): IUserEntity[];
|
|
29
28
|
static getUserEntityInstanceFromRegistrationEntityOrganizationEntity(registrationEntity: IRegistrationEntity, organizationEntity: IOrganizationEntity, hashedPassword: string): IUserEntity;
|
|
30
29
|
getRelationConfigs(): any;
|
|
31
|
-
validateUserRoleSuperAdmin(): void;
|
|
32
30
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserEntityModel = void 0;
|
|
4
4
|
const _enum_1 = require("../@enum");
|
|
5
|
-
const _model_1 = require("../@model");
|
|
6
5
|
const _type_1 = require("../@type");
|
|
7
6
|
const base_entity_model_1 = require("./base.entity.model");
|
|
8
7
|
class UserEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
@@ -18,7 +17,7 @@ class UserEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
18
17
|
this.isMobileVerified = false;
|
|
19
18
|
this.isAccountVerified = false;
|
|
20
19
|
this.requireNewPassword = false;
|
|
21
|
-
|
|
20
|
+
// role: UserRoleEnum = UserRoleEnum.ADVISOR;
|
|
22
21
|
this.registrationId = 0;
|
|
23
22
|
this.organizationId = 0;
|
|
24
23
|
this.imageUrl = null;
|
|
@@ -44,7 +43,7 @@ class UserEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
44
43
|
userEntity.isEmailVerified = false;
|
|
45
44
|
userEntity.isMobileVerified = false;
|
|
46
45
|
userEntity.status = _enum_1.UserStatus.REGISTRATION_APPROVED;
|
|
47
|
-
userEntity.role =
|
|
46
|
+
// userEntity.role = UserRoleEnum.OWNER;
|
|
48
47
|
userEntity.createdBy = registrationEntity.createdBy;
|
|
49
48
|
userEntity.updatedBy = registrationEntity.createdBy;
|
|
50
49
|
userEntity.updatedOn = Date.now();
|
|
@@ -62,16 +61,6 @@ class UserEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
62
61
|
getRelationConfigs() {
|
|
63
62
|
return this.constructor.prototype.constructor.relationConfigs;
|
|
64
63
|
}
|
|
65
|
-
validateUserRoleSuperAdmin() {
|
|
66
|
-
if (this.role !== _enum_1.UserRoleEnum.SUPERADMIN) {
|
|
67
|
-
throw new _model_1.AppBadRequestException({
|
|
68
|
-
key: "status",
|
|
69
|
-
message: [
|
|
70
|
-
`Only the SuperAdmin can update the status of ${_enum_1.OrganizationStatus.ACTIVE} and ${_enum_1.OrganizationStatus.ACCOUNT_SUSPENDED}.`,
|
|
71
|
-
],
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
64
|
}
|
|
76
65
|
exports.UserEntityModel = UserEntityModel;
|
|
77
66
|
// export class UserEntityModel implements IUserEntity {
|
|
@@ -86,3 +86,30 @@ export declare function groupByOneToOneFunction<T, K>(list: T[], keyGetter: (inp
|
|
|
86
86
|
export declare function getPropertyFilterByPermissionFn<T extends EntityEnum>(permissionFilterConfig: {
|
|
87
87
|
[key: string]: () => Promise<IEntitySearch<T>>;
|
|
88
88
|
}, propertyNames: string[], userPermission: string, filterDto: IEntitySearch<T>, emptyValue?: any): Promise<IEntitySearch<T>>;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the list of duplicate values from an array.
|
|
91
|
+
*
|
|
92
|
+
* @template T - The type of elements in the array.
|
|
93
|
+
*
|
|
94
|
+
* @param {T[]} arr - The array to check for duplicates.
|
|
95
|
+
*
|
|
96
|
+
* @returns {T[]} An array containing the values that appear more than once.
|
|
97
|
+
* Each duplicate value is included only once.
|
|
98
|
+
*
|
|
99
|
+
* @description
|
|
100
|
+
* This function scans the array and counts occurrences of each value using a Map.
|
|
101
|
+
* Any value with a count greater than 1 is considered a duplicate.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* getDuplicates([1, 2, 2, 3, 3, 3]);
|
|
105
|
+
* // Returns: [2, 3]
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* getDuplicates(['a', 'b', 'b', 'c']);
|
|
109
|
+
* // Returns: ['b']
|
|
110
|
+
*
|
|
111
|
+
* @remarks
|
|
112
|
+
* - Works with all primitive types: number, string, boolean, undefined, null.
|
|
113
|
+
* - For objects, duplicates are based on **reference equality**, not deep equality.
|
|
114
|
+
*/
|
|
115
|
+
export declare function getDuplicates<T>(arr: T[]): T[];
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getPropertyFilterByPermissionFn = exports.groupByOneToOneFunction = exports.deepMerge = exports.toDateFromEpoch = exports.groupByFunction = exports.transformDate = exports.getStringValues = exports.getTodayISTEpoch = void 0;
|
|
12
|
+
exports.getDuplicates = exports.getPropertyFilterByPermissionFn = exports.groupByOneToOneFunction = exports.deepMerge = exports.toDateFromEpoch = exports.groupByFunction = exports.transformDate = exports.getStringValues = exports.getTodayISTEpoch = void 0;
|
|
13
13
|
const _type_1 = require("../@type");
|
|
14
14
|
/**
|
|
15
15
|
* Returns epoch time (ms) for today's date at the given local time (IST).
|
|
@@ -183,95 +183,42 @@ function getPropertyFilterByPermissionFn(permissionFilterConfig, propertyNames,
|
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
exports.getPropertyFilterByPermissionFn = getPropertyFilterByPermissionFn;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
//
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
// [key: string]: IEntityFilterData<T>;
|
|
226
|
-
// },
|
|
227
|
-
// propertyName: keyof T,
|
|
228
|
-
// userPermission: string,
|
|
229
|
-
// filterDto: IEntityFilterData<T>,
|
|
230
|
-
// emptyValue: any = []
|
|
231
|
-
// ) {
|
|
232
|
-
// const dtoFilter = filterDto[propertyName as keyof IEntityFilterData<T>];
|
|
233
|
-
// const permissionFilter =
|
|
234
|
-
// permissionFilterConfig[userPermission][
|
|
235
|
-
// propertyName as keyof IEntityFilterData<T>
|
|
236
|
-
// ];
|
|
237
|
-
// const isDtoFilterIdPresent = dtoFilter && dtoFilter.length > 0;
|
|
238
|
-
// const isPermissionFilterIdPresent =
|
|
239
|
-
// permissionFilter && permissionFilter.length > 0;
|
|
240
|
-
// return {
|
|
241
|
-
// [propertyName]: isPermissionFilterIdPresent
|
|
242
|
-
// ? isDtoFilterIdPresent
|
|
243
|
-
// ? arrayIntersection(permissionFilter as any[], dtoFilter).length > 0
|
|
244
|
-
// ? arrayIntersection(permissionFilter as any[], dtoFilter)
|
|
245
|
-
// : emptyValue
|
|
246
|
-
// : permissionFilter
|
|
247
|
-
// : dtoFilter,
|
|
248
|
-
// };
|
|
249
|
-
// }
|
|
250
|
-
// export async function getFilterByPermissionFn<
|
|
251
|
-
// T extends EnumEntityType<EntityEnum>
|
|
252
|
-
// >(
|
|
253
|
-
// permissionFilterConfig: {
|
|
254
|
-
// [key: string]: () => Promise<IEntityFilterData<T>>;
|
|
255
|
-
// },
|
|
256
|
-
// propertyName: keyof T,
|
|
257
|
-
// userPermission: string,
|
|
258
|
-
// filterDto: IEntityFilterData<T>,
|
|
259
|
-
// emptyValue: any = []
|
|
260
|
-
// ) {
|
|
261
|
-
// const filterData = await permissionFilterConfig[userPermission]();
|
|
262
|
-
// const dtoFilter = filterDto[propertyName as keyof IEntityFilterData<T>];
|
|
263
|
-
// const permissionFilter =
|
|
264
|
-
// filterData[propertyName as keyof IEntityFilterData<T>];
|
|
265
|
-
// const isDtoFilterIdPresent = dtoFilter && dtoFilter.length > 0;
|
|
266
|
-
// const isPermissionFilterIdPresent =
|
|
267
|
-
// permissionFilter && permissionFilter.length > 0;
|
|
268
|
-
// return {
|
|
269
|
-
// [propertyName]: isPermissionFilterIdPresent
|
|
270
|
-
// ? isDtoFilterIdPresent
|
|
271
|
-
// ? arrayIntersection(permissionFilter as any[], dtoFilter).length > 0
|
|
272
|
-
// ? arrayIntersection(permissionFilter as any[], dtoFilter)
|
|
273
|
-
// : emptyValue
|
|
274
|
-
// : permissionFilter
|
|
275
|
-
// : dtoFilter,
|
|
276
|
-
// };
|
|
277
|
-
// }
|
|
186
|
+
/**
|
|
187
|
+
* Returns the list of duplicate values from an array.
|
|
188
|
+
*
|
|
189
|
+
* @template T - The type of elements in the array.
|
|
190
|
+
*
|
|
191
|
+
* @param {T[]} arr - The array to check for duplicates.
|
|
192
|
+
*
|
|
193
|
+
* @returns {T[]} An array containing the values that appear more than once.
|
|
194
|
+
* Each duplicate value is included only once.
|
|
195
|
+
*
|
|
196
|
+
* @description
|
|
197
|
+
* This function scans the array and counts occurrences of each value using a Map.
|
|
198
|
+
* Any value with a count greater than 1 is considered a duplicate.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* getDuplicates([1, 2, 2, 3, 3, 3]);
|
|
202
|
+
* // Returns: [2, 3]
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* getDuplicates(['a', 'b', 'b', 'c']);
|
|
206
|
+
* // Returns: ['b']
|
|
207
|
+
*
|
|
208
|
+
* @remarks
|
|
209
|
+
* - Works with all primitive types: number, string, boolean, undefined, null.
|
|
210
|
+
* - For objects, duplicates are based on **reference equality**, not deep equality.
|
|
211
|
+
*/
|
|
212
|
+
function getDuplicates(arr) {
|
|
213
|
+
const countMap = new Map();
|
|
214
|
+
for (const item of arr) {
|
|
215
|
+
countMap.set(item, (countMap.get(item) || 0) + 1);
|
|
216
|
+
}
|
|
217
|
+
const duplicates = [];
|
|
218
|
+
for (const [value, count] of countMap.entries()) {
|
|
219
|
+
if (count > 1)
|
|
220
|
+
duplicates.push(value);
|
|
221
|
+
}
|
|
222
|
+
return duplicates;
|
|
223
|
+
}
|
|
224
|
+
exports.getDuplicates = getDuplicates;
|