mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 12:28:44 +00:00
feat(audit): change audit log action to string at db level and split file/folder actions
This commit is contained in:
@@ -3,7 +3,8 @@ import { zValidator } from '@hono/zod-validator'
|
||||
import { postAttachmentRequestSchema } from '@shumai/dtos'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { AssetType } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { AssetType, AuditAction, prisma } from '@shumai/db'
|
||||
import { ulid } from 'ulid'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
@@ -37,6 +38,20 @@ const route = new Hono<{ Variables: { user: User } }>().post(
|
||||
creatorId: user.id,
|
||||
})
|
||||
|
||||
const proj = await prisma.project.findUnique({
|
||||
where: { id: projectId },
|
||||
select: { teamId: true },
|
||||
})
|
||||
if (proj) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.file_create,
|
||||
teamId: proj.teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: assetInfo.id,
|
||||
})
|
||||
}
|
||||
|
||||
const uploadUrl = await s3Service.presign(process.env.S3_BUCKET || 'shumai', key, 'PUT')
|
||||
|
||||
return c.json({
|
||||
|
||||
Reference in New Issue
Block a user