@tomei/rental 0.4.3 → 0.4.4
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/.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/index.d.ts +1 -1
- package/dist/index.js +17 -17
- package/dist/src/components/rental/rental.d.ts +45 -39
- package/dist/src/components/rental/rental.js +338 -331
- package/dist/src/components/rental/rental.js.map +1 -1
- package/dist/src/components/rental/rental.repository.d.ts +8 -8
- package/dist/src/components/rental/rental.repository.js +66 -66
- package/dist/src/components/rental-price/rental-price.d.ts +18 -12
- package/dist/src/components/rental-price/rental-price.js +78 -71
- package/dist/src/components/rental-price/rental-price.js.map +1 -1
- package/dist/src/components/rental-price/rental-price.repository.d.ts +8 -8
- package/dist/src/components/rental-price/rental-price.repository.js +66 -66
- package/dist/src/database.d.ts +4 -4
- package/dist/src/database.js +19 -19
- package/dist/src/enum/index.d.ts +2 -2
- package/dist/src/enum/index.js +5 -5
- package/dist/src/enum/rental-status.enum.d.ts +7 -7
- package/dist/src/enum/rental-status.enum.js +11 -11
- package/dist/src/index.d.ts +9 -9
- package/dist/src/index.js +30 -30
- package/dist/src/interfaces/index.d.ts +4 -4
- package/dist/src/interfaces/index.js +2 -2
- package/dist/src/interfaces/rental-attr.interface.d.ts +20 -20
- package/dist/src/interfaces/rental-attr.interface.js +2 -2
- package/dist/src/interfaces/rental-find-all-search-attr.interface.d.ts +10 -10
- package/dist/src/interfaces/rental-find-all-search-attr.interface.js +2 -2
- package/dist/src/interfaces/rental-price-attr.interface.d.ts +7 -7
- package/dist/src/interfaces/rental-price-attr.interface.js +2 -2
- package/dist/src/models/index.d.ts +3 -3
- package/dist/src/models/index.js +7 -7
- package/dist/src/models/rental-price.entity.d.ts +8 -8
- package/dist/src/models/rental-price.entity.js +58 -58
- package/dist/src/models/rental.entity.d.ts +23 -23
- package/dist/src/models/rental.entity.js +140 -140
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jest.config.js +10 -10
- package/migrations/rental-price-table-migration.js +32 -32
- package/migrations/rental-table-migrations.js +86 -86
- package/package.json +71 -71
- package/src/components/rental/rental.repository.ts +51 -51
- package/src/components/rental/rental.ts +511 -500
- package/src/components/rental-price/rental-price.repository.ts +54 -54
- package/src/components/rental-price/rental-price.ts +100 -89
- package/src/database.ts +21 -21
- package/src/enum/index.ts +3 -3
- package/src/enum/rental-status.enum.ts +29 -29
- package/src/index.ts +16 -16
- package/src/interfaces/index.ts +5 -5
- package/src/interfaces/rental-attr.interface.ts +21 -21
- 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/index.ts +4 -4
- package/src/models/rental-price.entity.ts +38 -38
- package/src/models/rental.entity.ts +116 -116
- 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,89 +1,100 @@
|
|
|
1
|
-
import { ClassError } 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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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,21 +1,21 @@
|
|
|
1
|
-
import { Sequelize, SequelizeOptions } from 'sequelize-typescript';
|
|
2
|
-
import { RentalModel } from './models/rental.entity';
|
|
3
|
-
import { RentalPriceModel } from './models/rental-price.entity';
|
|
4
|
-
|
|
5
|
-
let sequelize: Sequelize;
|
|
6
|
-
|
|
7
|
-
function init(sequelizeOptions: SequelizeOptions) {
|
|
8
|
-
sequelize = new Sequelize(sequelizeOptions);
|
|
9
|
-
|
|
10
|
-
sequelize.addModels([
|
|
11
|
-
// Add your models here
|
|
12
|
-
RentalModel,
|
|
13
|
-
RentalPriceModel,
|
|
14
|
-
]);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function getConnection() {
|
|
18
|
-
return sequelize;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
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
|
+
|
|
5
|
+
let sequelize: Sequelize;
|
|
6
|
+
|
|
7
|
+
function init(sequelizeOptions: SequelizeOptions) {
|
|
8
|
+
sequelize = new Sequelize(sequelizeOptions);
|
|
9
|
+
|
|
10
|
+
sequelize.addModels([
|
|
11
|
+
// Add your models here
|
|
12
|
+
RentalModel,
|
|
13
|
+
RentalPriceModel,
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getConnection() {
|
|
18
|
+
return sequelize;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { init, getConnection };
|
package/src/enum/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RentalStatusEnum } from './rental-status.enum';
|
|
2
|
-
|
|
3
|
-
export { RentalStatusEnum };
|
|
1
|
+
import { RentalStatusEnum } from './rental-status.enum';
|
|
2
|
+
|
|
3
|
+
export { RentalStatusEnum };
|
|
@@ -1,29 +1,29 @@
|
|
|
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
|
-
}
|
|
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
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
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 * as rentalDb from './database';
|
|
6
|
-
export * from './interfaces';
|
|
7
|
-
export * from './models';
|
|
8
|
-
export * from './enum';
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
Rental,
|
|
12
|
-
RentalPrice,
|
|
13
|
-
RentalRepository,
|
|
14
|
-
RentalPriceRepository,
|
|
15
|
-
rentalDb,
|
|
16
|
-
};
|
|
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 * as rentalDb from './database';
|
|
6
|
+
export * from './interfaces';
|
|
7
|
+
export * from './models';
|
|
8
|
+
export * from './enum';
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
Rental,
|
|
12
|
+
RentalPrice,
|
|
13
|
+
RentalRepository,
|
|
14
|
+
RentalPriceRepository,
|
|
15
|
+
rentalDb,
|
|
16
|
+
};
|
package/src/interfaces/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
|
|
5
|
-
export { IRentalAttr, IRentalPriceAttr, IRentalFindAllSearchAttr };
|
|
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
|
+
|
|
5
|
+
export { IRentalAttr, IRentalPriceAttr, IRentalFindAllSearchAttr };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { RentalStatusEnum } from '../enum/rental-status.enum';
|
|
2
|
-
|
|
3
|
-
export interface IRentalAttr {
|
|
4
|
-
RentalId: string;
|
|
5
|
-
CustomerId: string;
|
|
6
|
-
CustomerType: string;
|
|
7
|
-
ItemId: string;
|
|
8
|
-
ItemType: string;
|
|
9
|
-
PriceId: string;
|
|
10
|
-
StartDateTime: Date;
|
|
11
|
-
EndDateTime: Date;
|
|
12
|
-
CancelRemarks: string;
|
|
13
|
-
TerminateRemarks: string;
|
|
14
|
-
AgreementNo: string;
|
|
15
|
-
Status: RentalStatusEnum;
|
|
16
|
-
EscheatmentYN: string;
|
|
17
|
-
CreatedById: string;
|
|
18
|
-
CreatedAt: Date;
|
|
19
|
-
UpdatedById: string;
|
|
20
|
-
UpdatedAt: Date;
|
|
21
|
-
}
|
|
1
|
+
import { RentalStatusEnum } from '../enum/rental-status.enum';
|
|
2
|
+
|
|
3
|
+
export interface IRentalAttr {
|
|
4
|
+
RentalId: string;
|
|
5
|
+
CustomerId: string;
|
|
6
|
+
CustomerType: string;
|
|
7
|
+
ItemId: string;
|
|
8
|
+
ItemType: string;
|
|
9
|
+
PriceId: string;
|
|
10
|
+
StartDateTime: Date;
|
|
11
|
+
EndDateTime: Date;
|
|
12
|
+
CancelRemarks: string;
|
|
13
|
+
TerminateRemarks: string;
|
|
14
|
+
AgreementNo: string;
|
|
15
|
+
Status: RentalStatusEnum;
|
|
16
|
+
EscheatmentYN: string;
|
|
17
|
+
CreatedById: string;
|
|
18
|
+
CreatedAt: Date;
|
|
19
|
+
UpdatedById: string;
|
|
20
|
+
UpdatedAt: Date;
|
|
21
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { RentalStatusEnum } from '../enum/rental-status.enum';
|
|
2
|
-
|
|
3
|
-
export interface IRentalFindAllSearchAttr {
|
|
4
|
-
Status?: RentalStatusEnum;
|
|
5
|
-
StartDateTime?: Date;
|
|
6
|
-
EndDateTime?: Date;
|
|
7
|
-
ItemId?: string;
|
|
8
|
-
ItemType?: string;
|
|
9
|
-
CustomerId?: string;
|
|
10
|
-
CustomerType?: string;
|
|
11
|
-
}
|
|
1
|
+
import { RentalStatusEnum } from '../enum/rental-status.enum';
|
|
2
|
+
|
|
3
|
+
export interface IRentalFindAllSearchAttr {
|
|
4
|
+
Status?: RentalStatusEnum;
|
|
5
|
+
StartDateTime?: Date;
|
|
6
|
+
EndDateTime?: Date;
|
|
7
|
+
ItemId?: string;
|
|
8
|
+
ItemType?: string;
|
|
9
|
+
CustomerId?: string;
|
|
10
|
+
CustomerType?: string;
|
|
11
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface IRentalPriceAttr {
|
|
2
|
-
PriceId: string;
|
|
3
|
-
RetailPrice: number;
|
|
4
|
-
Currency: string;
|
|
5
|
-
PromoCode: string;
|
|
6
|
-
Remarks: string;
|
|
7
|
-
}
|
|
1
|
+
export interface IRentalPriceAttr {
|
|
2
|
+
PriceId: string;
|
|
3
|
+
RetailPrice: number;
|
|
4
|
+
Currency: string;
|
|
5
|
+
PromoCode: string;
|
|
6
|
+
Remarks: string;
|
|
7
|
+
}
|
package/src/models/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RentalModel } from './rental.entity';
|
|
2
|
-
import { RentalPriceModel } from './rental-price.entity';
|
|
3
|
-
|
|
4
|
-
export { RentalModel, RentalPriceModel };
|
|
1
|
+
import { RentalModel } from './rental.entity';
|
|
2
|
+
import { RentalPriceModel } from './rental-price.entity';
|
|
3
|
+
|
|
4
|
+
export { RentalModel, RentalPriceModel };
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { Column, DataType, Table, Model } from 'sequelize-typescript';
|
|
2
|
-
|
|
3
|
-
@Table({
|
|
4
|
-
tableName: 'rental_Price',
|
|
5
|
-
timestamps: false,
|
|
6
|
-
createdAt: false,
|
|
7
|
-
updatedAt: false,
|
|
8
|
-
})
|
|
9
|
-
export class RentalPriceModel extends Model {
|
|
10
|
-
@Column({
|
|
11
|
-
primaryKey: true,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
type: DataType.STRING(30),
|
|
14
|
-
})
|
|
15
|
-
PriceId: string;
|
|
16
|
-
|
|
17
|
-
@Column({
|
|
18
|
-
allowNull: false,
|
|
19
|
-
type: DataType.DECIMAL(10, 2),
|
|
20
|
-
})
|
|
21
|
-
RetailPrice: number;
|
|
22
|
-
|
|
23
|
-
@Column({
|
|
24
|
-
allowNull: false,
|
|
25
|
-
type: DataType.CHAR(3),
|
|
26
|
-
})
|
|
27
|
-
Currency: string;
|
|
28
|
-
|
|
29
|
-
@Column({
|
|
30
|
-
type: DataType.STRING(10),
|
|
31
|
-
})
|
|
32
|
-
PromoCode: string;
|
|
33
|
-
|
|
34
|
-
@Column({
|
|
35
|
-
type: DataType.STRING(3000),
|
|
36
|
-
})
|
|
37
|
-
Remarks: string;
|
|
38
|
-
}
|
|
1
|
+
import { Column, DataType, Table, Model } from 'sequelize-typescript';
|
|
2
|
+
|
|
3
|
+
@Table({
|
|
4
|
+
tableName: 'rental_Price',
|
|
5
|
+
timestamps: false,
|
|
6
|
+
createdAt: false,
|
|
7
|
+
updatedAt: false,
|
|
8
|
+
})
|
|
9
|
+
export class RentalPriceModel extends Model {
|
|
10
|
+
@Column({
|
|
11
|
+
primaryKey: true,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
type: DataType.STRING(30),
|
|
14
|
+
})
|
|
15
|
+
PriceId: string;
|
|
16
|
+
|
|
17
|
+
@Column({
|
|
18
|
+
allowNull: false,
|
|
19
|
+
type: DataType.DECIMAL(10, 2),
|
|
20
|
+
})
|
|
21
|
+
RetailPrice: number;
|
|
22
|
+
|
|
23
|
+
@Column({
|
|
24
|
+
allowNull: false,
|
|
25
|
+
type: DataType.CHAR(3),
|
|
26
|
+
})
|
|
27
|
+
Currency: string;
|
|
28
|
+
|
|
29
|
+
@Column({
|
|
30
|
+
type: DataType.STRING(10),
|
|
31
|
+
})
|
|
32
|
+
PromoCode: string;
|
|
33
|
+
|
|
34
|
+
@Column({
|
|
35
|
+
type: DataType.STRING(3000),
|
|
36
|
+
})
|
|
37
|
+
Remarks: string;
|
|
38
|
+
}
|