From 1e10391e203d07f8146f48b15002821b40dbcb07 Mon Sep 17 00:00:00 2001 From: Codinget Date: Thu, 23 Jul 2026 20:55:45 +0000 Subject: [PATCH] style: format postgres notes implementation Co-Authored-By: gpt-5.6-luna --- src/db/postgres/PostgresInterface.ts | 5 +---- src/db/postgres/cast.ts | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/db/postgres/PostgresInterface.ts b/src/db/postgres/PostgresInterface.ts index 75c87d7..ad7a778 100644 --- a/src/db/postgres/PostgresInterface.ts +++ b/src/db/postgres/PostgresInterface.ts @@ -564,10 +564,7 @@ export class PostgresInterface return selectPartialNotes(this.#db, sql`n."aid" = ${{ uuid: aid }}`); } async listNotesByUserId(uid: string): Promise { - return selectPartialNotes( - this.#db, - sql`n."created_by" = ${{ uuid: uid }}`, - ); + return selectPartialNotes(this.#db, sql`n."created_by" = ${{ uuid: uid }}`); } export(options: ExportOptions = {}): NodeJS.ReadableStream { diff --git a/src/db/postgres/cast.ts b/src/db/postgres/cast.ts index 20ae6ea..df7673b 100644 --- a/src/db/postgres/cast.ts +++ b/src/db/postgres/cast.ts @@ -1,7 +1,12 @@ import type { Abode } from "../types/Abode.js"; import type { ApikeyPermissions, ClientApikey } from "../types/Apikey.js"; import type { Resident, ResidentFlags } from "../types/Resident.js"; -import type { Note, NoteProperties, PartialNote, PartialNoteProperties } from "../types/Note.js"; +import type { + Note, + NoteProperties, + PartialNote, + PartialNoteProperties, +} from "../types/Note.js"; import type { ClientUser, PartialUser, UserFlags } from "../types/User.js"; export function pgToDate(d: Date | string): string { @@ -140,7 +145,11 @@ export function pgToClientApikey(apikey: { const validNoteTypes = new Set(["note"]); function pgToNoteProperties(properties: unknown): NoteProperties { - if (typeof properties !== "object" || !properties || Array.isArray(properties)) + if ( + typeof properties !== "object" || + !properties || + Array.isArray(properties) + ) return {}; const value = properties as Record; return validNoteTypes.has(value.type as string) @@ -148,9 +157,7 @@ function pgToNoteProperties(properties: unknown): NoteProperties { : {}; } -function pgToPartialNoteProperties( - properties: unknown, -): PartialNoteProperties { +function pgToPartialNoteProperties(properties: unknown): PartialNoteProperties { return { type: pgToNoteProperties(properties).type ?? "note" }; }