Calendar/resource-calendar-structure.md
2025-08-07 00:15:44 +02:00

4.7 KiB

Resource Calendar JSON Structure (Opdateret)

Her er den opdaterede JSON struktur med resources som array og detaljerede resource informationer:

{
  "date": "2025-08-05",
  "resources": [
    {
      "name": "karina.knudsen",
      "displayName": "Karina Knudsen",
      "avatarUrl": "/avatars/karina.jpg",
      "employeeId": "EMP001",
      "events": [
        {
          "id": "1",
          "title": "Balayage langt hår",
          "start": "2025-08-05T10:00:00",
          "end": "2025-08-05T11:00:00",
          "type": "work",
          "allDay": false,
          "syncStatus": "synced",
          "metadata": { "duration": 60, "color": "#9c27b0" }
        },
        {
          "id": "2",
          "title": "Klipning og styling",
          "start": "2025-08-05T14:00:00",
          "end": "2025-08-05T15:30:00",
          "type": "work",
          "allDay": false,
          "syncStatus": "synced",
          "metadata": { "duration": 90, "color": "#e91e63" }
        }
      ]
    },
    {
      "name": "maria.hansen",
      "displayName": "Maria Hansen",
      "avatarUrl": "/avatars/maria.jpg",
      "employeeId": "EMP002",
      "events": [
        {
          "id": "3",
          "title": "Permanent",
          "start": "2025-08-05T09:00:00",
          "end": "2025-08-05T11:00:00",
          "type": "work",
          "allDay": false,
          "syncStatus": "synced",
          "metadata": { "duration": 120, "color": "#3f51b5" }
        },
        {
          "id": "4",
          "title": "Farve behandling",
          "start": "2025-08-05T13:00:00",
          "end": "2025-08-05T15:00:00",
          "type": "work",
          "allDay": false,
          "syncStatus": "synced",
          "metadata": { "duration": 120, "color": "#ff9800" }
        }
      ]
    },
    {
      "name": "lars.nielsen",
      "displayName": "Lars Nielsen",
      "avatarUrl": "/avatars/lars.jpg",
      "employeeId": "EMP003",
      "events": [
        {
          "id": "5",
          "title": "Herreklipning",
          "start": "2025-08-05T11:00:00",
          "end": "2025-08-05T11:30:00",
          "type": "work",
          "allDay": false,
          "syncStatus": "synced",
          "metadata": { "duration": 30, "color": "#795548" }
        },
        {
          "id": "6",
          "title": "Skæg trimning",
          "start": "2025-08-05T16:00:00",
          "end": "2025-08-05T16:30:00",
          "type": "work",
          "allDay": false,
          "syncStatus": "synced",
          "metadata": { "duration": 30, "color": "#607d8b" }
        }
      ]
    },
    {
      "name": "anna.petersen",
      "displayName": "Anna Petersen",
      "avatarUrl": "/avatars/anna.jpg",
      "employeeId": "EMP004",
      "events": [
        {
          "id": "7",
          "title": "Bryllupsfrisure",
          "start": "2025-08-05T08:00:00",
          "end": "2025-08-05T10:00:00",
          "type": "work",
          "allDay": false,
          "syncStatus": "synced",
          "metadata": { "duration": 120, "color": "#009688" }
        }
      ]
    },
    {
      "name": "thomas.olsen",
      "displayName": "Thomas Olsen",
      "avatarUrl": "/avatars/thomas.jpg",
      "employeeId": "EMP005",
      "events": [
        {
          "id": "8",
          "title": "Highlights",
          "start": "2025-08-05T12:00:00",
          "end": "2025-08-05T14:00:00",
          "type": "work",
          "allDay": false,
          "syncStatus": "synced",
          "metadata": { "duration": 120, "color": "#8bc34a" }
        },
        {
          "id": "9",
          "title": "Styling konsultation",
          "start": "2025-08-05T15:00:00",
          "end": "2025-08-05T15:30:00",
          "type": "meeting",
          "allDay": false,
          "syncStatus": "synced",
          "metadata": { "duration": 30, "color": "#cddc39" }
        }
      ]
    }
  ]
}

Struktur Forklaring

  • date: Den specifikke dato for resource calendar visningen
  • resources: Array af resource objekter
  • Resource objekt:
    • name: Unikt navn/ID (kebab-case)
    • displayName: Navn til visning i UI
    • avatarUrl: URL til profilbillede
    • employeeId: Medarbejder ID
    • events: Array af events for denne resource

Fordele ved denne struktur:

  1. Fleksibel: Nemt at tilføje flere resource felter
  2. Skalerbar: Kan håndtere mange resources
  3. UI-venlig: DisplayName og avatar til visning
  4. Struktureret: Klar separation mellem resource info og events
  5. Søgbar: Name og employeeId til filtrering/søgning

Denne struktur gør det nemt at:

  • Vise resource info i headers (displayName, avatar)
  • Filtrere events per resource
  • Håndtere kun én dato ad gangen i resource mode
  • Udvide med flere resource felter senere