diff options
Diffstat (limited to 'persistence/people.ts')
| -rw-r--r-- | persistence/people.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/persistence/people.ts b/persistence/people.ts new file mode 100644 index 0000000..c26819c --- /dev/null +++ b/persistence/people.ts @@ -0,0 +1,14 @@ +import { userDataDb } from '@hollowdark/persistence/client' +import type { PersonId } from '@hollowdark/engine/entities/base' +import type { Person } from '@hollowdark/engine/entities/person' + +/** Fetch a single person by id, or `null` when the row is missing. */ +export async function getPerson(id: PersonId): Promise<Person | null> { + const row = await userDataDb().people.get(id) + return row ?? null +} + +/** Persist a person record. Replaces any existing row with the same id. */ +export async function savePerson(person: Person): Promise<void> { + await userDataDb().people.put(person) +} |
