fix(core): Ensure updatedAt field exists on folder object for source control (#16437)

This commit is contained in:
Andreas Fitzek
2025-06-17 15:28:36 +02:00
committed by GitHub
parent 1da3c70507
commit 81dd215ff9
2 changed files with 6 additions and 4 deletions

View File

@@ -216,10 +216,10 @@ export class SourceControlController {
@Get('/get-status', { middlewares: [sourceControlLicensedAndEnabledMiddleware] })
async getStatus(req: SourceControlRequest.GetStatus) {
try {
const result = (await this.sourceControlService.getStatus(
const result = await this.sourceControlService.getStatus(
req.user,
new SourceControlGetStatus(req.query),
)) as SourceControlledFile[];
);
return result;
} catch (error) {
throw new BadRequestError((error as { message: string }).message);

View File

@@ -963,6 +963,8 @@ export class SourceControlService {
select: ['updatedAt'],
});
const lastUpdatedDate = lastUpdatedFolder[0]?.updatedAt ?? new Date();
const foldersMappingsRemote =
await this.sourceControlImportService.getRemoteFoldersAndMappingsFromFile(context);
const foldersMappingsLocal =
@@ -999,7 +1001,7 @@ export class SourceControlService {
location: options.direction === 'push' ? 'local' : 'remote',
conflict: false,
file: getFoldersPath(this.gitFolder),
updatedAt: lastUpdatedFolder[0]?.updatedAt.toISOString(),
updatedAt: lastUpdatedDate.toISOString(),
});
});
foldersMissingInRemote.forEach((item) => {
@@ -1011,7 +1013,7 @@ export class SourceControlService {
location: options.direction === 'push' ? 'local' : 'remote',
conflict: options.direction === 'push' ? false : true,
file: getFoldersPath(this.gitFolder),
updatedAt: lastUpdatedFolder[0]?.updatedAt.toISOString(),
updatedAt: lastUpdatedDate.toISOString(),
});
});