We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3a26bb5 commit eb0766aCopy full SHA for eb0766a
1 file changed
apps/web/lib/apikey-handlers.ts
@@ -28,10 +28,7 @@ export async function getApiKeysByUserId(
28
query.keyId = keyId;
29
}
30
31
- return await ApikeyModel.find(
32
- { userId, deleted: { $ne: true } },
33
- projections,
34
- );
+ return await ApikeyModel.find(query, projections);
35
36
37
export async function getApikeyFromKeyId(
@@ -93,7 +90,7 @@ export async function getApikeyByUserId({
93
90
userId: mongoose.Types.ObjectId;
94
91
keyId: string;
95
92
}): Promise<Apikey | null> {
96
- const apikeys = await getApiKeysByUserId(userId);
+ const apikeys = await getApiKeysByUserId(userId, keyId);
97
if (!apikeys || apikeys.length === 0 || apikeys[0].keyId !== keyId) {
98
throw new Error("Apikey not found");
99
0 commit comments