randydev commited on
Commit
03ba349
·
verified ·
1 Parent(s): 15a0a4b

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +5 -5
index.js CHANGED
@@ -282,11 +282,11 @@ app.post("/api/v2/key/upgrade-key", authenticateApiKey, apiLimiter, async (req,
282
  const expirationDate = new Date();
283
  expirationDate.setDate(expirationDate.getDate() + expire_number);
284
 
285
- await ApiKey.updateOne(
286
- { owner: userIdNumber },
287
- { $set: { expiresAt: expirationDate, type: "premium" } }
288
- );
289
-
290
  res.json({
291
  apiKey: existingUser.key,
292
  createdAt: existingUser.createdAt,
 
282
  const expirationDate = new Date();
283
  expirationDate.setDate(expirationDate.getDate() + expire_number);
284
 
285
+ existingUser.expiresAt = expirationDate;
286
+ existingUser.type = "premium";
287
+ existingUser.is_expired = false;
288
+
289
+ await existingUser.save();
290
  res.json({
291
  apiKey: existingUser.key,
292
  createdAt: existingUser.createdAt,