@tomei/rental 0.4.3 → 0.4.5

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 (64) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.eslintrc +16 -16
  3. package/.eslintrc.js +35 -35
  4. package/.husky/commit-msg +15 -15
  5. package/.husky/pre-commit +7 -7
  6. package/.prettierrc +4 -4
  7. package/Jenkinsfile +51 -51
  8. package/README.md +8 -8
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +17 -17
  11. package/dist/src/components/rental/rental.d.ts +45 -39
  12. package/dist/src/components/rental/rental.js +338 -331
  13. package/dist/src/components/rental/rental.js.map +1 -1
  14. package/dist/src/components/rental/rental.repository.d.ts +8 -8
  15. package/dist/src/components/rental/rental.repository.js +66 -66
  16. package/dist/src/components/rental-price/rental-price.d.ts +18 -12
  17. package/dist/src/components/rental-price/rental-price.js +78 -71
  18. package/dist/src/components/rental-price/rental-price.js.map +1 -1
  19. package/dist/src/components/rental-price/rental-price.repository.d.ts +8 -8
  20. package/dist/src/components/rental-price/rental-price.repository.js +66 -66
  21. package/dist/src/database.d.ts +4 -4
  22. package/dist/src/database.js +19 -19
  23. package/dist/src/enum/index.d.ts +2 -2
  24. package/dist/src/enum/index.js +5 -5
  25. package/dist/src/enum/rental-status.enum.d.ts +7 -7
  26. package/dist/src/enum/rental-status.enum.js +11 -11
  27. package/dist/src/index.d.ts +9 -9
  28. package/dist/src/index.js +30 -30
  29. package/dist/src/interfaces/index.d.ts +4 -4
  30. package/dist/src/interfaces/index.js +2 -2
  31. package/dist/src/interfaces/rental-attr.interface.d.ts +20 -20
  32. package/dist/src/interfaces/rental-attr.interface.js +2 -2
  33. package/dist/src/interfaces/rental-find-all-search-attr.interface.d.ts +10 -10
  34. package/dist/src/interfaces/rental-find-all-search-attr.interface.js +2 -2
  35. package/dist/src/interfaces/rental-price-attr.interface.d.ts +7 -7
  36. package/dist/src/interfaces/rental-price-attr.interface.js +2 -2
  37. package/dist/src/models/index.d.ts +3 -3
  38. package/dist/src/models/index.js +7 -7
  39. package/dist/src/models/rental-price.entity.d.ts +8 -8
  40. package/dist/src/models/rental-price.entity.js +58 -58
  41. package/dist/src/models/rental.entity.d.ts +23 -23
  42. package/dist/src/models/rental.entity.js +140 -140
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/jest.config.js +10 -10
  45. package/migrations/rental-price-table-migration.js +32 -32
  46. package/migrations/rental-table-migrations.js +86 -86
  47. package/package.json +71 -71
  48. package/src/components/rental/rental.repository.ts +51 -51
  49. package/src/components/rental/rental.ts +511 -500
  50. package/src/components/rental-price/rental-price.repository.ts +54 -54
  51. package/src/components/rental-price/rental-price.ts +100 -89
  52. package/src/database.ts +21 -21
  53. package/src/enum/index.ts +3 -3
  54. package/src/enum/rental-status.enum.ts +29 -29
  55. package/src/index.ts +16 -16
  56. package/src/interfaces/index.ts +5 -5
  57. package/src/interfaces/rental-attr.interface.ts +21 -21
  58. package/src/interfaces/rental-find-all-search-attr.interface.ts +11 -11
  59. package/src/interfaces/rental-price-attr.interface.ts +7 -7
  60. package/src/models/index.ts +4 -4
  61. package/src/models/rental-price.entity.ts +38 -38
  62. package/src/models/rental.entity.ts +116 -116
  63. package/tsconfig.build.json +5 -5
  64. package/tsconfig.json +23 -23
