( name: string, prompt?: string | null, )
| 2 | import { type LocalCollection, db } from '../../db/flashcardsDB' |
| 3 | |
| 4 | export 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 | |
| 20 | export const getLocalCollections = async (): Promise<LocalCollection[]> => { |
| 21 | return await db.collections.orderBy('updatedAt').reverse().toArray() |
nothing calls this directly
no outgoing calls
no test coverage detected