reviewing and updating deck generation
This commit is contained in:
parent
521ffe3b6e
commit
9d1a82bdf0
5 changed files with 10 additions and 51 deletions
|
|
@ -29,7 +29,7 @@ Done when: `GET /api/decks/1/terms?limit=10` returns 10 terms from a specific de
|
|||
[x] Write Drizzle schema: `terms`, `translations`, `language_pairs`, `term_glosses`, `decks`, `deck_terms`
|
||||
[x] Write and run migration (includes CHECK constraints for `pos`, `gloss_type`)
|
||||
[x] Write `packages/db/src/seed.ts` (imports ALL terms + translations, NO decks)
|
||||
[ ] Download CEFR A1/A2 noun lists (from GitHub repos)
|
||||
[x] Download CEFR A1/A2 noun lists (from GitHub repos)
|
||||
[ ] Write `scripts/build_decks.ts` (reads external CEFR lists, matches to DB, creates decks)
|
||||
[ ] Run `pnpm db:seed` → populates terms
|
||||
[ ] Run `pnpm db:build-decks` → creates curated decks
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
a
|
||||
other
|
||||
us
|
||||
may
|
||||
st
|
||||
paul
|
||||
new
|
||||
software
|
||||
oxford
|
||||
english
|
||||
mary
|
||||
japan
|
||||
while
|
||||
pp
|
||||
membership
|
||||
manchester
|
||||
tony
|
||||
alan
|
||||
jones
|
||||
un
|
||||
northern
|
||||
simon
|
||||
behalf
|
||||
co
|
||||
graham
|
||||
joe
|
||||
guy
|
||||
lewis
|
||||
jane
|
||||
taylor
|
||||
co-operation
|
||||
travel
|
||||
self
|
||||
thatcher
|
||||
|
|
@ -7,7 +7,6 @@ import {
|
|||
unique,
|
||||
check,
|
||||
boolean,
|
||||
integer,
|
||||
primaryKey,
|
||||
index,
|
||||
} from "drizzle-orm/pg-core";
|
||||
|
|
@ -133,19 +132,19 @@ export const decks = pgTable(
|
|||
id: uuid().primaryKey().defaultRandom(),
|
||||
name: text().notNull(),
|
||||
description: text(),
|
||||
language_pair_id: uuid()
|
||||
validated_for_languages: varchar({ length: 10 })
|
||||
.array()
|
||||
.notNull()
|
||||
.references(() => language_pairs.id, { onDelete: "cascade" }),
|
||||
created_by: uuid()
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
.default([]),
|
||||
is_public: boolean().default(false).notNull(),
|
||||
created_at: timestamp({ withTimezone: true }).defaultNow().notNull(),
|
||||
},
|
||||
(table) => [
|
||||
unique("unique_deck_name").on(table.name, table.created_by),
|
||||
index("idx_decks_created_by").on(table.created_by),
|
||||
index("idx_decks_language_pair").on(table.language_pair_id),
|
||||
check(
|
||||
"validated_languages_check",
|
||||
sql`validated_for_languages <@ ARRAY[${sql.raw(SUPPORTED_LANGUAGE_CODES.map((l) => `'${l}'`).join(", "))}]::varchar[]`,
|
||||
),
|
||||
unique("unique_deck_name").on(table.name),
|
||||
],
|
||||
);
|
||||
|
||||
|
|
@ -158,7 +157,6 @@ export const deck_terms = pgTable(
|
|||
term_id: uuid()
|
||||
.notNull()
|
||||
.references(() => terms.id, { onDelete: "cascade" }),
|
||||
position: integer().notNull(),
|
||||
added_at: timestamp({ withTimezone: true }).defaultNow().notNull(),
|
||||
},
|
||||
(table) => [
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Close the DB connection
|
|||
import fs from "node:fs/promises";
|
||||
import { db } from "@glossa/db";
|
||||
import { translations } from "@glossa/db/schema";
|
||||
import { inArray, and, eq } from "drizzle-orm";
|
||||
import { inArray } from "drizzle-orm";
|
||||
|
||||
const wordlistPath = "./src/data/wordlists/top1000englishnouns";
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import { db } from "./index.js";
|
||||
|
||||
const result = await db.execute("select 1");
|
||||
|
||||
console.log("result: ", result);
|
||||
Loading…
Add table
Add a link
Reference in a new issue