style: format postgres notes implementation
CI / lint (pull_request) Successful in 26s
CI / format (pull_request) Successful in 27s
CI / install-and-build (pull_request) Successful in 50s
CI / typecheck-tests (pull_request) Successful in 33s
CI / typecheck-source (pull_request) Successful in 35s
CI / test (pull_request) Successful in 44s

Co-Authored-By: gpt-5.6-luna <noreply@openai.com>
This commit was merged in pull request #16.
This commit is contained in:
2026-07-23 20:55:45 +00:00
co-authored by Codex
parent a0a436c4b8
commit 1e10391e20
2 changed files with 13 additions and 9 deletions
+1 -4
View File
@@ -564,10 +564,7 @@ export class PostgresInterface
return selectPartialNotes(this.#db, sql`n."aid" = ${{ uuid: aid }}`);
}
async listNotesByUserId(uid: string): Promise<PartialNote[]> {
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 {
+12 -5
View File
@@ -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<string, unknown>;
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" };
}