@valentine-efagene/qshelter-common 1.0.0 → 1.0.3
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/dist/OpenApiHelper.d.ts +9 -0
- package/dist/OpenApiHelper.js +118 -0
- package/dist/OpenApiHelper.js.map +1 -0
- package/dist/decorator/index.d.ts +2 -0
- package/dist/decorator/index.js +19 -0
- package/dist/decorator/index.js.map +1 -0
- package/dist/decorator/permission.decorator.d.ts +2 -0
- package/dist/decorator/permission.decorator.js +6 -0
- package/dist/decorator/permission.decorator.js.map +1 -0
- package/dist/decorator/tenant.decorator.d.ts +2 -0
- package/dist/decorator/tenant.decorator.js +13 -0
- package/dist/decorator/tenant.decorator.js.map +1 -0
- package/dist/entities/common.entity.js +1 -1
- package/dist/entities/common.entity.js.map +1 -1
- package/dist/entities/common.pure.entity.js +3 -2
- package/dist/entities/common.pure.entity.js.map +1 -1
- package/dist/entities/mortgage.entity.js +13 -13
- package/dist/entities/mortgage.entity.js.map +1 -1
- package/dist/entities/property.entity.d.ts +1 -2
- package/dist/entities/property.entity.js +6 -12
- package/dist/entities/property.entity.js.map +1 -1
- package/dist/entities/tenant.entity.d.ts +1 -1
- package/dist/entities/tenant.entity.js +3 -3
- package/dist/entities/tenant.entity.js.map +1 -1
- package/dist/entities/user.entity.d.ts +1 -1
- package/dist/entities/user.entity.js +7 -7
- package/dist/entities/user.entity.js.map +1 -1
- package/dist/entities/wallet.entity.js +9 -9
- package/dist/entities/wallet.entity.js.map +1 -1
- package/dist/guard/index.d.ts +2 -0
- package/dist/guard/index.js +19 -0
- package/dist/guard/index.js.map +1 -0
- package/dist/guard/permission.guard.d.ts +10 -0
- package/dist/guard/permission.guard.js +47 -0
- package/dist/guard/permission.guard.js.map +1 -0
- package/dist/guard/swagger-auth.guard.d.ts +1 -0
- package/dist/guard/swagger-auth.guard.js +9 -0
- package/dist/guard/swagger-auth.guard.js.map +1 -0
- package/dist/helpers/ArrayHelper.d.ts +2 -0
- package/dist/helpers/ArrayHelper.js +6 -0
- package/dist/helpers/ArrayHelper.js.map +1 -0
- package/dist/helpers/ConstantHelper.d.ts +36 -0
- package/{helpers/ConstantHelper.ts → dist/helpers/ConstantHelper.js} +36 -47
- package/dist/helpers/ConstantHelper.js.map +1 -0
- package/dist/helpers/CustomNamingStrategy.d.ts +7 -0
- package/dist/helpers/CustomNamingStrategy.js +22 -0
- package/dist/helpers/CustomNamingStrategy.js.map +1 -0
- package/dist/helpers/DateHelper.d.ts +3 -0
- package/dist/helpers/DateHelper.js +20 -0
- package/dist/helpers/DateHelper.js.map +1 -0
- package/dist/helpers/EmailHelper.d.ts +4 -0
- package/dist/helpers/EmailHelper.js +65 -0
- package/dist/helpers/EmailHelper.js.map +1 -0
- package/dist/helpers/FileSystemHelper.d.ts +15 -0
- package/dist/helpers/FileSystemHelper.js +112 -0
- package/dist/helpers/FileSystemHelper.js.map +1 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/index.js +22 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/middleware/AccessLoggerMiddleware.d.ts +6 -0
- package/dist/middleware/AccessLoggerMiddleware.js +64 -0
- package/dist/middleware/AccessLoggerMiddleware.js.map +1 -0
- package/dist/middleware/AuthenticationMiddleware.d.ts +5 -0
- package/dist/middleware/AuthenticationMiddleware.js +19 -0
- package/dist/middleware/AuthenticationMiddleware.js.map +1 -0
- package/dist/middleware/TenantMiddleware.d.ts +14 -0
- package/dist/middleware/TenantMiddleware.js +49 -0
- package/dist/middleware/TenantMiddleware.js.map +1 -0
- package/dist/middleware/index.d.ts +3 -0
- package/dist/middleware/index.js +20 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/common.type.d.ts +15 -0
- package/dist/types/common.type.js +18 -1
- package/dist/types/common.type.js.map +1 -1
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mortgage-fsm.type.d.ts +180 -0
- package/dist/types/mortgage-fsm.type.js +130 -0
- package/dist/types/mortgage-fsm.type.js.map +1 -0
- package/dist/types/permission.enums.d.ts +42 -0
- package/dist/types/permission.enums.js +47 -0
- package/dist/types/permission.enums.js.map +1 -0
- package/dist/types/permission.type.d.ts +42 -0
- package/dist/types/permission.type.js +47 -0
- package/dist/types/permission.type.js.map +1 -0
- package/{types/policy.types.ts → dist/types/policy.type.d.ts} +0 -3
- package/dist/types/policy.type.js +3 -0
- package/dist/types/policy.type.js.map +1 -0
- package/dist/types/tenant.type.d.ts +13 -0
- package/dist/types/tenant.type.js +19 -0
- package/dist/types/tenant.type.js.map +1 -0
- package/dist/types/user.type.d.ts +10 -0
- package/dist/types/user.type.js +16 -0
- package/dist/types/user.type.js.map +1 -0
- package/package.json +52 -4
- package/OpenApiHelper.ts +0 -121
- package/decorator/permission.decorator.ts +0 -4
- package/decorator/tenant.decorator.ts +0 -16
- package/entities/BaseEntity.ts +0 -34
- package/entities/TenantAwareEntity.ts +0 -34
- package/entities/TenantAwareRepository.ts +0 -100
- package/entities/amenity.entity.ts +0 -10
- package/entities/common.entity.ts +0 -46
- package/entities/common.pure.entity.ts +0 -36
- package/entities/index.ts +0 -27
- package/entities/mortgage-document.entity.ts +0 -37
- package/entities/mortgage-downpayment-installment.entity.ts +0 -40
- package/entities/mortgage-downpayment-payment.entity.ts +0 -61
- package/entities/mortgage-downpayment.entity.ts +0 -43
- package/entities/mortgage-step.entity.ts +0 -33
- package/entities/mortgage-type.entity.ts +0 -31
- package/entities/mortgage.entity.ts +0 -89
- package/entities/password_reset_tokens.entity.ts +0 -25
- package/entities/permission.entity.ts +0 -12
- package/entities/property-document.entity.ts +0 -21
- package/entities/property-media.entity.ts +0 -23
- package/entities/property.entity.ts +0 -147
- package/entities/refresh_token.entity.ts +0 -16
- package/entities/role.entity.ts +0 -20
- package/entities/settings.entity.ts +0 -56
- package/entities/social.entity.ts +0 -27
- package/entities/tenant.entity.ts +0 -65
- package/entities/transaction.entity.ts +0 -56
- package/entities/user.entity.ts +0 -89
- package/entities/user_suspensions.entity.ts +0 -24
- package/entities/wallet.entity.ts +0 -54
- package/guard/permission.guard.ts +0 -42
- package/guard/swagger-auth.guard.ts +0 -9
- package/helpers/ArrayHelper.ts +0 -1
- package/helpers/CustomNamingStrategy.ts +0 -27
- package/helpers/DateHelper.ts +0 -21
- package/helpers/EmailHelper.ts +0 -38
- package/helpers/FileSystemHelper.ts +0 -101
- package/index.ts +0 -9
- package/middleware/TenantMiddleware.ts +0 -52
- package/pagination/index.ts +0 -2
- package/pagination/pagination.helper.ts +0 -57
- package/pagination/pagination.types.ts +0 -21
- package/standard-response.ts +0 -16
- package/tsconfig.json +0 -33
- package/types/common.type.ts +0 -32
- package/types/mortgage-fsm.types.ts +0 -279
- package/types/property.type.ts +0 -10
- package/types/social.enums.ts +0 -17
- package/types/tenant.enums.ts +0 -14
- package/types/transaction.type.ts +0 -9
- package/types/user.enums.ts +0 -11
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
|
|
2
|
-
import { AbstractBaseEntity } from './common.pure.entity';
|
|
3
|
-
import { MortgageDownpaymentPlan } from './mortgage-downpayment.entity';
|
|
4
|
-
import { MortgageDownpaymentInstallment } from './mortgage-downpayment-installment.entity';
|
|
5
|
-
import { User } from './user.entity';
|
|
6
|
-
|
|
7
|
-
// Legacy enum - kept for backward compatibility
|
|
8
|
-
export enum DownpaymentPaymentStatus {
|
|
9
|
-
PENDING = 'PENDING',
|
|
10
|
-
COMPLETED = 'COMPLETED',
|
|
11
|
-
FAILED = 'FAILED',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Payment state for FSM tracking
|
|
15
|
-
export enum PaymentState {
|
|
16
|
-
INITIATED = 'INITIATED',
|
|
17
|
-
COMPLETED = 'COMPLETED',
|
|
18
|
-
FAILED = 'FAILED',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Entity({ name: 'mortgage_downpayment_payment' })
|
|
22
|
-
export class MortgageDownpaymentPayment extends AbstractBaseEntity {
|
|
23
|
-
@ManyToOne(() => MortgageDownpaymentPlan, { onDelete: 'CASCADE' })
|
|
24
|
-
@JoinColumn({ name: 'plan_id' })
|
|
25
|
-
plan: MortgageDownpaymentPlan;
|
|
26
|
-
|
|
27
|
-
@Column({ nullable: true })
|
|
28
|
-
planId: number;
|
|
29
|
-
|
|
30
|
-
@ManyToOne(() => MortgageDownpaymentInstallment, { nullable: true })
|
|
31
|
-
@JoinColumn({ name: 'installment_id' })
|
|
32
|
-
installment: MortgageDownpaymentInstallment;
|
|
33
|
-
|
|
34
|
-
@Column({ nullable: true })
|
|
35
|
-
installmentId: number;
|
|
36
|
-
|
|
37
|
-
@ManyToOne(() => User, { nullable: true })
|
|
38
|
-
@JoinColumn({ name: 'payer_id' })
|
|
39
|
-
payer: User;
|
|
40
|
-
|
|
41
|
-
@Column({ nullable: true })
|
|
42
|
-
payerId: number;
|
|
43
|
-
|
|
44
|
-
@Column({ type: 'double precision' })
|
|
45
|
-
amount: number;
|
|
46
|
-
|
|
47
|
-
@Column({ nullable: true, unique: true })
|
|
48
|
-
providerReference: string;
|
|
49
|
-
|
|
50
|
-
@Column({ type: 'enum', enum: DownpaymentPaymentStatus, default: DownpaymentPaymentStatus.PENDING })
|
|
51
|
-
status: DownpaymentPaymentStatus;
|
|
52
|
-
|
|
53
|
-
// FSM state tracking
|
|
54
|
-
@Column({ type: 'enum', enum: PaymentState, default: PaymentState.INITIATED })
|
|
55
|
-
state: PaymentState;
|
|
56
|
-
|
|
57
|
-
@Column({ type: 'text', nullable: true })
|
|
58
|
-
stateMetadata: string; // JSON metadata for state transitions
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default MortgageDownpaymentPayment;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
|
|
2
|
-
import { AbstractBaseEntity } from './common.pure.entity';
|
|
3
|
-
import { Mortgage } from './mortgage.entity';
|
|
4
|
-
import { MortgageDownpaymentInstallment } from './mortgage-downpayment-installment.entity';
|
|
5
|
-
import { Frequency } from '../types/common.type';
|
|
6
|
-
|
|
7
|
-
export enum DownpaymentPlanStatus {
|
|
8
|
-
PENDING = 'PENDING',
|
|
9
|
-
ACTIVE = 'ACTIVE',
|
|
10
|
-
COMPLETED = 'COMPLETED',
|
|
11
|
-
DEFAULTED = 'DEFAULTED',
|
|
12
|
-
CANCELLED = 'CANCELLED',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@Entity({ name: 'mortgage_downpayment_plan' })
|
|
16
|
-
export class MortgageDownpaymentPlan extends AbstractBaseEntity {
|
|
17
|
-
@ManyToOne(() => Mortgage, { onDelete: 'CASCADE' })
|
|
18
|
-
@JoinColumn({ name: 'mortgage_id' })
|
|
19
|
-
mortgage: Mortgage;
|
|
20
|
-
|
|
21
|
-
@Column({ nullable: true })
|
|
22
|
-
mortgageId: number;
|
|
23
|
-
|
|
24
|
-
@Column({ type: 'double precision' })
|
|
25
|
-
totalAmount: number;
|
|
26
|
-
|
|
27
|
-
@Column({ type: 'int', nullable: true })
|
|
28
|
-
installmentCount: number;
|
|
29
|
-
|
|
30
|
-
@Column({ nullable: true, type: 'enum', enum: Frequency })
|
|
31
|
-
frequency: Frequency;
|
|
32
|
-
|
|
33
|
-
@Column({ type: 'date', nullable: true })
|
|
34
|
-
startDate: Date;
|
|
35
|
-
|
|
36
|
-
@Column({ type: 'enum', enum: DownpaymentPlanStatus, default: DownpaymentPlanStatus.PENDING })
|
|
37
|
-
status: DownpaymentPlanStatus;
|
|
38
|
-
|
|
39
|
-
@OneToMany(() => MortgageDownpaymentInstallment, (i) => i.plan, { cascade: true })
|
|
40
|
-
installments: MortgageDownpaymentInstallment[];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default MortgageDownpaymentPlan;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
|
|
2
|
-
import { AbstractBaseReviewableEntity } from './common.entity';
|
|
3
|
-
import { Mortgage } from './mortgage.entity';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'mortgage_step' })
|
|
6
|
-
export class MortgageStep extends AbstractBaseReviewableEntity {
|
|
7
|
-
@ManyToOne(() => Mortgage, (mortgage) => mortgage.steps, { onDelete: 'CASCADE' })
|
|
8
|
-
@JoinColumn({ name: 'mortgage_id' })
|
|
9
|
-
mortgage: Mortgage;
|
|
10
|
-
|
|
11
|
-
@Column({ nullable: true })
|
|
12
|
-
mortgageId: number;
|
|
13
|
-
|
|
14
|
-
@Column()
|
|
15
|
-
title: string;
|
|
16
|
-
|
|
17
|
-
@Column({ type: 'text', nullable: true })
|
|
18
|
-
description: string;
|
|
19
|
-
|
|
20
|
-
// Sequence order - easier to query and reorder than relying purely on linked-list pointers
|
|
21
|
-
@Column({ type: 'int', default: 0 })
|
|
22
|
-
sequence: number;
|
|
23
|
-
|
|
24
|
-
// We use `sequence` for ordering. Removed linked-list pointer fields (nextStep/nextStepId) to reduce redundancy.
|
|
25
|
-
|
|
26
|
-
@Column({ default: false })
|
|
27
|
-
isOptional: boolean;
|
|
28
|
-
|
|
29
|
-
@Column({ nullable: true })
|
|
30
|
-
completedAt: Date;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default MortgageStep;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Column, Entity } from 'typeorm';
|
|
2
|
-
import { AbstractBaseReviewableEntity } from './common.entity';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* MortgageType stores named mortgage configurations. Examples: 'Standard Fixed', 'Interest Only', 'Buy-to-Let'.
|
|
6
|
-
* - defaultSteps: array of step templates { title, description?, sequence?, isOptional? }
|
|
7
|
-
* - requiredDocuments: array of document templates { name, required: boolean }
|
|
8
|
-
* - config: free-form JSON for additional settings
|
|
9
|
-
*/
|
|
10
|
-
@Entity({ name: 'mortgage_type' })
|
|
11
|
-
export class MortgageType extends AbstractBaseReviewableEntity {
|
|
12
|
-
@Column()
|
|
13
|
-
name: string;
|
|
14
|
-
|
|
15
|
-
@Column({ nullable: true })
|
|
16
|
-
slug: string;
|
|
17
|
-
|
|
18
|
-
@Column({ type: 'text', nullable: true })
|
|
19
|
-
description?: string;
|
|
20
|
-
|
|
21
|
-
@Column({ type: 'json', nullable: true })
|
|
22
|
-
defaultSteps?: any[];
|
|
23
|
-
|
|
24
|
-
@Column({ type: 'json', nullable: true })
|
|
25
|
-
requiredDocuments?: any[];
|
|
26
|
-
|
|
27
|
-
@Column({ type: 'json', nullable: true })
|
|
28
|
-
config?: any;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default MortgageType;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne } from 'typeorm';
|
|
2
|
-
import { AbstractBaseReviewableEntity } from './common.entity';
|
|
3
|
-
import { Property } from './property.entity';
|
|
4
|
-
import { User } from './user.entity';
|
|
5
|
-
import MortgageDocument from './mortgage-document.entity';
|
|
6
|
-
import MortgageStep from './mortgage-step.entity';
|
|
7
|
-
import { MortgageType } from './mortgage-type.entity';
|
|
8
|
-
import { MortgageDownpaymentPlan } from './mortgage-downpayment.entity';
|
|
9
|
-
import { MortgageState } from '../types/mortgage-fsm.types';
|
|
10
|
-
|
|
11
|
-
// Legacy enum - kept for backward compatibility
|
|
12
|
-
export enum MortgageStatus {
|
|
13
|
-
DRAFT = 'DRAFT',
|
|
14
|
-
PENDING = 'PENDING',
|
|
15
|
-
ACTIVE = 'ACTIVE',
|
|
16
|
-
COMPLETED = 'COMPLETED',
|
|
17
|
-
CANCELLED = 'CANCELLED',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@Entity({ name: 'mortgage' })
|
|
21
|
-
export class Mortgage extends AbstractBaseReviewableEntity {
|
|
22
|
-
@ManyToOne(() => Property, (property) => property.mortgages, { onDelete: 'CASCADE' })
|
|
23
|
-
@JoinColumn({ name: 'property_id' })
|
|
24
|
-
property: Property;
|
|
25
|
-
|
|
26
|
-
@Column({ nullable: true })
|
|
27
|
-
propertyId: number;
|
|
28
|
-
|
|
29
|
-
@ManyToOne(() => User, { nullable: true })
|
|
30
|
-
@JoinColumn({ name: 'borrower_id' })
|
|
31
|
-
borrower: User;
|
|
32
|
-
|
|
33
|
-
@Column({ nullable: true })
|
|
34
|
-
borrowerId: number;
|
|
35
|
-
|
|
36
|
-
@Column({ type: 'double precision', nullable: true })
|
|
37
|
-
principal: number;
|
|
38
|
-
|
|
39
|
-
@Column({ type: 'double precision', nullable: true })
|
|
40
|
-
downPayment: number;
|
|
41
|
-
|
|
42
|
-
@Column({ type: 'int', nullable: true })
|
|
43
|
-
termMonths: number;
|
|
44
|
-
|
|
45
|
-
@Column({ type: 'double precision', nullable: true })
|
|
46
|
-
interestRate: number;
|
|
47
|
-
|
|
48
|
-
@Column({ type: 'double precision', nullable: true })
|
|
49
|
-
monthlyPayment: number;
|
|
50
|
-
|
|
51
|
-
@Column({ type: 'enum', enum: MortgageStatus, default: MortgageStatus.DRAFT })
|
|
52
|
-
status: MortgageStatus;
|
|
53
|
-
|
|
54
|
-
// FSM State - Primary state tracking
|
|
55
|
-
@Column({ type: 'varchar', default: MortgageState.DRAFT })
|
|
56
|
-
state: string; // Using string to store MortgageState enum values
|
|
57
|
-
|
|
58
|
-
// FSM Metadata - Stores transition history and context
|
|
59
|
-
@Column({ type: 'text', nullable: true })
|
|
60
|
-
stateMetadata: string; // JSON string containing last transition info
|
|
61
|
-
|
|
62
|
-
@OneToMany(() => MortgageDocument, (doc) => doc.mortgage)
|
|
63
|
-
documents: MortgageDocument[];
|
|
64
|
-
|
|
65
|
-
@OneToMany(() => MortgageStep, (step) => step.mortgage, { cascade: true })
|
|
66
|
-
steps: MortgageStep[];
|
|
67
|
-
|
|
68
|
-
@ManyToOne(() => MortgageType, { nullable: true })
|
|
69
|
-
@JoinColumn({ name: 'mortgage_type_id' })
|
|
70
|
-
mortgageType: MortgageType;
|
|
71
|
-
|
|
72
|
-
@Column({ nullable: true })
|
|
73
|
-
mortgageTypeId: number;
|
|
74
|
-
|
|
75
|
-
@Column({ type: 'timestamp', nullable: true })
|
|
76
|
-
lastReminderSentAt: Date;
|
|
77
|
-
|
|
78
|
-
@OneToOne(() => MortgageDownpaymentPlan, { nullable: true })
|
|
79
|
-
@JoinColumn({ name: 'downpayment_plan_id' })
|
|
80
|
-
downpaymentPlan: MortgageDownpaymentPlan;
|
|
81
|
-
|
|
82
|
-
@Column({ nullable: true })
|
|
83
|
-
downpaymentPlanId: number;
|
|
84
|
-
|
|
85
|
-
@Column({ type: 'double precision', nullable: true })
|
|
86
|
-
downPaymentPaid: number;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export default Mortgage;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Column, DeleteDateColumn, Entity, JoinColumn, OneToOne } from 'typeorm';
|
|
2
|
-
import { User } from './user.entity';
|
|
3
|
-
import { BaseEntity } from './BaseEntity';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'password_reset_token' })
|
|
6
|
-
export class PasswordResetToken extends BaseEntity {
|
|
7
|
-
@OneToOne(() => User, {
|
|
8
|
-
//eager: true,
|
|
9
|
-
onDelete: 'CASCADE',
|
|
10
|
-
onUpdate: 'CASCADE',
|
|
11
|
-
})
|
|
12
|
-
@JoinColumn({ name: 'user_id' })
|
|
13
|
-
user: User;
|
|
14
|
-
|
|
15
|
-
@Column({
|
|
16
|
-
nullable: true
|
|
17
|
-
})
|
|
18
|
-
tokenHash: string
|
|
19
|
-
|
|
20
|
-
@DeleteDateColumn({
|
|
21
|
-
nullable: true,
|
|
22
|
-
default: null
|
|
23
|
-
})
|
|
24
|
-
expiresAt: Date;
|
|
25
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, ManyToMany } from 'typeorm';
|
|
2
|
-
import { BaseEntity } from './BaseEntity';
|
|
3
|
-
import { Role } from './role.entity';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'permissions' })
|
|
6
|
-
export class Permission extends BaseEntity {
|
|
7
|
-
@Column({ type: 'varchar', nullable: true })
|
|
8
|
-
name: string;
|
|
9
|
-
|
|
10
|
-
@ManyToMany(() => Role, role => role.permissions)
|
|
11
|
-
roles: Role[]
|
|
12
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Column,
|
|
3
|
-
Entity,
|
|
4
|
-
JoinColumn,
|
|
5
|
-
ManyToOne,
|
|
6
|
-
} from 'typeorm';
|
|
7
|
-
import { Property } from './property.entity';
|
|
8
|
-
import { AbstractBaseDocumentEntity } from './common.entity';
|
|
9
|
-
|
|
10
|
-
@Entity({ name: 'property-document' })
|
|
11
|
-
export class PropertyDocument extends AbstractBaseDocumentEntity {
|
|
12
|
-
@ManyToOne(() => Property, (property) => property.documents, {
|
|
13
|
-
onDelete: 'CASCADE',
|
|
14
|
-
onUpdate: 'CASCADE',
|
|
15
|
-
})
|
|
16
|
-
@JoinColumn({ name: 'property_id' })
|
|
17
|
-
property: Property;
|
|
18
|
-
|
|
19
|
-
@Column()
|
|
20
|
-
propertyId: number;
|
|
21
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Column,
|
|
3
|
-
Entity,
|
|
4
|
-
JoinColumn,
|
|
5
|
-
ManyToOne,
|
|
6
|
-
} from 'typeorm';
|
|
7
|
-
import { Property } from './property.entity';
|
|
8
|
-
import { AbstractBaseMediaEntity } from './common.entity';
|
|
9
|
-
|
|
10
|
-
@Entity({ name: 'property_media' })
|
|
11
|
-
export class PropertyMedia extends AbstractBaseMediaEntity {
|
|
12
|
-
@ManyToOne(() => Property, (property) => property.media, {
|
|
13
|
-
onDelete: 'CASCADE',
|
|
14
|
-
onUpdate: 'CASCADE',
|
|
15
|
-
})
|
|
16
|
-
@JoinColumn({ name: 'property_id' })
|
|
17
|
-
property: Property;
|
|
18
|
-
|
|
19
|
-
@Column({
|
|
20
|
-
nullable: false
|
|
21
|
-
})
|
|
22
|
-
propertyId: number
|
|
23
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, OneToMany, OneToOne } from 'typeorm';
|
|
2
|
-
import { PropertyDocument } from './property-document.entity';
|
|
3
|
-
import { PropertyMedia } from './property-media.entity';
|
|
4
|
-
import { User } from './user.entity';
|
|
5
|
-
import { Amenity } from './amenity.entity';
|
|
6
|
-
import { AbstractBaseReviewableEntity } from './common.entity';
|
|
7
|
-
import { Mortgage } from './mortgage.entity';
|
|
8
|
-
import { PropertyStatus, PropertyType } from '../types/property.type';
|
|
9
|
-
import { Currency, PropertyCategory } from '../types/social.enums';
|
|
10
|
-
|
|
11
|
-
@Entity({ name: 'property' })
|
|
12
|
-
export class Property extends AbstractBaseReviewableEntity {
|
|
13
|
-
@ManyToOne(() => User, {
|
|
14
|
-
//eager: true,
|
|
15
|
-
onDelete: 'CASCADE',
|
|
16
|
-
onUpdate: 'CASCADE',
|
|
17
|
-
})
|
|
18
|
-
@JoinColumn({ name: 'user_id' })
|
|
19
|
-
user: User;
|
|
20
|
-
|
|
21
|
-
@Column({ nullable: true })
|
|
22
|
-
userId: number;
|
|
23
|
-
|
|
24
|
-
@OneToMany(
|
|
25
|
-
() => PropertyDocument,
|
|
26
|
-
(propertyDocument) => propertyDocument.property,
|
|
27
|
-
)
|
|
28
|
-
documents: PropertyDocument[];
|
|
29
|
-
|
|
30
|
-
@ManyToMany(() => Amenity)
|
|
31
|
-
@JoinTable()
|
|
32
|
-
amenities: Amenity[]
|
|
33
|
-
|
|
34
|
-
@OneToMany(
|
|
35
|
-
() => PropertyMedia,
|
|
36
|
-
(propertyDocument) => propertyDocument.property,
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
media: PropertyMedia[];
|
|
40
|
-
|
|
41
|
-
@OneToMany(() => Mortgage, (mortgage) => mortgage.property)
|
|
42
|
-
mortgages: Mortgage[];
|
|
43
|
-
@OneToOne(() => PropertyMedia, {
|
|
44
|
-
onDelete: 'SET NULL', // prevents FK errors if image is deleted
|
|
45
|
-
onUpdate: 'CASCADE'
|
|
46
|
-
})
|
|
47
|
-
@JoinColumn({ name: 'display_image_id' })
|
|
48
|
-
displayImage: PropertyMedia;
|
|
49
|
-
|
|
50
|
-
@Column({
|
|
51
|
-
nullable: true
|
|
52
|
-
})
|
|
53
|
-
displayImageId: number
|
|
54
|
-
|
|
55
|
-
@Column({ nullable: true })
|
|
56
|
-
title: string;
|
|
57
|
-
|
|
58
|
-
@Column({
|
|
59
|
-
nullable: true,
|
|
60
|
-
type: 'enum',
|
|
61
|
-
enum: PropertyCategory,
|
|
62
|
-
})
|
|
63
|
-
category: PropertyCategory;
|
|
64
|
-
|
|
65
|
-
@Column({
|
|
66
|
-
nullable: true,
|
|
67
|
-
type: 'enum',
|
|
68
|
-
enum: PropertyType
|
|
69
|
-
})
|
|
70
|
-
propertyType: string;
|
|
71
|
-
|
|
72
|
-
@Column({ nullable: true })
|
|
73
|
-
country: string;
|
|
74
|
-
|
|
75
|
-
@Column({
|
|
76
|
-
nullable: true,
|
|
77
|
-
type: 'enum',
|
|
78
|
-
enum: Currency,
|
|
79
|
-
})
|
|
80
|
-
currency: Currency;
|
|
81
|
-
|
|
82
|
-
@Column({ nullable: true })
|
|
83
|
-
city: string;
|
|
84
|
-
|
|
85
|
-
@Column({ nullable: true })
|
|
86
|
-
district: string;
|
|
87
|
-
|
|
88
|
-
@Column({ nullable: true })
|
|
89
|
-
zipCode: string;
|
|
90
|
-
|
|
91
|
-
@Column({ nullable: true })
|
|
92
|
-
streetAddress: string;
|
|
93
|
-
|
|
94
|
-
@Column({ nullable: false })
|
|
95
|
-
nBedrooms: string
|
|
96
|
-
|
|
97
|
-
@Column({ nullable: false })
|
|
98
|
-
nBathrooms: string
|
|
99
|
-
|
|
100
|
-
@Column({ nullable: false })
|
|
101
|
-
nParkingSpots: string
|
|
102
|
-
|
|
103
|
-
@Column({
|
|
104
|
-
type: 'double precision',
|
|
105
|
-
scale: 2,
|
|
106
|
-
precision: 20,
|
|
107
|
-
nullable: true,
|
|
108
|
-
})
|
|
109
|
-
price: number
|
|
110
|
-
|
|
111
|
-
@Column({
|
|
112
|
-
type: 'double precision',
|
|
113
|
-
scale: 2,
|
|
114
|
-
precision: 20,
|
|
115
|
-
nullable: true,
|
|
116
|
-
})
|
|
117
|
-
longitude: number
|
|
118
|
-
|
|
119
|
-
@Column({
|
|
120
|
-
type: 'double precision',
|
|
121
|
-
scale: 2,
|
|
122
|
-
precision: 20,
|
|
123
|
-
nullable: true,
|
|
124
|
-
})
|
|
125
|
-
latitude: number
|
|
126
|
-
|
|
127
|
-
@Column({
|
|
128
|
-
type: 'double precision',
|
|
129
|
-
scale: 2,
|
|
130
|
-
precision: 20,
|
|
131
|
-
nullable: true,
|
|
132
|
-
})
|
|
133
|
-
area: number
|
|
134
|
-
|
|
135
|
-
@Column({
|
|
136
|
-
type: 'text',
|
|
137
|
-
nullable: true
|
|
138
|
-
})
|
|
139
|
-
description: string
|
|
140
|
-
|
|
141
|
-
@Column({
|
|
142
|
-
type: 'enum',
|
|
143
|
-
enum: PropertyStatus,
|
|
144
|
-
default: PropertyStatus.PENDING,
|
|
145
|
-
})
|
|
146
|
-
status: PropertyStatus;
|
|
147
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
|
|
2
|
-
import { BaseEntity } from './BaseEntity';
|
|
3
|
-
import { User } from './user.entity';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'refresh_tokens' })
|
|
6
|
-
export class RefreshToken extends BaseEntity {
|
|
7
|
-
@ManyToOne(() => User, (user) => user.refreshTokens)
|
|
8
|
-
@JoinColumn({ name: 'user_id' })
|
|
9
|
-
user: User;
|
|
10
|
-
|
|
11
|
-
@Column({ nullable: true })
|
|
12
|
-
userId: number;
|
|
13
|
-
|
|
14
|
-
@Column({ nullable: false, type: 'text' })
|
|
15
|
-
token: string;
|
|
16
|
-
}
|
package/entities/role.entity.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, JoinTable, ManyToMany } from 'typeorm';
|
|
2
|
-
import { Permission } from './permission.entity';
|
|
3
|
-
import { User } from './user.entity';
|
|
4
|
-
import { BaseEntity } from './BaseEntity';
|
|
5
|
-
|
|
6
|
-
@Entity({ name: 'roles' })
|
|
7
|
-
export class Role extends BaseEntity {
|
|
8
|
-
@Column({ nullable: true })
|
|
9
|
-
name: string;
|
|
10
|
-
|
|
11
|
-
@ManyToMany(() => Permission, (permission) => permission.roles, {
|
|
12
|
-
onDelete: 'CASCADE',
|
|
13
|
-
eager: true
|
|
14
|
-
})
|
|
15
|
-
@JoinTable()
|
|
16
|
-
permissions: Permission[]
|
|
17
|
-
|
|
18
|
-
@ManyToMany(() => User, (user) => user.roles)
|
|
19
|
-
users: User[]
|
|
20
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
|
|
2
|
-
import { PropertyMedia } from './property-media.entity';
|
|
3
|
-
import { User } from './user.entity';
|
|
4
|
-
import { AbstractBaseReviewableEntity } from './common.entity';
|
|
5
|
-
import { Status } from '../types/common.type';
|
|
6
|
-
|
|
7
|
-
@Entity({ name: 'settings' })
|
|
8
|
-
export class Settings extends AbstractBaseReviewableEntity {
|
|
9
|
-
@ManyToOne(() => User, {
|
|
10
|
-
//eager: true,
|
|
11
|
-
onDelete: 'CASCADE',
|
|
12
|
-
onUpdate: 'CASCADE',
|
|
13
|
-
})
|
|
14
|
-
@JoinColumn({ name: 'created_by' })
|
|
15
|
-
creator: User;
|
|
16
|
-
|
|
17
|
-
@Column({ nullable: true })
|
|
18
|
-
createdBy: number;
|
|
19
|
-
|
|
20
|
-
@OneToMany(
|
|
21
|
-
() => PropertyMedia,
|
|
22
|
-
(PropertyMedia) => PropertyMedia.property,
|
|
23
|
-
)
|
|
24
|
-
media: PropertyMedia[];
|
|
25
|
-
|
|
26
|
-
@Column({ nullable: true })
|
|
27
|
-
title: string;
|
|
28
|
-
|
|
29
|
-
@Column()
|
|
30
|
-
location: string;
|
|
31
|
-
|
|
32
|
-
@Column()
|
|
33
|
-
startTime: Date;
|
|
34
|
-
|
|
35
|
-
@Column()
|
|
36
|
-
endTime: Date;
|
|
37
|
-
|
|
38
|
-
@Column({ default: true })
|
|
39
|
-
isPrivate: boolean;
|
|
40
|
-
|
|
41
|
-
@Column({ nullable: true })
|
|
42
|
-
qrOfflineCode: string;
|
|
43
|
-
|
|
44
|
-
@Column({
|
|
45
|
-
type: 'text',
|
|
46
|
-
nullable: true
|
|
47
|
-
})
|
|
48
|
-
description: string
|
|
49
|
-
|
|
50
|
-
@Column({
|
|
51
|
-
type: 'enum',
|
|
52
|
-
enum: Status,
|
|
53
|
-
default: Status.PENDING,
|
|
54
|
-
})
|
|
55
|
-
status: Status;
|
|
56
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
|
|
2
|
-
import { User } from './user.entity';
|
|
3
|
-
import { AbstractBaseReviewableEntity } from './common.entity';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'social' })
|
|
6
|
-
export class Social extends AbstractBaseReviewableEntity {
|
|
7
|
-
@ManyToOne(() => User, {
|
|
8
|
-
//eager: true,
|
|
9
|
-
onDelete: 'CASCADE',
|
|
10
|
-
onUpdate: 'CASCADE',
|
|
11
|
-
})
|
|
12
|
-
@JoinColumn({ name: 'user_id' })
|
|
13
|
-
user: User;
|
|
14
|
-
|
|
15
|
-
@Column({ nullable: true })
|
|
16
|
-
userId: number;
|
|
17
|
-
|
|
18
|
-
@Column({
|
|
19
|
-
nullable: true,
|
|
20
|
-
})
|
|
21
|
-
brand: string;
|
|
22
|
-
|
|
23
|
-
@Column({
|
|
24
|
-
nullable: true,
|
|
25
|
-
})
|
|
26
|
-
link: string;
|
|
27
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Entity, Column, Index, Unique } from 'typeorm';
|
|
2
|
-
import { BaseEntity } from './BaseEntity';
|
|
3
|
-
import { TenantStatus, TenantPlan } from '../types/tenant.enums';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'tenants' })
|
|
6
|
-
@Unique(['subdomain'])
|
|
7
|
-
@Unique(['domain'])
|
|
8
|
-
export class Tenant extends BaseEntity {
|
|
9
|
-
@Column({ length: 255 })
|
|
10
|
-
name: string;
|
|
11
|
-
|
|
12
|
-
@Column({ length: 100, unique: true })
|
|
13
|
-
@Index()
|
|
14
|
-
subdomain: string; // e.g., 'acme' for acme.yourdomain.com
|
|
15
|
-
|
|
16
|
-
@Column({ length: 255, nullable: true, unique: true })
|
|
17
|
-
domain: string; // Optional custom domain: e.g., 'realestate.acme.com'
|
|
18
|
-
|
|
19
|
-
@Column({ type: 'varchar', default: TenantStatus.ACTIVE })
|
|
20
|
-
status: TenantStatus;
|
|
21
|
-
|
|
22
|
-
@Column({ type: 'varchar', default: TenantPlan.FREE })
|
|
23
|
-
plan: TenantPlan;
|
|
24
|
-
|
|
25
|
-
@Column({ type: 'json', nullable: true })
|
|
26
|
-
config: {
|
|
27
|
-
maxUsers?: number;
|
|
28
|
-
maxProperties?: number;
|
|
29
|
-
features?: string[];
|
|
30
|
-
customBranding?: {
|
|
31
|
-
logo?: string;
|
|
32
|
-
primaryColor?: string;
|
|
33
|
-
secondaryColor?: string;
|
|
34
|
-
};
|
|
35
|
-
[key: string]: any;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
@Column({ type: 'json', nullable: true })
|
|
39
|
-
metadata: any; // Additional tenant-specific metadata
|
|
40
|
-
|
|
41
|
-
@Column({ type: 'timestamp', nullable: true })
|
|
42
|
-
trialEndsAt: Date;
|
|
43
|
-
|
|
44
|
-
@Column({ type: 'timestamp', nullable: true })
|
|
45
|
-
subscriptionEndsAt: Date;
|
|
46
|
-
|
|
47
|
-
// Contact information
|
|
48
|
-
@Column({ length: 255, nullable: true })
|
|
49
|
-
contactEmail: string;
|
|
50
|
-
|
|
51
|
-
@Column({ length: 50, nullable: true })
|
|
52
|
-
contactPhone: string;
|
|
53
|
-
|
|
54
|
-
// Database strategy (for future use if migrating to separate databases per tenant)
|
|
55
|
-
@Column({ type: 'varchar', default: 'shared' })
|
|
56
|
-
databaseStrategy: 'shared' | 'isolated';
|
|
57
|
-
|
|
58
|
-
@Column({ length: 255, nullable: true })
|
|
59
|
-
databaseHost: string;
|
|
60
|
-
|
|
61
|
-
@Column({ length: 100, nullable: true })
|
|
62
|
-
databaseName: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default Tenant;
|