- Rebrand all user-facing text to AgendaMax - Fix sidebar scrolling: card container no longer overflows html (flex h-full min-h-0) - Fix calendar toolbar hover: active buttons keep readable contrast - Sticky calendar toolbar (month/week/day always visible on scroll) - Seed guarantees 2-4 appointments per day for current week (Mon-Sat)
4.1 KiB
4.1 KiB
Task 1 Report — Migración V3→V4 + tipos compartidos
Files changed
H:\MegaSync\Proyectos\AgendaPro\server\db.ts- Added
migrateV3ToV4()immediately beforeexport function runMigrations(). - Registered
migrateV3ToV4();as the last call insiderunMigrations()(aftermigrateV2ToV3();).
- Added
H:\MegaSync\Proyectos\AgendaPro\shared\types.ts- Replaced
Businessinterface to add booking fields (booking_enabled,cancel_window_hours,cancel_penalty_pct,require_deposit,deposit_pct,timezone) and v4 fields (auto_assign_specialist,working_hours). - Added
WorkingDayandWorkingHoursMaptypes after theBusinessinterface. - Added
specialties,working_hours,efficiency_scoreto theEmployeeinterface (afterservice_ids?).
- Replaced
Verification
npm run typecheck output (last line)
> [email protected] typecheck
> tsc -b --noEmit
Exit code 0 — 0 errors. (Output was just the script banner + the tsc command echo; tsc prints nothing on success.)
tsx column check output (verbatim)
businesses has auto_assign_specialist: true
businesses has working_hours: true
employees has specialties: true
employees has working_hours: true
employees has efficiency_score: true
schema_version: [Object: null prototype] { value: '4' }
business working_hours backfilled: true
The check was run twice (second run for idempotency): identical output both times, no errors, schema_version stable at 4.
Deviations from the plan
- None in the actual code edits. The
migrateV3ToV4function, therunMigrationsbody, and all type additions match the plan verbatim. - Verification detail: the plan's one-liner
npx tsx -e "..."command failed under Windows PowerShell 5.1 because PowerShell parsed the embedded double-quoted SQL string ("SELECT value FROM meta WHERE key='schema_version'") as terminating the outer-eargument, producing an "Unterminated string literal" esbuild error. To get a clean result without altering any project code, the check was executed via a throwaway.mjsfile placed in the pre-approved temp dir (C:\Users\URIELJ~1\AppData\Local\Temp\opencode) that importsserver/db.tsvia an absolutefile:///H:/MegaSync/Proyectos/AgendaPro/server/db.tsURL. The file was deleted after running. No project files were created or modified beyondserver/db.tsandshared/types.ts.
Self-review
- All
Businessfields from the plan added? Yes — interface body matches the plan exactly, includingbooking_enabled,cancel_window_hours,cancel_penalty_pct,require_deposit,deposit_pct,timezone,auto_assign_specialist,working_hours. The DB already has the v3 booking columns frommigrateV2ToV3, so the type is now honest vs. the DB. - Does
migrateV3ToV4guard withschema_version >= "4"? Yes — first line of the function isif (getMeta("schema_version") >= "4") return;, mirroring the v2/v3 pattern. String comparison is safe here because the values are single-digit ASCII numerics ("3" < "4"). - Is the backfill idempotent? Yes, in two layers:
- The schema-version guard short-circuits the entire function on subsequent runs.
- Even if that guard were bypassed, the backfill UPDATE is gated by
WHERE working_hours IS NULL, so businesses whoseworking_hourswas already filled (e.g. by the user via PATCH/settings) are never overwritten. Confirmed by the second run producing identical output.
- Column-add idempotency: Each ALTER is guarded by
columnExists(...)— re-running against a DB that already has the column is a no-op. - Backfill content matches the plan's default (
1..5 = 09:00-20:00,6,7 = null), which replicates the previously hard-coded hours used bybooking.tspre-redesign. - Pre-existing WIP untouched:
src/components/AppointmentModal.tsx,src/pages/CalendarPage.tsx, and the FullCalendar block ofsrc/index.csswere not modified. Onlyserver/db.tsandshared/types.tswere edited. - No commit was made (per repo policy).
Concerns
None. Typecheck is clean and the migration ran end-to-end against the real data/agendapro.db, producing exactly the expected column set and backfilled data.