Skip to content

Commit eb0766a

Browse files
committed
Fixed a check
1 parent 3a26bb5 commit eb0766a

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

apps/web/lib/apikey-handlers.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ export async function getApiKeysByUserId(
2828
query.keyId = keyId;
2929
}
3030

31-
return await ApikeyModel.find(
32-
{ userId, deleted: { $ne: true } },
33-
projections,
34-
);
31+
return await ApikeyModel.find(query, projections);
3532
}
3633

3734
export async function getApikeyFromKeyId(
@@ -93,7 +90,7 @@ export async function getApikeyByUserId({
9390
userId: mongoose.Types.ObjectId;
9491
keyId: string;
9592
}): Promise<Apikey | null> {
96-
const apikeys = await getApiKeysByUserId(userId);
93+
const apikeys = await getApiKeysByUserId(userId, keyId);
9794
if (!apikeys || apikeys.length === 0 || apikeys[0].keyId !== keyId) {
9895
throw new Error("Apikey not found");
9996
}

0 commit comments

Comments
 (0)