Skip to content

feat: initial basic flow of backoffice (flow-testing)#41

Merged
JoelVR17 merged 16 commits intoTrustless-Work:developfrom
FabianSanchezD:feat/initial-create-campaign-flow
Mar 12, 2026
Merged

feat: initial basic flow of backoffice (flow-testing)#41
JoelVR17 merged 16 commits intoTrustless-Work:developfrom
FabianSanchezD:feat/initial-create-campaign-flow

Conversation

@FabianSanchezD
Copy link
Copy Markdown
Contributor

@FabianSanchezD FabianSanchezD commented Mar 11, 2026

** para pasar de página hacerlo con /flow-testing y /flow-roi **

This is the basic flow that will have all logic (not good UI) so we can work with this same logic.
With this, the work later will be much easier once we have all endpoints and can delegate all tasks for mostly front-end only work.

all under /flow-testing and /flow-roi (to prevent conflicts of any type)

its missing: proper UI (and ok route)

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced ROI Dashboard for managing campaigns with vault filtering (All, With Vault, Without Vault tabs)
    • Added campaign creation workflow with multi-step form and escrow initialization
    • Added campaign escrow detail view with loan management capabilities
    • Added vault creation, funding, and status toggle functionality
    • Added real-time vault information display (status, ROI percentage, USDC balance)
  • Chores

    • Updated environment configuration for API integration
    • Enabled cross-origin requests for local development

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 11, 2026

@FabianSanchezD is attempting to deploy a commit to the Trustless Work Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 11, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • apps/core/dist/loans/loans.controller.d.ts is excluded by !**/dist/**
  • apps/core/dist/loans/loans.service.d.ts is excluded by !**/dist/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09f73571-d608-4e00-81b4-b8f97706ee7d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The pull request migrates backend API routes from the Next.js frontend application to a dedicated NestJS core service, introduces ROI vault management and campaign flow testing features across frontend and backend, and updates environment configuration and CORS settings accordingly.

Changes

