# dong881/daily-trello-report architecture

> Architecture diagram of the GitHub repository dong881/daily-trello-report, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dong881/daily-trello-report
- Repository: https://github.com/dong881/daily-trello-report

## Overview

##### Project type and purpose
- This is a Google Apps Script integration tool. It runs entirely on Google’s Apps Script platform and is designed to:
- Fetch tasks assigned to a user from a Notion database.
- Generate a daily schedule based on those tasks.
- Post the schedule as a comment to Trello cards.
- Optionally forward a notification payload to a webhook (e.g., LINE) if `SEND_MSG_URL` is set.

##### File structure
- Top-level files:
- `.clasp.json`: CLASP configuration for local development/deployment.
- `appsscript.json`: Deployment manifest (scopes, triggers).
- `readme.md`: Project overview & setup instructions.
- `程式碼.js`: The entire script implementing the integrations.
- There are no separate “frontend” or “backend” folders—this is a single‐component, serverless script.

##### README for additional insights
- The README clarifies:
- Which script properties (environment variables) the script expects.
- The three main functions (`fetchAssigneeUUID()`, `fetchNotionTasks()`, `autoTrello()`).
- Execution order and OAuth/security considerations.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Scheduler
    Scheduler["Time-based Trigger\n(Google Apps Script)"]:::internal
    %% Configuration & Dev Components
    subgraph "Development & Config"
        CLASPConfig[".clasp.json\n(CLASP Configuration)"]:::dev
        Documentation["readme.md\n(Project Overview)"]:::dev
    end
    %% Script Properties Store
    ScriptProperties["Script Properties Store\n(Environment Variables)"]:::config
    %% Apps Script Runtime and Logic
    subgraph "Apps Script Runtime\n(程式碼.js)" 
        direction TB
        FetchUUID["fetchAssigneeUUID()"]:::internal
        FetchTasks["fetchNotionTasks()"]:::internal
        Transform["Transform Tasks → Daily Schedule"]:::internal
        AutoTrello["autoTrello()"]:::internal
        OptionalWebhook["Optional: Send Webhook\n(if SEND_MSG_URL)"]:::internal
    end
    %% External Services
    subgraph "External Services"
        direction TB
        NotionAPI["Notion API"]:::external
        TrelloAPI["Trello API"]:::external
        Webhook["Webhook Endpoint\n(e.g., LINE)"]:::external
    end

    %% Data Flow
    Scheduler -->|triggers| ScriptProperties
    Scheduler -->|invokes| FetchUUID
    ScriptProperties --> FetchUUID
    FetchUUID -->|GET tasks by UUID| NotionAPI
    NotionAPI -->|returns tasks JSON| FetchTasks
    FetchTasks --> Transform
    Transform --> AutoTrello
    AutoTrello -->|POST comment| TrelloAPI
    AutoTrello --> OptionalWebhook
    OptionalWebhook -->|POST payload| Webhook

    %% Dev Config links
    CLASPConfig -.-> Scheduler
    Documentation -.-> FetchUUID

    %% Click Events
    click Scheduler "https://github.com/dong881/daily-trello-report/blob/main/appsscript.json"
    click ScriptProperties "https://github.com/dong881/daily-trello-report/blob/main/appsscript.json"
    click FetchUUID "https://github.com/dong881/daily-trello-report/blob/main/程式碼.js"
    click FetchTasks "https://github.com/dong881/daily-trello-report/blob/main/程式碼.js"
    click Transform "https://github.com/dong881/daily-trello-report/blob/main/程式碼.js"
    click AutoTrello "https://github.com/dong881/daily-trello-report/blob/main/程式碼.js"
    click OptionalWebhook "https://github.com/dong881/daily-trello-report/blob/main/程式碼.js"
    click CLASPConfig "https://github.com/dong881/daily-trello-report/blob/main/.clasp.json"
    click Documentation "https://github.com/dong881/daily-trello-report/blob/main/readme.md"

    %% Styles
    classDef internal fill:#e0f7fa,stroke:#006064,color:#006064
    classDef external fill:#fff3e0,stroke:#e65100,color:#e65100
    classDef config fill:#e8f5e9,stroke:#2e7d32,color:#2e7d32
    classDef dev fill:#eceff1,stroke:#455a64,color:#455a64
```
