[PR #781] [MERGED] feat: add custom SQL cleanup for scheduled maintenance #759

Closed
opened 2026-02-26 21:32:50 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dreamhunter2333/cloudflare_temp_email/pull/781
Author: @dreamhunter2333
Created: 12/11/2025
Status: Merged
Merged: 12/11/2025
Merged by: @dreamhunter2333

Base: mainHead: feature/email


📝 Commits (1)

  • 670d09b feat: add custom SQL cleanup for scheduled maintenance

📊 Changes

4 files changed (+277 additions, -92 deletions)

View changed files

📝 frontend/src/views/admin/Maintenance.vue (+169 -91)
📝 worker/src/admin_api/cleanup_api.ts (+85 -1)
📝 worker/src/models/index.ts (+8 -0)
📝 worker/src/scheduled.ts (+15 -0)

📄 Description

User description

Summary

  • Add custom SQL cleanup feature to maintenance settings
  • Support multiple DELETE SQL statements saved in CleanupSettings
  • Each SQL entry can be enabled/disabled for scheduled execution
  • SQL validation: DELETE only, single statement, max 1000 characters, no comments

Changes

  • worker/src/models/index.ts: Add CustomSqlCleanup type
  • worker/src/admin_api/cleanup_api.ts: Add validateCustomSql, executeCustomSqlCleanup, normalizeSql functions
  • worker/src/scheduled.ts: Integrate custom SQL cleanup execution
  • frontend/src/views/admin/Maintenance.vue: Add tabs UI for basic/custom SQL cleanup

Test plan

  • Add custom SQL cleanup entry
  • Save and verify validation works
  • Enable auto cleanup and verify scheduled execution
  • Test invalid SQL rejection (non-DELETE, multiple statements, too long)

🤖 Generated with Claude Code


PR Type

Enhancement, Tests


Description

  • Introduced custom SQL cleanup functionality for scheduled maintenance.

  • Added SQL validation and normalization for DELETE statements.

  • Enhanced admin UI with tabs for basic and custom SQL cleanup.

  • Integrated custom SQL execution into the scheduled cleanup process.


Changes walkthrough 📝

Relevant files
Enhancement
Maintenance.vue
Add UI for custom SQL cleanup management                                 

frontend/src/views/admin/Maintenance.vue

  • Added UI for managing custom SQL cleanup tasks.
  • Introduced tabs for basic and custom cleanup options.
  • Implemented functionality to add, remove, and validate custom SQL
    entries.
  • Enhanced i18n support for new UI elements.
  • +169/-91
    cleanup_api.ts
    Add SQL validation and execution logic                                     

    worker/src/admin_api/cleanup_api.ts

  • Added validateCustomSql for SQL validation.
  • Implemented executeCustomSqlCleanup for executing custom SQL tasks.
  • Integrated validation into cleanup settings save logic.
  • +85/-1   
    index.ts
    Define types for custom SQL cleanup                                           

    worker/src/models/index.ts

  • Added CustomSqlCleanup type for custom SQL tasks.
  • Updated CleanupSettings to include custom SQL cleanup list.
  • +8/-0     
    scheduled.ts
    Integrate custom SQL cleanup into scheduled tasks               

    worker/src/scheduled.ts

  • Integrated custom SQL cleanup execution into scheduled tasks.
  • Added error handling for failed SQL executions.
  • +15/-0   

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.

  • 🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

    ## 📋 Pull Request Information **Original PR:** https://github.com/dreamhunter2333/cloudflare_temp_email/pull/781 **Author:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Created:** 12/11/2025 **Status:** ✅ Merged **Merged:** 12/11/2025 **Merged by:** [@dreamhunter2333](https://github.com/dreamhunter2333) **Base:** `main` ← **Head:** `feature/email` --- ### 📝 Commits (1) - [`670d09b`](https://github.com/dreamhunter2333/cloudflare_temp_email/commit/670d09b9b30ebad1a95f721b9cc1e42d13215784) feat: add custom SQL cleanup for scheduled maintenance ### 📊 Changes **4 files changed** (+277 additions, -92 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/views/admin/Maintenance.vue` (+169 -91) 📝 `worker/src/admin_api/cleanup_api.ts` (+85 -1) 📝 `worker/src/models/index.ts` (+8 -0) 📝 `worker/src/scheduled.ts` (+15 -0) </details> ### 📄 Description ### **User description** ## Summary - Add custom SQL cleanup feature to maintenance settings - Support multiple DELETE SQL statements saved in CleanupSettings - Each SQL entry can be enabled/disabled for scheduled execution - SQL validation: DELETE only, single statement, max 1000 characters, no comments ## Changes - `worker/src/models/index.ts`: Add `CustomSqlCleanup` type - `worker/src/admin_api/cleanup_api.ts`: Add `validateCustomSql`, `executeCustomSqlCleanup`, `normalizeSql` functions - `worker/src/scheduled.ts`: Integrate custom SQL cleanup execution - `frontend/src/views/admin/Maintenance.vue`: Add tabs UI for basic/custom SQL cleanup ## Test plan - [ ] Add custom SQL cleanup entry - [ ] Save and verify validation works - [ ] Enable auto cleanup and verify scheduled execution - [ ] Test invalid SQL rejection (non-DELETE, multiple statements, too long) 🤖 Generated with [Claude Code](https://claude.ai/code) ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Introduced custom SQL cleanup functionality for scheduled maintenance. - Added SQL validation and normalization for DELETE statements. - Enhanced admin UI with tabs for basic and custom SQL cleanup. - Integrated custom SQL execution into the scheduled cleanup process. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>Maintenance.vue</strong><dd><code>Add UI for custom SQL cleanup management</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> frontend/src/views/admin/Maintenance.vue <li>Added UI for managing custom SQL cleanup tasks.<br> <li> Introduced tabs for basic and custom cleanup options.<br> <li> Implemented functionality to add, remove, and validate custom SQL <br>entries.<br> <li> Enhanced i18n support for new UI elements. </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/781/files#diff-68808e9c7bcf8b34a2d45265cca130c547b77e75a97350ea7d16682e69922ae4">+169/-91</a></td> </tr> <tr> <td> <details> <summary><strong>cleanup_api.ts</strong><dd><code>Add SQL validation and execution logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/admin_api/cleanup_api.ts <li>Added <code>validateCustomSql</code> for SQL validation.<br> <li> Implemented <code>executeCustomSqlCleanup</code> for executing custom SQL tasks.<br> <li> Integrated validation into cleanup settings save logic. </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/781/files#diff-29fba59415d40dbb12a6c3d99fae9e035c1faac3e2e78838779c0d7352c90577">+85/-1</a>&nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>index.ts</strong><dd><code>Define types for custom SQL cleanup</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/models/index.ts <li>Added <code>CustomSqlCleanup</code> type for custom SQL tasks.<br> <li> Updated <code>CleanupSettings</code> to include custom SQL cleanup list. </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/781/files#diff-430bcc4ffa98738e7419c774a53ba2ce8b5127a36b3741e89bf36b95a56f02bc">+8/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>scheduled.ts</strong><dd><code>Integrate custom SQL cleanup into scheduled tasks</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> worker/src/scheduled.ts <li>Integrated custom SQL cleanup execution into scheduled tasks.<br> <li> Added error handling for failed SQL executions. </details> </td> <td><a href="https://github.com/dreamhunter2333/cloudflare_temp_email/pull/781/files#diff-32db4dd84c910f05f07a8a392340ce79b637bcb01d929f6df09f3ba94acfa9b7">+15/-0</a>&nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > <details> <summary> Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about PR-Agent usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
    kerem 2026-02-26 21:32:50 +03:00
    Sign in to join this conversation.
    No milestone
    No project
    No assignees
    1 participant
    Notifications
    Due date
    The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

    No due date set.

    Dependencies

    No dependencies set.

    Reference
    starred/cloudflare_temp_email#759
    No description provided.