Documents the shift planning and closure/payroll modules (new tables, routes, stores), the dark redesign, and the docker-compose-broken-host workaround. Adds CLAUDE.md pointing agents at docs/. Translates README to English and keeps host-specific infrastructure details out of the repo.
40 lines
1.2 KiB
Markdown
40 lines
1.2 KiB
Markdown
---
|
|
type: API Endpoint
|
|
title: Closure routes (employee)
|
|
description: GET /api/closure, POST /api/closure/confirm — the employee's own month-end confirmation.
|
|
resource: backend/src/routes/closure.ts
|
|
tags: [api, payroll]
|
|
timestamp: 2026-08-16T00:00:00Z
|
|
---
|
|
|
|
# Closure routes (employee)
|
|
|
|
Mounted at `/api/closure`. Every route requires `requireAuth` +
|
|
`requireEmployee`.
|
|
|
|
# Examples
|
|
|
|
```
|
|
GET /api/closure?period=YYYY-MM
|
|
200 -> { "closure": MonthClosure, "summary": ClosureSummary }
|
|
```
|
|
Lazily creates the closure row (`waiting_employee`) the first time this
|
|
period is opened. `summary` (`worked_minutes`, `shift_count`,
|
|
`earned_estimate`) is always computed live from
|
|
[attendance_events](/docs/data-model/attendance-events.md) — never stored
|
|
on the closure row itself.
|
|
|
|
```
|
|
POST /api/closure/confirm
|
|
Body: { "period": "YYYY-MM" }
|
|
200 -> { "ok": true }
|
|
400 -> "V tomto měsíci máš stále otevřenou směnu." (open shift blocks it)
|
|
| "Docházka je už uzamčena." (already locked)
|
|
```
|
|
|
|
# Related
|
|
|
|
- [month_closures](/docs/data-model/month-closures.md)
|
|
- [Admin routes](./admin-routes.md) — lock/reopen, tips/bonus adjustments, mark paid
|
|
- [Frontend stores](/docs/frontend/stores.md) — `closureStore`
|