randydev commited on
Commit
48eb3a3
·
verified ·
1 Parent(s): 5f62b27

Update middleware/midware.js

Browse files
Files changed (1) hide show
  1. middleware/midware.js +1 -1
middleware/midware.js CHANGED
@@ -28,7 +28,7 @@ const authenticateApiKeyPremium = async (req, res, next) => {
28
  }
29
 
30
  if (keyData.expiresAt && new Date() > keyData.expiresAt) {
31
- await keyData.updateOne({ is_expired: true });
32
  await TelegramUseLogNotif(keyData.owner, keyData.key);
33
  return res.status(403).json({ error: 'Premium API Key has expired' });
34
  }
 
28
  }
29
 
30
  if (keyData.expiresAt && new Date() > keyData.expiresAt) {
31
+ await ApiKey.updateOne({ key: apiKey }, { $set: { is_expired: true } });
32
  await TelegramUseLogNotif(keyData.owner, keyData.key);
33
  return res.status(403).json({ error: 'Premium API Key has expired' });
34
  }