Cohort / File(s) Summary
Environment & Configuration
apps/backoffice-tokenization/.env.example, apps/core/src/main.ts, turbo.json
Updated API URL variable from NEXT_PUBLIC_API_URL to NEXT_PUBLIC_CORE_API_URL, added CORS configuration for localhost:3000/3001, and enabled persistent dev task in Turbo.
Deleted API Routes
apps/backoffice-tokenization/src/app/api/deploy/route.ts, apps/backoffice-tokenization/src/app/api/deploy/vault-contract/route.ts, apps/backoffice-tokenization/src/app/api/helper/send-transaction/route.ts, apps/backoffice-tokenization/src/app/api/vault-contract/availability-for-exchange/route.ts
Removed four Next.js API routes (117, 71, 43, 68 lines respectively) that handled token contract deployment, vault deployment, transaction submission, and vault availability checks; functionality migrated to NestJS backend.
ROI Feature Pages & Components
apps/backoffice-tokenization/src/app/flow-roi/page.tsx, apps/backoffice-tokenization/src/features/flow-roi/*
Introduced complete ROI dashboard with campaign management, vault creation/funding, and vault status monitoring via RoiDashboard, CampaignRoiCard, CampaignRoiList, CreateRoiDialog, FundRoiDialog, ToggleVaultButton, and VaultInfoPanel components.
ROI Hooks & Services
apps/backoffice-tokenization/src/features/flow-roi/hooks/*, apps/backoffice-tokenization/src/features/flow-roi/services/*, apps/backoffice-tokenization/src/features/flow-roi/types.ts
Added wallet-integrated hooks (useCreateRoi, useFundRoi, useToggleVault, useVaultInfo) and backend services (roi.service.ts, transfer.service.ts) for vault operations, plus type definitions for Campaign and VaultInfo.
Flow Testing Pages & Components
apps/backoffice-tokenization/src/app/flow-testing/*, apps/backoffice-tokenization/src/features/flow-testing/components/*
Introduced multi-page flow testing interface with campaign management, escrow handling, and loan management via FlowTesting, CreateCampaignFlow, EscrowDetail, CampaignCard, CampaignList, EscrowHeader, EscrowLoansCard, MilestoneRow, MilestonesList, and supporting UI components.
Flow Testing Hooks & Services
apps/backoffice-tokenization/src/features/flow-testing/hooks/*, apps/backoffice-tokenization/src/features/flow-testing/services/*, apps/backoffice-tokenization/src/features/flow-testing/steps/*, apps/backoffice-tokenization/src/features/flow-testing/constants.ts, apps/backoffice-tokenization/src/features/flow-testing/types.ts
Added campaign flow management (useCampaignFlow hook), multi-phase tokenization steps (StepCampaignForm, StepInitializeEscrow, StepTokenizeEscrow), campaign/Soroban services, UI constants, and type definitions for campaigns and phase states.
Core Backend DTOs & Endpoints
apps/core/src/deploy/deploy.controller.ts, apps/core/src/deploy/deploy.service.ts, apps/core/src/deploy/dto/set-admin.dto.ts, apps/core/src/campaigns/dto/create-campaign.dto.ts
Added SetAdminDto and new setAdmin endpoint, extended CreateCampaignDto with tokenFactoryId and tokenSaleId fields, and implemented buildSetAdminTransaction service method.
Core Dev Script
apps/core/package.json
Added "dev" npm script for NestJS watch mode development.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FrontendUI as Frontend UI
    participant Wallet as Wallet Provider
    participant CoreAPI as Core API
    participant Stellar as Stellar RPC
    
    User->>FrontendUI: Initiate ROI Vault Creation
    FrontendUI->>Wallet: Get wallet address
    Wallet->>FrontendUI: Return address
    FrontendUI->>CoreAPI: POST /deploy/vault (params)
    CoreAPI->>Stellar: Build contract call transaction
    Stellar->>CoreAPI: Return unsigned XDR
    CoreAPI->>FrontendUI: Return unsignedXdr
    FrontendUI->>Wallet: Sign transaction
    Wallet->>FrontendUI: Return signed XDR
    FrontendUI->>Stellar: Submit signed transaction
    Stellar->>FrontendUI: Return vault contract address
    FrontendUI->>CoreAPI: PATCH /campaigns/{id} (vaultId)
    CoreAPI->>FrontendUI: Confirm update
    FrontendUI->>User: Show success
Loading
sequenceDiagram
    participant User
    participant CreateFlow as Create Campaign Flow
    participant WalletCtx as Wallet Context
    participant CoreAPI as Core API
    participant DB as Backend DB
    participant Stellar as Stellar RPC
    
    User->>CreateFlow: Start campaign creation
    CreateFlow->>WalletCtx: Validate wallet connection
    WalletCtx->>CreateFlow: Return address
    
    rect rgba(100, 150, 255, 0.5)
    Note over CreateFlow: Step 1: Campaign Form
    CreateFlow->>CreateFlow: Collect campaign data
    end
    
    rect rgba(150, 200, 100, 0.5)
    Note over CreateFlow: Step 2: Initialize Escrow
    CreateFlow->>CoreAPI: POST /deploy/escrow (multi-release)
    CoreAPI->>Stellar: Build & submit transaction
    Stellar->>CoreAPI: Return contract ID
    CoreAPI->>DB: Store escrow reference
    CoreAPI->>CreateFlow: Return contractId
    end
    
    rect rgba(200, 150, 100, 0.5)
    Note over CreateFlow: Step 3: Tokenize Escrow
    CreateFlow->>CoreAPI: Deploy token factory
    CreateFlow->>CoreAPI: Deploy participation token
    CreateFlow->>CoreAPI: Set admin
    CreateFlow->>CoreAPI: POST /campaigns (create campaign)
    CoreAPI->>DB: Store campaign
    end
    
    CreateFlow->>User: Complete & navigate
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Feat/vault contract function calls endpoints #58: Introduces corresponding core vault controller/service/DTOs (availability-for-exchange, deployVault) that complement the frontend ROI feature removal and new backend integration in this PR.
  • Refactor/move funcs to core #14: Provides foundational campaign and deploy services in the core app upon which the new frontend services and CORE_API calls in this PR directly depend.

Suggested reviewers

  • JoelVR17
  • armandocodecr
  • zkCaleb-dev

🐰 A rabbit hops through fields of vault and flow,
With dialogs, hooks, and campaigns aglow,
Backend routes retired, the core takes the helm,
While ROI and escrows beautifully overwhelm!
From frontend to backend, the architecture takes flight,
And tokenization flows smooth through the night!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding an initial basic flow for backoffice flow-testing functionality, which aligns with the extensive new files, components, and services added throughout the changeset.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@FabianSanchezD FabianSanchezD force-pushed the feat/initial-create-campaign-flow branch from 3572ceb to 6200627 Compare March 11, 2026 19:06
@FabianSanchezD FabianSanchezD changed the title feat: initial BASIC flow of backoffice feat: initial basic flow of backoffice (flow-testing) Mar 11, 2026
@FabianSanchezD FabianSanchezD marked this pull request as ready for review March 12, 2026 17:40
@JoelVR17 JoelVR17 merged commit f51235b into Trustless-Work:develop Mar 12, 2026
@coderabbitai coderabbitai bot mentioned this pull request Mar 13, 2026
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.

3 participants