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
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:
@@ -564,10 +564,7 @@ export class PostgresInterface
|
|||||||
return selectPartialNotes(this.#db, sql`n."aid" = ${{ uuid: aid }}`);
|
return selectPartialNotes(this.#db, sql`n."aid" = ${{ uuid: aid }}`);
|
||||||
}
|
}
|
||||||
async listNotesByUserId(uid: string): Promise<PartialNote[]> {
|
async listNotesByUserId(uid: string): Promise<PartialNote[]> {
|
||||||
return selectPartialNotes(
|
return selectPartialNotes(this.#db, sql`n."created_by" = ${{ uuid: uid }}`);
|
||||||
this.#db,
|
|
||||||
sql`n."created_by" = ${{ uuid: uid }}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export(options: ExportOptions = {}): NodeJS.ReadableStream {
|
export(options: ExportOptions = {}): NodeJS.ReadableStream {
|
||||||
|
|||||||
+12
-5
@@ -1,7 +1,12 @@
|
|||||||
import type { Abode } from "../types/Abode.js";
|
import type { Abode } from "../types/Abode.js";
|
||||||
import type { ApikeyPermissions, ClientApikey } from "../types/Apikey.js";
|
import type { ApikeyPermissions, ClientApikey } from "../types/Apikey.js";
|
||||||
import type { Resident, ResidentFlags } from "../types/Resident.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";
|
import type { ClientUser, PartialUser, UserFlags } from "../types/User.js";
|
||||||
|
|
||||||
export function pgToDate(d: Date | string): string {
|
export function pgToDate(d: Date | string): string {
|
||||||
@@ -140,7 +145,11 @@ export function pgToClientApikey(apikey: {
|
|||||||
const validNoteTypes = new Set(["note"]);
|
const validNoteTypes = new Set(["note"]);
|
||||||
|
|
||||||
function pgToNoteProperties(properties: unknown): NoteProperties {
|
function pgToNoteProperties(properties: unknown): NoteProperties {
|
||||||
if (typeof properties !== "object" || !properties || Array.isArray(properties))
|
if (
|
||||||
|
typeof properties !== "object" ||
|
||||||
|
!properties ||
|
||||||
|
Array.isArray(properties)
|
||||||
|
)
|
||||||
return {};
|
return {};
|
||||||
const value = properties as Record<string, unknown>;
|
const value = properties as Record<string, unknown>;
|
||||||
return validNoteTypes.has(value.type as string)
|
return validNoteTypes.has(value.type as string)
|
||||||
@@ -148,9 +157,7 @@ function pgToNoteProperties(properties: unknown): NoteProperties {
|
|||||||
: {};
|
: {};
|
||||||
}
|
}
|
||||||
|
|
||||||
function pgToPartialNoteProperties(
|
function pgToPartialNoteProperties(properties: unknown): PartialNoteProperties {
|
||||||
properties: unknown,
|
|
||||||
): PartialNoteProperties {
|
|
||||||
return { type: pgToNoteProperties(properties).type ?? "note" };
|
return { type: pgToNoteProperties(properties).type ?? "note" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user