Project Management
Project Management Use Cases
This document describes real-world scenarios for project management in Global Watch, including creating, updating, archiving, and deleting projects.
UC-001: Create Project
Description
User creates a new forest monitoring project within their account (personal or team). The system validates permissions, creates the project record, initializes default settings, and tracks usage.
Actors
- Primary: Authenticated User
- Secondary: Billing System, Usage Tracking System
Preconditions
- User is authenticated
- User has permission to create projects in the account
- Account has not exceeded project quota
Postconditions
- Project created with unique ID and slug
- Project ownership assigned to account
- Default settings initialized
- Usage tracking started
- Audit log entry created
Main Flow
- User navigates to Projects page
- User clicks "Create Project" button
- User enters project details:
- Name: "Al Maha Forest Monitoring 2025"
- Slug: Auto-generated as
al-maha-forest-monitoring-2025 - Description: Optional project description
- System validates slug uniqueness within account
- System checks account project quota
- System creates project record
- System initializes default settings
- System starts usage tracking
- User is redirected to new project dashboard
Alternative Flows
A1: Slug Already Exists
- User enters project name
- Auto-generated slug conflicts with existing project
- System shows error: "This project URL is already taken"
- User manually edits slug to unique value
- System validates new slug
- Continue from step 6 of main flow
A2: Quota Exceeded
- User attempts to create project
- System detects account has reached project limit
- System shows error: "Project quota exceeded"
- System suggests upgrade or deletion of existing projects
- Use case ends
A3: Permission Denied
- User attempts to create project
- System detects user lacks
projects.createpermission - System shows error: "Permission denied"
- Use case ends
Business Rules
| ID | Rule |
|---|---|
| BR-PRJ-001 | Project slug must be unique within account |
| BR-PRJ-002 | Project slug must match pattern: ^[a-z0-9-]+$ |
| BR-PRJ-003 | Free tier: max 3 projects per account |
| BR-PRJ-004 | Pro tier: max 50 projects per account |
| BR-PRJ-005 | Enterprise tier: unlimited projects |
Implementation
// Command
interface CreateProjectCommand {
accountId: string;
name: string;
slug: string;
description?: string;
geometry?: GeoJSON.Geometry;
}
// Use Case
class CreateProjectUseCase {
async execute(command: CreateProjectCommand): Promise<Result<Project, ProjectError>> {
// 1. Check quota
const quotaResult = await this.usageService.checkQuota(command.accountId, 'project');
if (!quotaResult.ok) return quotaResult;
// 2. Validate slug uniqueness
const slugExists = await this.projectRepository.slugExists(command.accountId, command.slug);
if (slugExists) {
return Result.err(new ProjectSlugAlreadyExistsError(command.slug));
}
// 3. Create project
const project = Project.create(command);
const result = await this.projectRepository.create(project);
// 4. Track usage
if (result.ok) {
await this.usageService.track({
accountId: command.accountId,
type: 'project',
amount: 1,
});
}
return result;
}
}UC-002: Update Project
Description
User updates project details including name, slug, description, and settings. System validates permissions, checks slug uniqueness, updates the record, and logs changes.
Actors
- Primary: Authenticated User
- Secondary: Audit System
Preconditions
- User is authenticated
- Project exists
- User has permission to update the project
Postconditions
- Project updated with new data
- Slug updated if changed (and unique)
- Audit log entry created
- Cache invalidated
Main Flow
- User navigates to project settings
- User modifies project details:
- Updates name
- Optionally changes slug
- Updates description
- User clicks "Save Changes"
- System validates new data
- If slug changed, system checks uniqueness
- System updates project record
- System logs change to audit log
- System invalidates cache
- User sees success message
Alternative Flows
A1: Slug Already Exists
- User changes slug to existing value
- System shows error: "Slug already in use"
- User provides different slug
- Continue from step 5 of main flow
A2: Project Not Found
- User attempts to access non-existent project
- System shows 404 error
- Use case ends
Business Rules
| ID | Rule |
|---|---|
| BR-PRJ-006 | Only project owner or admin can update |
| BR-PRJ-007 | Slug change must maintain uniqueness |
| BR-PRJ-008 | Cannot change project owner via update |
UC-003: Archive Project
Description
User archives a project to hide it from default views while preserving all data. Archived projects can be restored at any time.
Actors
- Primary: Authenticated User
Preconditions
- User is authenticated
- Project exists and is active
- User has permission to archive the project
Postconditions
- Project marked as archived
- Project hidden from default project lists
- Usage tracking paused
- All project data preserved
Main Flow
- User navigates to project settings
- User clicks "Archive Project"
- System shows confirmation dialog:
- "Are you sure you want to archive this project?"
- "Archived projects are hidden but can be restored."
- User confirms action
- System marks project as archived
- System pauses usage tracking
- User is redirected to projects list
- Success message: "Project archived successfully"
Alternative Flows
A1: User Cancels
- User clicks "Archive Project"
- System shows confirmation dialog
- User clicks "Cancel"
- Use case ends, no changes made
Business Rules
| ID | Rule |
|---|---|
| BR-PRJ-009 | Archived projects do not count toward quota |
| BR-PRJ-010 | Archived projects can be restored at any time |
| BR-PRJ-011 | No data loss during archive |
UC-004: Restore Project
Description
User restores an archived project back to active state.
Actors
- Primary: Authenticated User
Preconditions
- Project exists and is archived
- User has permission to restore the project
- Account has available quota
Postconditions
- Project marked as active
- Project visible in default project lists
- Usage tracking resumed
Main Flow
- User navigates to archived projects view
- User locates the archived project
- User clicks "Restore Project"
- System checks account quota
- System marks project as active
- System resumes usage tracking
- Success message: "Project restored successfully"
Alternative Flows
A1: Quota Exceeded
- User attempts to restore project
- System detects account has reached project limit
- System shows error: "Cannot restore - project quota exceeded"
- System suggests archiving another project or upgrading
- Use case ends
Business Rules
| ID | Rule |
|---|---|
| BR-PRJ-012 | Restored projects count toward quota |
| BR-PRJ-013 | Must have available quota to restore |
UC-005: Delete Project
Description
User permanently deletes a project. System validates permissions, checks for dependencies, performs soft delete, and schedules cleanup.
Actors
- Primary: Authenticated User
- Secondary: Usage Tracking System, Cleanup System
Preconditions
- User is authenticated
- Project exists and is not already deleted
- User has permission to delete the project
Postconditions
- Project marked as deleted (soft delete)
- Project slug released for reuse after 30 days
- Associated resources marked for cleanup
- Usage tracking stopped
- Audit log entry created
Main Flow
- User navigates to project settings
- User clicks "Delete Project"
- System shows confirmation dialog with warnings:
- "This action cannot be undone"
- "All project data will be permanently deleted"
- Lists associated resources (assets, documents, etc.)
- User types project name to confirm
- User clicks "Delete Permanently"
- System performs soft delete
- System schedules resource cleanup (30 days)
- System stops usage tracking
- System logs deletion to audit log
- User is redirected to projects list
Alternative Flows
A1: Has Active Dependencies
- User attempts to delete project
- System detects active assets/documents
- System shows warning: "Project has X assets and Y documents"
- User chooses: cancel or force delete
- If force, continue to step 6
- If cancel, use case ends
A2: Already Deleted
- User attempts to access deleted project
- System shows error: "Project not found"
- Use case ends
Business Rules
| ID | Rule |
|---|---|
| BR-PRJ-014 | Soft delete with 30-day recovery window |
| BR-PRJ-015 | Hard delete after 30 days (permanent) |
| BR-PRJ-016 | Only owner or admin can delete |
| BR-PRJ-017 | Slug reserved for 30 days after deletion |
UC-006: Slug Auto-Generation
Description
System automatically generates URL-friendly slugs from project names.
Scenarios
Scenario A: Simple Name
- Input:
John Doe - Output:
john-doe - Process:
- Convert to lowercase:
john doe - Replace spaces with hyphens:
john-doe
- Convert to lowercase:
Scenario B: Name with Special Characters
- Input:
João Silva & Co. - Output:
joao-silva-co - Process:
- Convert to lowercase:
joão silva & co. - Remove accents:
joao silva & co. - Remove special chars:
joao silva co - Replace spaces with hyphens:
joao-silva-co
- Convert to lowercase:
Scenario C: Name with Multiple Spaces
- Input:
Tech Solutions Inc - Output:
tech-solutions-inc - Process:
- Convert to lowercase
- Replace multiple spaces with single hyphen
Scenario D: Very Long Name
- Input: 300-character project name
- Output: Truncated to 128 characters
- Process:
- Generate slug normally
- Truncate at word boundary if possible
- Remove trailing hyphen
Business Rules
| ID | Rule |
|---|---|
| BR-PRJ-018 | Slug updates live as user types |
| BR-PRJ-019 | Maximum slug length: 128 characters |
| BR-PRJ-020 | No manual slug editing disables auto-generation |
Testing Checklist
Create Project
- Auto-generation works from name field
- Manual edit disables auto-generation
- Validation shows spinner while checking
- Green checkmark for available slug
- Red X for taken slug
- Debounce works (no validation spam)
- Unique slugs per account (not global)
- Handles special characters correctly
- Truncates long slugs to 128 chars
- Create button disabled until slug validated
Update Project
- All fields editable
- Slug change validates uniqueness
- Success message after save
- Audit log entry created
Archive/Restore
- Archive confirmation dialog
- Archived projects hidden from default view
- Restore checks quota
- Usage tracking paused/resumed correctly
Delete Project
- Confirmation requires typing project name
- Soft delete preserves data for 30 days
- Hard delete after 30 days
- Associated resources cleaned up