@tomei/rental 0.10.1 → 0.10.2

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.
Files changed (52) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.eslintrc +16 -16
  3. package/.eslintrc.js +35 -35
  4. package/.gitlab-ci.yml +16 -16
  5. package/.husky/commit-msg +15 -15
  6. package/.husky/pre-commit +7 -7
  7. package/.prettierrc +4 -4
  8. package/Jenkinsfile +51 -51
  9. package/README.md +8 -8
  10. package/dist/src/components/rental/rental.d.ts +1 -0
  11. package/dist/src/components/rental/rental.js +102 -15
  12. package/dist/src/components/rental/rental.js.map +1 -1
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/jest.config.js +10 -10
  15. package/migrations/booking-table-migration.js +79 -79
  16. package/migrations/joint-hirer-table-migration.js +52 -52
  17. package/migrations/rental-aggrement-table-migration.js +26 -26
  18. package/migrations/rental-price-table-migration.js +32 -32
  19. package/migrations/rental-table-migrations.js +96 -96
  20. package/package.json +75 -75
  21. package/sonar-project.properties +12 -12
  22. package/src/components/agreement/agreement.repository.ts +54 -54
  23. package/src/components/agreement/agreement.ts +46 -46
  24. package/src/components/booking/booking.repository.ts +51 -51
  25. package/src/components/booking/booking.ts +343 -343
  26. package/src/components/joint-hirer/joint-hirer.repository.ts +54 -54
  27. package/src/components/rental/rental.repository.ts +51 -51
  28. package/src/components/rental/rental.ts +861 -722
  29. package/src/components/rental-price/rental-price.repository.ts +54 -54
  30. package/src/components/rental-price/rental-price.ts +100 -100
  31. package/src/database.ts +27 -27
  32. package/src/enum/account-type.enum.ts +4 -4
  33. package/src/enum/booking.enum.ts +5 -5
  34. package/src/enum/index.ts +11 -11
  35. package/src/enum/rental-status.enum.ts +39 -39
  36. package/src/index.ts +28 -28
  37. package/src/interfaces/agreement-attr.interface.ts +6 -6
  38. package/src/interfaces/booking-attr.interface.ts +19 -19
  39. package/src/interfaces/booking-find-all-search-attr.interface.ts +12 -12
  40. package/src/interfaces/index.ts +15 -15
  41. package/src/interfaces/joint-hirer-attr.interface.ts +10 -10
  42. package/src/interfaces/rental-attr.interface.ts +25 -25
  43. package/src/interfaces/rental-find-all-search-attr.interface.ts +11 -11
  44. package/src/interfaces/rental-price-attr.interface.ts +7 -7
  45. package/src/models/agreement.entity.ts +33 -33
  46. package/src/models/booking.entity.ts +105 -105
  47. package/src/models/index.ts +13 -13
  48. package/src/models/joint-hirer.entity.ts +63 -63
  49. package/src/models/rental-price.entity.ts +38 -38
  50. package/src/models/rental.entity.ts +133 -133
  51. package/tsconfig.build.json +5 -5
  52. package/tsconfig.json +23 -23
