fix report search not working
All checks were successful
deploy / build-and-deploy (push) Successful in 31s
All checks were successful
deploy / build-and-deploy (push) Successful in 31s
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { alias, int, mysqlTable, text, timestamp, varchar } from 'drizzle-orm/mysql-core';
|
import { alias, int, mysqlTable, text, timestamp, varchar } from 'drizzle-orm/mysql-core';
|
||||||
import type { MySql2Database } from 'drizzle-orm/mysql2';
|
import type { MySql2Database } from 'drizzle-orm/mysql2';
|
||||||
import { and, desc, eq, isNotNull } from 'drizzle-orm';
|
import { and, desc, eq, isNotNull, like } from 'drizzle-orm';
|
||||||
import { reportStatus } from './reportStatus.ts';
|
import { reportStatus } from './reportStatus.ts';
|
||||||
import { generateRandomString } from '@util/random.ts';
|
import { generateRandomString } from '@util/random.ts';
|
||||||
import { BASE_PATH } from 'astro:env/server';
|
import { BASE_PATH } from 'astro:env/server';
|
||||||
@@ -133,8 +133,8 @@ export async function getReports(db: Database, values: GetReportsReq) {
|
|||||||
.leftJoin(strikeReason, eq(strike.strikeReasonId, strikeReason.id))
|
.leftJoin(strikeReason, eq(strike.strikeReasonId, strikeReason.id))
|
||||||
.where(
|
.where(
|
||||||
and(
|
and(
|
||||||
values.reporter != null ? eq(reporter.username, values.reporter) : undefined,
|
values.reporter != null ? like(reporter.username, `%${values.reporter}%`) : undefined,
|
||||||
values.reported != null ? eq(reported.username, values.reported) : undefined,
|
values.reported != null ? like(reported.username, `%${values.reported}%`) : undefined,
|
||||||
!values.includeDrafts ? isNotNull(report.createdAt) : undefined
|
!values.includeDrafts ? isNotNull(report.createdAt) : undefined
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user