CRA-Helper/replit.md
SylvainP1 2586c0eb09 Protect user data entry with an administrator lock feature
Introduce an admin lock mechanism to prevent unauthorized modifications to timesheet entries and quick entry fields.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 55837015-10e9-4be9-b857-7f5e6be73772
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: d79c5670-4ff2-409b-85ef-fc3f2472208b
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1cc377db-7ea0-49f2-97ce-c3e87e0228cc/55837015-10e9-4be9-b857-7f5e6be73772/LZewR4B
Replit-Helium-Checkpoint-Created: true
2026-04-21 10:47:21 +00:00

60 lines
2.9 KiB
Markdown

# CRA Manager - Compte Rendu d'Activité
## Overview
A French timesheet management application (CRA - Compte Rendu d'Activité) built as a pnpm workspace monorepo. Consultants use it to track and report hours worked across multiple projects each month.
## Stack
- **Monorepo tool**: pnpm workspaces
- **Node.js version**: 24
- **Package manager**: pnpm
- **TypeScript version**: 5.9
- **Frontend**: React + Vite + Tailwind CSS + shadcn/ui
- **API framework**: Express 5
- **Database**: PostgreSQL + Drizzle ORM
- **Validation**: Zod (`zod/v4`), `drizzle-zod`
- **API codegen**: Orval (from OpenAPI spec)
- **Build**: esbuild (CJS bundle)
- **Charts**: Recharts
- **Routing**: Wouter
## Features
- **Dashboard**: Overview with monthly hours chart, project breakdown, active project count, timesheet status
- **Timesheet Management**: Create, view, edit monthly timesheets (CRA)
- **CRA Grid**: Interactive calendar grid where rows = projects, columns = days of month. Click cells to open popover with hour options [0, 0.5, 1, 2, 3, 4, 5, 6, 7, 8]. Includes optional description per cell (amber dot indicator). Auto-save with debounce. Weekend distinction, row/column totals
- **Project Management**: CRUD for projects with code, name, client, category
- **Timesheet Workflow**: Draft → Submitted → Validated status flow
- **Inline Administration**: Sidebar Admin dialog to lock/unlock time entry editing and export/import project, CRA, line, and time-entry data as JSON
## Database Schema
- `projects` — Project definitions (code, name, client, category)
- `timesheets` — Monthly timesheet headers (year, month, status, collaborator)
- `timesheet_lines` — Project assignments within a timesheet
- `time_entries` — Daily hour entries per line (date, hours, description)
## Key Commands
- `pnpm run typecheck` — full typecheck across all packages
- `pnpm run build` — typecheck + build all packages
- `pnpm --filter @workspace/api-spec run codegen` — regenerate API hooks and Zod schemas from OpenAPI spec
- `pnpm --filter @workspace/db run push` — push DB schema changes (dev only)
- `pnpm --filter @workspace/api-server run dev` — run API server locally
## API Endpoints
- `GET/POST /api/projects` — List/create projects
- `GET/PATCH/DELETE /api/projects/:id` — Project CRUD
- `GET/POST /api/timesheets` — List/create timesheets (filter by year/month)
- `GET/PATCH/DELETE /api/timesheets/:id` — Timesheet CRUD (GET returns full detail with lines and entries)
- `GET/POST /api/timesheets/:id/lines` — Timesheet lines
- `DELETE /api/timesheets/:id/lines/:lineId` — Remove a line
- `PUT /api/timesheets/:id/entries` — Batch upsert time entries
- `GET /api/dashboard/summary` — Dashboard stats
- `GET /api/dashboard/monthly-hours` — Monthly hours breakdown
- `GET /api/dashboard/project-hours` — Hours per project
See the `pnpm-workspace` skill for workspace structure, TypeScript setup, and package details.