Skip to content

Milestone: M2 — Platform and Client Admin | SOW Reference: FR5, FR6, FR7 (cross-cutting) | Requirement Clarity: ✅ Clear | Dev Status: 🟢 Prototyped in POC Moved from docs/requirements/tasks/organization-onboarding-implementation.md. This is a cross-cutting overview spanning M2-01 (KYB), M2-02 (Registrar API), M2-03 (Ts&Cs/Privacy Policy), M2-04 (branding/email templates) and M2-05 (org admin/user setup) — kept as a single document since it was originally written that way; the per-item files above and below narrow in on their specific slice.

M2-00 Organization Onboarding Implementation Tasks

This document breaks down the implementation tasks for creating the organization onboarding features of the REC Verifiable Credentialing Platform. These features enable staffing companies to register on the platform, complete KYB verification, configure their settings, and set up administrators.

Implementation Strategy

The implementation will follow these steps: 1. Create DTOs for the existing organization-related entities 2. Implement the Velocity Network Registrar API integration 3. Develop controllers and services for organization management 4. Implement KYB verification workflow 5. Create organization configuration features 6. Implement organization admin setup functionality 7. Develop organization branding and email template configuration

Current Implementation Status

The project currently has:

  1. Entity Models:
  2. Organization entity with basic fields
  3. KybRecord entity for KYB verification
  4. Branding entity for organization branding
  5. EmailTemplate entity for customizable emails
  6. Role entity for role-based access control

  7. User Role Implementation:

  8. A comprehensive UserRole enum with roles including PLATFORM_ADMIN, ORG_ADMIN, ORG_USER, etc.
  9. Role-based access control infrastructure

  10. Admin Module:

  11. Basic module structure without controllers or services

Backend Tasks

DTOs for Organization Entities

  • Create app/backend/src/admin/dto/organization.dto.ts
  • Implement CreateOrganizationDto with validation:
    • name (string, required)
    • domain (string, required)
    • Add validation decorators (@IsNotEmpty, @IsString, etc.)
  • Implement UpdateOrganizationDto
  • Implement OrganizationResponseDto

  • Create app/backend/src/admin/dto/kyb-record.dto.ts

  • Implement CreateKybRecordDto
  • Implement UpdateKybRecordDto
  • Implement KybRecordResponseDto

  • Create app/backend/src/admin/dto/branding.dto.ts

  • Implement UpdateBrandingDto
  • Implement BrandingResponseDto

  • Create app/backend/src/admin/dto/email-template.dto.ts

  • Implement CreateEmailTemplateDto
  • Implement UpdateEmailTemplateDto
  • Implement EmailTemplateResponseDto

Velocity Network Registrar API Integration

  • Create app/backend/src/admin/services/velocity-registrar.service.ts
  • Implement methods to interact with the Velocity Network Registrar API:
    • registerOrganization(organizationData): Creates an organization in the Velocity Network
    • getOrganization(velocityOrgId): Retrieves organization details from Velocity Network
    • updateOrganization(velocityOrgId, organizationData): Updates organization details
  • Add proper error handling and retry logic
  • Implement logging for API interactions

  • Create app/backend/src/admin/dto/velocity-registrar.dto.ts

  • Define interfaces for all API request and response objects
  • Add validation decorators for request DTOs

Organization Management Implementation

  • Create app/backend/src/admin/services/organization.service.ts
  • Implement methods for organization management:
    • createOrganization(createOrganizationDto): Creates a new organization
    • getOrganizations(filters): Gets a list of organizations with filtering
    • getOrganizationById(id): Gets a single organization by ID
    • updateOrganization(id, updateOrganizationDto): Updates an organization
    • deleteOrganization(id): Deletes an organization (soft delete)
  • Add integration with VelocityRegistrarService

  • Create app/backend/src/admin/controllers/organization.controller.ts

  • Implement endpoints for organization management:
    • POST /organizations: Create a new organization
    • GET /organizations: List organizations (with filtering)
    • GET /organizations/:id: Get organization details
    • PUT /organizations/:id: Update organization details
    • DELETE /organizations/:id: Delete an organization
  • Add proper authorization guards using the UserRole enum
  • Implement validation using DTOs
  • Add Swagger documentation

  • Update app/backend/src/admin/admin.module.ts

  • Register OrganizationController and OrganizationService
  • Register TypeOrmModule.forFeature with all entities

KYB Verification Implementation

  • Create app/backend/src/admin/services/kyb-record.service.ts
  • Implement methods for KYB verification:

    • createKybRecord(createKybRecordDto): Creates a new KYB record
    • getKybRecords(filters): Gets a list of KYB records with filtering
    • getKybRecordById(id): Gets a single KYB record by ID
    • updateKybRecord(id, updateKybRecordDto): Updates a KYB record
    • approveKybRecord(id, notes): Approves a KYB record
    • rejectKybRecord(id, reason): Rejects a KYB record
    • requestAdditionalInfo(id, info): Requests additional information
  • Create app/backend/src/admin/controllers/kyb-record.controller.ts

  • Implement endpoints for KYB verification:
    • POST /organizations/:id/kyb: Submit KYB documents
    • GET /organizations/:id/kyb: Get KYB verification status
    • PUT /organizations/:id/kyb/:recordId: Update KYB verification status
    • GET /kyb-records: List all KYB verifications (for compliance officers)
    • PUT /kyb-records/:id/approve: Approve a KYB record
    • PUT /kyb-records/:id/reject: Reject a KYB record
    • PUT /kyb-records/:id/request-info: Request additional information
  • Add proper authorization guards
  • Implement validation using DTOs
  • Add Swagger documentation

  • Update app/backend/src/admin/admin.module.ts

  • Register KybRecordController and KybRecordService

