Add validation for updateTTL body

This commit is contained in:
Alex Holliday committed 2024-09-14 12:16:13 +08:00
1 parent 15e067c9bf
commit 9bbd5ce12a
5 files changed
+28 -8

No files matched your search

+4 -4
View File
@@ -239,16 +239,16 @@ const deleteChecksByTeamId = async (teamId) => {
}
};
const updateChecksTTL = async (teamId) => {
const updateChecksTTL = async (teamId, ttl) => {
try {
await Check.collection.dropIndex("expiry_1");
await Check.collection.createIndex(
{ expiry: 1 }, // Field to index
{ expireAfterSeconds: 60 } // TTL in seconds, adjust as necessary
{ expiry: 1 },
{ expireAfterSeconds: ttl } // TTL in seconds, adjust as necessary
);
} catch (error) {
error.service = SERVICE_NAME;
error.method = updateTTL;
error.method = "upddateChecksTTL";
throw error;
}
};