mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 16:17:41 +00:00
feat(audit): change audit log action to string at db level and split file/folder actions
This commit is contained in:
@@ -5,6 +5,7 @@ import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { AssetType } from '@shumai/db'
|
||||
import { authMiddleware } from './middleware/auth'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
// any is used here because Hono's Context and Next types are complex to mock in vitest.mock
|
||||
@@ -18,6 +19,23 @@ vi.mock('./middleware/auth', () => ({
|
||||
|
||||
vi.mock('@shumai/core/src/authz/authz')
|
||||
vi.mock('@shumai/core/src/asset/asset')
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/db', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('@shumai/db')>()
|
||||
return {
|
||||
...actual,
|
||||
prisma: {
|
||||
project: {
|
||||
findUnique: vi.fn().mockResolvedValue({ teamId: 't1' }),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
vi.mock('@shumai/core/src/s3/s3', () => ({
|
||||
s3Service: {
|
||||
@@ -65,5 +83,12 @@ describe('Attachment API', () => {
|
||||
projectId: 'project1',
|
||||
}),
|
||||
)
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'file_create',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
projectId: 'project1',
|
||||
itemId: 'asset1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -138,7 +138,7 @@ describe('file api', () => {
|
||||
id: 'test-id',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'asset_update',
|
||||
action: 'file_update',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
@@ -166,7 +166,7 @@ describe('file api', () => {
|
||||
})
|
||||
expect(assetService.deleteAssets).toHaveBeenCalledWith(['test-id'])
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'asset_delete',
|
||||
action: 'file_delete',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
|
||||
@@ -78,7 +78,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
const context = await assetService.getAssetContext(fileId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.asset_update,
|
||||
action: AuditAction.file_update,
|
||||
teamId: context.teamId,
|
||||
userId: user.id,
|
||||
projectId: context.projectId,
|
||||
@@ -107,7 +107,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
for (let i = 0; i < req.ids.length; i++) {
|
||||
const ctx = contexts[i]
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.asset_delete,
|
||||
action: AuditAction.file_delete,
|
||||
teamId: ctx.teamId,
|
||||
userId: user.id,
|
||||
projectId: ctx.projectId,
|
||||
|
||||
@@ -111,7 +111,7 @@ describe('folder api', () => {
|
||||
id: 'test-id',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'asset_update',
|
||||
action: 'folder_update',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
@@ -149,7 +149,7 @@ describe('folder api', () => {
|
||||
id: 'parent-id',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'asset_create',
|
||||
action: 'folder_create',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
@@ -210,7 +210,7 @@ describe('folder api', () => {
|
||||
})
|
||||
expect(assetService.deleteAssets).toHaveBeenCalledWith(['test-id'])
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'asset_delete',
|
||||
action: 'folder_delete',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
|
||||
@@ -37,7 +37,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
const parentCtx = await assetService.getAssetContext(req.parentId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.asset_create,
|
||||
action: AuditAction.folder_create,
|
||||
teamId: parentCtx.teamId,
|
||||
userId: user.id,
|
||||
projectId: parentCtx.projectId,
|
||||
@@ -84,7 +84,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
const ctx = await assetService.getAssetContext(folderId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.asset_update,
|
||||
action: AuditAction.folder_update,
|
||||
teamId: ctx.teamId,
|
||||
userId: user.id,
|
||||
projectId: ctx.projectId,
|
||||
@@ -149,7 +149,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
for (let i = 0; i < req.ids.length; i++) {
|
||||
const ctx = contexts[i]
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.asset_delete,
|
||||
action: AuditAction.folder_delete,
|
||||
teamId: ctx.teamId,
|
||||
userId: user.id,
|
||||
projectId: ctx.projectId,
|
||||
|
||||
@@ -7,6 +7,15 @@ import type { CreateUploadTaskResponse, TaskInfo } from '@shumai/dtos'
|
||||
import type { PaginatedData } from '@shumai/core/src/pagination'
|
||||
import { authzService, ResourceType, Permission } from '@shumai/core/src/authz/authz'
|
||||
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
// We use any here because mocking Hono context and middleware
|
||||
// with full type safety is overly complex for these unit tests.
|
||||
@@ -98,6 +107,10 @@ describe('Upload API', () => {
|
||||
|
||||
it('PATCH /teams/:teamId/upload/tasks/:taskId', async () => {
|
||||
vi.spyOn(uploadService, 'confirmFileUpload').mockResolvedValue(undefined)
|
||||
vi.spyOn(assetService, 'getAssetContext').mockResolvedValue({
|
||||
teamId: 'team1',
|
||||
projectId: 'p1',
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/team1/upload/tasks/task1', {
|
||||
method: 'PATCH',
|
||||
@@ -118,5 +131,12 @@ describe('Upload API', () => {
|
||||
expect(uploadService.confirmFileUpload).toHaveBeenCalledWith('user1', 'task1', {
|
||||
fileId: 'file1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'file_create',
|
||||
teamId: 'team1',
|
||||
userId: 'user1',
|
||||
projectId: 'p1',
|
||||
itemId: 'file1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -9,7 +9,9 @@ import {
|
||||
import { paginationParamsSchema } from '@shumai/dtos'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import { NotificationType } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { NotificationType, AuditAction } from '@shumai/db'
|
||||
import { s3Service, verifyLocalUrlSignature } from '@shumai/core/src/s3/s3'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
|
||||
@@ -108,6 +110,15 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
assetId: req.fileId,
|
||||
taskId: taskId,
|
||||
})
|
||||
|
||||
const context = await assetService.getAssetContext(req.fileId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.file_create,
|
||||
teamId: teamId,
|
||||
userId: user.id,
|
||||
projectId: context.projectId,
|
||||
itemId: req.fileId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json({ success: true })
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
-- AlterEnum
|
||||
-- This migration adds more than one value to an enum.
|
||||
-- With PostgreSQL versions 11 and earlier, this is not possible
|
||||
-- in a single migration. This can be worked around by creating
|
||||
-- multiple migrations, each migration adding only one value to
|
||||
-- the enum.
|
||||
|
||||
|
||||
ALTER TYPE "AuditAction" ADD VALUE 'file_create';
|
||||
ALTER TYPE "AuditAction" ADD VALUE 'file_update';
|
||||
ALTER TYPE "AuditAction" ADD VALUE 'file_delete';
|
||||
ALTER TYPE "AuditAction" ADD VALUE 'folder_create';
|
||||
ALTER TYPE "AuditAction" ADD VALUE 'folder_update';
|
||||
ALTER TYPE "AuditAction" ADD VALUE 'folder_delete';
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "audit_logs" ALTER COLUMN "action" TYPE TEXT USING "action"::text;
|
||||
|
||||
-- DropEnum
|
||||
DROP TYPE "AuditAction";
|
||||
@@ -848,52 +848,10 @@ model AiUsage {
|
||||
@@index([teamId, userId, periodStart])
|
||||
}
|
||||
|
||||
enum AuditAction {
|
||||
team_create
|
||||
team_update
|
||||
team_delete
|
||||
team_member_add
|
||||
team_member_update
|
||||
team_member_remove
|
||||
project_create
|
||||
project_update
|
||||
project_delete
|
||||
project_empty_trash
|
||||
project_member_add
|
||||
project_member_update
|
||||
project_member_remove
|
||||
asset_create
|
||||
asset_update
|
||||
asset_delete
|
||||
asset_reparent
|
||||
asset_copy
|
||||
share_create
|
||||
share_update
|
||||
share_delete
|
||||
agent_create
|
||||
agent_update
|
||||
agent_delete
|
||||
skill_create
|
||||
skill_update
|
||||
skill_delete
|
||||
provider_create
|
||||
provider_update
|
||||
provider_delete
|
||||
invite_create
|
||||
invite_revoke
|
||||
metadata_field_create
|
||||
metadata_field_update
|
||||
metadata_field_delete
|
||||
comment_create
|
||||
comment_update
|
||||
comment_delete
|
||||
comment_complete
|
||||
}
|
||||
|
||||
model AuditLog {
|
||||
id String @id @default(ulid())
|
||||
action AuditAction
|
||||
teamId String @map("team_id")
|
||||
id String @id @default(ulid())
|
||||
action String
|
||||
teamId String @map("team_id")
|
||||
userId String? @map("user_id")
|
||||
projectId String? @map("project_id")
|
||||
itemId String? @map("item_id")
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export const AuditAction = {
|
||||
team_create: 'team_create',
|
||||
team_update: 'team_update',
|
||||
team_delete: 'team_delete',
|
||||
team_member_add: 'team_member_add',
|
||||
team_member_update: 'team_member_update',
|
||||
team_member_remove: 'team_member_remove',
|
||||
project_create: 'project_create',
|
||||
project_update: 'project_update',
|
||||
project_delete: 'project_delete',
|
||||
project_empty_trash: 'project_empty_trash',
|
||||
project_member_add: 'project_member_add',
|
||||
project_member_update: 'project_member_update',
|
||||
project_member_remove: 'project_member_remove',
|
||||
file_create: 'file_create',
|
||||
file_update: 'file_update',
|
||||
file_delete: 'file_delete',
|
||||
folder_create: 'folder_create',
|
||||
folder_update: 'folder_update',
|
||||
folder_delete: 'folder_delete',
|
||||
asset_reparent: 'asset_reparent',
|
||||
asset_copy: 'asset_copy',
|
||||
share_create: 'share_create',
|
||||
share_update: 'share_update',
|
||||
share_delete: 'share_delete',
|
||||
agent_create: 'agent_create',
|
||||
agent_update: 'agent_update',
|
||||
agent_delete: 'agent_delete',
|
||||
skill_create: 'skill_create',
|
||||
skill_update: 'skill_update',
|
||||
skill_delete: 'skill_delete',
|
||||
provider_create: 'provider_create',
|
||||
provider_update: 'provider_update',
|
||||
provider_delete: 'provider_delete',
|
||||
invite_create: 'invite_create',
|
||||
invite_revoke: 'invite_revoke',
|
||||
metadata_field_create: 'metadata_field_create',
|
||||
metadata_field_update: 'metadata_field_update',
|
||||
metadata_field_delete: 'metadata_field_delete',
|
||||
comment_create: 'comment_create',
|
||||
comment_update: 'comment_update',
|
||||
comment_delete: 'comment_delete',
|
||||
comment_complete: 'comment_complete',
|
||||
} as const
|
||||
|
||||
export type AuditAction = (typeof AuditAction)[keyof typeof AuditAction]
|
||||
@@ -697,23 +697,6 @@ export type FloatWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type EnumAuditActionFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.AuditAction | Prisma.EnumAuditActionFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.AuditAction[] | Prisma.ListEnumAuditActionFieldRefInput<$PrismaModel>
|
||||
notIn?: $Enums.AuditAction[] | Prisma.ListEnumAuditActionFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedEnumAuditActionFilter<$PrismaModel> | $Enums.AuditAction
|
||||
}
|
||||
|
||||
export type EnumAuditActionWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.AuditAction | Prisma.EnumAuditActionFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.AuditAction[] | Prisma.ListEnumAuditActionFieldRefInput<$PrismaModel>
|
||||
notIn?: $Enums.AuditAction[] | Prisma.ListEnumAuditActionFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedEnumAuditActionWithAggregatesFilter<$PrismaModel> | $Enums.AuditAction
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumAuditActionFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumAuditActionFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedStringFilter<$PrismaModel = never> = {
|
||||
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
|
||||
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
|
||||
@@ -1332,21 +1315,4 @@ export type NestedFloatWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedEnumAuditActionFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.AuditAction | Prisma.EnumAuditActionFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.AuditAction[] | Prisma.ListEnumAuditActionFieldRefInput<$PrismaModel>
|
||||
notIn?: $Enums.AuditAction[] | Prisma.ListEnumAuditActionFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedEnumAuditActionFilter<$PrismaModel> | $Enums.AuditAction
|
||||
}
|
||||
|
||||
export type NestedEnumAuditActionWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.AuditAction | Prisma.EnumAuditActionFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.AuditAction[] | Prisma.ListEnumAuditActionFieldRefInput<$PrismaModel>
|
||||
notIn?: $Enums.AuditAction[] | Prisma.ListEnumAuditActionFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedEnumAuditActionWithAggregatesFilter<$PrismaModel> | $Enums.AuditAction
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedEnumAuditActionFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedEnumAuditActionFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
|
||||
|
||||
-45
@@ -168,48 +168,3 @@ export const AgentSessionType = {
|
||||
} as const
|
||||
|
||||
export type AgentSessionType = (typeof AgentSessionType)[keyof typeof AgentSessionType]
|
||||
|
||||
|
||||
export const AuditAction = {
|
||||
team_create: 'team_create',
|
||||
team_update: 'team_update',
|
||||
team_delete: 'team_delete',
|
||||
team_member_add: 'team_member_add',
|
||||
team_member_update: 'team_member_update',
|
||||
team_member_remove: 'team_member_remove',
|
||||
project_create: 'project_create',
|
||||
project_update: 'project_update',
|
||||
project_delete: 'project_delete',
|
||||
project_empty_trash: 'project_empty_trash',
|
||||
project_member_add: 'project_member_add',
|
||||
project_member_update: 'project_member_update',
|
||||
project_member_remove: 'project_member_remove',
|
||||
asset_create: 'asset_create',
|
||||
asset_update: 'asset_update',
|
||||
asset_delete: 'asset_delete',
|
||||
asset_reparent: 'asset_reparent',
|
||||
asset_copy: 'asset_copy',
|
||||
share_create: 'share_create',
|
||||
share_update: 'share_update',
|
||||
share_delete: 'share_delete',
|
||||
agent_create: 'agent_create',
|
||||
agent_update: 'agent_update',
|
||||
agent_delete: 'agent_delete',
|
||||
skill_create: 'skill_create',
|
||||
skill_update: 'skill_update',
|
||||
skill_delete: 'skill_delete',
|
||||
provider_create: 'provider_create',
|
||||
provider_update: 'provider_update',
|
||||
provider_delete: 'provider_delete',
|
||||
invite_create: 'invite_create',
|
||||
invite_revoke: 'invite_revoke',
|
||||
metadata_field_create: 'metadata_field_create',
|
||||
metadata_field_update: 'metadata_field_update',
|
||||
metadata_field_delete: 'metadata_field_delete',
|
||||
comment_create: 'comment_create',
|
||||
comment_update: 'comment_update',
|
||||
comment_delete: 'comment_delete',
|
||||
comment_complete: 'comment_complete'
|
||||
} as const
|
||||
|
||||
export type AuditAction = (typeof AuditAction)[keyof typeof AuditAction]
|
||||
|
||||
+4
-4
File diff suppressed because one or more lines are too long
@@ -3944,20 +3944,6 @@ export type EnumAgentSessionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<
|
||||
export type ListEnumAgentSessionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AgentSessionType[]'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AuditAction'
|
||||
*/
|
||||
export type EnumAuditActionFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AuditAction'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AuditAction[]'
|
||||
*/
|
||||
export type ListEnumAuditActionFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AuditAction[]'>
|
||||
|
||||
|
||||
/**
|
||||
* Batch Payload for updateMany & deleteMany & createMany
|
||||
*/
|
||||
|
||||
+34
-38
@@ -28,7 +28,7 @@ export type AggregateAuditLog = {
|
||||
|
||||
export type AuditLogMinAggregateOutputType = {
|
||||
id: string | null
|
||||
action: $Enums.AuditAction | null
|
||||
action: string | null
|
||||
teamId: string | null
|
||||
userId: string | null
|
||||
projectId: string | null
|
||||
@@ -38,7 +38,7 @@ export type AuditLogMinAggregateOutputType = {
|
||||
|
||||
export type AuditLogMaxAggregateOutputType = {
|
||||
id: string | null
|
||||
action: $Enums.AuditAction | null
|
||||
action: string | null
|
||||
teamId: string | null
|
||||
userId: string | null
|
||||
projectId: string | null
|
||||
@@ -163,7 +163,7 @@ export type AuditLogGroupByArgs<ExtArgs extends runtime.Types.Extensions.Interna
|
||||
|
||||
export type AuditLogGroupByOutputType = {
|
||||
id: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
teamId: string
|
||||
userId: string | null
|
||||
projectId: string | null
|
||||
@@ -194,7 +194,7 @@ export type AuditLogWhereInput = {
|
||||
OR?: Prisma.AuditLogWhereInput[]
|
||||
NOT?: Prisma.AuditLogWhereInput | Prisma.AuditLogWhereInput[]
|
||||
id?: Prisma.StringFilter<"AuditLog"> | string
|
||||
action?: Prisma.EnumAuditActionFilter<"AuditLog"> | $Enums.AuditAction
|
||||
action?: Prisma.StringFilter<"AuditLog"> | string
|
||||
teamId?: Prisma.StringFilter<"AuditLog"> | string
|
||||
userId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
|
||||
projectId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
|
||||
@@ -223,7 +223,7 @@ export type AuditLogWhereUniqueInput = Prisma.AtLeast<{
|
||||
AND?: Prisma.AuditLogWhereInput | Prisma.AuditLogWhereInput[]
|
||||
OR?: Prisma.AuditLogWhereInput[]
|
||||
NOT?: Prisma.AuditLogWhereInput | Prisma.AuditLogWhereInput[]
|
||||
action?: Prisma.EnumAuditActionFilter<"AuditLog"> | $Enums.AuditAction
|
||||
action?: Prisma.StringFilter<"AuditLog"> | string
|
||||
teamId?: Prisma.StringFilter<"AuditLog"> | string
|
||||
userId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
|
||||
projectId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
|
||||
@@ -252,7 +252,7 @@ export type AuditLogScalarWhereWithAggregatesInput = {
|
||||
OR?: Prisma.AuditLogScalarWhereWithAggregatesInput[]
|
||||
NOT?: Prisma.AuditLogScalarWhereWithAggregatesInput | Prisma.AuditLogScalarWhereWithAggregatesInput[]
|
||||
id?: Prisma.StringWithAggregatesFilter<"AuditLog"> | string
|
||||
action?: Prisma.EnumAuditActionWithAggregatesFilter<"AuditLog"> | $Enums.AuditAction
|
||||
action?: Prisma.StringWithAggregatesFilter<"AuditLog"> | string
|
||||
teamId?: Prisma.StringWithAggregatesFilter<"AuditLog"> | string
|
||||
userId?: Prisma.StringNullableWithAggregatesFilter<"AuditLog"> | string | null
|
||||
projectId?: Prisma.StringNullableWithAggregatesFilter<"AuditLog"> | string | null
|
||||
@@ -262,7 +262,7 @@ export type AuditLogScalarWhereWithAggregatesInput = {
|
||||
|
||||
export type AuditLogCreateInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
itemId?: string | null
|
||||
createdAt?: Date | string
|
||||
team: Prisma.TeamCreateNestedOneWithoutAuditLogsInput
|
||||
@@ -272,7 +272,7 @@ export type AuditLogCreateInput = {
|
||||
|
||||
export type AuditLogUncheckedCreateInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
teamId: string
|
||||
userId?: string | null
|
||||
projectId?: string | null
|
||||
@@ -282,7 +282,7 @@ export type AuditLogUncheckedCreateInput = {
|
||||
|
||||
export type AuditLogUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
team?: Prisma.TeamUpdateOneRequiredWithoutAuditLogsNestedInput
|
||||
@@ -292,7 +292,7 @@ export type AuditLogUpdateInput = {
|
||||
|
||||
export type AuditLogUncheckedUpdateInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -302,7 +302,7 @@ export type AuditLogUncheckedUpdateInput = {
|
||||
|
||||
export type AuditLogCreateManyInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
teamId: string
|
||||
userId?: string | null
|
||||
projectId?: string | null
|
||||
@@ -312,14 +312,14 @@ export type AuditLogCreateManyInput = {
|
||||
|
||||
export type AuditLogUpdateManyMutationInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
}
|
||||
|
||||
export type AuditLogUncheckedUpdateManyInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -493,13 +493,9 @@ export type AuditLogUncheckedUpdateManyWithoutProjectNestedInput = {
|
||||
deleteMany?: Prisma.AuditLogScalarWhereInput | Prisma.AuditLogScalarWhereInput[]
|
||||
}
|
||||
|
||||
export type EnumAuditActionFieldUpdateOperationsInput = {
|
||||
set?: $Enums.AuditAction
|
||||
}
|
||||
|
||||
export type AuditLogCreateWithoutUserInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
itemId?: string | null
|
||||
createdAt?: Date | string
|
||||
team: Prisma.TeamCreateNestedOneWithoutAuditLogsInput
|
||||
@@ -508,7 +504,7 @@ export type AuditLogCreateWithoutUserInput = {
|
||||
|
||||
export type AuditLogUncheckedCreateWithoutUserInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
teamId: string
|
||||
projectId?: string | null
|
||||
itemId?: string | null
|
||||
@@ -546,7 +542,7 @@ export type AuditLogScalarWhereInput = {
|
||||
OR?: Prisma.AuditLogScalarWhereInput[]
|
||||
NOT?: Prisma.AuditLogScalarWhereInput | Prisma.AuditLogScalarWhereInput[]
|
||||
id?: Prisma.StringFilter<"AuditLog"> | string
|
||||
action?: Prisma.EnumAuditActionFilter<"AuditLog"> | $Enums.AuditAction
|
||||
action?: Prisma.StringFilter<"AuditLog"> | string
|
||||
teamId?: Prisma.StringFilter<"AuditLog"> | string
|
||||
userId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
|
||||
projectId?: Prisma.StringNullableFilter<"AuditLog"> | string | null
|
||||
@@ -556,7 +552,7 @@ export type AuditLogScalarWhereInput = {
|
||||
|
||||
export type AuditLogCreateWithoutTeamInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
itemId?: string | null
|
||||
createdAt?: Date | string
|
||||
user?: Prisma.UserCreateNestedOneWithoutAuditLogsInput
|
||||
@@ -565,7 +561,7 @@ export type AuditLogCreateWithoutTeamInput = {
|
||||
|
||||
export type AuditLogUncheckedCreateWithoutTeamInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
userId?: string | null
|
||||
projectId?: string | null
|
||||
itemId?: string | null
|
||||
@@ -600,7 +596,7 @@ export type AuditLogUpdateManyWithWhereWithoutTeamInput = {
|
||||
|
||||
export type AuditLogCreateWithoutProjectInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
itemId?: string | null
|
||||
createdAt?: Date | string
|
||||
team: Prisma.TeamCreateNestedOneWithoutAuditLogsInput
|
||||
@@ -609,7 +605,7 @@ export type AuditLogCreateWithoutProjectInput = {
|
||||
|
||||
export type AuditLogUncheckedCreateWithoutProjectInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
teamId: string
|
||||
userId?: string | null
|
||||
itemId?: string | null
|
||||
@@ -644,7 +640,7 @@ export type AuditLogUpdateManyWithWhereWithoutProjectInput = {
|
||||
|
||||
export type AuditLogCreateManyUserInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
teamId: string
|
||||
projectId?: string | null
|
||||
itemId?: string | null
|
||||
@@ -653,7 +649,7 @@ export type AuditLogCreateManyUserInput = {
|
||||
|
||||
export type AuditLogUpdateWithoutUserInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
team?: Prisma.TeamUpdateOneRequiredWithoutAuditLogsNestedInput
|
||||
@@ -662,7 +658,7 @@ export type AuditLogUpdateWithoutUserInput = {
|
||||
|
||||
export type AuditLogUncheckedUpdateWithoutUserInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -671,7 +667,7 @@ export type AuditLogUncheckedUpdateWithoutUserInput = {
|
||||
|
||||
export type AuditLogUncheckedUpdateManyWithoutUserInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -680,7 +676,7 @@ export type AuditLogUncheckedUpdateManyWithoutUserInput = {
|
||||
|
||||
export type AuditLogCreateManyTeamInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
userId?: string | null
|
||||
projectId?: string | null
|
||||
itemId?: string | null
|
||||
@@ -689,7 +685,7 @@ export type AuditLogCreateManyTeamInput = {
|
||||
|
||||
export type AuditLogUpdateWithoutTeamInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
user?: Prisma.UserUpdateOneWithoutAuditLogsNestedInput
|
||||
@@ -698,7 +694,7 @@ export type AuditLogUpdateWithoutTeamInput = {
|
||||
|
||||
export type AuditLogUncheckedUpdateWithoutTeamInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -707,7 +703,7 @@ export type AuditLogUncheckedUpdateWithoutTeamInput = {
|
||||
|
||||
export type AuditLogUncheckedUpdateManyWithoutTeamInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
projectId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -716,7 +712,7 @@ export type AuditLogUncheckedUpdateManyWithoutTeamInput = {
|
||||
|
||||
export type AuditLogCreateManyProjectInput = {
|
||||
id?: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
teamId: string
|
||||
userId?: string | null
|
||||
itemId?: string | null
|
||||
@@ -725,7 +721,7 @@ export type AuditLogCreateManyProjectInput = {
|
||||
|
||||
export type AuditLogUpdateWithoutProjectInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
team?: Prisma.TeamUpdateOneRequiredWithoutAuditLogsNestedInput
|
||||
@@ -734,7 +730,7 @@ export type AuditLogUpdateWithoutProjectInput = {
|
||||
|
||||
export type AuditLogUncheckedUpdateWithoutProjectInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -743,7 +739,7 @@ export type AuditLogUncheckedUpdateWithoutProjectInput = {
|
||||
|
||||
export type AuditLogUncheckedUpdateManyWithoutProjectInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
action?: Prisma.EnumAuditActionFieldUpdateOperationsInput | $Enums.AuditAction
|
||||
action?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
userId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
itemId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
@@ -827,7 +823,7 @@ export type $AuditLogPayload<ExtArgs extends runtime.Types.Extensions.InternalAr
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
action: $Enums.AuditAction
|
||||
action: string
|
||||
teamId: string
|
||||
userId: string | null
|
||||
projectId: string | null
|
||||
@@ -1260,7 +1256,7 @@ export interface Prisma__AuditLogClient<T, Null = never, ExtArgs extends runtime
|
||||
*/
|
||||
export interface AuditLogFieldRefs {
|
||||
readonly id: Prisma.FieldRef<"AuditLog", 'String'>
|
||||
readonly action: Prisma.FieldRef<"AuditLog", 'AuditAction'>
|
||||
readonly action: Prisma.FieldRef<"AuditLog", 'String'>
|
||||
readonly teamId: Prisma.FieldRef<"AuditLog", 'String'>
|
||||
readonly userId: Prisma.FieldRef<"AuditLog", 'String'>
|
||||
readonly projectId: Prisma.FieldRef<"AuditLog", 'String'>
|
||||
|
||||
@@ -111,3 +111,4 @@ export function getPrismaTestingHelper() {
|
||||
|
||||
export * from './generated/prisma/client'
|
||||
export * from './utils/ngram'
|
||||
export * from './audit'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from 'zod'
|
||||
import { AuditAction } from '@shumai/db/enums'
|
||||
import { AuditAction } from '@shumai/db'
|
||||
|
||||
export { AuditAction }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user