diff --git a/docs/syncronizations/TSP/Architecture.md b/docs/syncronizations/TSP/Architecture.md new file mode 100644 index 0000000..5c61cbf --- /dev/null +++ b/docs/syncronizations/TSP/Architecture.md @@ -0,0 +1,9 @@ +# Architecture + +## TspSyncStrategy + +This strategy handles the sync of schools, students, teachers and classes from TSP and replaces both the legacy TspBaseSyncer and TspSchoolSyncer. It responds to the target "tsp". + +The flow looks like this (some of the logic for syncing is done in the provisioning strategy which is shared with the login): + +![Flow of the TSP sync strategy](tsp_sync_strategy.png) diff --git a/docs/syncronizations/TSP/How it works.md b/docs/syncronizations/TSP/How it works.md new file mode 100644 index 0000000..18a1e12 --- /dev/null +++ b/docs/syncronizations/TSP/How it works.md @@ -0,0 +1,52 @@ +# How it works + +## Configuration + +- FEATURE_TSP_SYNC_ENABLED - Activates the sync strategy inside the sync console + +- WITH_TSP_SYNC - Activates the cronjob in Kubernetes + +- TSP_API_CLIENT_BASE_URL - Base URL for the TSP API + +- TSP_API_TOKEN_LIFETIME_MS - Lifetime of the access token for the TSP API in milliseconds + +- TSP_SYNC_SCHOOL_LIMIT - The amount of schools the sync handles at once + +- TSP_SYNC_SCHOOL_DAYS_TO_FETCH - The amount of days for which the sync fetches schools from the TSP API + +- TSP_SYNC_DATA_LIMIT - The amount of school data updates the sync handles at once + +- TSP_SYNC_DATA_DAYS_TO_FETCH - The amount of days for which the sync fetches school data from the TSP API + +- FEATURE_TSP_MIGRATION_ENABLED - Activates the migration of TSP users within the sync + +- TSP_SYNC_MIGRATION_LIMIT - The amount of users the sync migrates at once + +## Sync console + +This is a console application that allows you to start the synchronization process for different sources. + +### Usage + +To start the synchronization process, run the following command: + +```bash +npm run nest:start:console sync run +``` + +Where `` is the name of the system you want to start the synchronization for. The currently available systems are: + +- `tsp` - Synchronize Thüringer Schulportal. + +If the target is not provided, the synchronization will not start and the available targets will be displayed in an error message. + +```bash +{ + message: 'Either synchronization is not activated or the target entered is invalid', + data: { enteredTarget: 'tsp', availableTargets: { TSP: 'tsp' }} +} +``` + +### TSP synchronization + +The TSP synchronization is controlled with the feature flag `FEATURE_TSP_SYNC_ENABLED`. diff --git a/docs/syncronizations/TSP/tsp_sync_strategy.png b/docs/syncronizations/TSP/tsp_sync_strategy.png new file mode 100644 index 0000000..76bbb87 Binary files /dev/null and b/docs/syncronizations/TSP/tsp_sync_strategy.png differ