Skip to content

User Flow Actions

Martin Mendoza edited this page Jun 8, 2025 · 6 revisions

πŸš€ StateForce User Flow Actions

This page provides detailed diagrams for specific user actions within the StateForce platform. These actions represent critical workflows such as creating events, registering institutions, managing resources, adding contacts, scheduling calendar entries, sending invites, attaching files, and viewing logs. Each diagram illustrates the steps involved, the interactions between entities, and the expected outcomes.


πŸ“ Create Event

Description:

This flow outlines the steps needed to create a new event in the system, including entering event details, assigning resources, and setting the event's priority and triage status.

sequenceDiagram
    actor User as Event Creator
    User->>UI: Open "Create Event" form
    UI->>User: Display form fields (type, location, description, priority)
    User->>API: Submit event details
    API->>DB: Create event record in `events` table
    API->>UI: Return confirmation and event ID
    User->>UI: Assign resources to event
    UI->>API: POST resource assignments (event_resources)
    API->>DB: Update `event_resources` table
    API->>UI: Display updated event details
Loading

🏒 Register Institution

Description:

This flow illustrates how an administrator registers a new institution, including adding its location, director, and sector type.

sequenceDiagram
    actor Admin as Institution Registrar
    Admin->>UI: Open "Create Institution" form
    UI->>Admin: Display form fields (name, location, director, sector type)
    Admin->>API: Submit institution details
    API->>DB: Create record in `institutions` table
    API->>UI: Return confirmation and institution ID
    Admin->>UI: Add institution contacts
    UI->>API: POST contact details (institution_contacts)
    API->>DB: Update `institution_contacts` table
    API->>UI: Display institution details
Loading

πŸ“¦ Add Resource

Description:

This flow shows the steps to register a new resource and assign it to an institution, including defining its type and availability.

sequenceDiagram
    actor Admin as Resource Registrar
    Admin->>UI: Open "Add Resource" form
    UI->>Admin: Display form fields (name, type, total units, location)
    Admin->>API: Submit resource details
    API->>DB: Create record in `resources` table
    API->>UI: Return confirmation and resource ID
    Admin->>UI: Update resource status
    UI->>API: PATCH resource status (available, maintenance)
    API->>DB: Update `resources.status` field
    API->>UI: Display updated resource details
Loading

πŸ§‘β€πŸ€β€πŸ§‘ Add Contact

Description:

This flow explains how to add a contact to the system and link it to an institution or user.

sequenceDiagram
    actor Admin as Contact Creator
    Admin->>UI: Open "Add Contact" form
    UI->>Admin: Display form fields (name, email, phone, type)
    Admin->>API: Submit contact details
    API->>DB: Create record in `contacts` table
    API->>DB: Link contact to institution/user (institution_contacts or user_contacts)
    API->>UI: Return confirmation and contact ID
    Admin->>UI: View contact details
Loading

πŸ“… Create Calendar Event

Description:

This flow demonstrates how to schedule a new calendar entry for an institution or team.

sequenceDiagram
    actor Manager as Calendar Scheduler
    Manager->>UI: Open "Create Calendar Event" form
    UI->>Manager: Display form fields (title, description, date, recurrence)
    Manager->>API: Submit calendar event details
    API->>DB: Create record in `calendar_entries` table
    API->>DB: Link entry to institution (calendar_entries_institutions)
    API->>UI: Return confirmation and event ID
    Manager->>UI: View calendar entry
Loading

βœ‰οΈ Send Invite

Description:

This flow outlines how an administrator sends an invite to a new user, including assigning a role and linking them to an institution.

sequenceDiagram
    actor Admin as Invite Sender
    Admin->>UI: Open "Send Invite" form
    UI->>Admin: Display form fields (email, role, institution)
    Admin->>API: Submit invite details
    API->>DB: Create record in `invites` table
    API->>UI: Return confirmation and invite token
    Admin->>UI: View invite status (pending, sent)
    Invitee->>UI: Accept invite via email link
    UI->>API: Activate user account
    API->>DB: Update `users` and `invites` tables
Loading

πŸ“Ž Attach File

Description:

This flow explains how a user uploads a file and links it to an event, institution, or resource.

sequenceDiagram
    actor User as File Uploader
    User->>UI: Open "Attach File" form
    UI->>User: Display file upload interface
    User->>API: Upload file (metadata + content)
    API->>DB: Create record in `attachments` table
    API->>DB: Link file to entity (event_attachments, institution_attachments, etc.)
    API->>UI: Return confirmation and file URL
    User->>UI: View attached file details
Loading

πŸ“œ View Logs

Description:

This flow highlights how a superadmin or administrator accesses audit logs to review system activity.

sequenceDiagram
    actor Superadmin as Log Viewer
    Superadmin->>UI: Open "Audit Logs" page
    UI->>Superadmin: Display filter options (user, action, date)
    Superadmin->>API: Request filtered logs
    API->>DB: Query `audit_logs` table with filters
    DB->>API: Return log data
    API->>UI: Display logs in paginated view
    Superadmin->>UI: Export logs to CSV/PDF
Loading

πŸ›  Notes

  • Real-Time Updates: All flows leverage real-time updates with Hotwire (Turbo Streams) to reflect changes instantly.
  • Error Handling: Ensure each flow includes fallback mechanisms for common errors, such as invalid inputs or network issues.
  • Data Privacy: Visibility settings (public, private, restricted) control access to sensitive data, ensuring compliance with operational requirements.

Related Pages

πŸ“š StateForce Wiki Sidebar

Welcome to the StateForce Wiki! Use this sidebar to navigate through the documentation.


🏠 Home


πŸ›  System Design


πŸ—„ Database


🎨 Design & Style


🚦 User Workflows


πŸ§ͺ Testing


πŸ“Ž Others

This sidebar provides quick access to all the documentation pages. For detailed information, click on the desired section.

Clone this wiki locally