Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-6420 - unsynced users deletion #4868

Merged
merged 77 commits into from
Apr 11, 2024
Merged

BC-6420 - unsynced users deletion #4868

merged 77 commits into from
Apr 11, 2024

Conversation

bn-pass
Copy link
Contributor

@bn-pass bn-pass commented Mar 22, 2024

Description

Links to Tickets or other pull requests

https://ticketsystem.dbildungscloud.de/browse/BC-6420

Changes

Datasecurity

Deployment

New Repos, NPM pakages or vendor scripts

Approval for review

  • DEV: If api was changed - generate-client:server was executed in vue frontend and changes were tested and put in a PR with the same branch name.
  • QA: In addition to review, the code has been manually tested (if manual testing is possible)
  • All points were discussed with the ticket creator, support-team or product owner. The code upholds all quality guidelines from the PR-template.

Notice: Please remove the WIP label if the PR is ready to review, otherwise nobody will review it.

WojciechGrancow and others added 30 commits February 8, 2024 07:32
import { AccountModule } from '../account';
import { defaultMikroOrmOptions } from '../server';
import { FileEntity } from '../files/entity';
import { UserModule } from '../user/user.module';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unnecessary imports

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1,4 +1,6 @@
import { Injectable } from '@nestjs/common';
import { AccountService } from '@src/modules/account';
import { UserService } from '@src/modules/user';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep to convention for imports from modules @modules/....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@WojciechGrancow WojciechGrancow added waiting for review and removed WIP This feature branch is in progress, do not merge into master. labels Apr 5, 2024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding Services as Providers directly is NOT the solution to circular dependencies. It does not solve them, it only makes them more narrow and harder to detect. They seem to be solved, but they are not, they will come back to bite us later.
It is absolutely forbidden to provide things that are already provided by another module.

Why do these circular dependencies appear? there should be no other module with any dependency on deletion console right?

Possibly they are caused by other circular dependencies that are already in the system, but hidden because other people tried to trick them by hiding them in explicit imports. Thats exactly the reason why you cant provide the UserService in your module, it will cause an dependency cycle in some harmless change later down the line in a different PR that has nothing to do with this one.

We need to figure out where the circular dependencies come from, what modules actually form the circle (modules, not files), and then either untangling or avoid using them.

@@ -25,6 +51,13 @@ import { BatchDeletionUc, DeletionExecutionUc } from './uc';
DeletionExecutionUc,
DeletionQueueConsole,
DeletionExecutionConsole,
UserService,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these services need to go, if you need them import the modules instead.
Some of the Repos are an exception since they are not part of a module, but you should avoid using the repos at all directly, and instead introduce service methods for things you need to do from the outside.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 074568b - all the non-local dependencies were moved to imports, in providers there are just the local dependencies now.

@bn-pass bn-pass requested a review from Metauriel April 10, 2024 16:54
Copy link

@bn-pass bn-pass merged commit d0c8758 into main Apr 11, 2024
55 of 56 checks passed
@bn-pass bn-pass deleted the BC-6420-unsynced-users-del branch April 11, 2024 13:13
bergatco pushed a commit that referenced this pull request Apr 15, 2024
* crate entity, repo, do, mapper for synchronization and deletion-reconcilation.uc

* add synchronization service and tests

* changes in reconcilation UC

* add lastSyncedAt to userEntity and change create in synchronization service

* create synchronization module and move files from deletion module into it

* add new interface, builders, method in userrepo and new methos in userservice, ande test cases

* some changes

* mofdify acount, user service and synchronization UC

* add some tests, remove userIdAndExternalId interface, builder

* changes in synchronizationEntity

* add staus to synchronizationEntity

* add update method in repo in synchronization module

* fix imports, add update method and test  in service

* add synchromization.module, fix import, modify uc

* fix in acount service test

* change folder structure in synchronization module, fix test in repo

* coments about chunk

* add loggable, and extension of UC

* add test cases to loggable and to userService

* add tests to useCase in synchronizationModule

* add test to UC

* BC-6223-add chunks

* add test cases in UC

* add tests

* remove private methon

* refactor

* add tests and change loop

* add test to UC

* add config

* sum with promise.all

* fixes typo, changes test in UC

* rename testConfig file

* add new command (for queueing unsynchronized entities for deletion)

* add new Ansible role for moin.schule sync with users deletion queueing CronJob task

* Update apps/server/src/shared/repo/user/user.repo.integration.spec.ts

Co-authored-by: Bartosz Nowicki <[email protected]>

* fix some issues after review

* fiz error cases in uc

* add test in UC

* modify SynchronizationErrorLoggableException

* main logic impl

* fix tests

* remove files that were not resolved automatically after merge

* Pr fix and test implementation part1

* test impl part2

* test impl part 3

* test implementation part 3

* add needed modules and providers

* add mongoDb flag

* fix import order

* import fix

* import chnages

* refactor dependencies

---------

Co-authored-by: WojciechGrancow <[email protected]>
Co-authored-by: Wojciech Grancow <[email protected]>
Co-authored-by: micners <[email protected]>
Co-authored-by: WojciechGrancow <[email protected]>
Co-authored-by: Szymon Szafoni <[email protected]>
Co-authored-by: sszafGCA <[email protected]>
bergatco pushed a commit that referenced this pull request May 6, 2024
* crate entity, repo, do, mapper for synchronization and deletion-reconcilation.uc

* add synchronization service and tests

* changes in reconcilation UC

* add lastSyncedAt to userEntity and change create in synchronization service

* create synchronization module and move files from deletion module into it

* add new interface, builders, method in userrepo and new methos in userservice, ande test cases

* some changes

* mofdify acount, user service and synchronization UC

* add some tests, remove userIdAndExternalId interface, builder

* changes in synchronizationEntity

* add staus to synchronizationEntity

* add update method in repo in synchronization module

* fix imports, add update method and test  in service

* add synchromization.module, fix import, modify uc

* fix in acount service test

* change folder structure in synchronization module, fix test in repo

* coments about chunk

* add loggable, and extension of UC

* add test cases to loggable and to userService

* add tests to useCase in synchronizationModule

* add test to UC

* BC-6223-add chunks

* add test cases in UC

* add tests

* remove private methon

* refactor

* add tests and change loop

* add test to UC

* add config

* sum with promise.all

* fixes typo, changes test in UC

* rename testConfig file

* add new command (for queueing unsynchronized entities for deletion)

* add new Ansible role for moin.schule sync with users deletion queueing CronJob task

* Update apps/server/src/shared/repo/user/user.repo.integration.spec.ts

Co-authored-by: Bartosz Nowicki <[email protected]>

* fix some issues after review

* fiz error cases in uc

* add test in UC

* modify SynchronizationErrorLoggableException

* main logic impl

* fix tests

* remove files that were not resolved automatically after merge

* Pr fix and test implementation part1

* test impl part2

* test impl part 3

* test implementation part 3

* add needed modules and providers

* add mongoDb flag

* fix import order

* import fix

* import chnages

* refactor dependencies

---------

Co-authored-by: WojciechGrancow <[email protected]>
Co-authored-by: Wojciech Grancow <[email protected]>
Co-authored-by: micners <[email protected]>
Co-authored-by: WojciechGrancow <[email protected]>
Co-authored-by: Szymon Szafoni <[email protected]>
Co-authored-by: sszafGCA <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants