Skip to main content

What are Unions?

Unions are organizational groups that contain union members who share a common identity, location, or are managed by the same credit officer. Every union is assigned to a specific credit officer who manages its members and loan operations.
Unions must be created before adding members. Each union is tied to one credit officer.

Union Data Model

Based on the Prisma schema, the Union model contains:
model Union {
  id              String   @id @default(cuid())
  name            String
  location        String?
  address         String?
  creditOfficerId String   // Required: Credit Officer assignment
  
  // Relations
  creditOfficer   User     @relation("OfficerUnions")
  unionMembers    UnionMember[]
  loans           Loan[]
  
  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt
  deletedAt DateTime? // Soft delete support
}

Key Fields

FieldTypeRequiredDescription
idStringYesUnique identifier (auto-generated)
nameStringYesUnion name (must be unique)
locationStringNoGeographic location or area
addressStringNoPhysical address details
creditOfficerIdStringYesAssigned credit officer ID
deletedAtDateTimeNoSoft delete timestamp

Viewing All Unions

Access the unions list from the sidebar:
1

Navigate

Click Business ManagementUnions
2

View List

See all unions you have permission to access

List Features

Search

Type union name in the search box to filter results

Filter

Filter by credit officer or status (Active/Inactive)

Sort

Click column headers to sort by name, officer, or date

Export

Download union list as CSV or Excel

Role-Based Access

Can view and manage all unions in the system
Can view unions assigned to credit officers under their supervision
Can only view and manage their own assigned unions

Creating a New Union

1

Start Creation

Go to the Unions page and click + Add Union button (top right)
2

Fill Required Fields

Required:
  • Union Name - Enter a unique, descriptive name
  • Credit Officer - Select the officer who will manage this union
Optional:
  • Location - Geographic area or region
  • Address - Physical address or meeting place
3

Save

Click Create Union to save

Field Guidelines

Union Name Best Practices:
  • Use clear, descriptive names (e.g., “Market Women Group”, “Potters Association Zone A”)
  • Avoid duplicate names
  • Include location if helpful (e.g., “Lagos Traders Union”)

API Endpoint

// POST /api/unions
const createUnion = async (data: {
  name: string;
  creditOfficerId: string;
  location?: string;
  address?: string;
}) => {
  // Creates new union and assigns to officer
}

Viewing Union Details

Click any union in the list to view:

Basic Information

  • Union name
  • Location and address
  • Assigned credit officer
  • Creation date

Member Statistics

  • Total members count
  • Active members
  • Recent additions

Loan Portfolio

  • Total loans issued
  • Active loans
  • Outstanding balance

Performance

  • Collection rate
  • Overdue loans
  • Repayment trends

Editing a Union

Only Administrators and Supervisors can edit union details
1

Find Union

Locate the union in the list
2

Open Editor

Click the Edit icon (pencil) in the Actions column
3

Update Fields

Modify the information as needed:
  • Change name
  • Update location/address
  • Reassign credit officer (see below)
4

Save Changes

Click Save Changes to update

Reassigning Credit Officers

When reassigning a union to a different officer, all members automatically move with the union

Reassignment Process

1

Access Reassignment

From union details or list, click Reassign Officer
2

Select New Officer

Choose the new credit officer from the dropdown
3

Add Reason

Provide a reason for the reassignment (optional but recommended)
4

Confirm

Review the changes and click Confirm Reassignment

What Happens During Reassignment?

  1. Union’s creditOfficerId is updated to the new officer
  2. Assignment history is recorded in UnionAssignmentHistory
  3. All union members remain in the union
  4. All loans stay connected to the union
  5. New officer gains access to all union data

Assignment History Tracking

model UnionAssignmentHistory {
  id              String   @id
  unionId         String
  oldOfficerId    String?
  newOfficerId    String
  changedByUserId String
  reason          String?
  changedAt       DateTime @default(now())
}
Each union details page shows a history log of all officer assignments with dates and reasons

Deleting a Union

You cannot delete a union that has:
  • Active members
  • Active or pending loans
Delete or reassign these first, or deactivate the union instead.

Soft Delete Process

1

Locate Union

Find the union in the list
2

Delete Action

Click the Delete icon (trash can) in the Actions column
3

Confirm Deletion

Review the confirmation popup and click Confirm
Unions are soft deleted (marked with deletedAt timestamp) rather than permanently removed, preserving historical data

Alternative: Deactivate

Instead of deleting:
  1. Edit the union
  2. Mark as inactive
  3. This hides it from active lists while preserving data

Adding Members to a Union

See Members documentation for details on creating members within a union.

Creating Loans for Union Members

When creating a loan:
  1. Select the union first
  2. Then select a member from that union
  3. The loan is automatically associated with both
See Loans documentation for complete workflow.

Search and Filters

The search function looks for matches in union name and location fields
// Search example
searchTerm: "market" 
// Finds: "Market Women Group", "New Market Traders", etc.

Filter by Credit Officer

1

Open Filter

Click the filter dropdown
2

Select Officer

Choose a credit officer from the list
3

Apply

View only unions assigned to that officer

Filter by Status

  • Active - Shows all active unions
  • Inactive - Shows deactivated unions
  • All - Shows both active and inactive

Export Options

CSV Export

Download as comma-separated valuesBest for Excel or Google Sheets

Excel Export

Download as .xlsx fileIncludes formatting and headers

Copy to Clipboard

Copy data for pasting elsewhereQuick data sharing

Export Includes

  • Union name
  • Location and address
  • Assigned credit officer name
  • Member count
  • Loan statistics
  • Creation date

Best Practices

Naming Conventions

  • Use consistent naming patterns
  • Include location if managing multiple areas
  • Avoid abbreviations that aren’t clear
  • Example: “Ikeja Market Women Union” not “IMW”

Officer Assignment

  • Assign unions to officers familiar with the area
  • Balance workload across officers
  • Consider geographic proximity
  • Document reassignment reasons

Data Management

  • Keep location and address updated
  • Review inactive unions periodically
  • Archive old unions instead of deleting
  • Maintain assignment history

Performance Monitoring

  • Track union-level metrics
  • Compare performance across unions
  • Identify high-performing groups
  • Address struggling unions proactively

Troubleshooting

Possible causes:
  • Union name already exists
  • Credit officer not selected
  • Insufficient permissions (not Admin/Supervisor)
Solution: Check name uniqueness and verify required fields
Reason: Union has active members or loansSolution:
  1. Reassign members to other unions
  2. Close or cancel all loans
  3. Or mark union as inactive instead
Reason: Role-based access restrictionsExplanation:
  • Credit Officers only see their assigned unions
  • Supervisors see unions of their team
  • Only Admins see all unions
Check:
  • You have Admin or Supervisor role
  • New officer exists and is active
  • You provided required information

API Reference

Endpoints

// Get all unions
GET /api/unions?page=1&limit=20&search=keyword&creditOfficerId=xxx

// Get union by ID
GET /api/unions/:id

// Create union
POST /api/unions
Body: { name, creditOfficerId, location?, address? }

// Update union
PUT /api/unions/:id
Body: { name?, location?, address?, creditOfficerId? }

// Delete union (soft)
DELETE /api/unions/:id

// Reassign officer
POST /api/unions/:unionId/assign
Body: { creditOfficerId, reason? }

// Export unions
GET /api/unions/export?creditOfficerId=xxx&search=keyword

Summary

Unions provide:
  • ✅ Organizational structure for members
  • ✅ Credit officer assignment and management
  • ✅ Loan portfolio grouping
  • ✅ Performance tracking by group
  • ✅ Assignment history and audit trail
  • ✅ Role-based access control

Next Steps

Build docs developers (and LLMs) love