Working on the retention system.

This commit is contained in:
charlesgauthereau
2025-08-24 20:11:34 +02:00
parent 7ac99a6618
commit 60728885b6
9 changed files with 48 additions and 4 deletions
+2 -1
View File
@@ -58,4 +58,5 @@ export const getOrganizationProjectDatabases = async ({organizationSlug, project
cause: e,
};
}
};
};
+12
View File
@@ -0,0 +1,12 @@
import cron from "node-cron";
import {retentionCleanTask} from "@/lib/tasks/project";
export const retentionJob = cron.schedule("* * * * *", async () => {
try {
console.log("Retention Job : Starting task");
await retentionCleanTask();
} catch (err) {
console.error(`[CRON] Error:`, err);
}
});
+12
View File
@@ -0,0 +1,12 @@
import {db} from "@/db";
import * as drizzleDb from "@/db";
export const retentionCleanTask = async () => {
try {
const projects = await db.query.project.findMany();
console.log(projects);
} catch (e: any) {
throw e;
}
}