From efb3c03c5c46f0edc0829b455c40076faf361a43 Mon Sep 17 00:00:00 2001 From: isra el Date: Sat, 30 Nov 2024 07:02:24 +0300 Subject: [PATCH] chore(api): sort api keys by properly --- api/src/auth/auth.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/auth/auth.service.ts b/api/src/auth/auth.service.ts index 6a4756b..dad46c2 100644 --- a/api/src/auth/auth.service.ts +++ b/api/src/auth/auth.service.ts @@ -213,7 +213,9 @@ export class AuthService { } async getUserApiKeys(currentUser: User) { - return this.apiKeyModel.find({ user: currentUser._id }) + return this.apiKeyModel.find({ user: currentUser._id }, null, { + sort: { createdAt: -1 }, + }) } async findApiKey(params) {