mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-07-22 23:12:02 +00:00
feat(telegram): add setTopicFetchEnabled server action
Admin-guarded toggle of TopicProgress.fetchEnabled by row id. Persists immediately; the worker honours it on its next live per-topic read. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -436,6 +436,32 @@ export async function rescanChannel(channelId: string): Promise<ActionResult> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Topic fetch toggle ──
|
||||||
|
|
||||||
|
export async function setTopicFetchEnabled(
|
||||||
|
topicProgressId: string,
|
||||||
|
enabled: boolean
|
||||||
|
): Promise<ActionResult> {
|
||||||
|
const admin = await requireAdmin();
|
||||||
|
if (!admin.success) return admin;
|
||||||
|
|
||||||
|
const existing = await prisma.topicProgress.findUnique({
|
||||||
|
where: { id: topicProgressId },
|
||||||
|
});
|
||||||
|
if (!existing) return { success: false, error: "Topic not found" };
|
||||||
|
|
||||||
|
try {
|
||||||
|
await prisma.topicProgress.update({
|
||||||
|
where: { id: topicProgressId },
|
||||||
|
data: { fetchEnabled: enabled },
|
||||||
|
});
|
||||||
|
revalidatePath(REVALIDATE_PATH);
|
||||||
|
return { success: true, data: undefined };
|
||||||
|
} catch {
|
||||||
|
return { success: false, error: "Failed to update topic" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ── Account-Channel link actions ──
|
// ── Account-Channel link actions ──
|
||||||
|
|
||||||
export async function linkChannel(
|
export async function linkChannel(
|
||||||
|
|||||||
Reference in New Issue
Block a user