diff --git a/packages/backend/src/server/api/endpoints/users/lists/push.ts b/packages/backend/src/server/api/endpoints/users/lists/push.ts index 6f3e09fcbf..899754aafb 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/push.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/push.ts @@ -52,14 +52,12 @@ export const paramDef = { export default define(meta, paramDef, async (ps, me) => { // Fetch the list - const listExists = await UserLists.exist({ - where: { - id: ps.listId, - userId: me.id, - }, + const userList = await UserLists.findOneBy({ + id: ps.listId, + userId: me.id, }); - if (!listExists) { + if (!userList) { throw new ApiError(meta.errors.noSuchList); } @@ -85,7 +83,7 @@ export default define(meta, paramDef, async (ps, me) => { const exist = await UserListJoinings.exist({ where: { - userListId: userList.id, + userListId: ps.listId, userId: user.id, }, }); diff --git a/packages/backend/src/server/api/endpoints/users/lists/show.ts b/packages/backend/src/server/api/endpoints/users/lists/show.ts index 8479a4e03f..cb4893b0e4 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/show.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/show.ts @@ -37,14 +37,12 @@ export const paramDef = { export default define(meta, paramDef, async (ps, me) => { // Fetch the list - const exist = await UserLists.exist({ - where: { - id: ps.listId, - userId: me.id, - }, + const userList = await UserLists.findOneBy({ + id: ps.listId, + userId: me.id, }); - if (!exist) { + if (!userList) { throw new ApiError(meta.errors.noSuchList); }