Commit b175d2c
committed
feat(db): add platform notification models and relations
Add PlatformNotification and PlatformNotificationInteraction Prisma models,
including enums PlatformNotificationSurface and PlatformNotificationScope,
indexes, timestamps, and fields for scoping (user, project, organization),
lifecycle (startsAt, endsAt, archivedAt) and delivery behavior (CLI-specific
fields, priority). Wire new relations into User, Organization, Project,
OrgMember and Workspace models so notifications and interactions can be
queried from those entities.
Add SQL migration to create the new enums and adjust schema constraints and
indexes required for the migration. The change enables admin-created,
scoped platform notifications with per-user interaction tracking for both
webapp and CLI surfaces.
feat(notifications): Add a way to notify users on platform
feat(notifications): Enforce notifications expired date, add CLI improvements
CLI colors
CLI show every n-th notification
feat(webapp): Platform notifications ui/ux improvements
feat(CLI): CLI notifications v1
feat(webapp): add dashboard platform notifications service & UI
Introduce a new server-side service to read and record platform notifications
targeted at the webapp.
- Add payload schema (v1) using zod and typed PayloadV1.
- Define PlatformNotificationWithPayload type and scope priority map.
- Implement getActivePlatformNotifications to:
- query active WEBAPP notifications with scope/org/project/user filters,
- include user interactions and validate payloads,
- filter dismissed items, compute unreadCount, and return sorted results.
- Add helper functions:
- findInteraction to match global/org interactions,
- compareNotifications to sort by scope, priority, then recency.
- Implement upsertInteraction to create or update platform notification
interactions, handling GLOBAL-scoped interactions per organization.
These changes centralize notification read/write logic, enforce payload
validation, and provide deterministic ordering and unread counts for the
webapp UI.1 parent 35298ac commit b175d2c
File tree
25 files changed
+2915
-89
lines changed- apps/webapp
- app
- routes
- services
- internal-packages/database/prisma
- migrations/20260223123615_add_platform_notification_tables
- packages/cli-v3/src
- commands
- utilities
25 files changed
+2915
-89
lines changedLines changed: 37 additions & 89 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | 145 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | 146 | | |
234 | 147 | | |
235 | 148 | | |
| |||
246 | 159 | | |
247 | 160 | | |
248 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
249 | 189 | | |
250 | 190 | | |
251 | 191 | | |
252 | 192 | | |
253 | 193 | | |
254 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
0 commit comments