Skip to content

System Architecture

Overall Architecture

%%{init: {'theme': 'default', 'themeVariables': {
  'primaryColor': '#E0F7FA',
  'primaryBorderColor': '#006064',
  'clusterBkg': '#F1F8E9',
  'fontSize': '14px',
  'fontFamily': 'monospace'
}}}%%
graph TD
    A["Frontend (React)"]:::UI
    A2["Google Chat"]:::UI
    B["Backend (FastAPI)"]:::Backend
    C["Database (PostgreSQL)"]:::Database

    A2 --> B
    A --> B
    B --> C

    classDef UI fill:#A5D6A7,stroke:#388E3C,stroke-width:2px,color:#1B5E20
    classDef Backend fill:#90CAF9,stroke:#1976D2,stroke-width:2px,color:#0D47A1
    classDef Database fill:#EF9A9A,stroke:#D32F2F,stroke-width:2px,color:#B71C1C

3. Technology Stack

  • Backend: FastAPI
  • Frontend: React
  • Database: PostgreSQL
  • Deployment: Docker

4. Database Design

erDiagram
    USERS {
        int id
        string name
        string email
        string dept
        int manager_id
    }

    TASKS {
        int id
        int assignee_id
        int assigner_id
        string title
        string description
        enum status
        datetime created_date
        datetime update_date
        datetime deadline
        int parent_id*
        string[] depends_on*
        string[] attachments*
        string[] tags*
    }

    USERS ||--o{ TASKS : assigned_to
    USERS ||--o{ TASKS : assigned_by

Note: Parent_id, depends_on, attachments, and tags are optional fields and will be used in V2 version

5. API Endpoints

5.1 Google Chat to App Script Endpoints

The Google Chat bot communicates with Google App Script through these endpoints:

Endpoint Method Description Request Body
/register POST Register a new user in the system User registration data
/new-task POST Create a new task via chat interface Task creation data
/get-tasks GET Retrieve tasks assigned to/from a user Query parameters
/update PUT Update an existing task via chat interface Task update data

5.2 Backend API Endpoints

The main backend API provides the following endpoints for both the UI and App Script:

Authentication Endpoints

  • POST /register
  • Description: Register a new user
  • Request Body:
    {
      "name": "string",
      "email": "string",
      "dept": "string",
      "manager_id": "int (optional)"
    }
    
  • Response: User object with generated ID

  • POST /login

  • Description: Authenticate user and return session token
  • Request Body:
    {
      "email": "string",
      "password": "string"
    }
    
  • Response: Authentication token and user details

Task Management Endpoints

  • POST /task
  • Description: Create a new task
  • Request Body:
    {
      "assignee_id": "int",
      "assigner_id": "int",
      "title": "string",
      "description": "string",
      "status": "enum (pending|in_progress|completed|cancelled)",
      "deadline": "datetime (ISO 8601)",
      "parent_id": "int (optional)",
      "depends_on": "string[] (optional)",
      "attachments": "string[] (optional)",
      "tags": "string[] (optional)"
    }
    
  • Response: Created task object with generated ID

  • PUT /task

  • Description: Update an existing task
  • Request Body:
    {
      "id": "int",
      "assignee_id": "int (optional)",
      "title": "string (optional)",
      "description": "string (optional)",
      "status": "enum (optional)",
      "deadline": "datetime (optional)",
      "parent_id": "int (optional)",
      "depends_on": "string[] (optional)",
      "attachments": "string[] (optional)",
      "tags": "string[] (optional)"
    }
    
  • Response: Updated task object

  • GET /tasks/

  • Description: Retrieve tasks with filtering options
  • Query Parameters:
    • assigned-to={id} - Filter tasks assigned to a specific user
    • assigned-from={id} - Filter tasks assigned by a specific user
    • status={status} - Filter by task status (optional)
    • limit={number} - Limit number of results (optional)
    • offset={number} - Pagination offset (optional)
  • Response: Array of task objects matching the criteria

5.3 Data Flow

sequenceDiagram
    participant GC as Google Chat
    participant AS as App Script
    participant BE as Backend API
    participant DB as Database
    participant UI as React UI

    Note over GC,UI: Task Creation Flow
    GC->>AS: POST /new (task data)
    AS->>BE: POST /task (JSON body)
    BE->>DB: Insert task
    DB->>BE: Task created
    BE->>AS: Task object
    AS->>GC: Confirmation message

    Note over UI,DB: Direct UI Flow
    UI->>BE: POST /task (JSON body)
    BE->>DB: Insert task
    DB->>BE: Task created
    BE->>UI: Task object

    Note over GC,UI: Task Retrieval Flow
    GC->>AS: GET /list
    AS->>BE: GET /tasks/?assigned-to={id}
    BE->>DB: Query tasks
    DB->>BE: Task list
    BE->>AS: Task array
    AS->>GC: Formatted task list