@tomei/rental 0.9.7 → 0.10.0
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 +38 -0
- package/dist/src/components/booking/booking.js.map +1 -1
- package/dist/src/components/rental/rental.js +15 -15
- package/dist/src/interfaces/booking-find-all-search-attr.interface.d.ts +12 -0
- package/dist/src/interfaces/booking-find-all-search-attr.interface.js +3 -0
- package/dist/src/interfaces/booking-find-all-search-attr.interface.js.map +1 -0
- package/dist/src/interfaces/index.d.ts +2 -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 +26 -26
- 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 +46 -46
- package/src/components/booking/booking.repository.ts +51 -51
- package/src/components/booking/booking.ts +343 -291
- 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 +722 -722
- 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 +6 -6
- package/src/interfaces/booking-attr.interface.ts +19 -19
- package/src/interfaces/booking-find-all-search-attr.interface.ts +12 -0
- package/src/interfaces/index.ts +15 -13
- 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 +33 -33
- 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
package/.commitlintrc.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"@commitlint/config-conventional"
|
|
4
|
-
],
|
|
5
|
-
"rules": {
|
|
6
|
-
"header-max-length": [ 2, "always", 120 ],
|
|
7
|
-
"type-enum": [
|
|
8
|
-
2,
|
|
9
|
-
"always",
|
|
10
|
-
[
|
|
11
|
-
"breaking",
|
|
12
|
-
"feat",
|
|
13
|
-
"fix",
|
|
14
|
-
"refactor",
|
|
15
|
-
"config",
|
|
16
|
-
"test",
|
|
17
|
-
"docs",
|
|
18
|
-
"chore"
|
|
19
|
-
]
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"@commitlint/config-conventional"
|
|
4
|
+
],
|
|
5
|
+
"rules": {
|
|
6
|
+
"header-max-length": [ 2, "always", 120 ],
|
|
7
|
+
"type-enum": [
|
|
8
|
+
2,
|
|
9
|
+
"always",
|
|
10
|
+
[
|
|
11
|
+
"breaking",
|
|
12
|
+
"feat",
|
|
13
|
+
"fix",
|
|
14
|
+
"refactor",
|
|
15
|
+
"config",
|
|
16
|
+
"test",
|
|
17
|
+
"docs",
|
|
18
|
+
"chore"
|
|
19
|
+
]
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
package/.eslintrc
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"parser": "@typescript-eslint/parser",
|
|
3
|
-
"parserOptions": {
|
|
4
|
-
"ecmaVersion": "latest",
|
|
5
|
-
"sourceType": "module" // Allows for the use of imports
|
|
6
|
-
},
|
|
7
|
-
"extends": ["plugin:@typescript-eslint/recommended"],
|
|
8
|
-
"env": {
|
|
9
|
-
"node": true // Enable Node.js global variables
|
|
10
|
-
},
|
|
11
|
-
"rules": {
|
|
12
|
-
"no-console": "off",
|
|
13
|
-
"import/prefer-default-export": "off",
|
|
14
|
-
"@typescript-eslint/no-unused-vars": "warn"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"parser": "@typescript-eslint/parser",
|
|
3
|
+
"parserOptions": {
|
|
4
|
+
"ecmaVersion": "latest",
|
|
5
|
+
"sourceType": "module" // Allows for the use of imports
|
|
6
|
+
},
|
|
7
|
+
"extends": ["plugin:@typescript-eslint/recommended"],
|
|
8
|
+
"env": {
|
|
9
|
+
"node": true // Enable Node.js global variables
|
|
10
|
+
},
|
|
11
|
+
"rules": {
|
|
12
|
+
"no-console": "off",
|
|
13
|
+
"import/prefer-default-export": "off",
|
|
14
|
+
"@typescript-eslint/no-unused-vars": "warn"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/.eslintrc.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: "@typescript-eslint/parser",
|
|
3
|
-
plugins: ["@typescript-eslint"],
|
|
4
|
-
|
|
5
|
-
parserOptions: {
|
|
6
|
-
ecmaVersion: "latest", // Allows the use of modern ECMAScript features
|
|
7
|
-
sourceType: "module", // Allows for the use of imports
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
|
11
|
-
env: {
|
|
12
|
-
node: true, // Enable Node.js global variables
|
|
13
|
-
},
|
|
14
|
-
rules: {
|
|
15
|
-
"no-console": "off",
|
|
16
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
17
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
18
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
19
|
-
"import/prefer-default-export": "off",
|
|
20
|
-
"@typescript-eslint/no-unused-vars": "warn",
|
|
21
|
-
"no-useless-catch": "off",
|
|
22
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
23
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
24
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
25
|
-
"@typescript-eslint/no-inferrable-types": "off",
|
|
26
|
-
"@typescript-eslint/no-namespace": "off",
|
|
27
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
28
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
29
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
|
30
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
31
|
-
"@typescript-eslint/no-unsafe-return": "off",
|
|
32
|
-
"@typescript-eslint/restrict-template-expressions": "off",
|
|
33
|
-
"no-useless-escape": "off",
|
|
34
|
-
},
|
|
35
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
parser: "@typescript-eslint/parser",
|
|
3
|
+
plugins: ["@typescript-eslint"],
|
|
4
|
+
|
|
5
|
+
parserOptions: {
|
|
6
|
+
ecmaVersion: "latest", // Allows the use of modern ECMAScript features
|
|
7
|
+
sourceType: "module", // Allows for the use of imports
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
|
11
|
+
env: {
|
|
12
|
+
node: true, // Enable Node.js global variables
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
"no-console": "off",
|
|
16
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
17
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
18
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
19
|
+
"import/prefer-default-export": "off",
|
|
20
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
|
21
|
+
"no-useless-catch": "off",
|
|
22
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
23
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
24
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
25
|
+
"@typescript-eslint/no-inferrable-types": "off",
|
|
26
|
+
"@typescript-eslint/no-namespace": "off",
|
|
27
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
28
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
29
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
30
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
31
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
32
|
+
"@typescript-eslint/restrict-template-expressions": "off",
|
|
33
|
+
"no-useless-escape": "off",
|
|
34
|
+
},
|
|
35
|
+
};
|
package/.gitlab-ci.yml
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
variables:
|
|
2
|
-
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
|
3
|
-
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
|
4
|
-
sonarcloud-check:
|
|
5
|
-
image:
|
|
6
|
-
name: sonarsource/sonar-scanner-cli:latest
|
|
7
|
-
entrypoint: [""]
|
|
8
|
-
cache:
|
|
9
|
-
key: "${CI_JOB_NAME}"
|
|
10
|
-
paths:
|
|
11
|
-
- .sonar/cache
|
|
12
|
-
script:
|
|
13
|
-
- sonar-scanner
|
|
14
|
-
only:
|
|
15
|
-
- merge_requests
|
|
16
|
-
- main
|
|
1
|
+
variables:
|
|
2
|
+
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
|
3
|
+
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
|
4
|
+
sonarcloud-check:
|
|
5
|
+
image:
|
|
6
|
+
name: sonarsource/sonar-scanner-cli:latest
|
|
7
|
+
entrypoint: [""]
|
|
8
|
+
cache:
|
|
9
|
+
key: "${CI_JOB_NAME}"
|
|
10
|
+
paths:
|
|
11
|
+
- .sonar/cache
|
|
12
|
+
script:
|
|
13
|
+
- sonar-scanner
|
|
14
|
+
only:
|
|
15
|
+
- merge_requests
|
|
16
|
+
- main
|
package/.husky/commit-msg
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
-
|
|
4
|
-
npx commitlint --edit $1
|
|
5
|
-
message="$(cat $1)"
|
|
6
|
-
echo "$message"
|
|
7
|
-
a=($(echo "$message" | tr ':' '\n'))
|
|
8
|
-
echo "${a[0]}"
|
|
9
|
-
if [ "${a[0]}" = "feat" ];
|
|
10
|
-
then
|
|
11
|
-
npm version --commit-hooks false --no-git-tag-version minor
|
|
12
|
-
else
|
|
13
|
-
npm version --commit-hooks false --no-git-tag-version patch
|
|
14
|
-
fi
|
|
15
|
-
git add .
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
npx commitlint --edit $1
|
|
5
|
+
message="$(cat $1)"
|
|
6
|
+
echo "$message"
|
|
7
|
+
a=($(echo "$message" | tr ':' '\n'))
|
|
8
|
+
echo "${a[0]}"
|
|
9
|
+
if [ "${a[0]}" = "feat" ];
|
|
10
|
+
then
|
|
11
|
+
npm version --commit-hooks false --no-git-tag-version minor
|
|
12
|
+
else
|
|
13
|
+
npm version --commit-hooks false --no-git-tag-version patch
|
|
14
|
+
fi
|
|
15
|
+
git add .
|
|
16
16
|
git commit -m "$message" --no-verify
|
package/.husky/pre-commit
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#!/usr/bin/env sh
|
|
2
|
-
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
-
|
|
4
|
-
npm run lint
|
|
5
|
-
npm run format
|
|
6
|
-
npm run build
|
|
7
|
-
git add .
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
npm run lint
|
|
5
|
+
npm run format
|
|
6
|
+
npm run build
|
|
7
|
+
git add .
|
package/.prettierrc
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"singleQuote": true,
|
|
3
|
-
"trailingComma": "all",
|
|
4
|
-
"endOfLine": "auto"
|
|
1
|
+
{
|
|
2
|
+
"singleQuote": true,
|
|
3
|
+
"trailingComma": "all",
|
|
4
|
+
"endOfLine": "auto"
|
|
5
5
|
}
|
package/Jenkinsfile
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
pipeline {
|
|
2
|
-
agent {
|
|
3
|
-
kubernetes {
|
|
4
|
-
label 'jenkins-agent'
|
|
5
|
-
namespace 'devops-tools'
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
tools {nodejs "node18"}
|
|
9
|
-
stages {
|
|
10
|
-
stage('Install') {
|
|
11
|
-
steps {
|
|
12
|
-
echo 'Install Dependencies..'
|
|
13
|
-
sh 'npm install'
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
stage('Test') {
|
|
17
|
-
steps {
|
|
18
|
-
echo 'Testing..'
|
|
19
|
-
// sh 'npm run test'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
stage('Build') {
|
|
23
|
-
steps {
|
|
24
|
-
echo 'Building..'
|
|
25
|
-
sh 'npm run build'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
stage('Publish') {
|
|
29
|
-
steps {
|
|
30
|
-
sh "npm publish"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
post {
|
|
36
|
-
success {
|
|
37
|
-
script {
|
|
38
|
-
def gitAuthor = sh(returnStdout: true, script: 'git log -1 --pretty=format:%an').trim()
|
|
39
|
-
discordSend description: "Git Commit: ${env.GIT_COMMIT}\nGit Branch: ${env.GIT_BRANCH}\nGit URL: ${env.GIT_URL}\nGit Author: ${gitAuthor}", footer: '', image: '', link: env.BUILD_URL, result: 'SUCCESS', scmWebUrl: '', thumbnail: '', title: "${env.JOB_NAME} Build #${env.BUILD_NUMBER} Success", webhookURL: 'https://discord.com/api/webhooks/1166358157166125076/AquDPsQ6L5piq_TfiSfLGOujmVqgHhxfK8yVEfJZrWfhgT6g-j5gJ3xhuXGFZUjRhhlo'
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
failure {
|
|
44
|
-
script {
|
|
45
|
-
def gitAuthor = sh(returnStdout: true, script: 'git log -1 --pretty=format:%an').trim()
|
|
46
|
-
discordSend description: "Git Commit: ${env.GIT_COMMIT}\nGit Branch: ${env.GIT_BRANCH}\nGit URL: ${env.GIT_URL}\nGit Author: ${gitAuthor}", footer: '', image: '', link: env.BUILD_URL, result: 'FAILURE', scmWebUrl: '', thumbnail: '', title: "${env.JOB_NAME} Build #${env.BUILD_NUMBER} Failed", webhookURL: 'https://discord.com/api/webhooks/1166358157166125076/AquDPsQ6L5piq_TfiSfLGOujmVqgHhxfK8yVEfJZrWfhgT6g-j5gJ3xhuXGFZUjRhhlo'
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
1
|
+
pipeline {
|
|
2
|
+
agent {
|
|
3
|
+
kubernetes {
|
|
4
|
+
label 'jenkins-agent'
|
|
5
|
+
namespace 'devops-tools'
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
tools {nodejs "node18"}
|
|
9
|
+
stages {
|
|
10
|
+
stage('Install') {
|
|
11
|
+
steps {
|
|
12
|
+
echo 'Install Dependencies..'
|
|
13
|
+
sh 'npm install'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
stage('Test') {
|
|
17
|
+
steps {
|
|
18
|
+
echo 'Testing..'
|
|
19
|
+
// sh 'npm run test'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
stage('Build') {
|
|
23
|
+
steps {
|
|
24
|
+
echo 'Building..'
|
|
25
|
+
sh 'npm run build'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
stage('Publish') {
|
|
29
|
+
steps {
|
|
30
|
+
sh "npm publish"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
post {
|
|
36
|
+
success {
|
|
37
|
+
script {
|
|
38
|
+
def gitAuthor = sh(returnStdout: true, script: 'git log -1 --pretty=format:%an').trim()
|
|
39
|
+
discordSend description: "Git Commit: ${env.GIT_COMMIT}\nGit Branch: ${env.GIT_BRANCH}\nGit URL: ${env.GIT_URL}\nGit Author: ${gitAuthor}", footer: '', image: '', link: env.BUILD_URL, result: 'SUCCESS', scmWebUrl: '', thumbnail: '', title: "${env.JOB_NAME} Build #${env.BUILD_NUMBER} Success", webhookURL: 'https://discord.com/api/webhooks/1166358157166125076/AquDPsQ6L5piq_TfiSfLGOujmVqgHhxfK8yVEfJZrWfhgT6g-j5gJ3xhuXGFZUjRhhlo'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
failure {
|
|
44
|
+
script {
|
|
45
|
+
def gitAuthor = sh(returnStdout: true, script: 'git log -1 --pretty=format:%an').trim()
|
|
46
|
+
discordSend description: "Git Commit: ${env.GIT_COMMIT}\nGit Branch: ${env.GIT_BRANCH}\nGit URL: ${env.GIT_URL}\nGit Author: ${gitAuthor}", footer: '', image: '', link: env.BUILD_URL, result: 'FAILURE', scmWebUrl: '', thumbnail: '', title: "${env.JOB_NAME} Build #${env.BUILD_NUMBER} Failed", webhookURL: 'https://discord.com/api/webhooks/1166358157166125076/AquDPsQ6L5piq_TfiSfLGOujmVqgHhxfK8yVEfJZrWfhgT6g-j5gJ3xhuXGFZUjRhhlo'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
## Package Template
|
|
2
|
-
|
|
3
|
-
### How to use
|
|
4
|
-
- run `npm i`
|
|
5
|
-
- create a `components` folder in the root of your project
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
## Package Template
|
|
2
|
+
|
|
3
|
+
### How to use
|
|
4
|
+
- run `npm i`
|
|
5
|
+
- create a `components` folder in the root of your project
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
@@ -4,6 +4,7 @@ import { IBookingAttr } from '../../interfaces/booking-attr.interface';
|
|
|
4
4
|
import { BookingRepository } from './booking.repository';
|
|
5
5
|
import { LoginUser } from '@tomei/sso';
|
|
6
6
|
import { RentalPrice } from '../rental-price/rental-price';
|
|
7
|
+
import { IBookingFindAllSearchAttr } from '../../interfaces/booking-find-all-search-attr.interface';
|
|
7
8
|
export declare class Booking extends ObjectBase {
|
|
8
9
|
ObjectId: string;
|
|
9
10
|
ObjectName: string;
|
|
@@ -38,4 +39,5 @@ export declare class Booking extends ObjectBase {
|
|
|
38
39
|
static init(dbTransaction?: any, bookingNo?: string): Promise<Booking>;
|
|
39
40
|
create(dbTransaction: any, loginUser: LoginUser, rentalPrice: RentalPrice): Promise<this>;
|
|
40
41
|
static isBookingItemAvailable(dbTransaction: any, itemId: string, itemType: string, startDateTime: Date, endDateTime: Date): Promise<boolean>;
|
|
42
|
+
static findAll(dbTransaction: any, page?: number, row?: number, search?: IBookingFindAllSearchAttr): Promise<any>;
|
|
41
43
|
}
|
|
@@ -200,6 +200,44 @@ class Booking extends general_1.ObjectBase {
|
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
|
+
static findAll(dbTransaction, page, row, search) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
try {
|
|
206
|
+
const queryObj = {};
|
|
207
|
+
let options = {
|
|
208
|
+
transaction: dbTransaction,
|
|
209
|
+
order: [['CreatedAt', 'DESC']],
|
|
210
|
+
};
|
|
211
|
+
if (page && row) {
|
|
212
|
+
options = Object.assign(Object.assign({}, options), { limit: row, offset: row * (page - 1) });
|
|
213
|
+
}
|
|
214
|
+
if (search) {
|
|
215
|
+
Object.entries(search).forEach(([key, value]) => {
|
|
216
|
+
if (key === 'ScheduledStartDateTime') {
|
|
217
|
+
queryObj[key] = {
|
|
218
|
+
[sequelize_1.Op.gte]: value,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
else if (key === 'ScheduledEndDateTime') {
|
|
222
|
+
queryObj[key] = {
|
|
223
|
+
[sequelize_1.Op.lte]: value,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
queryObj[key] = {
|
|
228
|
+
[sequelize_1.Op.substring]: value,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
options = Object.assign(Object.assign({}, options), { where: queryObj });
|
|
233
|
+
}
|
|
234
|
+
return yield Booking._Repo.findAndCountAll(options);
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
throw err;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
203
241
|
}
|
|
204
242
|
exports.Booking = Booking;
|
|
205
243
|
Booking._Repo = new booking_repository_1.BookingRepository();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking.js","sourceRoot":"","sources":["../../../../src/components/booking/booking.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AAGxD,6DAAyD;AACzD,iCAAiC;AAGjC,0CAAkD;AAClD,yCAA+B;AAC/B,6CAA0C;AAC1C,8DAA+D;
|
|
1
|
+
{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yBACH;6BAAM,IAAI,GAAG,KAAK,sBAAsB,EAAE;4BACzC,QAAQ,CAAC,GAAG,CAAC,GAAG;gCACd,CAAC,cAAE,CAAC,GAAG,CAAC,EAAE,KAAK;6BAChB,CAAC;yBACH;6BAAM;4BACL,QAAQ,CAAC,GAAG,CAAC,GAAG;gCACd,CAAC,cAAE,CAAC,SAAS,CAAC,EAAE,KAAK;6BACtB,CAAC;yBACH;oBACH,CAAC,CAAC,CAAC;oBAEH,OAAO,mCACF,OAAO,KACV,KAAK,EAAE,QAAQ,GAChB,CAAC;iBACH;gBAED,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;aACrD;YAAC,OAAO,GAAG,EAAE;gBACZ,MAAM,GAAG,CAAC;aACX;QACH,CAAC;KAAA;;AAxUH,0BAyUC;AArTkB,aAAK,GAAG,IAAI,sCAAiB,EAAE,CAAC"}
|
|
@@ -397,21 +397,21 @@ class Rental extends general_1.ObjectBase {
|
|
|
397
397
|
if (!isPrivileged) {
|
|
398
398
|
throw new general_1.ClassError('Rental', 'RentalErrMsg01', "You do not have 'Rental - View' privilege.");
|
|
399
399
|
}
|
|
400
|
-
const query = `
|
|
401
|
-
SELECT
|
|
402
|
-
r.*
|
|
403
|
-
FROM
|
|
404
|
-
rental_Rental r
|
|
405
|
-
LEFT JOIN
|
|
406
|
-
rental_JointHirer jh ON r.RentalId = jh.RentalId
|
|
407
|
-
WHERE
|
|
408
|
-
r.Status = 'Active'
|
|
409
|
-
AND (
|
|
410
|
-
r.CustomerId = '${CustomerId}'
|
|
411
|
-
OR jh.CustomerId = '${CustomerId}'
|
|
412
|
-
)
|
|
413
|
-
GROUP BY
|
|
414
|
-
r.RentalId
|
|
400
|
+
const query = `
|
|
401
|
+
SELECT
|
|
402
|
+
r.*
|
|
403
|
+
FROM
|
|
404
|
+
rental_Rental r
|
|
405
|
+
LEFT JOIN
|
|
406
|
+
rental_JointHirer jh ON r.RentalId = jh.RentalId
|
|
407
|
+
WHERE
|
|
408
|
+
r.Status = 'Active'
|
|
409
|
+
AND (
|
|
410
|
+
r.CustomerId = '${CustomerId}'
|
|
411
|
+
OR jh.CustomerId = '${CustomerId}'
|
|
412
|
+
)
|
|
413
|
+
GROUP BY
|
|
414
|
+
r.RentalId
|
|
415
415
|
`;
|
|
416
416
|
const db = rentalDb.getConnection();
|
|
417
417
|
const result = yield db.query(query, {
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-find-all-search-attr.interface.js","sourceRoot":"","sources":["../../../src/interfaces/booking-find-all-search-attr.interface.ts"],"names":[],"mappings":""}
|
|
@@ -3,4 +3,5 @@ import { IRentalPriceAttr } from './rental-price-attr.interface';
|
|
|
3
3
|
import { IRentalFindAllSearchAttr } from './rental-find-all-search-attr.interface';
|
|
4
4
|
import { IBookingAttr } from './booking-attr.interface';
|
|
5
5
|
import { IAgreementAttr } from './agreement-attr.interface';
|
|
6
|
-
|
|
6
|
+
import { IBookingFindAllSearchAttr } from './booking-find-all-search-attr.interface';
|
|
7
|
+
export { IRentalAttr, IRentalPriceAttr, IRentalFindAllSearchAttr, IBookingAttr, IAgreementAttr, IBookingFindAllSearchAttr, };
|