package/package.json CHANGED
@@ -1,75 +1,75 @@
1
- {
2
- "name": "@tomei/rental",
3
- "version": "0.10.1",
4
- "description": "Tomei Rental Package",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "start:dev": "tsc -w",
8
- "build": "tsc",
9
- "prepare": "husky install",
10
- "format": "prettier --write \"src/**/*.ts\"",
11
- "lint": "npx eslint . --fix",
12
- "test": "jest --forceExit --detectOpenHandles"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+ssh://git@gitlab.com/tomei-package/rental.git"
17
- },
18
- "keywords": [
19
- "tomei",
20
- "rental"
21
- ],
22
- "author": "Tomei",
23
- "license": "ISC",
24
- "bugs": {
25
- "url": "https://gitlab.com/tomei-package/rental/issues"
26
- },
27
- "homepage": "https://gitlab.com/tomei-package/rental#readme",
28
- "devDependencies": {
29
- "@commitlint/cli": "^17.6.3",
30
- "@commitlint/config-conventional": "^17.6.3",
31
- "@tsconfig/node18": "^2.0.1",
32
- "@types/jest": "^29.5.2",
33
- "@types/luxon": "^3.4.2",
34
- "@types/node": "^18.17.12",
35
- "@types/validator": "^13.11.1",
36
- "@typescript-eslint/eslint-plugin": "^5.33.0",
37
- "dotenv": "^16.1.4",
38
- "eslint": "^8.40.0",
39
- "eslint-config-prettier": "^8.5.0",
40
- "eslint-plugin-prettier": "^4.2.1",
41
- "husky": "^8.0.3",
42
- "jest": "^29.5.0",
43
- "jest-mock-extended": "^3.0.4",
44
- "lint-staged": "^13.2.2",
45
- "prettier": "^2.7.1",
46
- "ts-jest": "^29.1.0",
47
- "ts-node": "^10.9.1",
48
- "tsc-watch": "^5.0.3",
49
- "tsconfig-paths": "^4.0.0",
50
- "tslint": "^6.1.3",
51
- "typescript": "^4.7.4"
52
- },
53
- "publishConfig": {
54
- "access": "public"
55
- },
56
- "peerDependencies": {
57
- "@tomei/activity-history": "^0.2.15",
58
- "@tomei/config": "^0.3.10",
59
- "@tomei/general": "^0.11.8",
60
- "@tomei/sso": "^0.21.13",
61
- "cuid": "^3.0.0",
62
- "reflect-metadata": "^0.1.13",
63
- "sequelize": "^6.32.1",
64
- "sequelize-typescript": "^2.1.5"
65
- },
66
- "lint-staged": {
67
- "*/**/*.{js,ts,tsx}": [
68
- "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
69
- "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
70
- ]
71
- },
72
- "dependencies": {
73
- "luxon": "^3.4.4"
74
- }
75
- }
1
+ {
2
+ "name": "@tomei/rental",
3
+ "version": "0.10.2",
4
+ "description": "Tomei Rental Package",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "start:dev": "tsc -w",
8
+ "build": "tsc",
9
+ "prepare": "husky install",
10
+ "format": "prettier --write \"src/**/*.ts\"",
11
+ "lint": "npx eslint . --fix",
12
+ "test": "jest --forceExit --detectOpenHandles"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+ssh://git@gitlab.com/tomei-package/rental.git"
17
+ },
18
+ "keywords": [
19
+ "tomei",
20
+ "rental"
21
+ ],
22
+ "author": "Tomei",
23
+ "license": "ISC",
24
+ "bugs": {
25
+ "url": "https://gitlab.com/tomei-package/rental/issues"
26
+ },
27
+ "homepage": "https://gitlab.com/tomei-package/rental#readme",
28
+ "devDependencies": {
29
+ "@commitlint/cli": "^17.6.3",
30
+ "@commitlint/config-conventional": "^17.6.3",
31
+ "@tsconfig/node18": "^2.0.1",
32
+ "@types/jest": "^29.5.2",
33
+ "@types/luxon": "^3.4.2",
34
+ "@types/node": "^18.17.12",
35
+ "@types/validator": "^13.11.1",
36
+ "@typescript-eslint/eslint-plugin": "^5.33.0",
37
+ "dotenv": "^16.1.4",
38
+ "eslint": "^8.40.0",
39
+ "eslint-config-prettier": "^8.5.0",
40
+ "eslint-plugin-prettier": "^4.2.1",
41
+ "husky": "^8.0.3",
42
+ "jest": "^29.5.0",
43
+ "jest-mock-extended": "^3.0.4",
44
+ "lint-staged": "^13.2.2",
45
+ "prettier": "^2.7.1",
46
+ "ts-jest": "^29.1.0",
47
+ "ts-node": "^10.9.1",
48
+ "tsc-watch": "^5.0.3",
49
+ "tsconfig-paths": "^4.0.0",
50
+ "tslint": "^6.1.3",
51
+ "typescript": "^4.7.4"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "peerDependencies": {
57
+ "@tomei/activity-history": "^0.2.15",
58
+ "@tomei/config": "^0.3.10",
59
+ "@tomei/general": "^0.11.8",
60
+ "@tomei/sso": "^0.21.13",
61
+ "cuid": "^3.0.0",
62
+ "reflect-metadata": "^0.1.13",
63
+ "sequelize": "^6.32.1",
64
+ "sequelize-typescript": "^2.1.5"
65
+ },
66
+ "lint-staged": {
67
+ "*/**/*.{js,ts,tsx}": [
68
+ "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
69
+ "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
70
+ ]
71
+ },
72
+ "dependencies": {
73
+ "luxon": "^3.4.4"
74
+ }
75
+ }
@@ -1,13 +1,13 @@
1
- sonar.projectKey=all-tomei-projects_rental
2
- sonar.organization=all-tomei-projects
3
-
4
- # This is the name and version displayed in the SonarCloud UI.
5
- #sonar.projectName=Rental
6
- #sonar.projectVersion=1.0
7
-
8
-
9
- # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
10
- #sonar.sources=.
11
-
12
- # Encoding of the source code. Default is default system encoding
1
+ sonar.projectKey=all-tomei-projects_rental
2
+ sonar.organization=all-tomei-projects
3
+
4
+ # This is the name and version displayed in the SonarCloud UI.
5
+ #sonar.projectName=Rental
6
+ #sonar.projectVersion=1.0
7
+
8
+
9
+ # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
10
+ #sonar.sources=.
11
+
12
+ # Encoding of the source code. Default is default system encoding
13
13
  #sonar.sourceEncoding=UTF-8
@@ -1,54 +1,54 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import { AgreementModel } from '../../models/agreement.entity';
3
-
4
- export class AgreementRepository
5
- extends RepositoryBase<AgreementModel>
6
- implements IRepositoryBase<AgreementModel>
7
- {
8
- constructor() {
9
- super(AgreementModel);
10
- }
11
-
12
- async findByPk(
13
- id: string,
14
- transaction?: any,
15
- ): Promise<AgreementModel | null> {
16
- try {
17
- const result = await AgreementModel.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(AgreementNo: string, dbTransaction?: any) {
28
- try {
29
- const options = {
30
- where: {
31
- AgreementNo,
32
- },
33
- transaction: dbTransaction,
34
- };
35
- await AgreementModel.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 Agreements: any;
44
- if (options) {
45
- Agreements = await AgreementModel.findAndCountAll(options);
46
- } else {
47
- Agreements = await AgreementModel.findAndCountAll();
48
- }
49
- return Agreements;
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 { AgreementModel } from '../../models/agreement.entity';
3
+
4
+ export class AgreementRepository
5
+ extends RepositoryBase<AgreementModel>
6
+ implements IRepositoryBase<AgreementModel>
7
+ {
8
+ constructor() {
9
+ super(AgreementModel);
10
+ }
11
+
12
+ async findByPk(
13
+ id: string,
14
+ transaction?: any,
15
+ ): Promise<AgreementModel | null> {
16
+ try {
17
+ const result = await AgreementModel.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(AgreementNo: string, dbTransaction?: any) {
28
+ try {
29
+ const options = {
30
+ where: {
31
+ AgreementNo,
32
+ },
33
+ transaction: dbTransaction,
34
+ };
35
+ await AgreementModel.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 Agreements: any;
44
+ if (options) {
45
+ Agreements = await AgreementModel.findAndCountAll(options);
46
+ } else {
47
+ Agreements = await AgreementModel.findAndCountAll();
48
+ }
49
+ return Agreements;
50
+ } catch (error) {
51
+ throw new Error(`An Error occured when retriving : ${error.message}`);
52
+ }
53
+ }
54
+ }
@@ -1,46 +1,46 @@
1
- import { ObjectBase } from '@tomei/general';
2
- import { IAgreementAttr } from '../../interfaces/agreement-attr.interface';
3
- import { AgreementRepository } from './agreement.repository';
4
- import { AggrementStatusEnum } from '../../enum/aggrement-status.enum';
5
-
6
- export class Agreement extends ObjectBase {
7
- ObjectId: string;
8
- ObjectName: string;
9
- ObjectType: string = 'Agreement';
10
- TableName = 'rental_Agreement';
11
- Status: AggrementStatusEnum;
12
- DateSigned: Date;
13
- private static _Repo = new AgreementRepository();
14
-
15
- get AgreementNo(): string {
16
- return this.ObjectId;
17
- }
18
-
19
- set AgreementNo(value: string) {
20
- this.ObjectId = value;
21
- }
22
-
23
- protected constructor(agreementAttr?: IAgreementAttr) {
24
- super();
25
- if (agreementAttr) {
26
- this.ObjectId = agreementAttr.AgreementNo;
27
- this.Status = agreementAttr.Status;
28
- this.DateSigned = agreementAttr.DateSigned;
29
- }
30
- }
31
-
32
- public static async init(
33
- agreementNo?: string,
34
- dbTransaction?: any,
35
- ): Promise<Agreement> {
36
- try {
37
- if (agreementNo) {
38
- const agreement = await this._Repo.findByPk(agreementNo, dbTransaction);
39
- return new Agreement(agreement?.get({ plain: true }));
40
- }
41
- return new Agreement();
42
- } catch (error) {
43
- throw error;
44
- }
45
- }
46
- }
1
+ import { ObjectBase } from '@tomei/general';
2
+ import { IAgreementAttr } from '../../interfaces/agreement-attr.interface';
3
+ import { AgreementRepository } from './agreement.repository';
4
+ import { AggrementStatusEnum } from '../../enum/aggrement-status.enum';
5
+
6
+ export class Agreement extends ObjectBase {
7
+ ObjectId: string;
8
+ ObjectName: string;
9
+ ObjectType: string = 'Agreement';
10
+ TableName = 'rental_Agreement';
11
+ Status: AggrementStatusEnum;
12
+ DateSigned: Date;
13
+ private static _Repo = new AgreementRepository();
14
+
15
+ get AgreementNo(): string {
16
+ return this.ObjectId;
17
+ }
18
+
19
+ set AgreementNo(value: string) {
20
+ this.ObjectId = value;
21
+ }
22
+
23
+ protected constructor(agreementAttr?: IAgreementAttr) {
24
+ super();
25
+ if (agreementAttr) {
26
+ this.ObjectId = agreementAttr.AgreementNo;
27
+ this.Status = agreementAttr.Status;
28
+ this.DateSigned = agreementAttr.DateSigned;
29
+ }
30
+ }
31
+
32
+ public static async init(
33
+ agreementNo?: string,
34
+ dbTransaction?: any,
35
+ ): Promise<Agreement> {
36
+ try {
37
+ if (agreementNo) {
38
+ const agreement = await this._Repo.findByPk(agreementNo, dbTransaction);
39
+ return new Agreement(agreement?.get({ plain: true }));
40
+ }
41
+ return new Agreement();
42
+ } catch (error) {
43
+ throw error;
44
+ }
45
+ }
46
+ }
@@ -1,51 +1,51 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import { BookingModel } from '../../models/booking.entity';
3
-
4
- export class BookingRepository
5
- extends RepositoryBase<BookingModel>
6
- implements IRepositoryBase<BookingModel>
7
- {
8
- constructor() {
9
- super(BookingModel);
10
- }
11
-
12
- async findByPk(id: string, transaction?: any): Promise<BookingModel | null> {
13
- try {
14
- const result = await BookingModel.findByPk(id, {
15
- transaction: transaction,
16
- });
17
-
18
- return result;
19
- } catch (error) {
20
- throw new Error(`An Error occured when fetching : ${error.message}`);
21
- }
22
- }
23
-
24
- async delete(BookingNo: string, dbTransaction?: any) {
25
- try {
26
- const options = {
27
- where: {
28
- BookingNo: BookingNo,
29
- },
30
- transaction: dbTransaction,
31
- };
32
- await BookingModel.destroy(options);
33
- } catch (error) {
34
- throw new Error(`An Error occured when delete : ${error.message}`);
35
- }
36
- }
37
-
38
- async findAndCountAll(options?: any) {
39
- try {
40
- let Bookings: any;
41
- if (options) {
42
- Bookings = await BookingModel.findAndCountAll(options);
43
- } else {
44
- Bookings = await BookingModel.findAndCountAll();
45
- }
46
- return Bookings;
47
- } catch (error) {
48
- throw new Error(`An Error occured when retriving : ${error.message}`);
49
- }
50
- }
51
- }
1
+ import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
+ import { BookingModel } from '../../models/booking.entity';
3
+
4
+ export class BookingRepository
5
+ extends RepositoryBase<BookingModel>
6
+ implements IRepositoryBase<BookingModel>
7
+ {
8
+ constructor() {
9
+ super(BookingModel);
10
+ }
11
+
12
+ async findByPk(id: string, transaction?: any): Promise<BookingModel | null> {
13
+ try {
14
+ const result = await BookingModel.findByPk(id, {
15
+ transaction: transaction,
16
+ });
17
+
18
+ return result;
19
+ } catch (error) {
20
+ throw new Error(`An Error occured when fetching : ${error.message}`);
21
+ }
22
+ }
23
+
24
+ async delete(BookingNo: string, dbTransaction?: any) {
25
+ try {
26
+ const options = {
27
+ where: {
28
+ BookingNo: BookingNo,
29
+ },
30
+ transaction: dbTransaction,
31
+ };
32
+ await BookingModel.destroy(options);
33
+ } catch (error) {
34
+ throw new Error(`An Error occured when delete : ${error.message}`);
35
+ }
36
+ }
37
+
38
+ async findAndCountAll(options?: any) {
39
+ try {
40
+ let Bookings: any;
41
+ if (options) {
42
+ Bookings = await BookingModel.findAndCountAll(options);
43
+ } else {
44
+ Bookings = await BookingModel.findAndCountAll();
45
+ }
46
+ return Bookings;
47
+ } catch (error) {
48
+ throw new Error(`An Error occured when retriving : ${error.message}`);
49
+ }
50
+ }
51
+ }