···11import { Database } from "../db/index.ts";
22import { TimeCidKeyset } from "../db/pagination.ts";
33-import { compositeTime } from "./records.ts";
33+import { compositeTime } from "../util.ts";
4455// Helper function to format feed items
66function feedItemFromRow(
+1-8
data-plane/routes/records.ts
···22import { AtUri } from "@atp/syntax";
33import { ids } from "../../lex/lexicons.ts";
44import { keyBy } from "@atp/common";
55-import { Code, DataPlaneError } from "../util.ts";
55+import { Code, DataPlaneError, compositeTime } from "../util.ts";
6677export type Record = {
88 record: string;
···9696 ]);
97979898 return { records };
9999-}
100100-101101-// Helper function for composite time
102102-export function compositeTime(ts1?: string, ts2?: string): string | undefined {
103103- if (!ts1) return ts2;
104104- if (!ts2) return ts1;
105105- return new Date(ts1) < new Date(ts2) ? ts1 : ts2;
10699}
107100108101export class Records {
+1-1
data-plane/routes/search.ts
···11import { Database } from "../db/index.ts";
22import { IndexedAtDidKeyset, TimeCidKeyset } from "../db/pagination.ts";
33import { parsePostSearchQuery } from "../util.ts";
44-import { compositeTime } from "./records.ts";
44+import { compositeTime } from "../util.ts";
5566// Remove leading @ in case a handle is input that way
77const cleanQuery = (query: string) => query.trim().replace(/^@/g, "");
+1-1
data-plane/routes/stories.ts
···11import { Database } from "../db/index.ts";
22import { TimeCidKeyset } from "../db/pagination.ts";
33-import { compositeTime } from "./records.ts";
33+import { compositeTime } from "../util.ts";
4455const STORIES_EXPIRY_HOURS = 24;
66
+7
data-plane/util.ts
···281281 author,
282282 };
283283};
284284+285285+// Helper function for composite time
286286+export function compositeTime(ts1?: string, ts2?: string): string | undefined {
287287+ if (!ts1) return ts2;
288288+ if (!ts2) return ts1;
289289+ return new Date(ts1) < new Date(ts2) ? ts1 : ts2;
290290+}