-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete obsolete LocalAccounts on App startup (#356)
* feat: add logic to start of runtime * feat: add backbone route * refactor: rename checkIdentityDeletionForUsername * feat: add checkIdentityDeletionForUsername use case * feat: get username in transport * refactor: rename to checkDeletionOfIdentity * test: identitycontroller * fix: rename consistently * test: add runtime test * feat: continue startApp * feat: delete accounts if identities are deleted * feat: bump backbone * fix: provide config for updated backbone * feat: add IdentityDeletionInfo object * test: add transport test for passed grace period * refactor: errors * Revert "feat: add IdentityDeletionInfo object" This reverts commit 01813a6. * test: add runtime test for expired grace period * refactor: naming * refactor: rename startAccounts * feat: configure gracePeriod initializing IdentityDeletionProcess * feat: allow to manually run deletion job on backbone * test: run deletion job in skipped test * test: deleted Identity * feat: log error * refactor: backbone response can be null * feat: check for deleted Identities; wip * fix: return early for error other than noAuthGrant * feat: rename offoardDevice * test: accounts of deleted identities are remove on app startup * refactor: rename offboardDevice on AccountService * feat: add deleteAccount to AccountServices * fix: app-runtime tests * refactor: rename offboardAccount * chore: simplify * chore: simplify * refactor: rename checkIfIdentityIsDeleted * test: make tests independent * test: offboard account of identity with ongoing grace period * test: adjust runDeletionJob * chore: package-lock * test: rename * fix: make more tests independent --------- Co-authored-by: Julian König <33655937+jkoenig134@users.noreply.github.com> Co-authored-by: Julian König <julian.koenig@js-soft.com>
- Loading branch information
1 parent
59d5579
commit e1bd4c7
Showing
14 changed files
with
289 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/runtime/src/useCases/transport/account/CheckIfIdentityIsDeleted.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Result } from "@js-soft/ts-utils"; | ||
import { IdentityController } from "@nmshd/transport"; | ||
import { Inject } from "@nmshd/typescript-ioc"; | ||
import { UseCase } from "../../common"; | ||
|
||
export interface CheckIfIdentityIsDeletedResponse { | ||
isDeleted: boolean; | ||
deletionDate?: string; | ||
} | ||
|
||
export class CheckIfIdentityIsDeletedUseCase extends UseCase<void, CheckIfIdentityIsDeletedResponse> { | ||
public constructor(@Inject private readonly identityController: IdentityController) { | ||
super(); | ||
} | ||
|
||
protected async executeInternal(): Promise<Result<CheckIfIdentityIsDeletedResponse>> { | ||
const result = await this.identityController.checkIfIdentityIsDeleted(); | ||
|
||
if (result.isError) return Result.fail(result.error); | ||
|
||
return Result.ok(result.value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/transport/src/modules/accounts/backbone/BackboneCheckIfIdentityIsDeleted.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface BackboneCheckIfIdentityIsDeletedResponse { | ||
isDeleted: boolean; | ||
deletionDate: string | null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.