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

Class ApiCardRepository

frontend/src/repositories/card/ApiCardRepository.ts:5–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import type { CardRepository } from './CardRepository'
4
5export class ApiCardRepository implements CardRepository {
6 async getAll(collectionId: string): Promise<Card[]> {
7 const result = await FlashcardsService.readCards({ collectionId })
8 return result.data
9 }
10
11 async getById(collectionId: string, id: string): Promise<Card | null> {
12 try {
13 return await FlashcardsService.readCard({ cardId: id, collectionId })
14 } catch (e) {
15 return null
16 }
17 }
18
19 async create(collectionId: string, data: CardCreate): Promise<Card> {
20 return FlashcardsService.createCard({ collectionId, requestBody: data })
21 }
22
23 async update(collectionId: string, id: string, data: CardUpdate): Promise<Card> {
24 return FlashcardsService.updateCard({ cardId: id, collectionId, requestBody: data })
25 }
26
27 async delete(collectionId: string, id: string): Promise<void> {
28 await FlashcardsService.deleteCard({ cardId: id, collectionId })
29 }
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected