File tree 2 files changed +21
-4
lines changed
packages/api/src/filestorage
2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -258,16 +258,29 @@ export class OnedriveService implements IFileService {
258
258
) ;
259
259
}
260
260
261
- private async getLastSyncTime ( connection : any ) {
261
+ private async getLastSyncTime ( connection : {
262
+ id_connection : string ;
263
+ } ) : Promise < Date | null > {
262
264
const lastSyncTime = await this . prisma . fs_files . findFirst ( {
263
265
where : {
264
266
id_connection : connection . id_connection ,
265
267
} ,
266
268
orderBy : {
267
- remote_modified_at : 'desc' ,
269
+ remote_modified_at : {
270
+ sort : 'desc' ,
271
+ nulls : 'last' ,
272
+ } ,
273
+ } ,
274
+ select : {
275
+ remote_modified_at : true ,
268
276
} ,
269
277
} ) ;
270
- return lastSyncTime ?. remote_modified_at ;
278
+
279
+ this . logger . log (
280
+ `Last file sync time: ${ lastSyncTime ?. remote_modified_at } ` ,
281
+ 'onedrive files sync' ,
282
+ ) ;
283
+ return lastSyncTime ?. remote_modified_at ?? null ;
271
284
}
272
285
273
286
private async syncFolder (
Original file line number Diff line number Diff line change @@ -715,8 +715,12 @@ export class OnedriveService implements IFolderService {
715
715
private async getLastSyncTime ( connectionId : string ) : Promise < Date | null > {
716
716
const lastSync = await this . prisma . fs_folders . findFirst ( {
717
717
where : { id_connection : connectionId } ,
718
- orderBy : { remote_modified_at : 'desc' } ,
718
+ orderBy : { remote_modified_at : { sort : 'desc' , nulls : 'last' } } ,
719
719
} ) ;
720
+ this . logger . log (
721
+ `Last sync time: ${ lastSync ?. remote_modified_at } ` ,
722
+ 'onedrive folders sync' ,
723
+ ) ;
720
724
return lastSync ? lastSync . remote_modified_at : null ;
721
725
}
722
726
You can’t perform that action at this time.
0 commit comments