SudoSOS Back-end API / GEWIS/gewis-db-sync-service / GewisDBSyncService
Class: GewisDBSyncService ​
UserSyncService interface.
Specific sync service for users.
Extends ​
Constructors ​
Constructor ​
new GewisDBSyncService(
gewisdbApiKey?,
gewisdbApiUrl?,
manager?): GewisDBSyncService;Parameters ​
| Parameter | Type |
|---|---|
gewisdbApiKey? | string |
gewisdbApiUrl? | string |
manager? | EntityManager |
Returns ​
GewisDBSyncService
Overrides ​
Properties ​
| Property | Modifier | Type | Overrides | Inherited from |
|---|---|---|---|---|
manager | protected | EntityManager | - | UserSyncService.manager |
targets | public | UserType[] | UserSyncService.targets | - |
Methods ​
down() ​
down(entity, isDryRun?): Promise<void>;Down is called when the SyncService decides that the entity is no longer connected to this sync service be removed. This can be used to remove the entity from the database or clean up entities.
This should be revertible and idempotent!
Parameters ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
entity | User | undefined | - |
isDryRun | boolean | false | Whether this is a dry run (no actual changes) |
Returns ​
Promise<void>
Overrides ​
fetch() ​
fetch(): Promise<void>;Fetches the user data from the external data source. sync can be seen as a push and fetch as a pull.
Returns ​
Promise<void>
Overrides ​
guard() ​
guard(entity): Promise<boolean>;Guard determines whether the entity should be synced using this sync service.
Not passing the guard will result in the user being skipped. A skipped sync does not count as a failure.
Parameters ​
| Parameter | Type |
|---|---|
entity | User |
Returns ​
Promise<boolean>
True if the entity should be synced, false otherwise.
Overrides ​
post() ​
post(): Promise<void>;Called after a sync batch is finished.
Returns ​
Promise<void>
Inherited from ​
pre() ​
pre(): Promise<void>;Called before a sync batch is started.
Returns ​
Promise<void>
Overrides ​
sync() ​
sync(entity, isDryRun?): Promise<boolean>;Synchronizes the user data with the external data source.
Parameters ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
entity | User | undefined | - |
isDryRun | boolean | false | Whether this is a dry run (no actual changes) |
Returns ​
Promise<boolean>
True if the user was synchronized, false otherwise.
Overrides ​
up() ​
up(entity, isDryRun?): Promise<SyncResult>;Up is a wrapper around sync that handles the guard.
Parameters ​
| Parameter | Type | Default value | Description |
|---|---|---|---|
entity | User | undefined | - |
isDryRun | boolean | false | Whether this is a dry run (no actual changes) |
Returns ​
Promise<SyncResult>
The result of the sync.
Inherited from ​
isUpdateNeeded() ​
static isUpdateNeeded(memberUser, update): boolean;Parameters ​
| Parameter | Type |
|---|---|
memberUser | MemberUser |
update | any |
Returns ​
boolean