Skip to content

Commit

Permalink
fix: use updatedAt column for last updated date (#975)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcshzj authored Jan 7, 2025
1 parent 84a079f commit 6cbba8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tooling/build/scripts/publishing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async function main() {
type: resource.type,
title: resource.title,
permalink: `/${getConvertedPermalink(resource.fullPermalink)}`,
lastModified: new Date().toISOString(), // TODO: Update to updated_at column
lastModified: resource.updatedAt.toISOString(),
layout: resource.content.layout || "content",
summary:
(Array.isArray(resource.content.page.contentPageHeader?.summary)
Expand Down
8 changes: 5 additions & 3 deletions tooling/build/scripts/publishing/queries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const GET_ALL_RESOURCES_WITH_FULL_PERMALINKS = `
WITH RECURSIVE "resourcePath" (id, title, permalink, parentId, type, content, "fullPermalink", "publishedVersionId") AS (
WITH RECURSIVE "resourcePath" (id, title, permalink, parentId, type, content, "fullPermalink", "publishedVersionId", "updatedAt") AS (
-- Base case for all resources
SELECT
r.id,
Expand All @@ -12,7 +12,8 @@ WITH RECURSIVE "resourcePath" (id, title, permalink, parentId, type, content, "f
ELSE NULL
END AS content,
r.permalink AS "fullPermalink",
r."publishedVersionId"
r."publishedVersionId",
r."updatedAt"
FROM
public."Resource" r
LEFT JOIN public."Version" v ON v."id" = r."publishedVersionId"
Expand All @@ -34,7 +35,8 @@ WITH RECURSIVE "resourcePath" (id, title, permalink, parentId, type, content, "f
ELSE NULL
END AS content,
CONCAT(path."fullPermalink", '/', r.permalink) AS "fullPermalink",
r."publishedVersionId"
r."publishedVersionId",
r."updatedAt"
FROM
public."Resource" r
LEFT JOIN public."Version" v ON v."id" = r."publishedVersionId"
Expand Down

0 comments on commit 6cbba8c

Please sign in to comment.