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

Function addLocalCard

frontend/src/data/localDB/cards.ts:16–37  ·  view source on GitHub ↗
(
  collectionId: string,
  front: string,
  back: string,
)

Source from the content-addressed store, hash-verified

14}
15
16export const addLocalCard = async (
17 collectionId: string,
18 front: string,
19 back: string,
20): Promise<LocalCard> => {
21 const newCard: LocalCard = {
22 id: uuidv4(),
23 collectionId,
24 front,
25 back,
26 createdAt: Date.now(),
27 updatedAt: Date.now(),
28 synced: false,
29 }
30 await db.cards.add(newCard)
31 await db.collections.update(collectionId, {
32 updatedAt: Date.now(),
33 synced: false,
34 })
35 await removeIncompletePracticeSessionsForCollection(collectionId)
36 return newCard
37}
38
39export const getLocalCardsForCollection = async (
40 collectionId: string,

Callers

nothing calls this directly

Calls 2

updateMethod · 0.65

Tested by

no test coverage detected