PIT: hide restore button for last commit

This commit is contained in:
carlosmonastyrski
2025-05-25 11:52:28 -03:00
parent 14362dbe6a
commit b812761bdd
5 changed files with 16 additions and 10 deletions
@@ -85,6 +85,7 @@ const commitSchema = z.object({
envId: z.string(),
createdAt: z.union([z.string(), z.date()]),
updatedAt: z.union([z.string(), z.date()]),
isLatest: z.boolean().default(false),
changes: z.array(commitChangeSchema).optional()
});
@@ -1279,7 +1279,8 @@ export const folderCommitServiceFactory = ({
});
const changes = await folderCommitChangesDAL.findByCommitId(commitId, projectId);
const commit = await folderCommitDAL.findById(commitId, undefined, projectId);
return { ...commit, changes };
const latestCommit = await folderCommitDAL.findLatestCommit(commit.folderId, projectId);
return { ...commit, changes, isLatest: commit.id === latestCommit?.id };
};
/**