deb4f35fb8
Blackout / unavailability (ARCHITECTURE §4.7 / §5.3 rule 5 / §5.4): - src/domain/availability.ts — pure isUnavailable(records, date); a record covers the date if active and its inclusive range [starts_on, ends_on] contains it OR its rrule matches. No DB imports. - src/domain/availability.test.ts — 11 tests named after the rule, incl. the inclusive-end case (2026-11-21..2026-11-28 covers 11-28). - src/db/schema.ts — unavailability table: CHECK ends_on >= starts_on, CHECK span <= 365 days, unique (user_id, starts_on, ends_on) WHERE active. - src/db/unavailability.ts — list/get/create/update/cancel (soft-delete); range + rrule validated on write. - src/app/api/dev/unavailability/route.ts — GET/POST/PATCH; bad range/rrule -> 400, cancel flips status=cancelled. - drizzle/0008_needy_stryfe.sql + migration applied to DB on :5433. date columns stored as strings (mode: string) to match the YYYY-MM-DD domain; Postgres date is mode-agnostic so the migration is unchanged. Constraints enforced twice: validateUnavailabilityRange at the API, chk_unavailability_* at the DB. .env added to .gitignore (real secret was not ignored; .env.* missed the bare .env).
69 lines
1.3 KiB
JSON
69 lines
1.3 KiB
JSON
{
|
|
"version": "7",
|
|
"dialect": "pg",
|
|
"entries": [
|
|
{
|
|
"idx": 0,
|
|
"version": "7",
|
|
"when": 1794941009107,
|
|
"tag": "0000_loose_wendell_vaughn",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 1,
|
|
"version": "7",
|
|
"when": 1794941123648,
|
|
"tag": "0001_fluffy_vivisector",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 2,
|
|
"version": "7",
|
|
"when": 1794959606685,
|
|
"tag": "0002_fearless_doctor_spectrum",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 3,
|
|
"version": "7",
|
|
"when": 1794961261600,
|
|
"tag": "0003_whole_crystal",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 4,
|
|
"version": "7",
|
|
"when": 1794964903255,
|
|
"tag": "0004_hesitant_ezekiel",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 5,
|
|
"version": "7",
|
|
"when": 1794973120521,
|
|
"tag": "0005_keen_lenny_balinger",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 6,
|
|
"version": "7",
|
|
"when": 1794975448394,
|
|
"tag": "0006_modern_shiver_man",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 7,
|
|
"version": "7",
|
|
"when": 1794976728115,
|
|
"tag": "0007_funny_zarda",
|
|
"breakpoints": true
|
|
},
|
|
{
|
|
"idx": 8,
|
|
"version": "7",
|
|
"when": 1794979809192,
|
|
"tag": "0008_needy_stryfe",
|
|
"breakpoints": true
|
|
}
|
|
]
|
|
} |