fix: clean up someday lists and tasks when disconnecting a calendar provider
Unlink external references (externalId, externalProvider, externalListId) from someday lists and tasks when their associated calendar connection is deleted, so orphaned entries don't persist in the UI. v1.57.8 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3ec5a21714
commit
9e7266053b
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "my-weekly-todo-list",
|
||||
"version": "1.57.7",
|
||||
"version": "1.57.8",
|
||||
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@ -190,6 +190,20 @@ export async function DELETE(request: NextRequest) {
|
||||
where: { id: connectionId, userId: user.id }
|
||||
});
|
||||
|
||||
if (connection) {
|
||||
// Unlink someday lists that were synced with this provider
|
||||
await prisma.somedayList.updateMany({
|
||||
where: { userId: user.id, externalProvider: connection.provider },
|
||||
data: { externalId: null, externalProvider: null, lastSyncedAt: null },
|
||||
});
|
||||
|
||||
// Unlink tasks that were synced with this provider
|
||||
await prisma.task.updateMany({
|
||||
where: { userId: user.id, externalProvider: connection.provider },
|
||||
data: { externalId: null, externalProvider: null, externalListId: null, lastSyncedAt: null },
|
||||
});
|
||||
}
|
||||
|
||||
// Delete the connection
|
||||
await prisma.calendarConnection.delete({
|
||||
where: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user