( collectionId: string, front: string, back: string, )
| 14 | } |
| 15 | |
| 16 | export 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 | |
| 39 | export const getLocalCardsForCollection = async ( |
| 40 | collectionId: string, |
nothing calls this directly
no test coverage detected