Handover workspace

ERS, Todo, OfferReview, and Docu in one view

Imported from live server docs, code structure, and deployment notes.

Apr 3, 2026, 12:38 PM

Todo

Data Model

No summary found yet.

docs/DATA_MODEL.md

Updated Mar 4, 2026, 3:14 AM

Data Model

Database

  • Engine: PostgreSQL
  • ORM: Prisma
  • Schema file: prisma/schema.prisma

Core Entities

User

  • Auth account (email, passwordHash, optional displayName)
  • Owns personal categories/projects/logs/plans
  • Has one TeamMember membership

Team

  • Team container for collaboration and dashboards
  • Has many members, logs, plans, narratives, audit logs

TeamMember

  • Join model: teamId, userId, role
  • Roles: OWNER, ADMIN, MEMBER
  • Constraint: one membership per user (userId unique)

Category / Project

  • Personal taxonomy per user (@@unique([userId, name]))
  • Referenced by activity logs and planning allocations

ActivityLog

  • Daily execution entries (localDate, startTime, endTime, durationMinutes, energy)
  • References User, optional Team, Category, Project
  • Indexed by userId+localDate and teamId+localDate

DailyPlanAllocation

  • Planned focus allocations by day
  • Dimensions: CATEGORY or PROJECT
  • Fields: plannedMinutes, localDate, optional category/project refs

DailyNarrative

  • AI/fallback narrative text per userId + localDate
  • Includes model metadata and optional teamId

ScheduledExport

  • Export job config:
    • frequency: DAILY / WEEKLY / MONTHLY
    • format: CSV / PDF
    • scope: PERSONAL / TEAM
    • targetPath, isActive, nextRunAt, lastRunAt

AuditLog

  • Action trail for critical events
  • Stores action, optional userId/teamId/targetType/targetId, JSON metadata, IP, timestamp

Relationship Summary

  • Team 1 -> many TeamMember
  • User 1 -> 1 TeamMember
  • User 1 -> many ActivityLog, Category, Project, DailyPlanAllocation, DailyNarrative, ScheduledExport
  • Team 1 -> many ActivityLog, DailyPlanAllocation, DailyNarrative, ScheduledExport, AuditLog
  • Category/Project 1 -> many ActivityLog and planning rows

Deletion Semantics

  • Deleting user cascades to member linkage and personal dependent records
  • Category/project deletion is blocked when referenced by logs (FK restriction)
  • Team deletion cascades member links and team-scoped references