MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / addLocalCollection

Function addLocalCollection

frontend/src/data/localDB/collections.ts:4–18  ·  view source on GitHub ↗
(
  name: string,
  prompt?: string | null,
)

Source from the content-addressed store, hash-verified

2import { type LocalCollection, db } from '../../db/flashcardsDB'
3
4export const addLocalCollection = async (
5 name: string,
6 prompt?: string | null,
7): Promise<LocalCollection> => {
8 const newCollection: LocalCollection = {
9 id: uuidv4(),
10 name,
11 prompt,
12 createdAt: Date.now(),
13 updatedAt: Date.now(),
14 synced: false,
15 }
16 await db.collections.add(newCollection)
17 return newCollection
18}
19
20export const getLocalCollections = async (): Promise<LocalCollection[]> => {
21 return await db.collections.orderBy('updatedAt').reverse().toArray()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected