feat(auth): merge reporter, supervisor, capa_owner into ssa role
Add Site Safety Assistant (ssa) role replacing reporter, supervisor and capa_owner. Portals move under /ssa (overview, my-reports, incidents, capas). Update RLS, schema, API role checks, notification recipients, nav and tests. Add db/ops/2026-11-06-merge-roles-into-ssa.sql (not yet applied; needs owner go-ahead and a pg_dump first). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
701fefd286
commit
813395700f
@@ -14,7 +14,7 @@ vi.mock('resend', () => {
|
||||
// Mock asAdmin: first call returns recipients, second returns incident+join rows
|
||||
let asAdminCallCount = 0
|
||||
const mockRecipients = [
|
||||
{ email: 'supervisor@setiacorp.com' },
|
||||
{ email: 'ssa@setiacorp.com' },
|
||||
{ email: 'hse@setiacorp.com' },
|
||||
]
|
||||
const mockIncidentRows = [{
|
||||
@@ -44,11 +44,11 @@ beforeEach(() => {
|
||||
})
|
||||
|
||||
describe('sendNewIncidentEmail', () => {
|
||||
it('sends email to supervisor and hse users', async () => {
|
||||
it('sends email to ssa and hse users', async () => {
|
||||
await sendNewIncidentEmail('inc-001', 'site-001', 'SCW1-202607-0001', 'near_miss')
|
||||
expect(mockSend).toHaveBeenCalledTimes(1)
|
||||
const call = mockSend.mock.calls[0][0]
|
||||
expect(call.to).toEqual(expect.arrayContaining(['supervisor@setiacorp.com', 'hse@setiacorp.com']))
|
||||
expect(call.to).toEqual(expect.arrayContaining(['ssa@setiacorp.com', 'hse@setiacorp.com']))
|
||||
expect(call.subject).toContain('SCW1-202607-0001')
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user