Multi-user sharing, groups, and in-app notifications

Backend:
- Alembic migration 0025: groups, group_memberships, project_shares,
  note_shares, notifications tables
- models: Group, GroupMembership, ProjectShare, NoteShare, Notification
- services/access.py: permission resolution (viewer/editor/admin/owner)
- services/groups.py + routes/groups.py: full group CRUD + membership
- services/sharing.py + routes/shares.py: project/note sharing API
- services/notifications.py: in-app notification create/list/mark-read
- routes/in_app_notifications.py: GET/POST notification endpoints
- routes/users.py: user search endpoint
- services/projects.py + services/notes.py: *_for_user variants
- routes updated to use *_for_user on get/list; adds permission field
- app.py: register all new blueprints

Frontend:
- api/client.ts: ShareEntry, GroupEntry, NotificationEntry types + helpers
- stores/notifications.ts: Pinia store with polling
- NotificationBell.vue: bell icon + badge + dropdown toggle + 60s poll
- NotificationsPanel.vue: unread notification list with mark-all-read
- ShareDialog.vue: teleport modal for sharing projects/notes with users/groups
- SharedWithMeView.vue: /shared route listing shared projects and notes
- AppHeader: NotificationBell, Shared nav link
- ProjectView, NoteViewerView, TaskViewerView: Share button + ShareDialog
- SettingsView: Groups admin tab with create/delete groups + member mgmt
- router: /shared route

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 15:37:00 -04:00
parent 878b149f4d
commit c7ef709633
31 changed files with 3147 additions and 16 deletions
+45
View File
@@ -0,0 +1,45 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import {
getNotificationCount,
getNotifications,
markAllNotificationsRead,
markNotificationRead,
type NotificationEntry,
} from '@/api/client'
export const useNotificationsStore = defineStore('notifications', () => {
const count = ref(0)
const items = ref<NotificationEntry[]>([])
async function fetchCount() {
try {
count.value = await getNotificationCount()
} catch {
// silently ignore — polling failure shouldn't surface to user
}
}
async function fetchAll() {
try {
items.value = await getNotifications(false)
count.value = items.value.length
} catch {
//
}
}
async function markRead(id: number) {
await markNotificationRead(id)
items.value = items.value.filter(n => n.id !== id)
count.value = Math.max(0, count.value - 1)
}
async function markAll() {
await markAllNotificationsRead()
items.value = []
count.value = 0
}
return { count, items, fetchCount, fetchAll, markRead, markAll }
})