feat(api): implement game terms query with double join
- Add double join on translations for source/target languages - Left join term_glosses for optional source-language glosses - Filter difficulty on target side only (intentionally asymmetric: a word's difficulty can differ between languages, and what matters is the difficulty of the word being learned) - Return neutral field names (sourceText, targetText, sourceGloss) instead of quiz semantics; service layer maps to prompt/answer - Tighten term_glosses unique constraint to (term_id, language_code) to prevent the left join from multiplying question rows - Add TODO for ORDER BY RANDOM() scaling post-MVP
This commit is contained in:
parent
9fc3ba375a
commit
b59fac493d
4 changed files with 356 additions and 28 deletions
|
|
@ -5,6 +5,15 @@
|
|||
- pinning dependencies in package.json files
|
||||
- rethink organisation of datafiles and wordlists
|
||||
|
||||
## notes
|
||||
|
||||
- backend advice: https://github.com/MohdOwaisShah/backend
|
||||
- openapi
|
||||
- bruno for api testing
|
||||
- tailscale
|
||||
- husky/lint-staged
|
||||
- musicforprogramming.net
|
||||
|
||||
## openwordnet
|
||||
|
||||
download libraries via
|
||||
|
|
@ -44,17 +53,3 @@ list all libraries:
|
|||
```bash
|
||||
python -c "import wn; print(wn.lexicons())"
|
||||
```
|
||||
|
||||
## drizzle
|
||||
|
||||
generate migration file, go to packages/db, then:
|
||||
|
||||
```bash
|
||||
pnpm drizzle-kit generate
|
||||
```
|
||||
|
||||
execute migration, go to packages/db (docker containers need to be running):
|
||||
|
||||
```bash
|
||||
DATABASE_URL=postgresql://username:password@localhost:5432/database pnpm drizzle-kit migrate
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue