Skip to content

Commit

Permalink
refactor: move GEWISDB syncing logic to gewisdb-sync-service
Browse files Browse the repository at this point in the history
  • Loading branch information
JustSamuel committed Jan 19, 2025
1 parent b160ab6 commit 732e5a9
Show file tree
Hide file tree
Showing 11 changed files with 458 additions and 599 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"lint": "eslint package.json src test --ext .js --ext .ts",
"lint-fix": "npm run lint -- --fix",
"typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js",
"cli": "ts-node ./src/gewis/service/cli-service.ts",
"predocs:dev": "typedoc",
"typedoc": "typedoc",
"docs:dev": "vitepress dev docs",
Expand Down
15 changes: 5 additions & 10 deletions src/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import DefaultRoles from './rbac/default-roles';
import LdapSyncService from './service/sync/user/ldap-sync-service';
import { UserSyncService } from './service/sync/user/user-sync-service';
import UserSyncManager from './service/sync/user/user-sync-manager';
import GewisDBSyncService from './gewis/service/gewisdb-sync-service';

class CronApplication {
logger: Logger;
Expand Down Expand Up @@ -109,16 +110,10 @@ async function createCronTasks(): Promise<void> {
syncServices.push(ldapSyncService);
}

// TODO move to GewisDBSyncService
// if (process.env.GEWISDB_API_KEY && process.env.GEWISDB_API_URL && process.env.ENABLE_GEWISDB_SYNC) {
// await GewisDBService.syncAll();
// const syncGewis = cron.schedule('41 4 * * *', async () => {
// logger.debug('Syncing users with GEWISDB.');
// await GewisDBService.syncAll();
// logger.debug('Synced users with GEWISDB.');
// });
// application.tasks.push(syncGewis);
// }
if (process.env.GEWISDB_API_KEY && process.env.GEWISDB_API_URL && process.env.ENABLE_GEWISDB_SYNC) {
const gewisDBSyncService = new GewisDBSyncService();
syncServices.push(gewisDBSyncService);
}

if (syncServices.length !== 0) {
const syncManager = new UserSyncManager(syncServices);
Expand Down
1 change: 1 addition & 0 deletions src/entity/server-setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface ISettings {
jwtExpiryDefault: number;
jwtExpiryPointOfSale: number;
maintenanceMode: boolean;
allowGewisSyncDelete: boolean;
}

/**
Expand Down
72 changes: 0 additions & 72 deletions src/gewis/service/cli-service.ts

This file was deleted.

166 changes: 0 additions & 166 deletions src/gewis/service/gewisdb-service.ts

This file was deleted.

Loading

0 comments on commit 732e5a9

Please sign in to comment.