# URL Structure Improvements Documentation ## Overview This document outlines the comprehensive improvements made to the ATS application's URL structure to enhance consistency, maintainability, and scalability. ## Changes Made ### 1. Main Project URLs (`NorahUniversity/urls.py`) #### API Versioning - **Before**: `path('api/', include(router.urls))` - **After**: `path('api/v1/', include(router.urls))` - **Benefit**: Enables future API versioning without breaking changes #### API Endpoint Organization - **Before**: - `path('api/templates/', ...)` - `path('api/webhook/', ...)` - **After**: - `path('api/v1/templates/', ...)` - `path('api/v1/webhooks/zoom/', ...)` - **Benefit**: Consistent API structure with proper versioning #### Sync API Organization - **Before**: - `path('sync/task//status/', ...)` - `path('sync/history/', ...)` - **After**: - `path('api/v1/sync/task//status/', ...)` - `path('api/v1/sync/history/', ...)` - **Benefit**: Sync endpoints properly categorized under API ### 2. Application URLs (`recruitment/urls.py`) #### Application URL Consistency - **Standardized Pattern**: `applications//[action]/` - **Examples**: - `applications//` (detail view) - `applications//update/` (update view) - `applications//delete/` (delete view) - `applications//documents/upload/` (document upload) #### Document Management URLs - **Before**: Inconsistent patterns - **After**: Consistent structure - `applications//documents/upload/` - `applications//documents//delete/` - `applications//documents//download/` #### Applicant Portal URLs - **Standardized**: `applications//applicant-view/` - **Benefit**: Clear separation between admin and applicant views #### Removed Duplicates - Eliminated duplicate `compose_application_email` URL - Cleaned up commented-out URLs - Removed inconsistent URL patterns ## URL Structure Standards ### 1. Naming Conventions - **Snake Case**: All URL patterns use snake_case - **Consistent Naming**: Related URLs share common prefixes - **Descriptive Names**: URL names clearly indicate their purpose ### 2. Parameter Patterns - **Slugs for SEO**: `` for user-facing URLs - **Integers for IDs**: `` or `` for internal references - **String Parameters**: `` for non-numeric identifiers ### 3. RESTful Patterns - **Collection URLs**: `/resource/` (plural) - **Resource URLs**: `/resource//` (singular) - **Action URLs**: `/resource//action/` ## API Structure ### Version 1 API Endpoints ``` /api/v1/ ├── jobs/ # JobPosting ViewSet ├── candidates/ # Candidate ViewSet ├── templates/ # Form template management │ ├── POST save/ # Save template │ ├── GET / # Load template │ └── DELETE / # Delete template ├── webhooks/ │ └── zoom/ # Zoom webhook endpoint └── sync/ ├── task//status/ # Sync task status └── history/ # Sync history ``` ## Frontend URL Organization ### 1. Core Dashboard & Navigation ``` / # Dashboard /login/ # Portal login /careers/ # Public careers page ``` ### 2. Job Management ``` /jobs/ ├── / # Job detail ├── create/ # Create new job ├── /update/ # Edit job ├── /upload-image/ # Upload job image ├── /applicants/ # Job applicants list ├── /applications/ # Job applications list ├── /calendar/ # Interview calendar ├── bank/ # Job bank ├── /post-to-linkedin/ # Post to LinkedIn ├── /edit_linkedin_post_content/ # Edit LinkedIn content ├── /staff-assignment/ # Staff assignment ├── /sync-hired-applications/ # Sync hired applications ├── /export//csv/ # Export applications CSV ├── /request-download/ # Request CV download ├── /download-ready/ # Download ready CVs ├── /applications_screening_view/ # Screening stage view ├── /applications_exam_view/ # Exam stage view ├── /applications_interview_view/ # Interview stage view ├── /applications_document_review_view/ # Document review view ├── /applications_offer_view/ # Offer stage view ├── /applications_hired_view/ # Hired stage view ├── /application//update_status/// # Update status ├── /update_application_exam_status/ # Update exam status ├── /reschedule_meeting_for_application/ # Reschedule meeting ├── /schedule-interviews/ # Schedule interviews ├── /confirm-schedule-interviews/ # Confirm schedule └── /applications/compose-email/ # Compose email ``` ### 3. Application/Candidate Management ``` /applications/ ├── / # Application detail ├── create/ # Create new application ├── create// # Create for specific job ├── /update/ # Update application ├── /delete/ # Delete application ├── /resume-template/ # Resume template view ├── /update-stage/ # Update application stage ├── /retry-scoring/ # Retry AI scoring ├── /applicant-view/ # Applicant portal view ├── /documents/upload/ # Upload documents ├── /documents//delete/ # Delete document └── /documents//download/ # Download document ``` ### 4. Interview Management ``` /interviews/ ├── / # Interview detail ├── create// # Create interview (type selection) ├── create//remote/ # Create remote interview ├── create//onsite/ # Create onsite interview ├── /update_interview_status # Update interview status ├── /cancel_interview_for_application # Cancel interview └── /get_interview_list # Get interview list for job ``` ### 5. Person/Contact Management ``` /persons/ ├── / # Person detail ├── create/ # Create person ├── /update/ # Update person └── /delete/ # Delete person ``` ### 6. Training Management ``` /training/ ├── / # Training detail ├── create/ # Create training ├── /update/ # Update training └── /delete/ # Delete training ``` ### 7. Form & Template Management ``` /forms/ ├── builder/ # Form builder ├── builder// # Form builder for template ├── create-template/ # Create form template ├── /submissions// # Form submission details ├── template//submissions/ # Template submissions └── template//all-submissions/ # All submissions /application/ ├── signup// # Application signup ├── / # Submit form ├── /submit/ # Submit action ├── /apply/ # Apply action └── /success/ # Success page ``` ### 8. Integration & External Services ``` /integration/erp/ ├── / # ERP integration view ├── create-job/ # Create job via ERP ├── update-job/ # Update job via ERP └── health/ # ERP health check /jobs/linkedin/ ├── login/ # LinkedIn login └── callback/ # LinkedIn callback /sources/ ├── / # Source detail ├── create/ # Create source ├── /update/ # Update source ├── /delete/ # Delete source ├── /generate-keys/ # Generate API keys ├── /toggle-status/ # Toggle source status ├── /test-connection/ # Test connection └── api/copy-to-clipboard/ # Copy to clipboard ``` ### 9. Agency & Portal Management ``` /agencies/ ├── / # Agency detail ├── create/ # Create agency ├── /update/ # Update agency ├── /delete/ # Delete agency └── /applications/ # Agency applications /agency-assignments/ ├── / # Assignment detail ├── create/ # Create assignment ├── /update/ # Update assignment └── /extend-deadline/ # Extend deadline /agency-access-links/ ├── / # Access link detail ├── create/ # Create access link ├── /deactivate/ # Deactivate link └── /reactivate/ # Reactivate link /portal/ ├── dashboard/ # Agency portal dashboard ├── logout/ # Portal logout ├── /reset/ # Password reset ├── persons/ # Persons list ├── assignment// # Assignment detail ├── assignment//submit-application/ # Submit application └── submit-application/ # Submit application action /applicant/ └── dashboard/ # Applicant portal dashboard /portal/applications/ ├── /edit/ # Edit application └── /delete/ # Delete application ``` ### 10. User & Account Management ``` /user/ ├── # User detail ├── user_profile_image_update/ # Update profile image └── /password-reset/ # Password reset /staff/ └── create # Create staff user /set_staff_password// # Set staff password /account_toggle_status/ # Toggle account status ``` ### 11. Communication & Messaging ``` /messages/ ├── / # Message detail ├── create/ # Create message ├── /reply/ # Reply to message ├── /mark-read/ # Mark as read ├── /mark-unread/ # Mark as unread └── /delete/ # Delete message ``` ### 12. System & Administrative ``` /settings/ ├── / # Settings detail ├── create/ # Create settings ├── /update/ # Update settings ├── /delete/ # Delete settings └── /toggle/ # Toggle settings /easy_logs/ # Easy logs view /note/ ├── /application_add_note/ # Add application note ├── /interview_add_note/ # Add interview note └── /delete/ # Delete note ``` ### 13. Document Management ``` /documents/ ├── upload// # Upload document ├── /delete/ # Delete document └── /download/ # Download document ``` ### 14. API Endpoints ``` /api/ ├── create/ # Create job API ├── /edit/ # Edit job API ├── application// # Application detail API ├── unread-count/ # Unread count API /htmx/ ├── /application_criteria_view/ # Application criteria view ├── /application_set_exam_date/ # Set exam date └── /application_update_status/ # Update status ``` ## Benefits of Improvements ### 1. Maintainability - **Consistent Patterns**: Easier to understand and modify - **Clear Organization**: Related URLs grouped together - **Reduced Duplication**: Eliminated redundant URL definitions ### 2. Scalability - **API Versioning**: Ready for future API changes - **Modular Structure**: Easy to add new endpoints - **RESTful Design**: Follows industry standards ### 3. Developer Experience - **Predictable URLs**: Easy to guess URL patterns - **Clear Naming**: URL names indicate their purpose - **Better Documentation**: Structure is self-documenting ### 4. SEO and User Experience - **Clean URLs**: User-friendly and SEO-optimized - **Consistent Patterns**: Users can navigate intuitively - **Clear Separation**: Admin vs. user-facing URLs ## Migration Guide ### For Developers 1. **Update API Calls**: Change `/api/` to `/api/v1/` 2. **Update Sync URLs**: Move sync endpoints to `/api/v1/sync/` 3. **Update Template References**: Use new URL names in templates ### For Frontend Code 1. **JavaScript Updates**: Update AJAX calls to use new API endpoints 2. **Template Updates**: Use new URL patterns in Django templates 3. **Form Actions**: Update form actions to use new URLs ## Future Considerations ### 1. API v2 Planning - Structure is ready for API v2 implementation - Can maintain backward compatibility with v1 ### 2. Additional Endpoints - Easy to add new endpoints following established patterns - Consistent structure makes expansion straightforward ### 3. Authentication - API structure ready for token-based authentication - Clear separation of public and private endpoints ## Testing Recommendations ### 1. URL Resolution Tests - Test all new URL patterns resolve correctly - Verify reverse URL lookups work ### 2. API Endpoint Tests - Test API v1 endpoints respond correctly - Verify versioning doesn't break existing functionality ### 3. Integration Tests - Test frontend templates with new URLs - Verify JavaScript AJAX calls work with new endpoints ## Conclusion These URL structure improvements provide a solid foundation for the ATS application's continued development and maintenance. The consistent, well-organized structure will make future enhancements easier and improve the overall developer experience.