Skip to content

Conversation

@Zama15
Copy link
Collaborator

@Zama15 Zama15 commented Nov 23, 2025

Project Status Lifecycle & Rollback Workflow

Description

This PR implements the complete lifecycle management for transforming Applications into Projects. It introduces a strict state machine that handles the approval process, the official start of execution, and a destructive rollback mechanism, ensuring data integrity across the transition states.

Lifecycle & Workflow Changes

1. Status Architecture

  • Refactored the system to use Slugs (e.g., in_review, project_in_progress) for all logic checks, decoupling business rules from database IDs.

2. Approval & Ownership

  • When an Application is approved, it creates a Project instance.
  • The system now records the Project Creator (uuidCreator), which is the Professor who performed the approval.

3. Execution Phase (Start)

  • New logic to transition a Project from Approved to In Progress.
  • Validation: This transition is guarded by Domain rules that verify the Team Composition and Deadlines meet the specific constraints of the selected Project Type.

4. Rollback Mechanism

  • Introduced a Destructive Rollback action.
  • Allows the Project Creator to revert a Project back to the Application stage.
  • This deletes the Project entity and resets the Application status to In Review.

API Response Updates

To support the UI in rendering these states correctly, several endpoints have been standardized:

List Views
The following endpoints now return the status as a structured object status: { name, slug }:

  • GET /application/my-applications
  • GET /project/my-projects
  • GET /project/all

Application Details (GET /application/:uuid)

  • Returns status: { name, slug }.
  • Returns the instantiated project ID as project (UUID) to allow redirection to the project view if it exists.

Project Details (GET /project/:uuid)
Now provides expanded context for the project lifecycle:

  • Expanded Project Types: Returns detailed constraints per type:
    • projectTypes: { id, name, minEstimatedMonths, maxEstimatedMonths, requiredHours }[]
  • Ownership: Returns uuidCreator (The Professor who approved the app).
  • Lifecycle Timestamps:
    • createdAt: The date the original Application was created.
    • approvedAt: The date the Project was created/approved.

Infrastructure

  • Updated database seeding to generate realistic lifecycle scenarios, ensuring projects have valid Creators and status history.
  • Added uuidCreator schema support and migrations.

Important

pnpm cd packages/infrastructure
pnpm run db:clear
pnpm run db:migrate
pnpm run db:seed 

@Zama15 Zama15 merged commit 912dbdd into ReUC-Team:dev Nov 23, 2025
0 of 2 checks passed
@Zama15 Zama15 deleted the feature/project-status-lifecycle branch November 23, 2025 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant