mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Working on the retention system.
This commit is contained in:
+2
-1
@@ -58,4 +58,5 @@ export const getOrganizationProjectDatabases = async ({organizationSlug, project
|
||||
cause: e,
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user