-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat: deleted documents bin #1705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Skipped Deployments
|
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
🚨 @ephraimduncan has 12 pull requests awaiting review. Please consider reviewing them when possible. 🚨 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new "DELETED" document status along with functionality to restore deleted documents, updating various schemas, routers, queries, and UI components accordingly.
- Added a new extended document status "DELETED" in the Prisma types.
- Implemented restore document endpoints, mutation schemas, and audit logging.
- Updated document queries, stats, and UI components to support handling deleted documents.
Reviewed Changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/trpc/server/document-router/schema.ts | Added schema for the restore document mutation and updated document counting. |
packages/trpc/server/document-router/router.ts | Introduced a restoreDocument mutation endpoint. |
packages/prisma/types/extended-document-status.ts | Added the DELETED status to the document status enum. |
packages/lib/types/document-audit-logs.ts | Added audit log handling for document restoration. |
packages/lib/server-only/document/restore-document.ts | Implemented the restoreDocument function with transaction and webhook trigger. |
packages/lib/server-only/document/get-stats.ts | Updated document statistics queries to count DELETED documents. |
packages/lib/server-only/document/find-documents.ts | Modified document filtering to include a new deleted date range logic for DELETED documents. |
packages/lib/server-only/admin/get-documents-stats.ts | Updated admin stats to include the DELETED status. |
apps/remix/app/routes/_authenticated+/documents._index.tsx | Updated document tabs to include the DELETED status. |
apps/remix/app/components/tables/documents-table.tsx | Adjusted table actions to handle deleted documents. |
apps/remix/app/components/tables/documents-table-empty-state.tsx | Added an empty state for DELETED documents using the Trash icon. |
apps/remix/app/components/tables/documents-table-action-dropdown.tsx | Updated dropdown actions to include restoration of deleted documents. |
apps/remix/app/components/general/document/document-status.tsx | Updated document status display with a new DELETED state. |
apps/remix/app/components/general/document/document-page-view-information.tsx | Show deletion date information when applicable. |
apps/remix/app/components/general/document-signing/document-signing-recipient-provider.tsx | Removed commented logs; no functional change. |
apps/remix/app/components/dialogs/document-restore-dialog.tsx | Added dialog UI for restoring deleted documents. |
apps/remix/app/components/dialogs/document-delete-dialog.tsx | Updated fallback messaging in delete dialog for clarity. |
Files not reviewed (2)
- packages/prisma/migrations/20250313201939_add_document_restored_webhook_event/migration.sql: Language not supported
- packages/prisma/schema.prisma: Language not supported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a deleted documents bin feature that supports restoring deleted documents and includes the new DELETED status across the application. Key changes include:
- Adding a new restore endpoint and dialog to re-enable deleted documents.
- Updating stats, filters, and UI components to support and display the deleted documents status.
- Enhancing document history and status mapping to reflect the DELETED state.
Reviewed Changes
Copilot reviewed 21 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/lib/server-only/document/restore-document.ts | Adds restore functionality for deleted documents |
packages/lib/server-only/document/get-stats.ts | Updates statistics query to include deleted documents count |
packages/lib/server-only/document/find-documents.ts | Introduces filtering logic for deleted documents |
packages/lib/server-only/admin/get-documents-stats.ts | Includes a new count for deleted documents |
apps/remix/app/routes/_authenticated+/documents._index.tsx | Updates tab navigation to include a deleted documents view |
apps/remix/app/components/tables/documents-table.ts | Modifies the actions column rendering logic |
apps/remix/app/components/tables/documents-table-empty-state.tsx | Adds empty state message for the trash |
apps/remix/app/components/tables/documents-table-action-dropdown.tsx | Adds restoration action and dialog for deleted documents |
apps/remix/app/components/general/document/document-status.tsx | Updates friendly status mapping with DELETED and REJECTED statuses |
apps/remix/app/components/general/document/page-view-information.tsx | Appends deletion date info in document details |
apps/remix/app/components/general/document-history-sheet.tsx | Tracks document restore actions in history logs |
apps/remix/app/components/dialogs/document-restore-dialog.tsx | Implements dialog UI for restoring deleted documents |
Files not reviewed (6)
- packages/lib/translations/de/web.po: Language not supported
- packages/lib/translations/en/web.po: Language not supported
- packages/lib/translations/es/web.po: Language not supported
- packages/lib/translations/fr/web.po: Language not supported
- packages/lib/translations/it/web.po: Language not supported
- packages/lib/translations/pl/web.po: Language not supported
Comments suppressed due to low confidence (1)
apps/remix/app/components/general/document/document-status.tsx:36
- [nitpick] The mapping now includes a DELETED entry immediately before reintroducing REJECTED further down, which may confuse maintainers. Consider aligning the order of statuses to reflect a logical progression or grouping for clarity.
export const FRIENDLY_STATUS_MAP: Record<ExtendedDocumentStatus, FriendlyStatus> = {
<DocumentsTableActionDropdown row={row.original} /> | ||
</div> | ||
), | ||
cell: ({ row }) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional check that previously prevented rendering action buttons for deleted documents has been removed. Please confirm that the actions should now be visible regardless of the deletion status or add an appropriate guard to maintain intended behavior.
Copilot uses AI. Check for mistakes.
No description provided.