Aller au contenu

plane.so Integration

Status: API Key Required

Diese Integration benötigt einen plane.so API Key.

Übersicht

plane.so ist ein Open-Source Project Management Tool. Wir nutzen es für:

  • Property Issues - Reparaturen, Wartung
  • Contract Tracking - Vertragsmeilensteine
  • Team Collaboration - Aufgabenverwaltung

API Endpoints

Endpoint Methode Cache TTL Beschreibung
/api/v1/workspaces GET 5min Workspaces
/api/v1/workspaces/{slug}/projects GET 2min Projekte
/api/v1/workspaces/{slug}/projects/{id}/issues GET 1min Issues
/api/v1/workspaces/{slug}/projects/{id}/issues POST - Issue erstellen
/api/v1/workspaces/{slug}/projects/{id}/issues/{id} PATCH invalidate Issue update
/api/v1/workspaces/{slug}/projects/{id}/cycles GET 5min Cycles
/api/v1/workspaces/{slug}/projects/{id}/modules GET 5min Modules
/api/v1/workspaces/{slug}/members GET 10min Team Members

Authentifizierung

# API Key im Header
Authorization: Bearer {PLANE_API_KEY}

Datentypen

interface PlaneWorkspace {
  id: string;
  slug: string;
  name: string;
  logo?: string;
  created_at: string;
}

interface PlaneProject {
  id: string;
  workspace: string;
  name: string;
  identifier: string;  // z.B. "PROP"
  description?: string;
  network: 0 | 1 | 2;  // 0=Secret, 1=Public, 2=Invite
  created_at: string;
}

interface PlaneIssue {
  id: string;
  project: string;
  name: string;
  description_html?: string;
  state: string;
  priority: "urgent" | "high" | "medium" | "low" | "none";
  assignees: string[];
  labels: string[];
  start_date?: string;
  target_date?: string;
  estimate_point?: number;
  sequence_id: number;
  created_at: string;
  updated_at: string;
}

interface PlaneCycle {
  id: string;
  project: string;
  name: string;
  start_date: string;
  end_date: string;
  progress?: number;
}

D1 Cache Table

CREATE TABLE plane_issues (
  id TEXT PRIMARY KEY,
  plane_id TEXT NOT NULL UNIQUE,
  workspace_slug TEXT NOT NULL,
  project_id TEXT NOT NULL,
  project_identifier TEXT,
  sequence_id INTEGER NOT NULL,
  name TEXT NOT NULL,
  state TEXT NOT NULL,
  priority TEXT NOT NULL,
  -- Links zu PostgreSQL
  property_id TEXT,
  contract_id TEXT,
  synced_at INTEGER NOT NULL
);

Use Cases

Property Issues

// Issue für Property erstellen
const issue = await plane.createIssue({
  project: "PROP",
  name: "Heizung defekt - Wohnung 3.OG",
  priority: "high",
  labels: ["maintenance", "heating"],
  // Custom field oder Label für Property-Link
});

Contract Milestones

// Vertragsende als Cycle
const cycle = await plane.getCycle({
  name: "Vertrag Müller - Q4 2024",
  start_date: "2024-10-01",
  end_date: "2024-12-31",
});

Setup

  1. API Key generieren (HUMAN)
  2. plane.so → Settings → API → Create API Key

  3. Environment Variable

    PLANE_API_KEY=your-api-key
    PLANE_WORKSPACE_SLUG=your-workspace
    

  4. Route implementieren

    // sonicjs/src/routes/plane.routes.ts
    import { Hono } from 'hono';
    
    const plane = new Hono();
    
    plane.get('/issues', async (c) => {
      // ...
    });