Skip to content

Commit ba65fc5

Browse files
committed
fix 'updated_at' range parameter for campus sync
1 parent 4d4dea4 commit ba65fc5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/sync.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ export const syncWithIntra = async function(): Promise<void> {
7474
* @param lastPullDate The date of the last synchronization
7575
* @returns A promise that resolves when the synchronization is complete
7676
*/
77-
async function syncCampuses(fast42Api: Fast42, lastSync: Date | undefined): Promise<void> {
77+
async function syncCampuses(fast42Api: Fast42, now: Date): Promise<void> {
7878
let campusesApi;
7979
try {
80+
let lastSyncRaw = await DatabaseService.getLastSyncTimestamp("full", 1);
81+
let lastSync: Date | undefined = lastSyncRaw === null ? undefined : lastSyncRaw;
8082
log(2, `Syncing campuses...`);
81-
campusesApi = await syncData(fast42Api, new Date(), lastSync, `/campus`, { 'active': 'true' });
83+
campusesApi = await syncData(fast42Api, now, lastSync, `/campus`, { 'active': 'true' });
8284
const dbCampuses = campusesApi.map(transformApiCampusToDb);
8385
await DatabaseService.insertManyCampuses(dbCampuses);
8486
log(2, `Finished syncing campuses`);

0 commit comments

Comments
 (0)