Fix tests

Also fix sharp on nixos
This commit is contained in:
Zoe Roux
2025-03-16 21:59:43 +01:00
parent 71b57c50e7
commit f11e1b56db
8 changed files with 42 additions and 38 deletions
+7 -7
View File
@@ -1,7 +1,7 @@
import { mkdir, writeFile } from "node:fs/promises";
import path from "node:path";
import { encode } from "blurhash";
import { type SQLWrapper, eq, sql } from "drizzle-orm";
import { SQL, type SQLWrapper, eq, getTableName, sql } from "drizzle-orm";
import type { PgColumn, PgTable } from "drizzle-orm/pg-core";
import { version } from "package.json";
import type { PoolClient } from "pg";
@@ -10,7 +10,7 @@ import { type Transaction, db } from "~/db";
import { mqueue } from "~/db/schema/queue";
import type { Image } from "~/models/utils";
export const imageDir = process.env.IMAGES_PATH ?? "/images";
export const imageDir = process.env.IMAGES_PATH ?? "./images";
await mkdir(imageDir, { recursive: true });
type ImageTask = {
@@ -27,7 +27,7 @@ export const enqueueOptImage = async (
tx: Transaction,
img:
| { url: string | null; column: PgColumn }
| { url: string | null; table: PgTable; column: SQLWrapper },
| { url: string | null; table: PgTable; column: SQL },
): Promise<Image | null> => {
if (!img.url) return null;
@@ -40,14 +40,14 @@ export const enqueueOptImage = async (
? {
id,
url: img.url,
table: img.table._.name,
column: img.column.getSQL().sql,
table: getTableName(img.table),
column: db.execute(img.column).getQuery().sql,
}
: {
id,
url: img.url,
table: img.column.table._.name,
column: img.column,
table: getTableName(img.column.table),
column: img.column.name,
};
await tx.insert(mqueue).values({
kind: "image",
+2 -2
View File
@@ -1,4 +1,4 @@
import { eq } from "drizzle-orm";
import { eq, sql } from "drizzle-orm";
import { db } from "~/db";
import { roles, staff } from "~/db/schema";
import { conflictUpdateAllExcept } from "~/db/utils";
@@ -41,7 +41,7 @@ export const insertStaff = async (
image: await enqueueOptImage(tx, {
url: x.character.image,
table: roles,
column: `${roles.character}['image']`,
column: sql`${roles.character}['image']`,
}),
},
})),
+1 -1
View File
@@ -3,7 +3,7 @@ import type { SeedMovie } from "~/models/movie";
import { getYear } from "~/utils";
import { insertCollection } from "./insert/collection";
import { insertEntries } from "./insert/entries";
import { insertShow, updateAvailableCount } from "./insert/shows";
import { insertShow } from "./insert/shows";
import { insertStaff } from "./insert/staff";
import { insertStudios } from "./insert/studios";
import { guessNextRefresh } from "./refresh";