@@ -1,86 +1,86 @@
1
- 'use strict';
2
-
3
- /** @type {import('sequelize-cli').Migration} */
4
- module.exports = {
5
- async up(queryInterface, Sequelize) {
6
- await queryInterface.createTable('rental_Rental', {
7
- RentalId: {
8
- type: Sequelize.STRING(30),
9
- allowNull: false,
10
- primaryKey: true,
11
- },
12
- CustomerId: {
13
- type: Sequelize.STRING(30),
14
- allowNull: false,
15
- },
16
- CustomerType: {
17
- type: Sequelize.STRING(30),
18
- allowNull: false,
19
- },
20
- ItemId: {
21
- type: Sequelize.STRING(30),
22
- allowNull: false,
23
- },
24
- ItemType: {
25
- type: Sequelize.STRING(30),
26
- allowNull: false,
27
- },
28
- PriceId: {
29
- type: Sequelize.STRING(30),
30
- allowNull: false,
31
- references: {
32
- model: 'rental_Price',
33
- key: 'PriceId',
34
- },
35
- onUpdate: 'CASCADE',
36
- onDelete: 'CASCADE',
37
- },
38
- StartDateTime: {
39
- type: Sequelize.DATE,
40
- allowNull: false,
41
- },
42
- EndDateTime: {
43
- type: Sequelize.DATE,
44
- allowNull: false,
45
- },
46
- Status: {
47
- type: Sequelize.STRING(20),
48
- allowNull: false,
49
- },
50
- CancelRemarks: {
51
- type: Sequelize.STRING(3000),
52
- },
53
- TerminateRemarks: {
54
- type: Sequelize.STRING(3000),
55
- },
56
- EscheatmentYN: {
57
- type: Sequelize.CHAR(1),
58
- },
59
- AgreementNo: {
60
- type: Sequelize.STRING(30),
61
- allowNull: false,
62
- unique: true,
63
- },
64
- CreatedById: {
65
- type: Sequelize.STRING(30),
66
- allowNull: false,
67
- },
68
- CreatedAt: {
69
- type: Sequelize.DATE,
70
- allowNull: false,
71
- },
72
- UpdatedById: {
73
- type: Sequelize.STRING(30),
74
- allowNull: false,
75
- },
76
- UpdatedAt: {
77
- type: Sequelize.DATE,
78
- allowNull: false,
79
- },
80
- });
81
- },
82
-
83
- async down(queryInterface, Sequelize) {
84
- await queryInterface.dropTable('rental_Rental');
85
- },
86
- };
1
+ 'use strict';
2
+
3
+ /** @type {import('sequelize-cli').Migration} */
4
+ module.exports = {
5
+ async up(queryInterface, Sequelize) {
6
+ await queryInterface.createTable('rental_Rental', {
7
+ RentalId: {
8
+ type: Sequelize.STRING(30),
9
+ allowNull: false,
10
+ primaryKey: true,
11
+ },
12
+ CustomerId: {
13
+ type: Sequelize.STRING(30),
14
+ allowNull: false,
15
+ },
16
+ CustomerType: {
17
+ type: Sequelize.STRING(30),
18
+ allowNull: false,
19
+ },
20
+ ItemId: {
21
+ type: Sequelize.STRING(30),
22
+ allowNull: false,
23
+ },
24
+ ItemType: {
25
+ type: Sequelize.STRING(30),
26
+ allowNull: false,
27
+ },
28
+ PriceId: {
29
+ type: Sequelize.STRING(30),
30
+ allowNull: false,
31
+ references: {
32
+ model: 'rental_Price',
33
+ key: 'PriceId',
34
+ },
35
+ onUpdate: 'CASCADE',
36
+ onDelete: 'CASCADE',
37
+ },
38
+ StartDateTime: {
39
+ type: Sequelize.DATE,
40
+ allowNull: false,
41
+ },
42
+ EndDateTime: {
43
+ type: Sequelize.DATE,
44
+ allowNull: false,
45
+ },
46
+ Status: {
47
+ type: Sequelize.STRING(20),
48
+ allowNull: false,
49
+ },
50
+ CancelRemarks: {
51
+ type: Sequelize.STRING(3000),
52
+ },
53
+ TerminateRemarks: {
54
+ type: Sequelize.STRING(3000),
55
+ },
56
+ EscheatmentYN: {
57
+ type: Sequelize.CHAR(1),
58
+ },
59
+ AgreementNo: {
60
+ type: Sequelize.STRING(30),
61
+ allowNull: false,
62
+ unique: true,
63
+ },
64
+ CreatedById: {
65
+ type: Sequelize.STRING(30),
66
+ allowNull: false,
67
+ },
68
+ CreatedAt: {
69
+ type: Sequelize.DATE,
70
+ allowNull: false,
71
+ },
72
+ UpdatedById: {
73
+ type: Sequelize.STRING(30),
74
+ allowNull: false,
75
+ },
76
+ UpdatedAt: {
77
+ type: Sequelize.DATE,
78
+ allowNull: false,
79
+ },
80
+ });
81
+ },
82
+
83
+ async down(queryInterface, Sequelize) {
84
+ await queryInterface.dropTable('rental_Rental');
85
+ },
86
+ };
package/package.json CHANGED
@@ -1,71 +1,71 @@
1
- {
2
- "name": "@tomei/rental",
3
- "version": "0.4.3",
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/node": "^18.17.12",
34
- "@types/validator": "^13.11.1",
35
- "@typescript-eslint/eslint-plugin": "^5.33.0",
36
- "dotenv": "^16.1.4",
37
- "eslint": "^8.40.0",
38
- "eslint-config-prettier": "^8.5.0",
39
- "eslint-plugin-prettier": "^4.2.1",
40
- "husky": "^8.0.3",
41
- "jest": "^29.5.0",
42
- "jest-mock-extended": "^3.0.4",
43
- "lint-staged": "^13.2.2",
44
- "prettier": "^2.7.1",
45
- "ts-jest": "^29.1.0",
46
- "ts-node": "^10.9.1",
47
- "tsc-watch": "^5.0.3",
48
- "tsconfig-paths": "^4.0.0",
49
- "tslint": "^6.1.3",
50
- "typescript": "^4.7.4"
51
- },
52
- "publishConfig": {
53
- "access": "public"
54
- },
55
- "peerDependencies": {
56
- "cuid": "^3.0.0",
57
- "reflect-metadata": "^0.1.13",
58
- "sequelize": "^6.32.1",
59
- "sequelize-typescript": "^2.1.5",
60
- "@tomei/activity-history": "^0.2.1",
61
- "@tomei/config": "^0.2.2",
62
- "@tomei/general": "^0.5.1",
63
- "@tomei/sso": "^0.11.6"
64
- },
65
- "lint-staged": {
66
- "*/**/*.{js,ts,tsx}": [
67
- "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
68
- "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
69
- ]
70
- }
71
- }
1
+ {
2
+ "name": "@tomei/rental",
3
+ "version": "0.4.5",
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/node": "^18.17.12",
34
+ "@types/validator": "^13.11.1",
35
+ "@typescript-eslint/eslint-plugin": "^5.33.0",
36
+ "dotenv": "^16.1.4",
37
+ "eslint": "^8.40.0",
38
+ "eslint-config-prettier": "^8.5.0",
39
+ "eslint-plugin-prettier": "^4.2.1",
40
+ "husky": "^8.0.3",
41
+ "jest": "^29.5.0",
42
+ "jest-mock-extended": "^3.0.4",
43
+ "lint-staged": "^13.2.2",
44
+ "prettier": "^2.7.1",
45
+ "ts-jest": "^29.1.0",
46
+ "ts-node": "^10.9.1",
47
+ "tsc-watch": "^5.0.3",
48
+ "tsconfig-paths": "^4.0.0",
49
+ "tslint": "^6.1.3",
50
+ "typescript": "^4.7.4"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "peerDependencies": {
56
+ "@tomei/activity-history": "^0.2.15",
57
+ "@tomei/config": "^0.3.10",
58
+ "@tomei/general": "^0.11.8",
59
+ "@tomei/sso": "^0.21.13",
60
+ "cuid": "^3.0.0",
61
+ "reflect-metadata": "^0.1.13",
62
+ "sequelize": "^6.32.1",
63
+ "sequelize-typescript": "^2.1.5"
64
+ },
65
+ "lint-staged": {
66
+ "*/**/*.{js,ts,tsx}": [
67
+ "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
68
+ "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
69
+ ]
70
+ }
71
+ }
@@ -1,51 +1,51 @@
1
- import { RepositoryBase, IRepositoryBase } from '@tomei/general';
2
- import { RentalModel } from '../../models/rental.entity';
3
-
4
- export class RentalRepository
5
- extends RepositoryBase<RentalModel>
6
- implements IRepositoryBase<RentalModel>
7
- {
8
- constructor() {
9
- super(RentalModel);
10
- }
11
-
12
- async findByPk(id: string, transaction?: any): Promise<RentalModel | null> {
13
- try {
14
- const result = await RentalModel.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(RentalId: string, dbTransaction?: any) {
25
- try {
26
- const options = {
27
- where: {
28
- RentalId: RentalId,
29
- },
30
- transaction: dbTransaction,
31
- };
32
- await RentalModel.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 Rentals: any;
41
- if (options) {
42
- Rentals = await RentalModel.findAndCountAll(options);
43
- } else {
44
- Rentals = await RentalModel.findAndCountAll();
45
- }
46
- return Rentals;
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 { RentalModel } from '../../models/rental.entity';
3
+
4
+ export class RentalRepository
5
+ extends RepositoryBase<RentalModel>
6
+ implements IRepositoryBase<RentalModel>
7
+ {
8
+ constructor() {
9
+ super(RentalModel);
10
+ }
11
+
12
+ async findByPk(id: string, transaction?: any): Promise<RentalModel | null> {
13
+ try {
14
+ const result = await RentalModel.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(RentalId: string, dbTransaction?: any) {
25
+ try {
26
+ const options = {
27
+ where: {
28
+ RentalId: RentalId,
29
+ },
30
+ transaction: dbTransaction,
31
+ };
32
+ await RentalModel.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 Rentals: any;
41
+ if (options) {
42
+ Rentals = await RentalModel.findAndCountAll(options);
43
+ } else {
44
+ Rentals = await RentalModel.findAndCountAll();
45
+ }
46
+ return Rentals;
47
+ } catch (error) {
48
+ throw new Error(`An Error occured when retriving : ${error.message}`);
49
+ }
50
+ }
51
+ }