Organization Branding Implementation

  • Create app/backend/src/admin/services/branding.service.ts
  • Implement methods for organization branding:

    • getBranding(organizationId): Gets branding for an organization
    • updateBranding(organizationId, updateBrandingDto): Updates branding
    • uploadLogo(organizationId, file): Uploads a logo file
    • uploadHeroImage(organizationId, file): Uploads a hero image
  • Create app/backend/src/admin/controllers/branding.controller.ts

  • Implement endpoints for organization branding:
    • GET /organizations/:id/branding: Get branding
    • PUT /organizations/:id/branding: Update branding
    • POST /organizations/:id/branding/logo: Upload logo
    • POST /organizations/:id/branding/hero-image: Upload hero image
  • Add proper authorization guards
  • Implement validation using DTOs
  • Add Swagger documentation

  • Update app/backend/src/admin/admin.module.ts

  • Register BrandingController and BrandingService

Email Template Implementation

  • Create app/backend/src/admin/services/email-template.service.ts
  • Implement methods for email templates:

    • createEmailTemplate(createEmailTemplateDto): Creates a new email template
    • getEmailTemplates(organizationId): Gets templates for an organization
    • getEmailTemplateById(id): Gets a single template by ID
    • updateEmailTemplate(id, updateEmailTemplateDto): Updates a template
    • deleteEmailTemplate(id): Deletes a template
    • getDefaultTemplates(): Gets system default templates
  • Create app/backend/src/admin/controllers/email-template.controller.ts

  • Implement endpoints for email templates:
    • POST /organizations/:id/email-templates: Create a template
    • GET /organizations/:id/email-templates: List templates
    • GET /organizations/:id/email-templates/:templateId: Get template
    • PUT /organizations/:id/email-templates/:templateId: Update template
    • DELETE /organizations/:id/email-templates/:templateId: Delete template
  • Add proper authorization guards
  • Implement validation using DTOs
  • Add Swagger documentation

  • Update app/backend/src/admin/admin.module.ts

  • Register EmailTemplateController and EmailTemplateService

Organization Admin Setup

  • Update app/backend/src/users/services/users.service.ts
  • Add methods for organization admin management:

    • createOrgAdmin(organizationId, userData): Create initial admin
    • assignOrgRole(userId, organizationId, role): Assign role to user
    • getOrgUsers(organizationId): Get all users in organization
  • Create app/backend/src/admin/controllers/org-users.controller.ts

  • Implement endpoints for organization user management:
    • POST /organizations/:id/users: Add user to organization
    • GET /organizations/:id/users: List users in organization
    • PUT /organizations/:id/users/:userId: Update user details
    • DELETE /organizations/:id/users/:userId: Remove user from organization
    • PUT /organizations/:id/users/:userId/roles: Update user roles
  • Add proper authorization guards
  • Implement validation using DTOs
  • Add Swagger documentation

  • Update app/backend/src/admin/admin.module.ts

  • Register OrgUsersController and import UsersService from UsersModule

Frontend Tasks

Organization Registration UI

  • Create organization registration form components:
  • Create app/frontend/src/components/organizations/RegistrationForm.tsx
  • Implement form with all required fields
  • Add validation for all inputs
  • Implement form submission to API
  • Add success/error handling

  • Create organization list and detail views:

  • Create app/frontend/src/components/organizations/OrganizationList.tsx
  • Create app/frontend/src/components/organizations/OrganizationDetail.tsx
  • Implement filtering and pagination for list view
  • Add edit functionality to detail view

KYB Verification UI

  • Create KYB submission form:
  • Create app/frontend/src/components/kyb/KybSubmissionForm.tsx
  • Implement document upload functionality
  • Add form validation
  • Implement submission to API

  • Create KYB verification dashboard for compliance officers:

  • Create app/frontend/src/components/kyb/KybDashboard.tsx
  • Implement list of pending verifications
  • Add approval/rejection functionality
  • Implement filtering and sorting

Organization Branding UI

  • Create branding configuration components:
  • Create app/frontend/src/components/branding/BrandingForm.tsx
  • Implement color picker for theme colors
  • Add logo and hero image upload
  • Implement preview functionality
  • Add form submission to API

Email Template UI

  • Create email template editor:
  • Create app/frontend/src/components/email-templates/TemplateEditor.tsx
  • Implement rich text editor for HTML content
  • Add variable insertion functionality
  • Implement preview functionality
  • Add form submission to API

Organization Admin UI

  • Create organization user management components:
  • Create app/frontend/src/components/organizations/UserManagement.tsx
  • Implement user list with roles
  • Add user invitation functionality
  • Implement role assignment
  • Add user removal functionality

Dependencies & Assumptions

Prerequisites

  • The UserRole enum must be implemented and available
  • The entity models must be properly defined and registered
  • The database schema must be updated to include all required tables

Cross-team Needs

  • Frontend team needs to implement the UI components
  • DevOps team needs to configure the Velocity Network API credentials
  • QA team needs to test the organization onboarding flow

Implementation Notes

  1. API Security:
  2. All organization management endpoints should be protected with proper authorization
  3. Only PLATFORM_ADMIN should be able to create new organizations
  4. Organization admins should only be able to manage their own organization

  5. Data Validation:

  6. All input data should be validated using class-validator
  7. API responses should be properly typed and documented

  8. Error Handling:

  9. All API endpoints should have proper error handling
  10. Velocity Network API integration should handle network errors and retry logic

  11. Testing Requirements:

  12. Unit tests should be written for all services
  13. Integration tests should be written for all controllers
  14. End-to-end tests should be written for the complete organization onboarding flow