feat(notifications): staff notification store in services-system
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
1 parent
26b285cc0a
commit
d5384c6ac0
10 files changed
+411
-47
No files matched your search
@@ -0,0 +1,19 @@
|
||||
-- Co-Lite change add-lead-notifications: the staff notification bell.
|
||||
-- Target: `service-system`.`notification`, the unused table from Tastefully. Pre-check (read-only):
|
||||
-- SELECT COUNT(*) FROM `service-system`.`notification`; -- expect 0
|
||||
-- The table is converted to utf8mb4 (names in any script) and gains babyboo's bell columns plus company_id
|
||||
-- and collapse_key. Existing columns keep their meaning. Run once.
|
||||
SET NAMES utf8mb4;
|
||||
USE `service-system`;
|
||||
ALTER TABLE `notification`
|
||||
CONVERT TO CHARACTER SET utf8mb4,
|
||||
ADD COLUMN `recipient_type` char(1) NULL COMMENT 'A = staff user' AFTER `receiver`,
|
||||
ADD COLUMN `company_id` bigint NULL AFTER `recipient_type`,
|
||||
ADD COLUMN `title` varchar(255) NULL COMMENT 'Message code' AFTER `company_id`,
|
||||
ADD COLUMN `type` varchar(45) NULL COMMENT 'LEAD_ASSIGNED, WEB_SIGNUP, WHATSAPP_MESSAGE, FOLLOW_UP_DUE' AFTER `message`,
|
||||
ADD COLUMN `link` varchar(512) NULL COMMENT 'Portal path opened on click' AFTER `type`,
|
||||
ADD COLUMN `collapse_key` varchar(100) NULL COMMENT 'An unread row with the same receiver and key is updated, not duplicated' AFTER `link`,
|
||||
ADD COLUMN `seen` tinyint(1) NOT NULL DEFAULT 0 AFTER `collapse_key`,
|
||||
ADD COLUMN `read_at` datetime NULL AFTER `seen`,
|
||||
ADD INDEX `idx_notification_inbox` (`recipient_type`, `receiver`, `seen`, `create_date_time`),
|
||||
ADD INDEX `idx_notification_collapse` (`receiver`, `collapse_key`, `seen`);
|
||||
@@ -0,0 +1,15 @@
|
||||
-- Co-Lite change add-lead-notifications: rollback. Drops the bell columns and labels; the previous release never
|
||||
-- reads them. The charset change is left in place (utf8mb4 holds everything utf8mb3 did).
|
||||
SET NAMES utf8mb4;
|
||||
USE `service-system`;
|
||||
ALTER TABLE `notification`
|
||||
DROP INDEX `idx_notification_inbox`,
|
||||
DROP INDEX `idx_notification_collapse`,
|
||||
DROP COLUMN `recipient_type`,
|
||||
DROP COLUMN `company_id`,
|
||||
DROP COLUMN `title`,
|
||||
DROP COLUMN `type`,
|
||||
DROP COLUMN `link`,
|
||||
DROP COLUMN `collapse_key`,
|
||||
DROP COLUMN `seen`,
|
||||
DROP COLUMN `read_at`;
|
||||
@@ -4,8 +4,8 @@ Design: `design.md` and `docs/superpowers/specs/2026-12-02-lead-notifications-de
|
||||
|
||||
## 1. Store and API
|
||||
|
||||
- [ ] 1.1 SQL: `sql/01-notification-columns.sql` (columns, index, `utf8mb4`), `sql/99-rollback.sql`; mirror 01 into `local/seed/`.
|
||||
- [ ] 1.2 services-system: the extended `Notification`; create (with `collapse_key`), list mine (paged), unread count, mark one read (own rows only), mark all read.
|
||||
- [x] 1.1 SQL: `sql/01-notification-columns.sql` (columns, index, `utf8mb4`), `sql/99-rollback.sql`; mirror 01 into `local/seed/`.
|
||||
- [x] 1.2 services-system: the extended `Notification`; create (with `collapse_key`), list mine (paged), unread count, mark one read (own rows only), mark all read.
|
||||
- Verify: `mvn -T 1C -B -pl solvway-services-system -am verify`
|
||||
- [ ] 1.3 mobile-api: `/api/admin/notifications`, `/unread-count`, `/{id}/read`, `/read-all`, user and company from the session.
|
||||
- Verify: `mvn -T 1C -B -pl solvway-mobile-api -am verify`
|
||||
|
||||
Reference in new issue
Block a user