feat: Add cleanup functionality for pending photos and database management
This commit introduces new API endpoints for cleaning up files and records related to pending photos. The frontend has been updated to include buttons for admins to trigger cleanup operations, allowing for the deletion of files from shared space and records from the pending_photos table. Additionally, the README has been updated with instructions for granting DELETE permissions on auth database tables, and a script has been added to automate this process. Documentation has been updated to reflect these changes.
This commit is contained in:
@@ -76,6 +76,27 @@ sudo -u postgres psql -c "CREATE DATABASE punimtag OWNER punimtag;"
|
||||
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE punimtag TO punimtag;"
|
||||
```
|
||||
|
||||
**Grant DELETE Permissions on Auth Database Tables:**
|
||||
If you encounter permission errors when trying to delete records from the auth database (e.g., when using "Clear database" in the admin panel), grant DELETE permissions:
|
||||
|
||||
```bash
|
||||
# Grant DELETE permission on all auth database tables
|
||||
sudo -u postgres psql -d punimtag_auth << 'EOF'
|
||||
GRANT DELETE ON TABLE pending_photos TO punimtag;
|
||||
GRANT DELETE ON TABLE users TO punimtag;
|
||||
GRANT DELETE ON TABLE pending_identifications TO punimtag;
|
||||
GRANT DELETE ON TABLE inappropriate_photo_reports TO punimtag;
|
||||
EOF
|
||||
|
||||
# Or grant on a single table:
|
||||
sudo -u postgres psql -d punimtag_auth -c "GRANT DELETE ON TABLE pending_photos TO punimtag;"
|
||||
```
|
||||
|
||||
Alternatively, use the automated script (requires sudo password):
|
||||
```bash
|
||||
./scripts/grant_auth_db_delete_permission.sh
|
||||
```
|
||||
|
||||
**Configuration:**
|
||||
The `.env` file contains the database connection string:
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user