GDPR export route (#969)

* GDPR export route

* make users able to access
This commit is contained in:
Geometrically
2024-09-27 12:43:17 -07:00
committed by GitHub
parent f7d1cd2a4f
commit 28b6bf8603
20 changed files with 417 additions and 163 deletions

View File

@@ -355,31 +355,12 @@ impl Project {
.execute(&mut **transaction)
.await?;
// Notably joins with report id and not thread.mod_id directly, as
// this is set to null for threads that are reports.
let report_threads = sqlx::query!(
"
SELECT t.id
FROM threads t
INNER JOIN reports r ON t.report_id = r.id
WHERE r.mod_id = $1 AND report_id IS NOT NULL
",
id as ProjectId,
)
.fetch(&mut **transaction)
.map_ok(|x| ThreadId(x.id))
.try_collect::<Vec<_>>()
.await?;
for thread_id in report_threads {
models::Thread::remove_full(thread_id, transaction).await?;
}
models::Thread::remove_full(project.thread_id, transaction).await?;
sqlx::query!(
"
DELETE FROM reports
UPDATE reports
SET mod_id = NULL
WHERE mod_id = $1
",
id as ProjectId,