feat: add curriculum management admin dashboard with AI generation and draft approval workflows
This commit is contained in:
@@ -133,6 +133,24 @@ export async function updateSourceStatus(id, status, error = '') {
|
||||
return pb.collection('sources').update(id, { status, error });
|
||||
}
|
||||
|
||||
export async function updateSourceProgress(id, progress) {
|
||||
return pb.collection('sources').update(id, { progress });
|
||||
}
|
||||
|
||||
/**
|
||||
* Find sources stuck in 'processing' status — likely orphaned by a tab close.
|
||||
* Sources older than 5 minutes in 'processing' state are considered stale.
|
||||
*/
|
||||
export async function getOrphanedSources() {
|
||||
try {
|
||||
const all = await pb.collection('sources').getFullList({
|
||||
filter: 'status="processing"',
|
||||
});
|
||||
const fiveMinAgo = Date.now() - 5 * 60 * 1000;
|
||||
return all.filter(s => new Date(s.updated || s.created).getTime() < fiveMinAgo);
|
||||
} catch { return []; }
|
||||
}
|
||||
|
||||
export async function deleteSource(id) {
|
||||
return pb.collection('sources').delete(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user