fix(database): 🐛 Fix incorrect column name used in queries

This commit is contained in:
Jesse Wierzbinski 2024-04-15 09:01:51 -10:00
parent 972ced1f10
commit ffc45c5869
No known key found for this signature in database
3 changed files with 4 additions and 4 deletions

View file

@ -57,7 +57,7 @@ export default apiRoute<typeof meta, typeof schema>(
max_id ? lt(follower.id, max_id) : undefined,
since_id ? gte(follower.id, since_id) : undefined,
min_id ? gt(follower.id, min_id) : undefined,
sql`EXISTS (SELECT 1 FROM "Relationship" WHERE "Relationship"."subjectId" = ${otherUser.id} AND "Relationship"."objectId" = ${follower.id} AND "Relationship"."following" = true)`,
sql`EXISTS (SELECT 1 FROM "Relationship" WHERE "Relationship"."subjectId" = ${otherUser.id} AND "Relationship"."ownerId" = ${follower.id} AND "Relationship"."following" = true)`,
),
// @ts-expect-error Yes I KNOW the types are wrong
orderBy: (liker, { desc }) => desc(liker.id),

View file

@ -57,7 +57,7 @@ export default apiRoute<typeof meta, typeof schema>(
max_id ? lt(following.id, max_id) : undefined,
since_id ? gte(following.id, since_id) : undefined,
min_id ? gt(following.id, min_id) : undefined,
sql`EXISTS (SELECT 1 FROM "Relationship" WHERE "Relationship"."subjectId" = ${following.id} AND "Relationship"."objectId" = ${otherUser.id} AND "Relationship"."following" = true)`,
sql`EXISTS (SELECT 1 FROM "Relationship" WHERE "Relationship"."subjectId" = ${following.id} AND "Relationship"."ownerId" = ${otherUser.id} AND "Relationship"."following" = true)`,
),
// @ts-expect-error Yes I KNOW the types are wrong
orderBy: (liker, { desc }) => desc(liker.id),

View file

@ -172,7 +172,7 @@ export default apiRoute<typeof meta, typeof schema>(
self?.id
} AND Relationships.following = ${
following ? true : false
} AND Relationships.objectId = ${user.id})`
} AND Relationships.ownerId = ${user.id})`
: undefined,
),
orderBy: (user, { desc }) => desc(user.createdAt),
@ -191,7 +191,7 @@ export default apiRoute<typeof meta, typeof schema>(
self?.id
} AND Relationships.following = ${
following ? true : false
} AND Relationships.objectId = ${status.authorId})`
} AND Relationships.ownerId = ${status.authorId})`
: undefined,
),
orderBy: (status, { desc }) => desc(status.createdAt),