@tomei/rental 0.11.1 → 0.11.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/.commitlintrc.json +22 -22
- package/.eslintrc +16 -16
- package/.eslintrc.js +35 -35
- package/.gitlab-ci.yml +16 -16
- package/.husky/commit-msg +15 -15
- package/.husky/pre-commit +7 -7
- package/.prettierrc +4 -4
- package/Jenkinsfile +51 -51
- package/README.md +8 -8
- package/dist/src/components/booking/booking.d.ts +2 -0
- package/dist/src/components/booking/booking.js +25 -0
- package/dist/src/components/booking/booking.js.map +1 -1
- package/dist/src/components/rental/rental.js +22 -17
- package/dist/src/components/rental/rental.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jest.config.js +10 -10
- package/migrations/booking-table-migration.js +79 -79
- package/migrations/joint-hirer-table-migration.js +52 -52
- package/migrations/rental-aggrement-table-migration.js +30 -30
- package/migrations/rental-price-table-migration.js +32 -32
- package/migrations/rental-table-migrations.js +96 -96
- package/package.json +75 -75
- package/sonar-project.properties +12 -12
- package/src/components/agreement/agreement.repository.ts +54 -54
- package/src/components/agreement/agreement.ts +49 -49
- package/src/components/booking/booking.repository.ts +51 -51
- package/src/components/booking/booking.ts +396 -343
- package/src/components/joint-hirer/joint-hirer.repository.ts +54 -54
- package/src/components/rental/rental.repository.ts +51 -51
- package/src/components/rental/rental.ts +966 -961
- package/src/components/rental-price/rental-price.repository.ts +54 -54
- package/src/components/rental-price/rental-price.ts +100 -100
- package/src/database.ts +27 -27
- package/src/enum/account-type.enum.ts +4 -4
- package/src/enum/booking.enum.ts +5 -5
- package/src/enum/index.ts +11 -11
- package/src/enum/rental-status.enum.ts +39 -39
- package/src/index.ts +28 -28
- package/src/interfaces/agreement-attr.interface.ts +7 -7
- package/src/interfaces/booking-attr.interface.ts +19 -19
- package/src/interfaces/booking-find-all-search-attr.interface.ts +12 -12
- package/src/interfaces/index.ts +15 -15
- package/src/interfaces/joint-hirer-attr.interface.ts +10 -10
- package/src/interfaces/rental-attr.interface.ts +25 -25
- package/src/interfaces/rental-find-all-search-attr.interface.ts +11 -11
- package/src/interfaces/rental-price-attr.interface.ts +7 -7
- package/src/models/agreement.entity.ts +39 -39
- package/src/models/booking.entity.ts +105 -105
- package/src/models/index.ts +13 -13
- package/src/models/joint-hirer.entity.ts +63 -63
- package/src/models/rental-price.entity.ts +38 -38
- package/src/models/rental.entity.ts +133 -133
- package/tsconfig.build.json +5 -5
- package/tsconfig.json +23 -23
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
|
-
import { RentalPriceModel } from '../../models/rental-price.entity';
|
|
3
|
-
|
|
4
|
-
export class RentalPriceRepository
|
|
5
|
-
extends RepositoryBase<RentalPriceModel>
|
|
6
|
-
implements IRepositoryBase<RentalPriceModel>
|
|
7
|
-
{
|
|
8
|
-
constructor() {
|
|
9
|
-
super(RentalPriceModel);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async findByPk(
|
|
13
|
-
id: string,
|
|
14
|
-
transaction?: any,
|
|
15
|
-
): Promise<RentalPriceModel | null> {
|
|
16
|
-
try {
|
|
17
|
-
const result = await RentalPriceModel.findByPk(id, {
|
|
18
|
-
transaction: transaction,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
return result;
|
|
22
|
-
} catch (error) {
|
|
23
|
-
throw new Error(`An Error occured when fetching : ${error.message}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async delete(RentalPriceId: string, dbTransaction?: any) {
|
|
28
|
-
try {
|
|
29
|
-
const options = {
|
|
30
|
-
where: {
|
|
31
|
-
RentalPriceId: RentalPriceId,
|
|
32
|
-
},
|
|
33
|
-
transaction: dbTransaction,
|
|
34
|
-
};
|
|
35
|
-
await RentalPriceModel.destroy(options);
|
|
36
|
-
} catch (error) {
|
|
37
|
-
throw new Error(`An Error occured when delete : ${error.message}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async findAndCountAll(options?: any) {
|
|
42
|
-
try {
|
|
43
|
-
let RentalPrices: any;
|
|
44
|
-
if (options) {
|
|
45
|
-
RentalPrices = await RentalPriceModel.findAndCountAll(options);
|
|
46
|
-
} else {
|
|
47
|
-
RentalPrices = await RentalPriceModel.findAndCountAll();
|
|
48
|
-
}
|
|
49
|
-
return RentalPrices;
|
|
50
|
-
} catch (error) {
|
|
51
|
-
throw new Error(`An Error occured when retriving : ${error.message}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
|
+
import { RentalPriceModel } from '../../models/rental-price.entity';
|
|
3
|
+
|
|
4
|
+
export class RentalPriceRepository
|
|
5
|
+
extends RepositoryBase<RentalPriceModel>
|
|
6
|
+
implements IRepositoryBase<RentalPriceModel>
|
|
7
|
+
{
|
|
8
|
+
constructor() {
|
|
9
|
+
super(RentalPriceModel);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async findByPk(
|
|
13
|
+
id: string,
|
|
14
|
+
transaction?: any,
|
|
15
|
+
): Promise<RentalPriceModel | null> {
|
|
16
|
+
try {
|
|
17
|
+
const result = await RentalPriceModel.findByPk(id, {
|
|
18
|
+
transaction: transaction,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return result;
|
|
22
|
+
} catch (error) {
|
|
23
|
+
throw new Error(`An Error occured when fetching : ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async delete(RentalPriceId: string, dbTransaction?: any) {
|
|
28
|
+
try {
|
|
29
|
+
const options = {
|
|
30
|
+
where: {
|
|
31
|
+
RentalPriceId: RentalPriceId,
|
|
32
|
+
},
|
|
33
|
+
transaction: dbTransaction,
|
|
34
|
+
};
|
|
35
|
+
await RentalPriceModel.destroy(options);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
throw new Error(`An Error occured when delete : ${error.message}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async findAndCountAll(options?: any) {
|
|
42
|
+
try {
|
|
43
|
+
let RentalPrices: any;
|
|
44
|
+
if (options) {
|
|
45
|
+
RentalPrices = await RentalPriceModel.findAndCountAll(options);
|
|
46
|
+
} else {
|
|
47
|
+
RentalPrices = await RentalPriceModel.findAndCountAll();
|
|
48
|
+
}
|
|
49
|
+
return RentalPrices;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
throw new Error(`An Error occured when retriving : ${error.message}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { ClassError, ObjectBase } from '@tomei/general';
|
|
2
|
-
import { RentalPriceRepository } from './rental-price.repository';
|
|
3
|
-
import { IRentalPriceAttr } from '../../interfaces/rental-price-attr.interface';
|
|
4
|
-
import { LoginUser } from '@tomei/sso';
|
|
5
|
-
import { ApplicationConfig } from '@tomei/config';
|
|
6
|
-
|
|
7
|
-
export class RentalPrice extends ObjectBase {
|
|
8
|
-
ObjectId: string;
|
|
9
|
-
ObjectName: string;
|
|
10
|
-
ObjectType = 'RentalPrice';
|
|
11
|
-
TableName: string;
|
|
12
|
-
RetailPrice: number;
|
|
13
|
-
Currency: string;
|
|
14
|
-
PromoCode: string;
|
|
15
|
-
Remarks: string;
|
|
16
|
-
|
|
17
|
-
get PriceId() {
|
|
18
|
-
return this.ObjectId;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
set PriceId(value: string) {
|
|
22
|
-
this.ObjectId = value;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
private static _Repo = new RentalPriceRepository();
|
|
26
|
-
|
|
27
|
-
private constructor(rentalPriceAttr?: IRentalPriceAttr) {
|
|
28
|
-
super();
|
|
29
|
-
if (rentalPriceAttr) {
|
|
30
|
-
this.PriceId = rentalPriceAttr.PriceId;
|
|
31
|
-
this.RetailPrice = rentalPriceAttr.RetailPrice;
|
|
32
|
-
this.Currency = rentalPriceAttr.Currency;
|
|
33
|
-
this.PromoCode = rentalPriceAttr.PromoCode;
|
|
34
|
-
this.Remarks = rentalPriceAttr.Remarks;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public static async init(dbTransaction?: any, priceId?: string) {
|
|
39
|
-
try {
|
|
40
|
-
if (priceId) {
|
|
41
|
-
const rentalPrice = await RentalPrice._Repo.findByPk(
|
|
42
|
-
priceId,
|
|
43
|
-
dbTransaction,
|
|
44
|
-
);
|
|
45
|
-
if (rentalPrice) {
|
|
46
|
-
return new RentalPrice(rentalPrice);
|
|
47
|
-
} else {
|
|
48
|
-
throw new ClassError(
|
|
49
|
-
'RentalPrice',
|
|
50
|
-
'RentalPriceErrMsg',
|
|
51
|
-
'RentalPrice Not Found',
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return new RentalPrice();
|
|
56
|
-
} catch (error) {
|
|
57
|
-
throw new ClassError(
|
|
58
|
-
'RentalPrice',
|
|
59
|
-
'RentalPriceErrMsg',
|
|
60
|
-
'Failed To Initialize RentalPrice',
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public async create(loginUser: LoginUser, dbTransaction?: any) {
|
|
66
|
-
try {
|
|
67
|
-
const systemCode =
|
|
68
|
-
ApplicationConfig.getComponentConfigValue('system-code');
|
|
69
|
-
const isPrivileged = await loginUser.checkPrivileges(
|
|
70
|
-
systemCode,
|
|
71
|
-
'Rental - Create',
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
if (!isPrivileged) {
|
|
75
|
-
throw new ClassError(
|
|
76
|
-
'RentalPrice',
|
|
77
|
-
'RentalPriceErrMsg01',
|
|
78
|
-
"You do not have 'Rental - Create' privilege.",
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
this.PriceId = this.createId();
|
|
83
|
-
|
|
84
|
-
await RentalPrice._Repo.create(
|
|
85
|
-
{
|
|
86
|
-
PriceId: this.PriceId,
|
|
87
|
-
RetailPrice: this.RetailPrice,
|
|
88
|
-
Currency: this.Currency,
|
|
89
|
-
PromoCode: this.PromoCode,
|
|
90
|
-
Remarks: this.Remarks,
|
|
91
|
-
},
|
|
92
|
-
dbTransaction,
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
return this;
|
|
96
|
-
} catch (error) {
|
|
97
|
-
throw error;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
1
|
+
import { ClassError, ObjectBase } from '@tomei/general';
|
|
2
|
+
import { RentalPriceRepository } from './rental-price.repository';
|
|
3
|
+
import { IRentalPriceAttr } from '../../interfaces/rental-price-attr.interface';
|
|
4
|
+
import { LoginUser } from '@tomei/sso';
|
|
5
|
+
import { ApplicationConfig } from '@tomei/config';
|
|
6
|
+
|
|
7
|
+
export class RentalPrice extends ObjectBase {
|
|
8
|
+
ObjectId: string;
|
|
9
|
+
ObjectName: string;
|
|
10
|
+
ObjectType = 'RentalPrice';
|
|
11
|
+
TableName: string;
|
|
12
|
+
RetailPrice: number;
|
|
13
|
+
Currency: string;
|
|
14
|
+
PromoCode: string;
|
|
15
|
+
Remarks: string;
|
|
16
|
+
|
|
17
|
+
get PriceId() {
|
|
18
|
+
return this.ObjectId;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
set PriceId(value: string) {
|
|
22
|
+
this.ObjectId = value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private static _Repo = new RentalPriceRepository();
|
|
26
|
+
|
|
27
|
+
private constructor(rentalPriceAttr?: IRentalPriceAttr) {
|
|
28
|
+
super();
|
|
29
|
+
if (rentalPriceAttr) {
|
|
30
|
+
this.PriceId = rentalPriceAttr.PriceId;
|
|
31
|
+
this.RetailPrice = rentalPriceAttr.RetailPrice;
|
|
32
|
+
this.Currency = rentalPriceAttr.Currency;
|
|
33
|
+
this.PromoCode = rentalPriceAttr.PromoCode;
|
|
34
|
+
this.Remarks = rentalPriceAttr.Remarks;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static async init(dbTransaction?: any, priceId?: string) {
|
|
39
|
+
try {
|
|
40
|
+
if (priceId) {
|
|
41
|
+
const rentalPrice = await RentalPrice._Repo.findByPk(
|
|
42
|
+
priceId,
|
|
43
|
+
dbTransaction,
|
|
44
|
+
);
|
|
45
|
+
if (rentalPrice) {
|
|
46
|
+
return new RentalPrice(rentalPrice);
|
|
47
|
+
} else {
|
|
48
|
+
throw new ClassError(
|
|
49
|
+
'RentalPrice',
|
|
50
|
+
'RentalPriceErrMsg',
|
|
51
|
+
'RentalPrice Not Found',
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return new RentalPrice();
|
|
56
|
+
} catch (error) {
|
|
57
|
+
throw new ClassError(
|
|
58
|
+
'RentalPrice',
|
|
59
|
+
'RentalPriceErrMsg',
|
|
60
|
+
'Failed To Initialize RentalPrice',
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public async create(loginUser: LoginUser, dbTransaction?: any) {
|
|
66
|
+
try {
|
|
67
|
+
const systemCode =
|
|
68
|
+
ApplicationConfig.getComponentConfigValue('system-code');
|
|
69
|
+
const isPrivileged = await loginUser.checkPrivileges(
|
|
70
|
+
systemCode,
|
|
71
|
+
'Rental - Create',
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
if (!isPrivileged) {
|
|
75
|
+
throw new ClassError(
|
|
76
|
+
'RentalPrice',
|
|
77
|
+
'RentalPriceErrMsg01',
|
|
78
|
+
"You do not have 'Rental - Create' privilege.",
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this.PriceId = this.createId();
|
|
83
|
+
|
|
84
|
+
await RentalPrice._Repo.create(
|
|
85
|
+
{
|
|
86
|
+
PriceId: this.PriceId,
|
|
87
|
+
RetailPrice: this.RetailPrice,
|
|
88
|
+
Currency: this.Currency,
|
|
89
|
+
PromoCode: this.PromoCode,
|
|
90
|
+
Remarks: this.Remarks,
|
|
91
|
+
},
|
|
92
|
+
dbTransaction,
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
return this;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
package/src/database.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { Sequelize, SequelizeOptions } from 'sequelize-typescript';
|
|
2
|
-
import { RentalModel } from './models/rental.entity';
|
|
3
|
-
import { RentalPriceModel } from './models/rental-price.entity';
|
|
4
|
-
import { BookingModel } from './models/booking.entity';
|
|
5
|
-
import { JointHirerModel } from './models/joint-hirer.entity';
|
|
6
|
-
import { AgreementModel } from './models/agreement.entity';
|
|
7
|
-
|
|
8
|
-
let sequelize: Sequelize;
|
|
9
|
-
|
|
10
|
-
function init(sequelizeOptions: SequelizeOptions) {
|
|
11
|
-
sequelize = new Sequelize(sequelizeOptions);
|
|
12
|
-
|
|
13
|
-
sequelize.addModels([
|
|
14
|
-
// Add your models here
|
|
15
|
-
RentalModel,
|
|
16
|
-
RentalPriceModel,
|
|
17
|
-
BookingModel,
|
|
18
|
-
JointHirerModel,
|
|
19
|
-
AgreementModel,
|
|
20
|
-
]);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function getConnection() {
|
|
24
|
-
return sequelize;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export { init, getConnection };
|
|
1
|
+
import { Sequelize, SequelizeOptions } from 'sequelize-typescript';
|
|
2
|
+
import { RentalModel } from './models/rental.entity';
|
|
3
|
+
import { RentalPriceModel } from './models/rental-price.entity';
|
|
4
|
+
import { BookingModel } from './models/booking.entity';
|
|
5
|
+
import { JointHirerModel } from './models/joint-hirer.entity';
|
|
6
|
+
import { AgreementModel } from './models/agreement.entity';
|
|
7
|
+
|
|
8
|
+
let sequelize: Sequelize;
|
|
9
|
+
|
|
10
|
+
function init(sequelizeOptions: SequelizeOptions) {
|
|
11
|
+
sequelize = new Sequelize(sequelizeOptions);
|
|
12
|
+
|
|
13
|
+
sequelize.addModels([
|
|
14
|
+
// Add your models here
|
|
15
|
+
RentalModel,
|
|
16
|
+
RentalPriceModel,
|
|
17
|
+
BookingModel,
|
|
18
|
+
JointHirerModel,
|
|
19
|
+
AgreementModel,
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getConnection() {
|
|
24
|
+
return sequelize;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { init, getConnection };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export enum RentalAccountTypeEnum {
|
|
2
|
-
SINGLE = 'Single',
|
|
3
|
-
JOINT = 'Joint',
|
|
4
|
-
}
|
|
1
|
+
export enum RentalAccountTypeEnum {
|
|
2
|
+
SINGLE = 'Single',
|
|
3
|
+
JOINT = 'Joint',
|
|
4
|
+
}
|
package/src/enum/booking.enum.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export enum BookingStatusEnum {
|
|
2
|
-
CONFIRMED = 'Confirmed',
|
|
3
|
-
PENDING = 'Pending',
|
|
4
|
-
CANCELLED = 'Cancelled',
|
|
5
|
-
}
|
|
1
|
+
export enum BookingStatusEnum {
|
|
2
|
+
CONFIRMED = 'Confirmed',
|
|
3
|
+
PENDING = 'Pending',
|
|
4
|
+
CANCELLED = 'Cancelled',
|
|
5
|
+
}
|
package/src/enum/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { RentalStatusEnum } from './rental-status.enum';
|
|
2
|
-
import { BookingStatusEnum } from './booking.enum';
|
|
3
|
-
import { RentalAccountTypeEnum } from './account-type.enum';
|
|
4
|
-
import { AggrementStatusEnum } from './aggrement-status.enum';
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
RentalStatusEnum,
|
|
8
|
-
BookingStatusEnum,
|
|
9
|
-
RentalAccountTypeEnum,
|
|
10
|
-
AggrementStatusEnum,
|
|
11
|
-
};
|
|
1
|
+
import { RentalStatusEnum } from './rental-status.enum';
|
|
2
|
+
import { BookingStatusEnum } from './booking.enum';
|
|
3
|
+
import { RentalAccountTypeEnum } from './account-type.enum';
|
|
4
|
+
import { AggrementStatusEnum } from './aggrement-status.enum';
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
RentalStatusEnum,
|
|
8
|
+
BookingStatusEnum,
|
|
9
|
+
RentalAccountTypeEnum,
|
|
10
|
+
AggrementStatusEnum,
|
|
11
|
+
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enum representing the status of a rental.
|
|
3
|
-
*/
|
|
4
|
-
export enum RentalStatusEnum {
|
|
5
|
-
/**
|
|
6
|
-
* Customer confirmed a rental, but rental period hasn't started.
|
|
7
|
-
*/
|
|
8
|
-
RESERVED = 'Reserved',
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Customer already paid, and the rental period has started.
|
|
12
|
-
*/
|
|
13
|
-
ACTIVE = 'Active',
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Rental is suspended because of a reason by the system.
|
|
17
|
-
*/
|
|
18
|
-
SUSPENDED = 'Suspended',
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Rental has been cancelled by the customer.
|
|
22
|
-
*/
|
|
23
|
-
CANCELLED = 'Cancelled',
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Rental has been terminated by the customer.
|
|
27
|
-
*/
|
|
28
|
-
TERMINATED = 'Terminated',
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Customer is pending signing rental agreement
|
|
32
|
-
*/
|
|
33
|
-
PENDING_SIGNING = 'Pending Signing',
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Customer already signed and now needs to collect the rental key.
|
|
37
|
-
*/
|
|
38
|
-
PENDING_KEY_COLLECTION = 'Pending Key Collection',
|
|
39
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing the status of a rental.
|
|
3
|
+
*/
|
|
4
|
+
export enum RentalStatusEnum {
|
|
5
|
+
/**
|
|
6
|
+
* Customer confirmed a rental, but rental period hasn't started.
|
|
7
|
+
*/
|
|
8
|
+
RESERVED = 'Reserved',
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Customer already paid, and the rental period has started.
|
|
12
|
+
*/
|
|
13
|
+
ACTIVE = 'Active',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Rental is suspended because of a reason by the system.
|
|
17
|
+
*/
|
|
18
|
+
SUSPENDED = 'Suspended',
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Rental has been cancelled by the customer.
|
|
22
|
+
*/
|
|
23
|
+
CANCELLED = 'Cancelled',
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Rental has been terminated by the customer.
|
|
27
|
+
*/
|
|
28
|
+
TERMINATED = 'Terminated',
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Customer is pending signing rental agreement
|
|
32
|
+
*/
|
|
33
|
+
PENDING_SIGNING = 'Pending Signing',
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Customer already signed and now needs to collect the rental key.
|
|
37
|
+
*/
|
|
38
|
+
PENDING_KEY_COLLECTION = 'Pending Key Collection',
|
|
39
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { RentalPriceRepository } from './components/rental-price/rental-price.repository';
|
|
2
|
-
import { RentalRepository } from './components/rental/rental.repository';
|
|
3
|
-
import { Rental } from './components/rental/rental';
|
|
4
|
-
import { RentalPrice } from './components/rental-price/rental-price';
|
|
5
|
-
import { Booking } from './components/booking/booking';
|
|
6
|
-
import { BookingRepository } from './components/booking/booking.repository';
|
|
7
|
-
import { JointHirer } from './components/joint-hirer/joint-hirer';
|
|
8
|
-
import { JointHirerRepository } from './components/joint-hirer/joint-hirer.repository';
|
|
9
|
-
import { Agreement } from './components/agreement/agreement';
|
|
10
|
-
import { AgreementRepository } from './components/agreement/agreement.repository';
|
|
11
|
-
import * as rentalDb from './database';
|
|
12
|
-
export * from './interfaces';
|
|
13
|
-
export * from './models';
|
|
14
|
-
export * from './enum';
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
Rental,
|
|
18
|
-
RentalPrice,
|
|
19
|
-
RentalRepository,
|
|
20
|
-
RentalPriceRepository,
|
|
21
|
-
Booking,
|
|
22
|
-
BookingRepository,
|
|
23
|
-
rentalDb,
|
|
24
|
-
JointHirer,
|
|
25
|
-
JointHirerRepository,
|
|
26
|
-
Agreement,
|
|
27
|
-
AgreementRepository,
|
|
28
|
-
};
|
|
1
|
+
import { RentalPriceRepository } from './components/rental-price/rental-price.repository';
|
|
2
|
+
import { RentalRepository } from './components/rental/rental.repository';
|
|
3
|
+
import { Rental } from './components/rental/rental';
|
|
4
|
+
import { RentalPrice } from './components/rental-price/rental-price';
|
|
5
|
+
import { Booking } from './components/booking/booking';
|
|
6
|
+
import { BookingRepository } from './components/booking/booking.repository';
|
|
7
|
+
import { JointHirer } from './components/joint-hirer/joint-hirer';
|
|
8
|
+
import { JointHirerRepository } from './components/joint-hirer/joint-hirer.repository';
|
|
9
|
+
import { Agreement } from './components/agreement/agreement';
|
|
10
|
+
import { AgreementRepository } from './components/agreement/agreement.repository';
|
|
11
|
+
import * as rentalDb from './database';
|
|
12
|
+
export * from './interfaces';
|
|
13
|
+
export * from './models';
|
|
14
|
+
export * from './enum';
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
Rental,
|
|
18
|
+
RentalPrice,
|
|
19
|
+
RentalRepository,
|
|
20
|
+
RentalPriceRepository,
|
|
21
|
+
Booking,
|
|
22
|
+
BookingRepository,
|
|
23
|
+
rentalDb,
|
|
24
|
+
JointHirer,
|
|
25
|
+
JointHirerRepository,
|
|
26
|
+
Agreement,
|
|
27
|
+
AgreementRepository,
|
|
28
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AggrementStatusEnum } from '../enum/aggrement-status.enum';
|
|
2
|
-
export interface IAgreementAttr {
|
|
3
|
-
AgreementNo: string;
|
|
4
|
-
Status: AggrementStatusEnum;
|
|
5
|
-
DateSigned?: Date;
|
|
6
|
-
MediaId?: string;
|
|
7
|
-
}
|
|
1
|
+
import { AggrementStatusEnum } from '../enum/aggrement-status.enum';
|
|
2
|
+
export interface IAgreementAttr {
|
|
3
|
+
AgreementNo: string;
|
|
4
|
+
Status: AggrementStatusEnum;
|
|
5
|
+
DateSigned?: Date;
|
|
6
|
+
MediaId?: string;
|
|
7
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { BookingStatusEnum } from '../enum/booking.enum';
|
|
2
|
-
|
|
3
|
-
export interface IBookingAttr {
|
|
4
|
-
BookingNo: string;
|
|
5
|
-
CustomerId: string;
|
|
6
|
-
CustomerType: string;
|
|
7
|
-
ItemId: string;
|
|
8
|
-
ItemType: string;
|
|
9
|
-
PriceId: string;
|
|
10
|
-
ScheduledStartDateTime: Date;
|
|
11
|
-
ScheduledEndDateTime: Date;
|
|
12
|
-
BookingFee: number;
|
|
13
|
-
Status: BookingStatusEnum;
|
|
14
|
-
CancelRemarks: string;
|
|
15
|
-
CreatedById: string;
|
|
16
|
-
CreatedAt: Date;
|
|
17
|
-
UpdatedById: string;
|
|
18
|
-
UpdatedAt: Date;
|
|
19
|
-
}
|
|
1
|
+
import { BookingStatusEnum } from '../enum/booking.enum';
|
|
2
|
+
|
|
3
|
+
export interface IBookingAttr {
|
|
4
|
+
BookingNo: string;
|
|
5
|
+
CustomerId: string;
|
|
6
|
+
CustomerType: string;
|
|
7
|
+
ItemId: string;
|
|
8
|
+
ItemType: string;
|
|
9
|
+
PriceId: string;
|
|
10
|
+
ScheduledStartDateTime: Date;
|
|
11
|
+
ScheduledEndDateTime: Date;
|
|
12
|
+
BookingFee: number;
|
|
13
|
+
Status: BookingStatusEnum;
|
|
14
|
+
CancelRemarks: string;
|
|
15
|
+
CreatedById: string;
|
|
16
|
+
CreatedAt: Date;
|
|
17
|
+
UpdatedById: string;
|
|
18
|
+
UpdatedAt: Date;
|
|
19
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export interface IBookingFindAllSearchAttr {
|
|
2
|
-
BookingNo?: string;
|
|
3
|
-
CustomerId?: string;
|
|
4
|
-
CustomerType?: string;
|
|
5
|
-
ItemId?: string;
|
|
6
|
-
ItemType?: string;
|
|
7
|
-
PriceId?: string;
|
|
8
|
-
ScheduledStartDateTime?: Date;
|
|
9
|
-
ScheduledEndDateTime?: Date;
|
|
10
|
-
BookingFee?: number;
|
|
11
|
-
Status?: string;
|
|
12
|
-
}
|
|
1
|
+
export interface IBookingFindAllSearchAttr {
|
|
2
|
+
BookingNo?: string;
|
|
3
|
+
CustomerId?: string;
|
|
4
|
+
CustomerType?: string;
|
|
5
|
+
ItemId?: string;
|
|
6
|
+
ItemType?: string;
|
|
7
|
+
PriceId?: string;
|
|
8
|
+
ScheduledStartDateTime?: Date;
|
|
9
|
+
ScheduledEndDateTime?: Date;
|
|
10
|
+
BookingFee?: number;
|
|
11
|
+
Status?: string;
|
|
12
|
+
}
|
package/src/interfaces/index.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { IRentalAttr } from './rental-attr.interface';
|
|
2
|
-
import { IRentalPriceAttr } from './rental-price-attr.interface';
|
|
3
|
-
import { IRentalFindAllSearchAttr } from './rental-find-all-search-attr.interface';
|
|
4
|
-
import { IBookingAttr } from './booking-attr.interface';
|
|
5
|
-
import { IAgreementAttr } from './agreement-attr.interface';
|
|
6
|
-
import { IBookingFindAllSearchAttr } from './booking-find-all-search-attr.interface';
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
IRentalAttr,
|
|
10
|
-
IRentalPriceAttr,
|
|
11
|
-
IRentalFindAllSearchAttr,
|
|
12
|
-
IBookingAttr,
|
|
13
|
-
IAgreementAttr,
|
|
14
|
-
IBookingFindAllSearchAttr,
|
|
15
|
-
};
|
|
1
|
+
import { IRentalAttr } from './rental-attr.interface';
|
|
2
|
+
import { IRentalPriceAttr } from './rental-price-attr.interface';
|
|
3
|
+
import { IRentalFindAllSearchAttr } from './rental-find-all-search-attr.interface';
|
|
4
|
+
import { IBookingAttr } from './booking-attr.interface';
|
|
5
|
+
import { IAgreementAttr } from './agreement-attr.interface';
|
|
6
|
+
import { IBookingFindAllSearchAttr } from './booking-find-all-search-attr.interface';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
IRentalAttr,
|
|
10
|
+
IRentalPriceAttr,
|
|
11
|
+
IRentalFindAllSearchAttr,
|
|
12
|
+
IBookingAttr,
|
|
13
|
+
IAgreementAttr,
|
|
14
|
+
IBookingFindAllSearchAttr,
|
|
15
|
+
};
|