mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix: 🐛 Fix v2 search API not working at all
This commit is contained in:
parent
93b8609411
commit
84bdb75d77
|
|
@ -154,42 +154,50 @@ export default (app: Hono) =>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const accounts = await User.manyFromSql(
|
const accounts =
|
||||||
and(
|
accountResults.length > 0
|
||||||
inArray(
|
? await User.manyFromSql(
|
||||||
Users.id,
|
and(
|
||||||
accountResults.map((hit) => hit),
|
inArray(
|
||||||
),
|
Users.id,
|
||||||
self
|
accountResults.map((hit) => hit),
|
||||||
? sql`EXISTS (SELECT 1 FROM Relationships WHERE Relationships.subjectId = ${
|
),
|
||||||
self?.id
|
self && following
|
||||||
} AND Relationships.following = ${!!following} AND Relationships.ownerId = ${
|
? sql`EXISTS (SELECT 1 FROM "Relationships" WHERE "Relationships"."subjectId" = ${
|
||||||
Users.id
|
self?.id
|
||||||
})`
|
} AND "Relationships".following = ${!!following} AND "Relationships"."ownerId" = ${
|
||||||
: undefined,
|
Users.id
|
||||||
),
|
})`
|
||||||
);
|
: undefined,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: [];
|
||||||
|
|
||||||
const statuses = await Note.manyFromSql(
|
const statuses =
|
||||||
and(
|
statusResults.length > 0
|
||||||
inArray(
|
? await Note.manyFromSql(
|
||||||
Notes.id,
|
and(
|
||||||
statusResults.map((hit) => hit),
|
inArray(
|
||||||
),
|
Notes.id,
|
||||||
account_id ? eq(Notes.authorId, account_id) : undefined,
|
statusResults.map((hit) => hit),
|
||||||
self
|
),
|
||||||
? sql`EXISTS (SELECT 1 FROM Relationships WHERE Relationships.subjectId = ${
|
account_id
|
||||||
self?.id
|
? eq(Notes.authorId, account_id)
|
||||||
} AND Relationships.following = ${!!following} AND Relationships.ownerId = ${
|
: undefined,
|
||||||
Notes.authorId
|
self && following
|
||||||
})`
|
? sql`EXISTS (SELECT 1 FROM "Relationships" WHERE "Relationships"."subjectId" = ${
|
||||||
: undefined,
|
self?.id
|
||||||
),
|
} AND "Relationships".following = ${!!following} AND "Relationships"."ownerId" = ${
|
||||||
undefined,
|
Notes.authorId
|
||||||
undefined,
|
})`
|
||||||
undefined,
|
: undefined,
|
||||||
self?.id,
|
),
|
||||||
);
|
undefined,
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
self?.id,
|
||||||
|
)
|
||||||
|
: [];
|
||||||
|
|
||||||
return jsonResponse({
|
return jsonResponse({
|
||||||
accounts: accounts.map((account) => account.toApi()),
|
accounts: accounts.map((account) => account.toApi()),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue