mirror of
https://github.com/versia-pub/server.git
synced 2026-01-26 12:16:01 +01:00
feat(api): ✨ Make account searches case-insensitive
This commit is contained in:
parent
7c285ee14d
commit
407eb5e205
|
|
@ -4,7 +4,7 @@ import type { Hono } from "@hono/hono";
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { SignatureConstructor } from "@lysand-org/federation";
|
import { SignatureConstructor } from "@lysand-org/federation";
|
||||||
import { FederationRequester } from "@lysand-org/federation/requester";
|
import { FederationRequester } from "@lysand-org/federation/requester";
|
||||||
import { eq, like, not, or, sql } from "drizzle-orm";
|
import { eq, ilike, not, or, sql } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
anyOf,
|
anyOf,
|
||||||
charIn,
|
charIn,
|
||||||
|
|
@ -114,8 +114,8 @@ export default (app: Hono) =>
|
||||||
accounts.push(
|
accounts.push(
|
||||||
...(await User.manyFromSql(
|
...(await User.manyFromSql(
|
||||||
or(
|
or(
|
||||||
like(Users.displayName, `%${q}%`),
|
ilike(Users.displayName, `%${q}%`),
|
||||||
like(Users.username, `%${q}%`),
|
ilike(Users.username, `%${q}%`),
|
||||||
following && self
|
following && self
|
||||||
? sql`EXISTS (SELECT 1 FROM "Relationships" WHERE "Relationships"."subjectId" = ${Users.id} AND "Relationships"."ownerId" = ${self.id} AND "Relationships"."following" = true)`
|
? sql`EXISTS (SELECT 1 FROM "Relationships" WHERE "Relationships"."subjectId" = ${Users.id} AND "Relationships"."ownerId" = ${self.id} AND "Relationships"."following" = true)`
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue