Files
co-lite/openspec/changes/add-admin-events/tasks.md
T
ngqileandClaude Opus 5.5 c908fbe9fc feat(admin-portal): port babyboo's date picker and calendar
Adds react-day-picker 10.0.1 (it brings date-fns). The portal bans native date
inputs, and the events and leads forms need a date field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
2026-11-27 00:23:56 +08:00

4.9 KiB

Tasks

Babyboo source: ~/Projects/babyboo (read only). Tastefully backoffice rules: ~/Projects/tastefully/solvway-backoffice/.../controller/EventController.java (add and edit). All tasks run serially.

1. Database

  • 1.1 Write sql/01-event-salesperson.sql (service-counter.event_salesperson: id bigint auto-increment PK, company_id bigint NOT NULL, event_uuid bigint NOT NULL, user_id bigint NOT NULL, create_by varchar(255), create_date_time datetime default now; unique (event_uuid, user_id), index event_uuid), sql/02-bo-events-module.sql (40100000 BO_EVENTS 'Events', area BO, type M, parent 40000000, url /events, icon CalendarDays) and sql/99-rollback.sql. Mirror into local/seed/03-colite.sql. Verify: docker compose -f local/docker-compose.yml down -v && local/up.sh exits 0, then a read-only SELECT shows the table and the module row.
    • Scope: openspec/changes/add-admin-events/sql/**, local/seed/**

2. services-counter event team

  • 2.1 Add EventSalesperson entity and repository, and EventSalespersonController with GET /counter/eventSalesperson/findByEventUuid/{eventUuid} and POST /counter/eventSalesperson/replace ({eventUuid, companyId, userIds, doneBy}; delete the event's rows and insert the set in one transaction; duplicate ids collapse to one row). Tests first: replace then find returns the new set; replacing with an empty list clears it; a failure midway leaves the old set. Verify: mvn -T 1C -B -q -pl solvway-services-counter -am verify.
    • Scope: solvway-services-counter/src/**

3. mobile-api events

  • 3.1 Add AdminEventController and AdminEventService under /api/admin/events, all @AdminModule("BO_EVENTS"): GET /events (paged; q searches name; enabled Y/N filter; sort by name, startDate, endDate), GET /events/{uuid} (with team), POST /events, PUT /events/{uuid}, GET /events/salesperson-options (active admin users {id, name, username}). Per design: uuid as a JSON string, dates as YYYY-MM-DD mapped to 00:00:00 and 23:59:59, update patches the stored event so upload fields and createBy survive, validation codes REQUIRED_FIELD / TOO_LONG / END_BEFORE_START / INVALID_DATE with the field name, team ids must be enabled type-A users (else 400 UNKNOWN_USER), company_id from the caller, partial create answers 502 TEAM_NOT_SAVED with the uuid, unknown uuid 404. Tests first for each admin-events scenario that the API decides, including an exact-JSON test that uuid is a string. Verify: mvn -T 1C -B -q -pl solvway-mobile-api -am verify.
    • Scope: solvway-mobile-api/src/**/controller/admin/**, solvway-mobile-api/src/**/service/AdminEvent*, solvway-mobile-api/src/**/dto/admin/**, solvway-mobile-api/src/**/constant/api/**, matching tests

4. Admin portal

  • 4.1 Port babyboo's calendar.tsx and date-picker.tsx (and their tests) into app/components/ui/, with their helpers app/lib/date-input.ts (and test), test/pickDate.ts and the four Ui* i18n keys, adding react-day-picker 10.0.1 to package.json (npm install, commit the lockfile; it brings date-fns itself). Verify: npm run lint && npx tsc --noEmit && npx vitest run exit 0.
    • Scope: solvway-admin-portal/app/components/ui/**, solvway-admin-portal/app/lib/date-input*, solvway-admin-portal/test/pickDate.ts, solvway-admin-portal/app/lib/i18n/defaultMessages.ts, solvway-admin-portal/package.json, solvway-admin-portal/package-lock.json
  • 4.2 Add the Events screens on the Users pattern: app/events/page.tsx (list: search, enabled filter, sortable name/start/end, columns name, location, start, end, enabled; row Edit), app/events/new/page.tsx, app/events/[uuid]/page.tsx, an EventForm (name, location, start and end DatePicker, enabled on edit only, team multi-select from salesperson-options with inactive members shown marked), route handlers app/api/events/**, app/lib/services/adminEvents.ts, types, i18n defaults, and /events → BO_EVENTS in routeModules. Form checks required fields and end not before start before submitting; API errors show on the field. TEAM_NOT_SAVED lands on the edit page with its message. Tests first (vitest) for each portal-visible scenario. Verify: npm run lint && npx tsc --noEmit && npx vitest run && npm run build exit 0.
    • Scope: solvway-admin-portal/app/**

5. End-to-end check

  • 5.1 Rebuild the stack and drive the portal with Playwright: grant BO_EVENTS to a role, create an event with a two-person team, the missing-field and end-before-start errors, edit dates and team, disable it, search and filter the list, and a user without BO_EVENTS gets not-authorised. Screenshots in verification/. Only local dev data. Verify: each scenario observed as specified, local/smoke.sh prints smoke: OK.
    • Scope: openspec/changes/add-admin-events/verification/**

Workflow follow-up

  • Code review, PR to main, merge, then archive this change.