refactoring
This commit is contained in:
parent
cdedbc44cd
commit
38a62ca3a4
1 changed files with 2 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import { db } from "@glossa/db";
|
import { db } from "@glossa/db";
|
||||||
import { translations, terms, decks, deck_terms } from "@glossa/db/schema";
|
import { translations, terms, decks, deck_terms } from "@glossa/db/schema";
|
||||||
import { inArray, and, eq, count, ne } from "drizzle-orm";
|
import { inArray, and, eq, ne, countDistinct } from "drizzle-orm";
|
||||||
|
|
||||||
type DbOrTx = Parameters<Parameters<typeof db.transaction>[0]>[0];
|
type DbOrTx = Parameters<Parameters<typeof db.transaction>[0]>[0];
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ const validateLanguages = async (sourceLanguage: string, termIds: string[]) => {
|
||||||
const coverage = await db
|
const coverage = await db
|
||||||
.select({
|
.select({
|
||||||
language: translations.language_code,
|
language: translations.language_code,
|
||||||
coveredCount: count(translations.term_id),
|
coveredCount: countDistinct(translations.term_id),
|
||||||
})
|
})
|
||||||
.from(translations)
|
.from(translations)
|
||||||
.where(
|
.where(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue