feat: add race cover image extraction
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
This commit is contained in:
@@ -24,6 +24,7 @@ function mockRowFromInsert(sql: string, params: unknown[]): RaceRow {
|
||||
distance_km: "0",
|
||||
status: null,
|
||||
official_url: null,
|
||||
cover_image_url: null,
|
||||
start_time: null,
|
||||
cluster_schedule: null,
|
||||
bib_pickup: null,
|
||||
@@ -47,6 +48,7 @@ function mockRowFromInsert(sql: string, params: unknown[]): RaceRow {
|
||||
distance_km: String(row.distance_km ?? "0"),
|
||||
status: row.status != null ? String(row.status) : null,
|
||||
official_url: row.official_url != null ? String(row.official_url) : null,
|
||||
cover_image_url: row.cover_image_url != null ? String(row.cover_image_url) : null,
|
||||
start_time: row.start_time != null ? String(row.start_time) : null,
|
||||
cluster_schedule: row.cluster_schedule != null ? String(row.cluster_schedule) : null,
|
||||
bib_pickup: row.bib_pickup != null ? String(row.bib_pickup) : null,
|
||||
@@ -108,7 +110,19 @@ function createMockPool(): Pool {
|
||||
if (!existing) {
|
||||
return emptyResult();
|
||||
}
|
||||
const setMatch = sql.match(/UPDATE races SET (.+) WHERE id =/);
|
||||
const updated = { ...existing, updated_at: new Date() };
|
||||
const setColumns =
|
||||
setMatch?.[1]
|
||||
.split(",")
|
||||
.map((part) => part.trim())
|
||||
.filter((part) => !part.startsWith("updated_at"))
|
||||
.map((part) => part.split("=")[0]?.trim())
|
||||
.filter((col): col is string => Boolean(col)) ?? [];
|
||||
|
||||
setColumns.forEach((col, index) => {
|
||||
(updated as unknown as Record<string, unknown>)[col] = p[index] ?? null;
|
||||
});
|
||||
store.set(id, updated);
|
||||
return {
|
||||
rows: [updated as unknown as T],
|
||||
|
||||
Reference in New Issue
Block a user