mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 09:07:46 +02:00
Fix missions serialized document dates
This commit is contained in:
1 parent
e551b857ca
commit
8f3aa3519d
2 files changed
+15
-1
No files matched your search
@@ -158,6 +158,12 @@ function stringifyError(error: unknown) {
|
||||
return String(error);
|
||||
}
|
||||
|
||||
function toIsoTimestamp(value: Date | string | null | undefined) {
|
||||
if (value instanceof Date) return value.toISOString();
|
||||
if (typeof value === "string") return value;
|
||||
return new Date(0).toISOString();
|
||||
}
|
||||
|
||||
function unique<T>(values: T[]) {
|
||||
return [...new Set(values)];
|
||||
}
|
||||
@@ -240,7 +246,7 @@ async function parseMissionDocuments(
|
||||
issueId: issue.id,
|
||||
key: summary.key,
|
||||
title: summary.title,
|
||||
updatedAt: summary.updatedAt.toISOString(),
|
||||
updatedAt: toIsoTimestamp(summary.updatedAt),
|
||||
parsed: parseMissionValidationReportDocument(document.body, { round }),
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -527,6 +527,14 @@ describe("missions plugin worker", () => {
|
||||
});
|
||||
}
|
||||
|
||||
const originalList = harness.ctx.issues.documents.list;
|
||||
harness.ctx.issues.documents.list = async (...args) =>
|
||||
(await originalList(...args)).map((summary) => ({
|
||||
...summary,
|
||||
createdAt: summary.createdAt.toISOString(),
|
||||
updatedAt: summary.updatedAt.toISOString(),
|
||||
})) as unknown as Awaited<ReturnType<typeof originalList>>;
|
||||
|
||||
const originalUpsert = harness.ctx.issues.documents.upsert;
|
||||
const documentUpdates: Array<{ key: string; baseRevisionId: string | null | undefined }> = [];
|
||||
harness.ctx.issues.documents.upsert = async (input) => {
|
||||
|
||||
Reference in new issue
Block a user