Make user business logic reusable (#1114)

- Refactor user business logic from `user.service` into `user.domain`
  Make user business logic reusable by using `user.domain` from other services than `user.service`

- Add `jest-when` lib to make testing easier and use it in `userService`
  Using when helps from coupling tests to order of mock implementations execution

- Move all user business logic from user-repository to user.service

- Fix user.service tests not awaiting promises leaking state between tests

- Presentation logic for `getUserProfileImage` moved from UserService to UserController

- Fix `user.e2e` test logic. Pending fixing the configuration of the test itself
This commit is contained in:
Jaime Baez
2022-12-23 21:08:50 +01:00
committed by GitHub
parent bf921a41f9
commit 20c5578470
20 changed files with 577 additions and 972 deletions

View File

@@ -61,6 +61,7 @@
"geo-tz": "^7.0.2",
"handlebars": "^4.7.7",
"i18n-iso-countries": "^7.5.0",
"jest-when": "^3.5.2",
"joi": "^17.5.0",
"local-reverse-geocoder": "^0.12.5",
"lodash": "^4.17.21",
@@ -96,6 +97,7 @@
"@types/fluent-ffmpeg": "^2.1.20",
"@types/imagemin": "^8.0.0",
"@types/jest": "27.0.2",
"@types/jest-when": "^3.5.2",
"@types/lodash": "^4.14.178",
"@types/multer": "^1.4.7",
"@types/mv": "^2.1.2",
@@ -145,6 +147,7 @@
"@app/database/config": "<rootDir>/libs/database/src/config",
"@app/common": "<rootDir>/libs/common/src",
"^@app/job(|/.*)$": "<rootDir>/libs/job/src/$1",
"@app/job": "<rootDir>/libs/job/src",
"^@app/immich-config(|/.*)$": "<rootDir>/libs/immich-config/src/$1",
"^@app/storage(|/.*)$": "<rootDir>/libs/storage/src/$1"
}