Skip to content

Add Document Workflow System for User-Related Documents #12

@Dark-Developer93

Description

@Dark-Developer93

Description

Implement a Document Workflow system that allows admins and moderators to upload, manage, and track important user-related documents such as signed contracts and appraisals. The system should categorize documents by year and user, and provide a comprehensive view of each user's document status.

Features to Implement

  1. Document upload functionality for admins and moderators.
  2. Year-based categorization for uploaded documents.
  3. User-specific document management page.
  4. Document type classification (e.g., contract, appraisal).
  5. Document status tracking and reporting.
  6. Missing document identification system.

Technical Tasks

  1. Update Prisma schema to include new models for document management.
  2. Create new API routes for document upload, retrieval, and management.
  3. Develop user interface for document upload and management.
  4. Implement document categorization by year and type.
  5. Create a user-specific document overview page.
  6. Develop a system to identify and report missing documents.
  7. Implement access control for document viewing and management.

Database Schema Updates

Add the following model to the Prisma schema:

model UserDocument {
    id String @id @default(cuid())
    userId String
    user User @relation(fields: [userId], references: [id])
    documentType String // e.g., "contract", "appraisal"
    year Int
    fileName String
    fileUrl String
    uploadedAt DateTime @default(now())
    uploadedBy String
}

model User {
    // ... existing fields
    documents UserDocument[]
}

File Updates

  1. Create app/(dashboard)/dashboard/documents/page.tsx for the main document management page.
  2. Create app/(dashboard)/dashboard/documents/[userId]/page.tsx for user-specific document pages.
  3. Create app/actions/documentActions.ts for document-related server actions.
  4. Update navigation components to include the new document management pages.

Additional Considerations

  • Implement secure file storage and retrieval system.
  • Ensure proper file type validation for uploads (e.g., only allow PDFs).
  • Consider implementing document versioning for tracking changes over time.
  • Add a notification system for upcoming or overdue document requirements.

Acceptance Criteria

  • Admins and moderators can successfully upload documents for users.
  • Documents are correctly categorized by year and type.
  • User-specific document pages display all relevant documents.
  • The system accurately identifies and reports missing documents.
  • Document upload and management interfaces are intuitive and user-friendly.
  • Access control ensures that only authorized personnel can view and manage documents.

Related Files

  • app/(dashboard)/dashboard/users/page.tsx
  • app/(dashboard)/dashboard/users/UsersTable.tsx
  • prisma/schema.prisma

Please update these files and any others necessary to fully integrate the new Document Workflow System.

Document Requirements

Implement a system to check for the following document requirements:

  1. Each user should have a signed contract for the current year.
  2. Users should have two appraisals per year.

The system should flag any missing documents based on these requirements.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions