mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-01 13:34:33 +00:00
feat(api): add missing audit log calls to API endpoints
This commit is contained in:
@@ -9,8 +9,9 @@ import {
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { inviteService } from '@shumai/core/src/invite/invite'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import { NotificationType } from '@shumai/db'
|
||||
import { NotificationType, AuditAction } from '@shumai/db'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -53,6 +54,13 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
inviterId: user.id,
|
||||
})
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.invite_create,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
itemId: inv.id,
|
||||
})
|
||||
|
||||
return c.json(mapToInviteInfo(inv))
|
||||
})
|
||||
.post(
|
||||
@@ -77,6 +85,14 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
inviterId: user.id,
|
||||
})
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.invite_create,
|
||||
teamId: inv.teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: inv.id,
|
||||
})
|
||||
|
||||
return c.json(mapToInviteInfo(inv))
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user