wordeck/apps/web/src/lib/api/cards.ts
Till JS 372832d266
Some checks are pending
CI / validate (push) Waiting to run
refactor(big-bang): cards → wordeck im gesamten Code-Layer
Phase 2 des cards→wordeck Big-Bang-Rebrand:

- 4 package.json: @cards/* → @wordeck/*
- packages/cards-domain/ → packages/wordeck-domain/
- 41+12 Files: from '@cards/domain' → '@wordeck/domain'
- pgSchema('cards') → pgSchema('wordeck') (Drizzle-Schema)
- 17 Files: process.env.CARDS_* → process.env.WORDECK_*
- docker-compose Service-Names: cards-* → wordeck-*
- docker-compose Volume: /Volumes/ManaData/cards → wordeck
- env-vars in compose: CARDS_DB_PASSWORD/_API_VERSION/_DSGVO_SERVICE_KEY etc. → WORDECK_*
- Log-Prefixes + Error-Strings + manifest-id 'cards' → 'wordeck'
- CORS-Origin cardecky.mana.how → wordeck.com
- .env.production.example umbenannt + S3-Key entfernt (kein MinIO mehr)

Type-Check 0 Errors in api+domain+web, 51/51 Domain-Tests grün.

DB-Rename + Container/Volume-Rename auf mana-server folgen in nächstem
Commit nach Verzeichnis-Rename.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 22:39:42 +02:00

28 lines
945 B
TypeScript

import type { Card, CardCreate, CardUpdate } from '@wordeck/domain';
import { api } from './client.ts';
export function listCards(deckId?: string) {
const qs = deckId ? `?deck_id=${encodeURIComponent(deckId)}` : '';
return api<{ cards: Card[]; total: number }>(`/api/v1/cards${qs}`);
}
/** Holt nur die content_hash-Liste — kompakt für Anki-Re-Import-Dedupe. */
export function listCardHashes() {
return api<{ hashes: string[]; total: number }>('/api/v1/cards/hashes');
}
export function getCard(id: string) {
return api<Card>(`/api/v1/cards/${id}`);
}
export function createCard(input: CardCreate) {
return api<Card>('/api/v1/cards', { method: 'POST', body: input });
}
export function updateCard(id: string, patch: CardUpdate) {
return api<Card>(`/api/v1/cards/${id}`, { method: 'PATCH', body: patch });
}
export function deleteCard(id: string) {
return api<{ deleted: string }>(`/api/v1/cards/${id}`, { method: 'DELETE' });
}