mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 06:48:19 +00:00
Merge pull request #251 from shumaiOne/feat/audit-log-support
feat(audit): add audit log support for APIs and WebUI dashboard
This commit is contained in:
@@ -1,15 +1,25 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { authzService } from '@shumai/core/src/authz/authz'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import app from './agent'
|
||||
|
||||
vi.mock('@shumai/core/src/agent/agent')
|
||||
vi.mock('@shumai/core/src/authz/authz')
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
describe('Agent API', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
||||
vi.mocked(agentService.getAgent).mockResolvedValue({
|
||||
id: 'agent1',
|
||||
teamId: 'team1',
|
||||
} as unknown as Awaited<ReturnType<typeof agentService.getAgent>>)
|
||||
})
|
||||
|
||||
describe('GET /teams/:teamId/agents', () => {
|
||||
@@ -90,6 +100,12 @@ describe('Agent API', () => {
|
||||
expect(data.name).toBe('New Agent')
|
||||
expect(data.soul).toBe('New Soul')
|
||||
expect(data.deniedTools).toEqual(['bash'])
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'agent_create',
|
||||
teamId: 'team1',
|
||||
userId: undefined,
|
||||
itemId: 'agent2',
|
||||
})
|
||||
})
|
||||
|
||||
it('validates request', async () => {
|
||||
@@ -110,6 +126,7 @@ describe('Agent API', () => {
|
||||
it('updates an agent', async () => {
|
||||
const mockAgent = {
|
||||
id: 'agent1',
|
||||
teamId: 'team1',
|
||||
user: { name: 'Updated Agent', image: 'avatar1' },
|
||||
type: 'autofill',
|
||||
providerId: 'prov1',
|
||||
@@ -140,6 +157,12 @@ describe('Agent API', () => {
|
||||
expect(data.name).toBe('Updated Agent')
|
||||
expect(data.soul).toBe('Updated Soul')
|
||||
expect(data.deniedTools).toEqual(['bash'])
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'agent_update',
|
||||
teamId: 'team1',
|
||||
userId: undefined,
|
||||
itemId: 'agent1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -151,6 +174,12 @@ describe('Agent API', () => {
|
||||
|
||||
expect(res.status).toBe(204)
|
||||
expect(agentService.deleteAgent).toHaveBeenCalledWith({ agentId: 'agent1' })
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'agent_delete',
|
||||
teamId: 'team1',
|
||||
userId: undefined,
|
||||
itemId: 'agent1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -9,9 +9,11 @@ import {
|
||||
paginationParamsSchema,
|
||||
AgentInfo,
|
||||
AgentType,
|
||||
AuditAction,
|
||||
} from '@shumai/dtos'
|
||||
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -94,6 +96,13 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
deniedTools: config.deniedTools || [],
|
||||
}
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.agent_create,
|
||||
teamId,
|
||||
userId: userReq?.id,
|
||||
itemId: agent.id,
|
||||
})
|
||||
|
||||
return c.json(info, 200)
|
||||
})
|
||||
.put('/agents/:agentId', zValidator('json', updateAgentRequestSchema), async (c) => {
|
||||
@@ -113,6 +122,13 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
...req,
|
||||
})
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.agent_update,
|
||||
teamId: agent.teamId,
|
||||
userId: userReq?.id,
|
||||
itemId: agent.id,
|
||||
})
|
||||
|
||||
const config = agent.config as unknown as PrismaJson.AgentConfig
|
||||
const info: AgentInfo = {
|
||||
id: agent.id,
|
||||
@@ -146,10 +162,21 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: agentId,
|
||||
})
|
||||
|
||||
const existingAgent = await agentService.getAgent({ agentId })
|
||||
|
||||
await agentService.deleteAgent({
|
||||
agentId,
|
||||
})
|
||||
|
||||
if (existingAgent) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.agent_delete,
|
||||
teamId: existingAgent.teamId,
|
||||
userId: userReq?.id,
|
||||
itemId: agentId,
|
||||
})
|
||||
}
|
||||
|
||||
return new Response(null, { status: 204 })
|
||||
})
|
||||
.get('/agent-sessions/:sessionId/entries', async (c) => {
|
||||
|
||||
@@ -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,16 @@ vi.mock('./middleware/auth', () => ({
|
||||
|
||||
vi.mock('@shumai/core/src/authz/authz')
|
||||
vi.mock('@shumai/core/src/asset/asset')
|
||||
vi.mock('@shumai/core/src/project/project', () => ({
|
||||
projectService: {
|
||||
getProjectTeam: vi.fn().mockResolvedValue('t1'),
|
||||
},
|
||||
}))
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/s3/s3', () => ({
|
||||
s3Service: {
|
||||
@@ -65,5 +76,12 @@ describe('Attachment API', () => {
|
||||
projectId: 'project1',
|
||||
}),
|
||||
)
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'file_create',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
projectId: 'project1',
|
||||
itemId: 'asset1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Hono } from 'hono'
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { postAttachmentRequestSchema } from '@shumai/dtos'
|
||||
import { postAttachmentRequestSchema, AuditAction } from '@shumai/dtos'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import { AssetType } from '@shumai/db'
|
||||
import { ulid } from 'ulid'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
@@ -37,6 +39,17 @@ const route = new Hono<{ Variables: { user: User } }>().post(
|
||||
creatorId: user.id,
|
||||
})
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.file_create,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: assetInfo.id,
|
||||
})
|
||||
}
|
||||
|
||||
const uploadUrl = await s3Service.presign(process.env.S3_BUCKET || 'shumai', key, 'PUT')
|
||||
|
||||
return c.json({
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Hono } from 'hono'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
import { userService } from '@shumai/core/src/user/user'
|
||||
import { auth } from '@shumai/core/src/auth/auth'
|
||||
import { z } from 'zod'
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { ulid } from 'ulid'
|
||||
|
||||
const app = new Hono()
|
||||
@@ -31,13 +31,10 @@ const route = app
|
||||
const { username, email } = c.req.valid('json')
|
||||
|
||||
const dummyEmail = `guest_${ulid()}@guest.local`
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
name: username,
|
||||
email: dummyEmail,
|
||||
guestEmail: email,
|
||||
type: 'human',
|
||||
},
|
||||
const user = await userService.createGuestUser({
|
||||
name: username,
|
||||
email: dummyEmail,
|
||||
guestEmail: email,
|
||||
})
|
||||
|
||||
return c.json({ id: user.id })
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { Hono, type Context, type Next } from 'hono'
|
||||
import { prisma } from '@shumai/db'
|
||||
import fileRoute from './file'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
@@ -40,6 +39,14 @@ vi.mock('@shumai/core/src/authz/authz', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
authMiddleware: async (c: Context, next: Next) => {
|
||||
c.set('user', { id: 'user1', name: 'Test User' })
|
||||
@@ -58,6 +65,10 @@ describe('file api', () => {
|
||||
vi.spyOn(assetService, 'createComment').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'completeComment').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'deleteComment').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'getComment').mockResolvedValue({
|
||||
id: 'comment1',
|
||||
assetId: 'file1',
|
||||
} as unknown as Awaited<ReturnType<typeof assetService.getComment>>)
|
||||
vi.spyOn(assetService, 'listComments').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'restoreAssets').mockImplementation(vi.fn())
|
||||
vi.spyOn(metadataService, 'updateAssetMetadata').mockImplementation(vi.fn())
|
||||
@@ -129,6 +140,13 @@ describe('file api', () => {
|
||||
type: ResourceType.Asset,
|
||||
id: 'test-id',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'file_update',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
itemId: 'test-id',
|
||||
})
|
||||
})
|
||||
|
||||
it('DELETE /files', async () => {
|
||||
@@ -150,6 +168,13 @@ describe('file api', () => {
|
||||
id: 'test-id',
|
||||
})
|
||||
expect(assetService.deleteAssets).toHaveBeenCalledWith(['test-id'])
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'file_delete',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
itemId: 'test-id',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /files/restore', async () => {
|
||||
@@ -208,6 +233,14 @@ describe('file api', () => {
|
||||
const json = await res.json()
|
||||
expect(json.message).toBe('hello')
|
||||
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'comment_create',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
itemId: 'comment-id',
|
||||
})
|
||||
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith({
|
||||
user: { id: 'user1', name: 'Test User' },
|
||||
permission: Permission.Read,
|
||||
@@ -248,9 +281,9 @@ describe('file api', () => {
|
||||
project: { teamId: 'test-team' },
|
||||
} as any) // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
|
||||
const mockFindUnique = vi.spyOn(prisma.assetComment, 'findUnique').mockResolvedValue({
|
||||
vi.mocked(assetService.getComment).mockResolvedValue({
|
||||
id: 'parent-comment-id',
|
||||
creatorId: 'parent-comment-creator-id',
|
||||
creator: { id: 'parent-comment-creator-id' },
|
||||
} as any) // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
|
||||
const app = new Hono().use('*', authMiddleware).route('/', fileRoute)
|
||||
@@ -276,8 +309,6 @@ describe('file api', () => {
|
||||
userId: 'parent-comment-creator-id',
|
||||
commentMessage: 'hello reply',
|
||||
})
|
||||
|
||||
mockFindUnique.mockRestore()
|
||||
})
|
||||
|
||||
it('GET /files/:fileId/comments', async () => {
|
||||
|
||||
+81
-27
@@ -5,7 +5,7 @@ import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import { s3Service } from '@shumai/core/src/s3/s3'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import {
|
||||
createCommentRequestSchema,
|
||||
deleteFilesRequestSchema,
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
uploadFileRequestSchema,
|
||||
getDownloadLinksRequestSchema,
|
||||
completeCommentRequestSchema,
|
||||
AuditAction,
|
||||
} from '@shumai/dtos'
|
||||
import { transcodeService } from '@shumai/core'
|
||||
import fs from 'fs'
|
||||
@@ -75,6 +76,15 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
name: req.name,
|
||||
})
|
||||
|
||||
const context = await assetService.getAssetContext(fileId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.file_update,
|
||||
teamId: context.teamId,
|
||||
userId: user.id,
|
||||
projectId: context.projectId,
|
||||
itemId: fileId,
|
||||
})
|
||||
|
||||
return c.json(updatedAsset)
|
||||
})
|
||||
.delete('/files', zValidator('json', deleteFilesRequestSchema), async (c) => {
|
||||
@@ -90,7 +100,21 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
})
|
||||
}
|
||||
|
||||
const contexts = await Promise.all(req.ids.map((id) => assetService.getAssetContext(id)))
|
||||
|
||||
await assetService.deleteAssets(req.ids)
|
||||
|
||||
for (let i = 0; i < req.ids.length; i++) {
|
||||
const ctx = contexts[i]
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.file_delete,
|
||||
teamId: ctx.teamId,
|
||||
userId: user.id,
|
||||
projectId: ctx.projectId,
|
||||
itemId: req.ids[i],
|
||||
})
|
||||
}
|
||||
|
||||
return c.body(null, 204)
|
||||
})
|
||||
.patch(
|
||||
@@ -120,14 +144,12 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
const hasStatus = req.some((m) => m.key === 'status')
|
||||
if (hasStatus) {
|
||||
const context = await assetService.getAssetContext(fileId)
|
||||
if (context?.teamId) {
|
||||
notificationService.create({
|
||||
type: 'metadata_field_updated_status',
|
||||
teamId: context.teamId,
|
||||
creatorId: user.id,
|
||||
assetId: fileId,
|
||||
})
|
||||
}
|
||||
notificationService.create({
|
||||
type: 'metadata_field_updated_status',
|
||||
teamId: context.teamId,
|
||||
creatorId: user.id,
|
||||
assetId: fileId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json('')
|
||||
@@ -162,27 +184,31 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
const context = await assetService.getAssetContext(fileId)
|
||||
|
||||
if (context?.teamId) {
|
||||
let targetUserId: string | undefined
|
||||
if (req.replyToId) {
|
||||
const parentComment = await prisma.assetComment.findUnique({
|
||||
where: { id: req.replyToId },
|
||||
})
|
||||
if (parentComment?.creatorId) {
|
||||
targetUserId = parentComment.creatorId
|
||||
}
|
||||
let targetUserId: string | undefined
|
||||
if (req.replyToId) {
|
||||
const parentComment = await assetService.getComment(req.replyToId).catch(() => null)
|
||||
if (parentComment?.creator?.id) {
|
||||
targetUserId = parentComment.creator.id
|
||||
}
|
||||
|
||||
notificationService.create({
|
||||
type: notifType,
|
||||
teamId: context.teamId,
|
||||
creatorId: user.id,
|
||||
assetId: fileId,
|
||||
userId: targetUserId,
|
||||
commentMessage: req.message,
|
||||
})
|
||||
}
|
||||
|
||||
notificationService.create({
|
||||
type: notifType,
|
||||
teamId: context.teamId,
|
||||
creatorId: user.id,
|
||||
assetId: fileId,
|
||||
userId: targetUserId,
|
||||
commentMessage: req.message,
|
||||
})
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.comment_create,
|
||||
teamId: context.teamId,
|
||||
userId: user.id,
|
||||
projectId: context.projectId,
|
||||
itemId: comment.id,
|
||||
})
|
||||
|
||||
return c.json(comment, 201)
|
||||
},
|
||||
)
|
||||
@@ -216,7 +242,21 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: commentId,
|
||||
})
|
||||
|
||||
const commentData = await assetService.getComment(commentId).catch(() => null)
|
||||
|
||||
const updated = await assetService.completeComment(commentId, req.isCompleted, user.id)
|
||||
|
||||
if (commentData?.assetId) {
|
||||
const context = await assetService.getAssetContext(commentData.assetId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.comment_complete,
|
||||
teamId: context.teamId,
|
||||
userId: user.id,
|
||||
projectId: context.projectId,
|
||||
itemId: commentId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json(updated)
|
||||
},
|
||||
)
|
||||
@@ -231,7 +271,21 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: commentId,
|
||||
})
|
||||
|
||||
const commentData = await assetService.getComment(commentId).catch(() => null)
|
||||
|
||||
await assetService.deleteComment({ commentId, userId: user.id })
|
||||
|
||||
if (commentData?.assetId) {
|
||||
const context = await assetService.getAssetContext(commentData.assetId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.comment_delete,
|
||||
teamId: context.teamId,
|
||||
userId: user.id,
|
||||
projectId: context.projectId,
|
||||
itemId: commentId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json({ success: true })
|
||||
})
|
||||
.post('/files/restore', zValidator('json', restoreFilesRequestSchema), async (c) => {
|
||||
|
||||
@@ -6,6 +6,14 @@ import { searchService } from '@shumai/core/src/search/search'
|
||||
import { authzService, ResourceType, Permission } from '@shumai/core/src/authz/authz'
|
||||
import { authMiddleware } from './middleware/auth'
|
||||
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/authz/authz', () => ({
|
||||
authzService: {
|
||||
hasPermission: vi.fn().mockResolvedValue(undefined),
|
||||
@@ -33,6 +41,7 @@ describe('folder api', () => {
|
||||
vi.mocked(authzService.hasPermission).mockClear()
|
||||
|
||||
vi.spyOn(assetService, 'getAsset').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'getAssetContext').mockResolvedValue({ teamId: 'test-team' })
|
||||
vi.spyOn(assetService, 'createAsset').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'updateAssetName').mockImplementation(vi.fn())
|
||||
vi.spyOn(assetService, 'deleteAssets').mockImplementation(vi.fn())
|
||||
@@ -101,6 +110,13 @@ describe('folder api', () => {
|
||||
type: ResourceType.Asset,
|
||||
id: 'test-id',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'folder_update',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
itemId: 'test-id',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /folders', async () => {
|
||||
@@ -132,6 +148,13 @@ describe('folder api', () => {
|
||||
type: ResourceType.Asset,
|
||||
id: 'parent-id',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'folder_create',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
itemId: 'new-id',
|
||||
})
|
||||
})
|
||||
|
||||
it('GET /folders/:folderId/children', async () => {
|
||||
@@ -186,6 +209,13 @@ describe('folder api', () => {
|
||||
id: 'test-id',
|
||||
})
|
||||
expect(assetService.deleteAssets).toHaveBeenCalledWith(['test-id'])
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'folder_delete',
|
||||
teamId: 'test-team',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
itemId: 'test-id',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /folders/restore', async () => {
|
||||
|
||||
@@ -9,9 +9,10 @@ import {
|
||||
deleteFoldersRequestSchema,
|
||||
restoreFoldersRequestSchema,
|
||||
} from '@shumai/dtos'
|
||||
import { listChildrenRequestSchema, updateAssetOrderRequestSchema } from '@shumai/dtos'
|
||||
import { listChildrenRequestSchema, updateAssetOrderRequestSchema, AuditAction } from '@shumai/dtos'
|
||||
import { searchRequestSchema } from '@shumai/dtos'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -33,6 +34,15 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
type: 'folder',
|
||||
})
|
||||
|
||||
const parentCtx = await assetService.getAssetContext(req.parentId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.folder_create,
|
||||
teamId: parentCtx.teamId,
|
||||
userId: user.id,
|
||||
projectId: parentCtx.projectId,
|
||||
itemId: newAsset.id,
|
||||
})
|
||||
|
||||
return c.json(newAsset)
|
||||
})
|
||||
.patch(
|
||||
@@ -71,6 +81,15 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
name: req.name,
|
||||
})
|
||||
|
||||
const ctx = await assetService.getAssetContext(folderId)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.folder_update,
|
||||
teamId: ctx.teamId,
|
||||
userId: user.id,
|
||||
projectId: ctx.projectId,
|
||||
itemId: folderId,
|
||||
})
|
||||
|
||||
return c.json(updatedAsset)
|
||||
})
|
||||
.get('/folders/:folderId', async (c) => {
|
||||
@@ -122,7 +141,21 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
})
|
||||
}
|
||||
|
||||
const contexts = await Promise.all(req.ids.map((id) => assetService.getAssetContext(id)))
|
||||
|
||||
await assetService.deleteAssets(req.ids)
|
||||
|
||||
for (let i = 0; i < req.ids.length; i++) {
|
||||
const ctx = contexts[i]
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.folder_delete,
|
||||
teamId: ctx.teamId,
|
||||
userId: user.id,
|
||||
projectId: ctx.projectId,
|
||||
itemId: req.ids[i],
|
||||
})
|
||||
}
|
||||
|
||||
return c.body(null, 204)
|
||||
})
|
||||
.post('/folders/restore', zValidator('json', restoreFoldersRequestSchema), async (c) => {
|
||||
|
||||
@@ -6,9 +6,16 @@ import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/a
|
||||
import { inviteService } from '@shumai/core/src/invite/invite'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
vi.mock('@shumai/core/src/invite/invite')
|
||||
vi.mock('@shumai/core/src/notification/notification')
|
||||
vi.mock('@shumai/core/src/authz/authz')
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
authMiddleware: async (
|
||||
@@ -67,6 +74,7 @@ describe('Invite API', () => {
|
||||
|
||||
// Using any here because mocking complex service return types or Hono context is overly verbose for this test.
|
||||
vi.mocked(inviteService.createTeamInvite).mockResolvedValue({
|
||||
id: 'inv1',
|
||||
code: 'test-code',
|
||||
role: 'editor',
|
||||
teamId: 't1',
|
||||
@@ -104,6 +112,12 @@ describe('Invite API', () => {
|
||||
role: 'editor',
|
||||
inviterId: 'u1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'invite_create',
|
||||
teamId: 't1',
|
||||
userId: 'u1',
|
||||
itemId: 'inv1',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /projects/:projectId/invite', async () => {
|
||||
@@ -111,6 +125,7 @@ describe('Invite API', () => {
|
||||
|
||||
// Using any here because mocking complex service return types or Hono context is overly verbose for this test.
|
||||
vi.mocked(inviteService.createProjectInvite).mockResolvedValue({
|
||||
id: 'inv2',
|
||||
code: 'proj-code',
|
||||
role: 'reviewer',
|
||||
teamId: 't1',
|
||||
@@ -151,6 +166,13 @@ describe('Invite API', () => {
|
||||
role: 'reviewer',
|
||||
inviterId: 'u1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'invite_create',
|
||||
teamId: 't1',
|
||||
userId: 'u1',
|
||||
projectId: 'p1',
|
||||
itemId: 'inv2',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /join (Team)', async () => {
|
||||
|
||||
@@ -5,12 +5,14 @@ import {
|
||||
createTeamInviteRequestSchema,
|
||||
joinRequestSchema,
|
||||
InviteInfo,
|
||||
AuditAction,
|
||||
} from '@shumai/dtos'
|
||||
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 type { Prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -53,6 +55,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 +86,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))
|
||||
},
|
||||
)
|
||||
|
||||
@@ -4,6 +4,8 @@ import metadataRoute from './metadata'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
authMiddleware: async (
|
||||
c: Context<{ Variables: { user: { id: string; name: string } } }>,
|
||||
@@ -16,6 +18,16 @@ vi.mock('./middleware/auth', () => ({
|
||||
|
||||
vi.mock('@shumai/core/src/authz/authz')
|
||||
vi.mock('@shumai/core/src/metadata/metadata')
|
||||
vi.mock('@shumai/core/src/project/project', () => ({
|
||||
projectService: {
|
||||
getProjectTeam: vi.fn().mockResolvedValue('t1'),
|
||||
},
|
||||
}))
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
describe('metadata api', () => {
|
||||
const app = new Hono<{ Variables: { user: { id: string; name: string } } }>()
|
||||
@@ -91,6 +103,12 @@ describe('metadata api', () => {
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'metadata_field_create',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
itemId: 'newfield',
|
||||
})
|
||||
})
|
||||
|
||||
it('GET /projects/:projectId/fields', async () => {
|
||||
@@ -167,6 +185,13 @@ describe('metadata api', () => {
|
||||
type: ResourceType.MetadataField,
|
||||
id: 'f1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'metadata_field_delete',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
itemId: 'f1',
|
||||
})
|
||||
})
|
||||
|
||||
it('PUT /fields/:fieldId', async () => {
|
||||
@@ -204,5 +229,12 @@ describe('metadata api', () => {
|
||||
type: ResourceType.MetadataField,
|
||||
id: 'f1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'metadata_field_update',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
projectId: undefined,
|
||||
itemId: 'f1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { Hono } from 'hono'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import {
|
||||
createFieldRequestSchema,
|
||||
updateFieldRequestSchema,
|
||||
updateProjectFieldsOrderRequestSchema,
|
||||
FieldInfo,
|
||||
AuditAction,
|
||||
} from '@shumai/dtos'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -42,6 +45,14 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
})
|
||||
|
||||
const field = await metadataService.createTeamField(teamId, req)
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.metadata_field_create,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
itemId: field.key,
|
||||
})
|
||||
|
||||
return c.json(toFieldInfo(field))
|
||||
})
|
||||
.get('/teams/:teamId/fields', async (c) => {
|
||||
@@ -85,6 +96,21 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
throw new Error('Field has no context')
|
||||
}
|
||||
|
||||
let teamId = field.teamId
|
||||
if (field.projectId && !teamId) {
|
||||
teamId = await projectService.getProjectTeam(field.projectId).catch(() => null)
|
||||
}
|
||||
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.metadata_field_update,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId: field.projectId || undefined,
|
||||
itemId: fieldId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json(toFieldInfo(updated))
|
||||
})
|
||||
.delete('/fields/:fieldId', async (c) => {
|
||||
@@ -109,6 +135,21 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
throw new Error('Field has no context')
|
||||
}
|
||||
|
||||
let teamId = field.teamId
|
||||
if (field.projectId && !teamId) {
|
||||
teamId = await projectService.getProjectTeam(field.projectId).catch(() => null)
|
||||
}
|
||||
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.metadata_field_delete,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId: field.projectId || undefined,
|
||||
itemId: fieldId,
|
||||
})
|
||||
}
|
||||
|
||||
return new Response(null, { status: 204 })
|
||||
})
|
||||
.post('/projects/:projectId/fields', zValidator('json', createFieldRequestSchema), async (c) => {
|
||||
@@ -124,6 +165,19 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
})
|
||||
|
||||
const field = await metadataService.createProjectField(projectId, req)
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.metadata_field_create,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: field.key,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json(toFieldInfo(field))
|
||||
})
|
||||
.get('/projects/:projectId/fields', async (c) => {
|
||||
|
||||
@@ -2,7 +2,8 @@ import { describe, expect, it, vi, beforeEach } from 'vitest'
|
||||
import { Hono } from 'hono'
|
||||
import { authMiddleware } from './auth'
|
||||
import { auth } from '@shumai/core/src/auth/auth'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { userService } from '@shumai/core/src/user/user'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
|
||||
vi.mock('@shumai/core/src/auth/auth', () => ({
|
||||
auth: {
|
||||
@@ -12,14 +13,15 @@ vi.mock('@shumai/core/src/auth/auth', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/db', () => ({
|
||||
prisma: {
|
||||
user: {
|
||||
findUnique: vi.fn(),
|
||||
},
|
||||
teamMember: {
|
||||
findFirst: vi.fn(),
|
||||
},
|
||||
vi.mock('@shumai/core/src/user/user', () => ({
|
||||
userService: {
|
||||
getUserById: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/team/team', () => ({
|
||||
teamService: {
|
||||
hasWritableRoleInAnyTeam: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -39,7 +41,7 @@ describe('authMiddleware', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(auth.api.getSession).mockResolvedValue({ user: { id: 'user1' } } as any)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(prisma.user.findUnique).mockResolvedValue({ id: 'user1' } as any)
|
||||
vi.mocked(userService.getUserById).mockResolvedValue({ id: 'user1' } as any)
|
||||
|
||||
const res = await app.request('/test')
|
||||
expect(res.status).toBe(200)
|
||||
@@ -61,7 +63,7 @@ describe('authMiddleware', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(auth.api.getSession).mockResolvedValue({ user: { id: 'user1' } } as any)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(prisma.user.findUnique).mockResolvedValue({ id: 'user1' } as any)
|
||||
vi.mocked(userService.getUserById).mockResolvedValue({ id: 'user1' } as any)
|
||||
|
||||
const res = await app.request('/test')
|
||||
expect(res.status).toBe(200)
|
||||
@@ -71,8 +73,8 @@ describe('authMiddleware', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(auth.api.getSession).mockResolvedValue({ user: { id: 'user1' } } as any)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(prisma.user.findUnique).mockResolvedValue({ id: 'user1' } as any)
|
||||
vi.mocked(prisma.teamMember.findFirst).mockResolvedValue(null) // No owner/editor role
|
||||
vi.mocked(userService.getUserById).mockResolvedValue({ id: 'user1' } as any)
|
||||
vi.mocked(teamService.hasWritableRoleInAnyTeam).mockResolvedValue(false) // No owner/editor role
|
||||
|
||||
const res = await app.request('/test', { method: 'POST' })
|
||||
expect(res.status).toBe(403)
|
||||
@@ -83,7 +85,7 @@ describe('authMiddleware', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(auth.api.getSession).mockResolvedValue({ user: { id: 'user1' } } as any)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(prisma.user.findUnique).mockResolvedValue({ id: 'user1' } as any)
|
||||
vi.mocked(userService.getUserById).mockResolvedValue({ id: 'user1' } as any)
|
||||
|
||||
const res = await app.request('/test/search', { method: 'POST' })
|
||||
expect(res.status).toBe(200)
|
||||
@@ -93,12 +95,8 @@ describe('authMiddleware', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(auth.api.getSession).mockResolvedValue({ user: { id: 'user1' } } as any)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(prisma.user.findUnique).mockResolvedValue({ id: 'user1' } as any)
|
||||
vi.mocked(prisma.teamMember.findFirst).mockResolvedValue({
|
||||
id: 'member1',
|
||||
role: 'owner',
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.mocked(userService.getUserById).mockResolvedValue({ id: 'user1' } as any)
|
||||
vi.mocked(teamService.hasWritableRoleInAnyTeam).mockResolvedValue(true)
|
||||
|
||||
const res = await app.request('/test', { method: 'POST' })
|
||||
expect(res.status).toBe(200)
|
||||
@@ -108,12 +106,8 @@ describe('authMiddleware', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(auth.api.getSession).mockResolvedValue({ user: { id: 'user1' } } as any)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
vi.mocked(prisma.user.findUnique).mockResolvedValue({ id: 'user1' } as any)
|
||||
vi.mocked(prisma.teamMember.findFirst).mockResolvedValue({
|
||||
id: 'member1',
|
||||
role: 'editor',
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.mocked(userService.getUserById).mockResolvedValue({ id: 'user1' } as any)
|
||||
vi.mocked(teamService.hasWritableRoleInAnyTeam).mockResolvedValue(true)
|
||||
|
||||
const res = await app.request('/test', { method: 'POST' })
|
||||
expect(res.status).toBe(200)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auth } from '@shumai/core/src/auth/auth'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { userService } from '@shumai/core/src/user/user'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
import { createMiddleware } from 'hono/factory'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
@@ -24,9 +25,7 @@ export const authMiddleware = createMiddleware<{
|
||||
}
|
||||
|
||||
try {
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: session.user.id },
|
||||
})
|
||||
const user = await userService.getUserById(session.user.id)
|
||||
|
||||
if (!user) {
|
||||
return c.json({ error: 'User not found' }, 401)
|
||||
@@ -38,14 +37,9 @@ export const authMiddleware = createMiddleware<{
|
||||
const method = c.req.method.toUpperCase()
|
||||
const path = c.req.path
|
||||
if (['POST', 'PUT', 'PATCH', 'DELETE'].includes(method) && !path.endsWith('/search')) {
|
||||
const member = await prisma.teamMember.findFirst({
|
||||
where: {
|
||||
userId: user.id,
|
||||
role: { in: ['owner', 'editor'] },
|
||||
},
|
||||
})
|
||||
const hasWritable = await teamService.hasWritableRoleInAnyTeam(user.id)
|
||||
|
||||
if (!member) {
|
||||
if (!hasWritable) {
|
||||
return c.json({ error: 'System is in read-only mode' }, 403)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest'
|
||||
import { Hono } from 'hono'
|
||||
import { tokenAuthMiddleware } from './tokenAuth'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { apiTokenService } from '@shumai/core/src/user/api-token'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
|
||||
vi.mock('@shumai/db', () => ({
|
||||
prisma: {
|
||||
apiToken: {
|
||||
findUnique: vi.fn(),
|
||||
},
|
||||
vi.mock('@shumai/core/src/user/api-token', () => ({
|
||||
apiTokenService: {
|
||||
validateToken: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -31,21 +30,11 @@ describe('tokenAuthMiddleware', () => {
|
||||
})
|
||||
|
||||
it('sets user when valid Authorization Bearer token is provided', async () => {
|
||||
vi.mocked(prisma.apiToken.findUnique).mockResolvedValue({
|
||||
id: 'token1',
|
||||
token: 'ulid_token_123',
|
||||
name: 'cli-key',
|
||||
userId: 'user123',
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
user: {
|
||||
id: 'user123',
|
||||
name: 'John Doe',
|
||||
email: 'john@example.com',
|
||||
},
|
||||
// Mocking the complex PrismaPromise return type of findUnique is not feasible without any here.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.mocked(apiTokenService.validateToken).mockResolvedValue({
|
||||
id: 'user123',
|
||||
name: 'John Doe',
|
||||
email: 'john@example.com',
|
||||
} as unknown as Prisma.UserGetPayload<Record<string, never>>)
|
||||
|
||||
const res = await app.request('/test', {
|
||||
headers: {
|
||||
@@ -54,28 +43,15 @@ describe('tokenAuthMiddleware', () => {
|
||||
})
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.text()).toBe('user:user123')
|
||||
expect(prisma.apiToken.findUnique).toHaveBeenCalledWith({
|
||||
where: { token: 'ulid_token_123' },
|
||||
include: { user: true },
|
||||
})
|
||||
expect(apiTokenService.validateToken).toHaveBeenCalledWith('ulid_token_123')
|
||||
})
|
||||
|
||||
it('sets user when valid x-api-key header is provided', async () => {
|
||||
vi.mocked(prisma.apiToken.findUnique).mockResolvedValue({
|
||||
id: 'token1',
|
||||
token: 'ulid_token_123',
|
||||
name: 'cli-key',
|
||||
userId: 'user123',
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
user: {
|
||||
id: 'user123',
|
||||
name: 'John Doe',
|
||||
email: 'john@example.com',
|
||||
},
|
||||
// Mocking the complex PrismaPromise return type of findUnique is not feasible without any here.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} as any)
|
||||
vi.mocked(apiTokenService.validateToken).mockResolvedValue({
|
||||
id: 'user123',
|
||||
name: 'John Doe',
|
||||
email: 'john@example.com',
|
||||
} as unknown as Prisma.UserGetPayload<Record<string, never>>)
|
||||
|
||||
const res = await app.request('/test', {
|
||||
headers: {
|
||||
@@ -87,7 +63,7 @@ describe('tokenAuthMiddleware', () => {
|
||||
})
|
||||
|
||||
it('returns 401 when invalid token is provided', async () => {
|
||||
vi.mocked(prisma.apiToken.findUnique).mockResolvedValue(null)
|
||||
vi.mocked(apiTokenService.validateToken).mockResolvedValue(null)
|
||||
|
||||
const res = await app.request('/test', {
|
||||
headers: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { apiTokenService } from '@shumai/core/src/user/api-token'
|
||||
import { createMiddleware } from 'hono/factory'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
@@ -16,16 +16,13 @@ export const tokenAuthMiddleware = createMiddleware<{
|
||||
: c.req.header('x-api-key') || null
|
||||
|
||||
if (token) {
|
||||
const apiToken = await prisma.apiToken.findUnique({
|
||||
where: { token },
|
||||
include: { user: true },
|
||||
})
|
||||
const user = await apiTokenService.validateToken(token)
|
||||
|
||||
if (!apiToken) {
|
||||
if (!user) {
|
||||
return c.json({ error: 'Unauthorized: Invalid API Key' }, 401)
|
||||
}
|
||||
|
||||
c.set('user', apiToken.user)
|
||||
c.set('user', user)
|
||||
}
|
||||
|
||||
await next()
|
||||
|
||||
@@ -4,6 +4,8 @@ import projectRoute from './project'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import type { ProjectInfo } from '@shumai/dtos'
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
authMiddleware: async (
|
||||
@@ -16,16 +18,27 @@ vi.mock('./middleware/auth', () => ({
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/authz/authz')
|
||||
vi.mock('@shumai/core/src/project/project')
|
||||
vi.mock('@shumai/core/src/project/project', () => ({
|
||||
projectService: {
|
||||
createProject: vi.fn(),
|
||||
updateProject: vi.fn(),
|
||||
getProject: vi.fn(),
|
||||
getProjectTeam: vi.fn().mockResolvedValue('t1'),
|
||||
deleteProject: vi.fn(),
|
||||
listProjects: vi.fn(),
|
||||
getUserProjects: vi.fn(),
|
||||
listProjectMembers: vi.fn(),
|
||||
addProjectMember: vi.fn(),
|
||||
updateMemberRole: vi.fn(),
|
||||
removeMember: vi.fn(),
|
||||
getProjectMe: vi.fn(),
|
||||
},
|
||||
}))
|
||||
vi.mock('@shumai/core/src/asset/asset')
|
||||
vi.mock('@shumai/db', () => ({
|
||||
prisma: {
|
||||
teamMember: {
|
||||
findMany: vi.fn(),
|
||||
},
|
||||
project: {
|
||||
findMany: vi.fn(),
|
||||
},
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
listAuditLogs: vi.fn().mockResolvedValue({ nodes: [], pageInfo: {}, total: 0 }),
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -151,6 +164,7 @@ describe('project api', () => {
|
||||
})
|
||||
|
||||
it('POST /projects/:projectId/reparent', async () => {
|
||||
vi.mocked(projectService.getProjectTeam).mockResolvedValue('t1')
|
||||
vi.mocked(assetService.reparentAssets).mockResolvedValue(undefined)
|
||||
|
||||
const res = await app.request('/projects/p/reparent', {
|
||||
@@ -186,6 +200,49 @@ describe('project api', () => {
|
||||
assetIds: ['asset_1', 'asset_2'],
|
||||
creatorId: 'user1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'asset_reparent',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
projectId: 'p',
|
||||
itemId: 'asset_1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'asset_reparent',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
projectId: 'p',
|
||||
itemId: 'asset_2',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /projects/:projectId/copy', async () => {
|
||||
vi.mocked(projectService.getProjectTeam).mockResolvedValue('t1')
|
||||
vi.mocked(assetService.copyAssets).mockResolvedValue(undefined)
|
||||
|
||||
const res = await app.request('/projects/p/copy', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
newParentId: 'new_parent_id',
|
||||
assetIds: ['asset_1'],
|
||||
}),
|
||||
})
|
||||
|
||||
expect(res.status).toBe(204)
|
||||
expect(assetService.copyAssets).toHaveBeenCalledWith({
|
||||
newParentId: 'new_parent_id',
|
||||
assetIds: ['asset_1'],
|
||||
withComments: false,
|
||||
creatorId: 'user1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'asset_copy',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
projectId: 'p',
|
||||
itemId: 'asset_1',
|
||||
})
|
||||
})
|
||||
|
||||
it('POST /projects/:projectId/empty-trash', async () => {
|
||||
@@ -258,24 +315,16 @@ describe('project api', () => {
|
||||
})
|
||||
|
||||
it('GET /projects', async () => {
|
||||
const { prisma } = await import('@shumai/db')
|
||||
vi.mocked(prisma.teamMember.findMany).mockResolvedValue([
|
||||
{ id: 'tm1', teamId: 'team1', userId: 'user1', scope: 'team' },
|
||||
// Mocking complex Prisma client returns requires any here
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
] as any)
|
||||
vi.mocked(prisma.project.findMany).mockResolvedValue([
|
||||
vi.mocked(projectService.getUserProjects).mockResolvedValue([
|
||||
{
|
||||
id: 'proj1',
|
||||
name: 'My Project',
|
||||
teamId: 'team1',
|
||||
rootFolderId: 'folder1',
|
||||
rootFolder: 'folder1',
|
||||
enableNotification: true,
|
||||
updatedAt: new Date('2026-06-21T00:00:00.000Z'),
|
||||
updatedAt: '2026-06-21T00:00:00.000Z',
|
||||
},
|
||||
// Mocking complex Prisma client returns requires any here
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
] as any)
|
||||
] as unknown as ProjectInfo[])
|
||||
|
||||
const res = await app.request('/projects?first=10')
|
||||
|
||||
@@ -290,13 +339,6 @@ describe('project api', () => {
|
||||
enableNotification: true,
|
||||
updatedAt: '2026-06-21T00:00:00.000Z',
|
||||
})
|
||||
expect(prisma.teamMember.findMany).toHaveBeenCalledWith({
|
||||
where: { userId: 'user1' },
|
||||
})
|
||||
expect(prisma.project.findMany).toHaveBeenCalledWith({
|
||||
where: { teamId: 'team1' },
|
||||
orderBy: { id: 'desc' },
|
||||
take: 10,
|
||||
})
|
||||
expect(projectService.getUserProjects).toHaveBeenCalledWith('user1', 10)
|
||||
})
|
||||
})
|
||||
|
||||
+107
-30
@@ -12,9 +12,9 @@ import {
|
||||
updateProjectMemberRoleRequestSchema,
|
||||
addProjectMemberRequestSchema,
|
||||
} from '@shumai/dtos'
|
||||
import { listMembersQuerySchema, paginationParamsSchema } from '@shumai/dtos'
|
||||
import { listMembersQuerySchema, paginationParamsSchema, AuditAction } from '@shumai/dtos'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -24,41 +24,16 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
const req = c.req.valid('query')
|
||||
const limit = req.first ? Math.min(req.first, 200) : 200
|
||||
|
||||
const teamMembers = await prisma.teamMember.findMany({
|
||||
where: { userId: user.id },
|
||||
})
|
||||
|
||||
type ProjectType = Prisma.ProjectGetPayload<Record<string, never>>
|
||||
const allProjects: ProjectType[] = []
|
||||
|
||||
for (const member of teamMembers) {
|
||||
const where: Prisma.ProjectWhereInput = {
|
||||
teamId: member.teamId,
|
||||
}
|
||||
if (member.scope === 'project') {
|
||||
where.members = {
|
||||
some: { teamMemberId: member.id },
|
||||
}
|
||||
}
|
||||
const teamProjects = await prisma.project.findMany({
|
||||
where,
|
||||
orderBy: { id: 'desc' },
|
||||
take: limit - allProjects.length,
|
||||
})
|
||||
allProjects.push(...teamProjects)
|
||||
if (allProjects.length >= limit) {
|
||||
break
|
||||
}
|
||||
}
|
||||
const allProjects = await projectService.getUserProjects(user.id, limit)
|
||||
|
||||
return c.json({
|
||||
data: allProjects.map((p) => ({
|
||||
id: p.id,
|
||||
name: p.name,
|
||||
teamId: p.teamId,
|
||||
rootFolder: p.rootFolderId || undefined,
|
||||
rootFolder: p.rootFolder,
|
||||
enableNotification: p.enableNotification,
|
||||
updatedAt: p.updatedAt.toISOString(),
|
||||
updatedAt: p.updatedAt,
|
||||
})),
|
||||
})
|
||||
})
|
||||
@@ -79,6 +54,14 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
...req,
|
||||
})
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.project_create,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId: newProject.id,
|
||||
itemId: newProject.id,
|
||||
})
|
||||
|
||||
return c.json(newProject)
|
||||
})
|
||||
.put('/projects/:projectId', zValidator('json', updateProjectRequestSchema), async (c) => {
|
||||
@@ -98,6 +81,16 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
...req,
|
||||
})
|
||||
|
||||
if (updatedProject) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.project_update,
|
||||
teamId: updatedProject.teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: projectId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json(updatedProject)
|
||||
})
|
||||
.get(
|
||||
@@ -138,6 +131,17 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
await assetService.emptyTrash(projectId)
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.project_empty_trash,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: projectId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json({ success: true })
|
||||
})
|
||||
.get('/teams/:teamId/projects', zValidator('query', listProjectsRequestSchema), async (c) => {
|
||||
@@ -193,7 +197,19 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: projectId,
|
||||
})
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
await projectService.deleteProject(projectId)
|
||||
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.project_delete,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: projectId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json({ success: true })
|
||||
})
|
||||
.get('/projects/:projectId/team', async (c) => {
|
||||
@@ -247,6 +263,7 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
'/projects/:projectId/reparent',
|
||||
zValidator('json', reparentAssetsRequestSchema),
|
||||
async (c) => {
|
||||
const projectId = c.req.param('projectId')
|
||||
const user = c.get('user')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
@@ -273,10 +290,24 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
creatorId: user.id,
|
||||
})
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
if (teamId) {
|
||||
for (const assetId of req.assetIds) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.asset_reparent,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: assetId,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return c.body(null, 204)
|
||||
},
|
||||
)
|
||||
.post('/projects/:projectId/copy', zValidator('json', copyAssetsRequestSchema), async (c) => {
|
||||
const projectId = c.req.param('projectId')
|
||||
const user = c.get('user')
|
||||
const req = c.req.valid('json')
|
||||
|
||||
@@ -303,6 +334,19 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
creatorId: user.id,
|
||||
})
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
if (teamId) {
|
||||
for (const assetId of req.assetIds) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.asset_copy,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: assetId,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return c.body(null, 204)
|
||||
})
|
||||
.patch(
|
||||
@@ -327,6 +371,17 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
role: req.role,
|
||||
})
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.project_member_update,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: userId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json({ success: true })
|
||||
},
|
||||
)
|
||||
@@ -342,8 +397,19 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: projectId,
|
||||
})
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
await projectService.removeMember(projectId, userId)
|
||||
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.project_member_remove,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: userId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json({ success: true })
|
||||
})
|
||||
.post(
|
||||
@@ -367,6 +433,17 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
role: req.role,
|
||||
})
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.project_member_add,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: req.userId,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json({ success: true })
|
||||
},
|
||||
)
|
||||
|
||||
@@ -4,6 +4,8 @@ import providerRoute from './provider'
|
||||
import { providerService } from '@shumai/core/src/provider/provider'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
authMiddleware: async (
|
||||
c: Context<{ Variables: { user: { id: string; name: string } } }>,
|
||||
@@ -16,6 +18,11 @@ vi.mock('./middleware/auth', () => ({
|
||||
|
||||
vi.mock('@shumai/core/src/authz/authz')
|
||||
vi.mock('@shumai/core/src/provider/provider')
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
describe('provider api', () => {
|
||||
const app = new Hono<{ Variables: { user: { id: string; name: string } } }>()
|
||||
@@ -115,6 +122,12 @@ describe('provider api', () => {
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'provider_create',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
itemId: 'p1',
|
||||
})
|
||||
})
|
||||
|
||||
it('PUT /providers/:id updates provider', async () => {
|
||||
@@ -163,6 +176,12 @@ describe('provider api', () => {
|
||||
type: ResourceType.Provider,
|
||||
id: 'p1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'provider_update',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
itemId: 'p1',
|
||||
})
|
||||
})
|
||||
|
||||
it('DELETE /providers/:id deletes provider', async () => {
|
||||
@@ -188,5 +207,11 @@ describe('provider api', () => {
|
||||
type: ResourceType.Provider,
|
||||
id: 'p1',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'provider_delete',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
itemId: 'p1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -2,8 +2,9 @@ import { zValidator } from '@hono/zod-validator'
|
||||
import { Hono } from 'hono'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { providerService } from '@shumai/core/src/provider/provider'
|
||||
import { createProviderRequestSchema, updateProviderRequestSchema } from '@shumai/dtos'
|
||||
import { createProviderRequestSchema, updateProviderRequestSchema, AuditAction } from '@shumai/dtos'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -54,6 +55,12 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
})
|
||||
|
||||
const provider = await providerService.create(teamId, name, config, models)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.provider_create,
|
||||
teamId,
|
||||
userId: user?.id,
|
||||
itemId: provider.id,
|
||||
})
|
||||
return c.json(provider)
|
||||
})
|
||||
|
||||
@@ -73,6 +80,12 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
if (!providerBefore) throw new Error('Provider not found')
|
||||
|
||||
const provider = await providerService.update(providerBefore.teamId, id, config, models)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.provider_update,
|
||||
teamId: providerBefore.teamId,
|
||||
userId: user?.id,
|
||||
itemId: id,
|
||||
})
|
||||
return c.json(provider)
|
||||
})
|
||||
|
||||
@@ -91,6 +104,12 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
if (!providerBefore) throw new Error('Provider not found')
|
||||
|
||||
await providerService.delete(providerBefore.teamId, id)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.provider_delete,
|
||||
teamId: providerBefore.teamId,
|
||||
userId: user?.id,
|
||||
itemId: id,
|
||||
})
|
||||
return c.json({ success: true })
|
||||
})
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@ import { z } from 'zod'
|
||||
import { metadataService } from '@shumai/core/src/metadata/metadata'
|
||||
import { FieldInfo } from '@shumai/dtos'
|
||||
import type { Prisma as PrismaType } from '@shumai/db'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import { userService } from '@shumai/core/src/user/user'
|
||||
import { auth } from '@shumai/core/src/auth/auth'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { createCommentRequestSchema } from '@shumai/dtos'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import {
|
||||
@@ -204,14 +205,7 @@ const route = app
|
||||
|
||||
const targetFileId = await assetService.resolveTargetAssetId(fileId)
|
||||
|
||||
const project = await prisma.project.findUnique({
|
||||
where: { id: shareLink.projectId },
|
||||
select: { teamId: true },
|
||||
})
|
||||
|
||||
if (!project) {
|
||||
throw new Error('Project not found')
|
||||
}
|
||||
const teamId = await projectService.getProjectTeam(shareLink.projectId)
|
||||
|
||||
// Identify user
|
||||
let userId: string | null = null
|
||||
@@ -222,9 +216,7 @@ const route = app
|
||||
if (session?.user) {
|
||||
userId = session.user.id
|
||||
} else if (guestUserId) {
|
||||
const guestUser = await prisma.user.findUnique({
|
||||
where: { id: guestUserId },
|
||||
})
|
||||
const guestUser = await userService.getUserById(guestUserId)
|
||||
if (guestUser) {
|
||||
userId = guestUser.id
|
||||
}
|
||||
@@ -248,7 +240,7 @@ const route = app
|
||||
|
||||
notificationService.create({
|
||||
type: notifType,
|
||||
teamId: project.teamId,
|
||||
teamId: teamId,
|
||||
creatorId: userId,
|
||||
assetId: targetFileId,
|
||||
commentMessage: req.message,
|
||||
|
||||
@@ -8,6 +8,8 @@ import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { ShareLinkPasswordInvalidError, ShareLinkExpiredError } from '@shumai/core/src/share/errors'
|
||||
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
authMiddleware: async (c: any, next: any) => {
|
||||
@@ -33,6 +35,18 @@ vi.mock('@shumai/core/src/authz/authz', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/project/project', () => ({
|
||||
projectService: {
|
||||
getProjectTeam: vi.fn().mockResolvedValue('t1'),
|
||||
},
|
||||
}))
|
||||
|
||||
describe('Share API', () => {
|
||||
const app = new Hono()
|
||||
.route('/', publicShareRoute)
|
||||
@@ -204,6 +218,13 @@ describe('Share API', () => {
|
||||
{ name: 'My Share' },
|
||||
'user1',
|
||||
)
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'share_create',
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
projectId: 'project1',
|
||||
itemId: 'share1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -2,13 +2,16 @@ import { Hono } from 'hono'
|
||||
import { zValidator } from '@hono/zod-validator'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { shareService } from '@shumai/core/src/share/share'
|
||||
import { projectService } from '@shumai/core/src/project/project'
|
||||
import {
|
||||
createShareLinkRequestSchema,
|
||||
updateShareLinkRequestSchema,
|
||||
listShareLinksRequestSchema,
|
||||
addAssetToShareRequestSchema,
|
||||
AuditAction,
|
||||
} from '@shumai/dtos'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -29,6 +32,18 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
})
|
||||
|
||||
const shareLink = await shareService.createShareLink(projectId, req, user.id)
|
||||
|
||||
const teamId = await projectService.getProjectTeam(projectId).catch(() => null)
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.share_create,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId,
|
||||
itemId: shareLink.id,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json(shareLink)
|
||||
},
|
||||
)
|
||||
@@ -81,7 +96,22 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: shareId,
|
||||
})
|
||||
|
||||
const existingShare = await shareService.getShareLink(shareId)
|
||||
const updated = await shareService.updateShareLink(shareId, req)
|
||||
|
||||
if (existingShare) {
|
||||
const teamId = await projectService.getProjectTeam(existingShare.projectId).catch(() => null)
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.share_update,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId: existingShare.projectId,
|
||||
itemId: shareId,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return c.json(updated)
|
||||
})
|
||||
.delete('/shares/:shareId', async (c) => {
|
||||
@@ -95,7 +125,22 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id: shareId,
|
||||
})
|
||||
|
||||
const existingShare = await shareService.getShareLink(shareId)
|
||||
await shareService.deleteShareLink(shareId)
|
||||
|
||||
if (existingShare) {
|
||||
const teamId = await projectService.getProjectTeam(existingShare.projectId).catch(() => null)
|
||||
if (teamId) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.share_delete,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
projectId: existingShare.projectId,
|
||||
itemId: shareId,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return c.body(null, 204)
|
||||
})
|
||||
.post('/shares/:shareId/assets', zValidator('json', addAssetToShareRequestSchema), async (c) => {
|
||||
|
||||
@@ -5,6 +5,25 @@ import { skillService } from '@shumai/core/src/skill/skill'
|
||||
import { authMiddleware } from './middleware/auth'
|
||||
import { authzService, ResourceType, Permission } from '@shumai/core/src/authz/authz'
|
||||
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn().mockResolvedValue({}),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/skill/skill', () => ({
|
||||
skillService: {
|
||||
listSkills: vi.fn(),
|
||||
upsertSkill: vi.fn(),
|
||||
deleteSkill: vi.fn(),
|
||||
updateSkillConfig: vi.fn(),
|
||||
updateSkillPermission: vi.fn(),
|
||||
getSkill: vi.fn().mockResolvedValue({ id: 'skill1', teamId: 'team1' }),
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('./middleware/auth', () => ({
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
authMiddleware: async (c: any, next: any) => {
|
||||
@@ -35,6 +54,10 @@ describe('Skill API', () => {
|
||||
beforeEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.mocked(authzService.hasPermission).mockResolvedValue(undefined)
|
||||
vi.mocked(skillService.getSkill).mockResolvedValue({
|
||||
id: 'skill1',
|
||||
teamId: 'team1',
|
||||
} as unknown as Awaited<ReturnType<typeof skillService.getSkill>>)
|
||||
})
|
||||
|
||||
describe('GET /teams/:teamId/skills', () => {
|
||||
@@ -102,6 +125,12 @@ describe('Skill API', () => {
|
||||
}),
|
||||
)
|
||||
expect(skillService.upsertSkill).toHaveBeenCalledWith('team1', { assetId: 'asset1' })
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'skill_create',
|
||||
teamId: 'team1',
|
||||
userId: 'user1',
|
||||
itemId: 'skill1',
|
||||
})
|
||||
})
|
||||
|
||||
test('Success with githubUrl', async () => {
|
||||
@@ -129,6 +158,12 @@ describe('Skill API', () => {
|
||||
expect(skillService.upsertSkill).toHaveBeenCalledWith('team1', {
|
||||
githubUrl: 'https://github.com/test/repo',
|
||||
})
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'skill_create',
|
||||
teamId: 'team1',
|
||||
userId: 'user1',
|
||||
itemId: 'skill1',
|
||||
})
|
||||
})
|
||||
|
||||
test('Forbidden without Admin permission', async () => {
|
||||
@@ -162,6 +197,12 @@ describe('Skill API', () => {
|
||||
}),
|
||||
)
|
||||
expect(skillService.deleteSkill).toHaveBeenCalledWith('skill1')
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'skill_delete',
|
||||
teamId: 'team1',
|
||||
userId: 'user1',
|
||||
itemId: 'skill1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -199,6 +240,12 @@ describe('Skill API', () => {
|
||||
}),
|
||||
)
|
||||
expect(skillService.updateSkillConfig).toHaveBeenCalledWith('skill1', mockConfig)
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'skill_update',
|
||||
teamId: 'team1',
|
||||
userId: 'user1',
|
||||
itemId: 'skill1',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -233,6 +280,12 @@ describe('Skill API', () => {
|
||||
}),
|
||||
)
|
||||
expect(skillService.updateSkillPermission).toHaveBeenCalledWith('skill1', 'owner')
|
||||
expect(auditLogService.logAction).toHaveBeenCalledWith({
|
||||
action: 'skill_update',
|
||||
teamId: 'team1',
|
||||
userId: 'user1',
|
||||
itemId: 'skill1',
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -6,8 +6,10 @@ import {
|
||||
upsertSkillRequestSchema,
|
||||
updateSkillConfigRequestSchema,
|
||||
updateSkillPermissionRequestSchema,
|
||||
AuditAction,
|
||||
} from '@shumai/dtos'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
|
||||
@@ -40,6 +42,12 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
try {
|
||||
const skill = await skillService.upsertSkill(teamId, req)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.skill_create,
|
||||
teamId,
|
||||
userId: user?.id,
|
||||
itemId: skill.id,
|
||||
})
|
||||
return c.json(skill)
|
||||
} catch (err: unknown) {
|
||||
if (err instanceof Error && err.name === 'ConflictError') {
|
||||
@@ -59,7 +67,19 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id,
|
||||
})
|
||||
|
||||
const existingSkill = await skillService.getSkill(id)
|
||||
|
||||
await skillService.deleteSkill(id)
|
||||
|
||||
if (existingSkill) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.skill_delete,
|
||||
teamId: existingSkill.teamId,
|
||||
userId: user?.id,
|
||||
itemId: id,
|
||||
})
|
||||
}
|
||||
|
||||
return new Response(null, { status: 204 })
|
||||
})
|
||||
.patch('/skills/:id/config', zValidator('json', updateSkillConfigRequestSchema), async (c) => {
|
||||
@@ -74,7 +94,19 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id,
|
||||
})
|
||||
|
||||
const existingSkill = await skillService.getSkill(id)
|
||||
|
||||
const skill = await skillService.updateSkillConfig(id, req.config)
|
||||
|
||||
if (existingSkill) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.skill_update,
|
||||
teamId: existingSkill.teamId,
|
||||
userId: user?.id,
|
||||
itemId: id,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json(skill)
|
||||
})
|
||||
.patch(
|
||||
@@ -92,7 +124,19 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
id,
|
||||
})
|
||||
|
||||
const existingSkill = await skillService.getSkill(id)
|
||||
|
||||
const skill = await skillService.updateSkillPermission(id, req.permission)
|
||||
|
||||
if (existingSkill) {
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.skill_update,
|
||||
teamId: existingSkill.teamId,
|
||||
userId: user?.id,
|
||||
itemId: id,
|
||||
})
|
||||
}
|
||||
|
||||
return c.json(skill)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { Hono } from 'hono'
|
||||
import { AuditAction } from '@shumai/dtos'
|
||||
import teamRoute from './team'
|
||||
import { authMiddleware } from './middleware/auth'
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
@@ -44,6 +45,13 @@ vi.mock('@shumai/core/src/ai-usage/ai-usage', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/auditLog/auditLog', () => ({
|
||||
auditLogService: {
|
||||
logAction: vi.fn(),
|
||||
listAuditLogs: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
describe('team api', () => {
|
||||
const app = new Hono().use('*', authMiddleware).route('/', teamRoute)
|
||||
let mockCreateTeam: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
@@ -471,5 +479,41 @@ describe('team api', () => {
|
||||
userId: 'user1',
|
||||
})
|
||||
})
|
||||
|
||||
it('GET /teams/:teamId/audit-logs returns list of audit logs for team owner', async () => {
|
||||
const { auditLogService } = await import('@shumai/core/src/auditLog/auditLog')
|
||||
vi.mocked(auditLogService.listAuditLogs).mockResolvedValue({
|
||||
nodes: [
|
||||
{
|
||||
id: 'log1',
|
||||
action: AuditAction.project_create,
|
||||
teamId: 't1',
|
||||
userId: 'user1',
|
||||
projectId: 'p1',
|
||||
itemId: 'p1',
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
],
|
||||
pageInfo: {
|
||||
hasNextPage: false,
|
||||
endCursor: null,
|
||||
},
|
||||
total: 1,
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/audit-logs')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.nodes).toHaveLength(1)
|
||||
expect(data.nodes[0].id).toBe('log1')
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,7 +4,6 @@ import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/a
|
||||
import { teamService } from '@shumai/core/src/team/team'
|
||||
import { userMetadataService } from '@shumai/core/src/user-metadata/user-metadata'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import { NotificationType } from '@shumai/db'
|
||||
import {
|
||||
createTeamRequestSchema,
|
||||
getUserTeamsRequestSchema,
|
||||
@@ -14,10 +13,17 @@ import {
|
||||
updateMeRequestSchema,
|
||||
updateTeamMemberRoleRequestSchema,
|
||||
createApiTokenRequestSchema,
|
||||
listAuditLogsQuerySchema,
|
||||
} from '@shumai/dtos'
|
||||
import {
|
||||
updateUserMetadataRequestSchema,
|
||||
getTeamAiUsageQuerySchema,
|
||||
AuditAction,
|
||||
} from '@shumai/dtos'
|
||||
import { updateUserMetadataRequestSchema, getTeamAiUsageQuerySchema } from '@shumai/dtos'
|
||||
import { apiTokenService } from '@shumai/core/src/user/api-token'
|
||||
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { NotificationType } from '@shumai/db'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
@@ -28,6 +34,12 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
const req = c.req.valid('json')
|
||||
|
||||
const newTeam = await teamService.createTeam(user, req)
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.team_create,
|
||||
teamId: newTeam.id,
|
||||
userId: user.id,
|
||||
itemId: newTeam.id,
|
||||
})
|
||||
return c.json(newTeam)
|
||||
})
|
||||
.get('/teams', zValidator('query', getUserTeamsRequestSchema), async (c) => {
|
||||
@@ -62,6 +74,13 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
userId: user.id,
|
||||
})
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.team_member_add,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
itemId: user.id,
|
||||
})
|
||||
|
||||
return new Response(null, { status: 204 })
|
||||
})
|
||||
.get('/teams/:teamId/me', async (c) => {
|
||||
@@ -139,6 +158,13 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
role: req.role,
|
||||
})
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.team_member_update,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
itemId: userId,
|
||||
})
|
||||
|
||||
return c.json({ success: true })
|
||||
},
|
||||
)
|
||||
@@ -156,6 +182,13 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
await teamService.removeMember(teamId, userId)
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.team_member_remove,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
itemId: userId,
|
||||
})
|
||||
|
||||
return c.json({ success: true })
|
||||
})
|
||||
.get('/teams/:teamId/settings', async (c) => {
|
||||
@@ -188,6 +221,14 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
})
|
||||
|
||||
const settings = await teamService.updateSettings(teamId, req.key, req.value)
|
||||
|
||||
await auditLogService.logAction({
|
||||
action: AuditAction.team_update,
|
||||
teamId,
|
||||
userId: user.id,
|
||||
itemId: teamId,
|
||||
})
|
||||
|
||||
return c.json(settings)
|
||||
},
|
||||
)
|
||||
@@ -334,5 +375,28 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
|
||||
return c.json(stats)
|
||||
})
|
||||
.get('/teams/:teamId/audit-logs', zValidator('query', listAuditLogsQuerySchema), async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
const query = c.req.valid('query')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const logs = await auditLogService.listAuditLogs({
|
||||
teamId,
|
||||
actions: query.actions,
|
||||
userIds: query.userIds,
|
||||
itemId: query.itemId,
|
||||
first: query.first,
|
||||
after: query.after,
|
||||
})
|
||||
|
||||
return c.json(logs)
|
||||
})
|
||||
|
||||
export default route
|
||||
|
||||
@@ -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',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -6,9 +6,11 @@ import {
|
||||
createUploadTaskRequestSchema,
|
||||
localUploadQuerySchema,
|
||||
} from '@shumai/dtos'
|
||||
import { paginationParamsSchema } from '@shumai/dtos'
|
||||
import { paginationParamsSchema, AuditAction } from '@shumai/dtos'
|
||||
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
|
||||
import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { NotificationType } 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 })
|
||||
|
||||
@@ -300,6 +300,12 @@ export class AgentService {
|
||||
})
|
||||
}
|
||||
|
||||
async getAgent(params: { agentId: string }) {
|
||||
return this.prismaClient.agent.findUnique({
|
||||
where: { id: params.agentId },
|
||||
})
|
||||
}
|
||||
|
||||
async deleteAgent(params: DeleteAgentParams) {
|
||||
const { agentId } = params
|
||||
|
||||
|
||||
@@ -2721,4 +2721,37 @@ describe('AssetService — natural sort by name', () => {
|
||||
expect(info.sizeByte).toBe(largeSize)
|
||||
})
|
||||
})
|
||||
|
||||
describe('getAssetContext', () => {
|
||||
it('returns context for project asset', async () => {
|
||||
const user = await prisma.user.create({
|
||||
data: { name: 'User_Ctx_' + Date.now(), email: `test-ctx-${Date.now()}@example.com` },
|
||||
})
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'Team_Ctx_' + Date.now() },
|
||||
})
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Project_Ctx', teamId: team.id },
|
||||
})
|
||||
const asset = await prisma.asset.create({
|
||||
data: {
|
||||
name: 'Asset_Ctx',
|
||||
type: AssetType.folder,
|
||||
projectId: project.id,
|
||||
creatorId: user.id,
|
||||
status: AssetStatus.uploaded,
|
||||
},
|
||||
})
|
||||
|
||||
const context = await assetService.getAssetContext(asset.id)
|
||||
expect(context.projectId).toBe(project.id)
|
||||
expect(context.teamId).toBe(team.id)
|
||||
})
|
||||
|
||||
it('throws error when asset is not found', async () => {
|
||||
await expect(assetService.getAssetContext('non-existent-id')).rejects.toThrow(
|
||||
'Asset not found: non-existent-id',
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -864,7 +864,7 @@ export class AssetService {
|
||||
return info
|
||||
}
|
||||
|
||||
async getAssetContext(assetId: string): Promise<{ teamId: string; projectId?: string } | null> {
|
||||
async getAssetContext(assetId: string): Promise<{ teamId: string; projectId?: string }> {
|
||||
const asset = await this.prismaClient.asset.findUnique({
|
||||
where: { id: assetId },
|
||||
select: {
|
||||
@@ -874,7 +874,9 @@ export class AssetService {
|
||||
},
|
||||
})
|
||||
|
||||
if (!asset) return null
|
||||
if (!asset) {
|
||||
throw new Error(`Asset not found: ${assetId}`)
|
||||
}
|
||||
|
||||
if (asset.project) {
|
||||
return { teamId: asset.project.teamId, projectId: asset.projectId ?? undefined }
|
||||
@@ -884,7 +886,7 @@ export class AssetService {
|
||||
return { teamId: asset.teamRootFolder.id }
|
||||
}
|
||||
|
||||
return null
|
||||
throw new Error(`Asset has no team context: ${assetId}`)
|
||||
}
|
||||
|
||||
async resolveTargetAssetId(assetId: string): Promise<string> {
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { AuditAction } from '@shumai/dtos'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { auditLogService } from './auditLog'
|
||||
|
||||
describe('AuditLogService', () => {
|
||||
setupTestDbHooks()
|
||||
|
||||
it('creates and lists audit logs with pagination and filters', async () => {
|
||||
const user = await prisma.user.create({
|
||||
data: { name: 'Audit Test User', email: 'audit@example.com', password: 'password' },
|
||||
})
|
||||
|
||||
const team = await prisma.team.create({
|
||||
data: { name: 'Audit Test Team' },
|
||||
})
|
||||
|
||||
const project = await prisma.project.create({
|
||||
data: { name: 'Audit Test Project', teamId: team.id },
|
||||
})
|
||||
|
||||
// Create action logs
|
||||
const log1 = await auditLogService.logAction({
|
||||
action: AuditAction.project_create,
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
projectId: project.id,
|
||||
itemId: project.id,
|
||||
})
|
||||
|
||||
const log2 = await auditLogService.logAction({
|
||||
action: AuditAction.project_update,
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
projectId: project.id,
|
||||
itemId: project.id,
|
||||
})
|
||||
|
||||
expect(log1).toBeDefined()
|
||||
expect(log2).toBeDefined()
|
||||
|
||||
// Test list all audit logs for team
|
||||
const resultAll = await auditLogService.listAuditLogs({
|
||||
teamId: team.id,
|
||||
})
|
||||
|
||||
expect(resultAll.total).toBe(2)
|
||||
expect(resultAll.nodes).toHaveLength(2)
|
||||
expect(resultAll.nodes[0].action).toBe(AuditAction.project_update)
|
||||
expect(resultAll.nodes[1].action).toBe(AuditAction.project_create)
|
||||
|
||||
// Test filtering by action
|
||||
const resultAction = await auditLogService.listAuditLogs({
|
||||
teamId: team.id,
|
||||
actions: [AuditAction.project_create],
|
||||
})
|
||||
|
||||
expect(resultAction.total).toBe(1)
|
||||
expect(resultAction.nodes[0].action).toBe(AuditAction.project_create)
|
||||
|
||||
// Test filtering by user ID
|
||||
const resultUser = await auditLogService.listAuditLogs({
|
||||
teamId: team.id,
|
||||
userIds: [user.id],
|
||||
})
|
||||
|
||||
expect(resultUser.total).toBe(2)
|
||||
|
||||
// Test filtering by item ID
|
||||
const resultItem = await auditLogService.listAuditLogs({
|
||||
teamId: team.id,
|
||||
itemId: project.id,
|
||||
})
|
||||
|
||||
expect(resultItem.total).toBe(2)
|
||||
})
|
||||
|
||||
it('handles database errors gracefully and logs error without throwing', async () => {
|
||||
const result = await auditLogService.logAction({
|
||||
action: AuditAction.project_create,
|
||||
teamId: 'invalid-non-existent-team-id',
|
||||
})
|
||||
|
||||
expect(result).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,90 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
import type { AuditAction } from '@shumai/dtos'
|
||||
import { paginateQuery } from '@shumai/core/src/pagination'
|
||||
import { logger } from '@shumai/core/src/logger'
|
||||
|
||||
export interface LogActionParams {
|
||||
action: AuditAction
|
||||
teamId: string
|
||||
userId?: string
|
||||
projectId?: string
|
||||
itemId?: string
|
||||
}
|
||||
|
||||
export interface ListAuditLogsParams {
|
||||
teamId: string
|
||||
actions?: AuditAction[]
|
||||
userIds?: string[]
|
||||
itemId?: string
|
||||
first?: number
|
||||
after?: string
|
||||
}
|
||||
|
||||
export class AuditLogService {
|
||||
async logAction(params: LogActionParams) {
|
||||
try {
|
||||
return await prisma.auditLog.create({
|
||||
data: {
|
||||
action: params.action,
|
||||
teamId: params.teamId,
|
||||
userId: params.userId,
|
||||
projectId: params.projectId,
|
||||
itemId: params.itemId,
|
||||
},
|
||||
})
|
||||
} catch (err) {
|
||||
logger.error({ err, params }, 'Failed to create audit log')
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
async listAuditLogs(params: ListAuditLogsParams) {
|
||||
const where: Prisma.AuditLogWhereInput = {
|
||||
teamId: params.teamId,
|
||||
}
|
||||
|
||||
if (params.actions && params.actions.length > 0) {
|
||||
where.action = { in: params.actions }
|
||||
}
|
||||
|
||||
if (params.userIds && params.userIds.length > 0) {
|
||||
where.userId = { in: params.userIds }
|
||||
}
|
||||
|
||||
if (params.itemId && params.itemId.trim() !== '') {
|
||||
where.itemId = { contains: params.itemId.trim(), mode: 'insensitive' }
|
||||
}
|
||||
|
||||
const result = await paginateQuery(
|
||||
(skip, take) =>
|
||||
prisma.auditLog.findMany({
|
||||
where,
|
||||
orderBy: { id: 'desc' },
|
||||
skip,
|
||||
take,
|
||||
}),
|
||||
() => prisma.auditLog.count({ where }),
|
||||
{ first: params.first, after: params.after },
|
||||
)
|
||||
|
||||
return {
|
||||
nodes: result.data.map((item) => ({
|
||||
id: item.id,
|
||||
action: item.action,
|
||||
teamId: item.teamId,
|
||||
userId: item.userId,
|
||||
projectId: item.projectId,
|
||||
itemId: item.itemId,
|
||||
createdAt: item.createdAt.toISOString(),
|
||||
})),
|
||||
pageInfo: {
|
||||
hasNextPage: !!result.pageInfo.cursor,
|
||||
endCursor: result.pageInfo.cursor || null,
|
||||
},
|
||||
total: result.pageInfo.total ?? 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const auditLogService = new AuditLogService()
|
||||
@@ -17,6 +17,7 @@ export * from './transcode/transcode'
|
||||
export * from './upload/upload'
|
||||
export * from './user-metadata/user-metadata'
|
||||
export * from './user/avatar'
|
||||
export * from './user/user'
|
||||
export * from './versionStack/versionStack'
|
||||
export * from './hyrumtoken'
|
||||
export * from './pagination'
|
||||
|
||||
@@ -160,6 +160,38 @@ export class ProjectService {
|
||||
return res
|
||||
}
|
||||
|
||||
async getUserProjects(userId: string, limit = 200): Promise<ProjectInfo[]> {
|
||||
const teamMembers = await prisma.teamMember.findMany({
|
||||
where: { userId },
|
||||
})
|
||||
|
||||
const allProjects: ProjectInfo[] = []
|
||||
|
||||
for (const member of teamMembers) {
|
||||
const where: Prisma.ProjectWhereInput = {
|
||||
teamId: member.teamId,
|
||||
}
|
||||
if (member.scope === 'project') {
|
||||
where.members = {
|
||||
some: { teamMemberId: member.id },
|
||||
}
|
||||
}
|
||||
const teamProjects = await prisma.project.findMany({
|
||||
where,
|
||||
orderBy: { id: 'desc' },
|
||||
take: limit - allProjects.length,
|
||||
include: { rootFolder: true },
|
||||
})
|
||||
const infos = await Promise.all(teamProjects.map((p) => this.toProjectInfo(p)))
|
||||
allProjects.push(...infos)
|
||||
if (allProjects.length >= limit) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return allProjects
|
||||
}
|
||||
|
||||
async addProjectMember(req: ServiceAddProjectMemberRequest): Promise<void> {
|
||||
const user = await prisma.user.findUnique({ where: { id: req.userId } })
|
||||
if (!user) throw new Error('User not found')
|
||||
|
||||
@@ -275,6 +275,17 @@ export class SkillService {
|
||||
return { name, description }
|
||||
}
|
||||
|
||||
async getSkill(id: string) {
|
||||
const s = await this.prismaClient.skill.findUnique({
|
||||
where: { id },
|
||||
})
|
||||
if (!s) return null
|
||||
return {
|
||||
...this.toSkillInfo(s),
|
||||
teamId: s.teamId,
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private toSkillInfo(s: any): SkillInfo {
|
||||
return {
|
||||
|
||||
@@ -364,6 +364,16 @@ export class TeamService {
|
||||
}
|
||||
}
|
||||
|
||||
async hasWritableRoleInAnyTeam(userId: string): Promise<boolean> {
|
||||
const member = await prisma.teamMember.findFirst({
|
||||
where: {
|
||||
userId,
|
||||
role: { in: ['owner', 'editor'] },
|
||||
},
|
||||
})
|
||||
return !!member
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private toTeamInfo(team: any): TeamInfo {
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
|
||||
export class UserService {
|
||||
constructor(private readonly prismaClient: typeof prisma = prisma) {}
|
||||
|
||||
async getUserById(id: string) {
|
||||
return this.prismaClient.user.findUnique({
|
||||
where: { id },
|
||||
})
|
||||
}
|
||||
|
||||
async createGuestUser(data: { name: string; email: string; guestEmail: string }) {
|
||||
return this.prismaClient.user.create({
|
||||
data: {
|
||||
name: data.name,
|
||||
email: data.email,
|
||||
guestEmail: data.guestEmail,
|
||||
type: 'human',
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export const userService = new UserService()
|
||||
@@ -5,6 +5,13 @@
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./enums": "./src/generated/prisma/enums.ts",
|
||||
"./test": "./src/test.ts",
|
||||
"./src/prisma-json-types": "./src/prisma-json-types.ts",
|
||||
"./src/*": "./src/*.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/adapter-pg": "7.8.0",
|
||||
"@prisma/client": "7.8.0",
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "audit_logs" (
|
||||
"id" TEXT NOT NULL,
|
||||
"action" TEXT NOT NULL,
|
||||
"team_id" TEXT NOT NULL,
|
||||
"user_id" TEXT,
|
||||
"project_id" TEXT,
|
||||
"item_id" TEXT,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "audit_logs_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "audit_logs_team_id_id_idx" ON "audit_logs"("team_id", "id" DESC);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "audit_logs_user_id_idx" ON "audit_logs"("user_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "audit_logs_action_idx" ON "audit_logs"("action");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "audit_logs_item_id_idx" ON "audit_logs"("item_id");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -156,6 +156,7 @@ model User {
|
||||
shareLinks ShareLink[] @relation("UserToShareLink")
|
||||
apiTokens ApiToken[] @relation("UserToApiToken")
|
||||
aiUsages AiUsage[] @relation("UserToAiUsage")
|
||||
auditLogs AuditLog[] @relation("UserToAuditLog")
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -239,6 +240,7 @@ model Team {
|
||||
sandbox Sandbox? @relation("TeamToSandbox")
|
||||
agents Agent[] @relation("TeamToAgent")
|
||||
aiUsages AiUsage[] @relation("TeamToAiUsage")
|
||||
auditLogs AuditLog[] @relation("TeamToAuditLog")
|
||||
|
||||
@@map("teams")
|
||||
}
|
||||
@@ -322,6 +324,7 @@ model Project {
|
||||
notifications Notification[] @relation("ProjectToNotification")
|
||||
shareLinks ShareLink[] @relation("ProjectToShareLink")
|
||||
collections Collection[] @relation("ProjectToCollection")
|
||||
auditLogs AuditLog[] @relation("ProjectToAuditLog")
|
||||
|
||||
@@map("projects")
|
||||
@@index([createdAt])
|
||||
@@ -845,3 +848,24 @@ model AiUsage {
|
||||
@@index([teamId, userId, periodStart])
|
||||
}
|
||||
|
||||
model AuditLog {
|
||||
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")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
team Team @relation("TeamToAuditLog", fields: [teamId], references: [id], onDelete: Cascade)
|
||||
user User? @relation("UserToAuditLog", fields: [userId], references: [id], onDelete: SetNull)
|
||||
project Project? @relation("ProjectToAuditLog", fields: [projectId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([teamId, id(sort: Desc)])
|
||||
@@index([userId])
|
||||
@@index([action])
|
||||
@@index([itemId])
|
||||
@@map("audit_logs")
|
||||
}
|
||||
|
||||
|
||||
|
||||
+5
@@ -187,3 +187,8 @@ export type ApiToken = Prisma.ApiTokenModel
|
||||
*
|
||||
*/
|
||||
export type AiUsage = Prisma.AiUsageModel
|
||||
/**
|
||||
* Model AuditLog
|
||||
*
|
||||
*/
|
||||
export type AuditLog = Prisma.AuditLogModel
|
||||
|
||||
+5
@@ -211,3 +211,8 @@ export type ApiToken = Prisma.ApiTokenModel
|
||||
*
|
||||
*/
|
||||
export type AiUsage = Prisma.AiUsageModel
|
||||
/**
|
||||
* Model AuditLog
|
||||
*
|
||||
*/
|
||||
export type AuditLog = Prisma.AuditLogModel
|
||||
|
||||
+14
-4
File diff suppressed because one or more lines are too long
+91
-2
@@ -417,7 +417,8 @@ export const ModelName = {
|
||||
Provider: 'Provider',
|
||||
Collection: 'Collection',
|
||||
ApiToken: 'ApiToken',
|
||||
AiUsage: 'AiUsage'
|
||||
AiUsage: 'AiUsage',
|
||||
AuditLog: 'AuditLog'
|
||||
} as const
|
||||
|
||||
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
||||
@@ -433,7 +434,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
omit: GlobalOmitOptions
|
||||
}
|
||||
meta: {
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "asset" | "storageKey" | "assetMetadataValue" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage"
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "asset" | "storageKey" | "assetMetadataValue" | "assetComment" | "assetCommentAttachment" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -2953,6 +2954,80 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
AuditLog: {
|
||||
payload: Prisma.$AuditLogPayload<ExtArgs>
|
||||
fields: Prisma.AuditLogFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.AuditLogFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.AuditLogFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.AuditLogFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.AuditLogFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.AuditLogFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.AuditLogCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.AuditLogCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.AuditLogCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.AuditLogDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.AuditLogUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.AuditLogDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.AuditLogUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.AuditLogUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.AuditLogUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AuditLogPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.AuditLogAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateAuditLog>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.AuditLogGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AuditLogGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.AuditLogCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AuditLogCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} & {
|
||||
other: {
|
||||
@@ -3488,6 +3563,19 @@ export const AiUsageScalarFieldEnum = {
|
||||
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
|
||||
|
||||
|
||||
export const AuditLogScalarFieldEnum = {
|
||||
id: 'id',
|
||||
action: 'action',
|
||||
teamId: 'teamId',
|
||||
userId: 'userId',
|
||||
projectId: 'projectId',
|
||||
itemId: 'itemId',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type AuditLogScalarFieldEnum = (typeof AuditLogScalarFieldEnum)[keyof typeof AuditLogScalarFieldEnum]
|
||||
|
||||
|
||||
export const SortOrder = {
|
||||
asc: 'asc',
|
||||
desc: 'desc'
|
||||
@@ -4000,6 +4088,7 @@ export type GlobalOmitConfig = {
|
||||
collection?: Prisma.CollectionOmit
|
||||
apiToken?: Prisma.ApiTokenOmit
|
||||
aiUsage?: Prisma.AiUsageOmit
|
||||
auditLog?: Prisma.AuditLogOmit
|
||||
}
|
||||
|
||||
/* Types for Logging */
|
||||
|
||||
@@ -84,7 +84,8 @@ export const ModelName = {
|
||||
Provider: 'Provider',
|
||||
Collection: 'Collection',
|
||||
ApiToken: 'ApiToken',
|
||||
AiUsage: 'AiUsage'
|
||||
AiUsage: 'AiUsage',
|
||||
AuditLog: 'AuditLog'
|
||||
} as const
|
||||
|
||||
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
||||
@@ -599,6 +600,19 @@ export const AiUsageScalarFieldEnum = {
|
||||
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
|
||||
|
||||
|
||||
export const AuditLogScalarFieldEnum = {
|
||||
id: 'id',
|
||||
action: 'action',
|
||||
teamId: 'teamId',
|
||||
userId: 'userId',
|
||||
projectId: 'projectId',
|
||||
itemId: 'itemId',
|
||||
createdAt: 'createdAt'
|
||||
} as const
|
||||
|
||||
export type AuditLogScalarFieldEnum = (typeof AuditLogScalarFieldEnum)[keyof typeof AuditLogScalarFieldEnum]
|
||||
|
||||
|
||||
export const SortOrder = {
|
||||
asc: 'asc',
|
||||
desc: 'desc'
|
||||
|
||||
+1
@@ -42,4 +42,5 @@ export type * from './models/Provider.ts'
|
||||
export type * from './models/Collection.ts'
|
||||
export type * from './models/ApiToken.ts'
|
||||
export type * from './models/AiUsage.ts'
|
||||
export type * from './models/AuditLog.ts'
|
||||
export type * from './commonInputTypes.ts'
|
||||
+1719
File diff suppressed because it is too large
Load Diff
+196
@@ -230,6 +230,7 @@ export type ProjectWhereInput = {
|
||||
notifications?: Prisma.NotificationListRelationFilter
|
||||
shareLinks?: Prisma.ShareLinkListRelationFilter
|
||||
collections?: Prisma.CollectionListRelationFilter
|
||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||
}
|
||||
|
||||
export type ProjectOrderByWithRelationInput = {
|
||||
@@ -253,6 +254,7 @@ export type ProjectOrderByWithRelationInput = {
|
||||
notifications?: Prisma.NotificationOrderByRelationAggregateInput
|
||||
shareLinks?: Prisma.ShareLinkOrderByRelationAggregateInput
|
||||
collections?: Prisma.CollectionOrderByRelationAggregateInput
|
||||
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
export type ProjectWhereUniqueInput = Prisma.AtLeast<{
|
||||
@@ -279,6 +281,7 @@ export type ProjectWhereUniqueInput = Prisma.AtLeast<{
|
||||
notifications?: Prisma.NotificationListRelationFilter
|
||||
shareLinks?: Prisma.ShareLinkListRelationFilter
|
||||
collections?: Prisma.CollectionListRelationFilter
|
||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||
}, "id" | "rootFolderId" | "shareRootId">
|
||||
|
||||
export type ProjectOrderByWithAggregationInput = {
|
||||
@@ -331,6 +334,7 @@ export type ProjectCreateInput = {
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateInput = {
|
||||
@@ -351,6 +355,7 @@ export type ProjectUncheckedCreateInput = {
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUpdateInput = {
|
||||
@@ -371,6 +376,7 @@ export type ProjectUpdateInput = {
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateInput = {
|
||||
@@ -391,6 +397,7 @@ export type ProjectUncheckedUpdateInput = {
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectCreateManyInput = {
|
||||
@@ -698,6 +705,22 @@ export type ProjectUpdateOneRequiredWithoutCollectionsNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ProjectUpdateToOneWithWhereWithoutCollectionsInput, Prisma.ProjectUpdateWithoutCollectionsInput>, Prisma.ProjectUncheckedUpdateWithoutCollectionsInput>
|
||||
}
|
||||
|
||||
export type ProjectCreateNestedOneWithoutAuditLogsInput = {
|
||||
create?: Prisma.XOR<Prisma.ProjectCreateWithoutAuditLogsInput, Prisma.ProjectUncheckedCreateWithoutAuditLogsInput>
|
||||
connectOrCreate?: Prisma.ProjectCreateOrConnectWithoutAuditLogsInput
|
||||
connect?: Prisma.ProjectWhereUniqueInput
|
||||
}
|
||||
|
||||
export type ProjectUpdateOneWithoutAuditLogsNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.ProjectCreateWithoutAuditLogsInput, Prisma.ProjectUncheckedCreateWithoutAuditLogsInput>
|
||||
connectOrCreate?: Prisma.ProjectCreateOrConnectWithoutAuditLogsInput
|
||||
upsert?: Prisma.ProjectUpsertWithoutAuditLogsInput
|
||||
disconnect?: Prisma.ProjectWhereInput | boolean
|
||||
delete?: Prisma.ProjectWhereInput | boolean
|
||||
connect?: Prisma.ProjectWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.ProjectUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.ProjectUpdateWithoutAuditLogsInput>, Prisma.ProjectUncheckedUpdateWithoutAuditLogsInput>
|
||||
}
|
||||
|
||||
export type ProjectCreateWithoutTeamInput = {
|
||||
id?: string
|
||||
name: string
|
||||
@@ -715,6 +738,7 @@ export type ProjectCreateWithoutTeamInput = {
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutTeamInput = {
|
||||
@@ -734,6 +758,7 @@ export type ProjectUncheckedCreateWithoutTeamInput = {
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutTeamInput = {
|
||||
@@ -795,6 +820,7 @@ export type ProjectCreateWithoutMembersInput = {
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutMembersInput = {
|
||||
@@ -814,6 +840,7 @@ export type ProjectUncheckedCreateWithoutMembersInput = {
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutMembersInput = {
|
||||
@@ -849,6 +876,7 @@ export type ProjectUpdateWithoutMembersInput = {
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutMembersInput = {
|
||||
@@ -868,6 +896,7 @@ export type ProjectUncheckedUpdateWithoutMembersInput = {
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectCreateWithoutShareLinksInput = {
|
||||
@@ -887,6 +916,7 @@ export type ProjectCreateWithoutShareLinksInput = {
|
||||
invites?: Prisma.InviteCreateNestedManyWithoutProjectInput
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutShareLinksInput = {
|
||||
@@ -906,6 +936,7 @@ export type ProjectUncheckedCreateWithoutShareLinksInput = {
|
||||
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutProjectInput
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutShareLinksInput = {
|
||||
@@ -941,6 +972,7 @@ export type ProjectUpdateWithoutShareLinksInput = {
|
||||
invites?: Prisma.InviteUpdateManyWithoutProjectNestedInput
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutShareLinksInput = {
|
||||
@@ -960,6 +992,7 @@ export type ProjectUncheckedUpdateWithoutShareLinksInput = {
|
||||
invites?: Prisma.InviteUncheckedUpdateManyWithoutProjectNestedInput
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectCreateWithoutAssetsInput = {
|
||||
@@ -979,6 +1012,7 @@ export type ProjectCreateWithoutAssetsInput = {
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutAssetsInput = {
|
||||
@@ -998,6 +1032,7 @@ export type ProjectUncheckedCreateWithoutAssetsInput = {
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutAssetsInput = {
|
||||
@@ -1022,6 +1057,7 @@ export type ProjectCreateWithoutRootFolderInput = {
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutRootFolderInput = {
|
||||
@@ -1041,6 +1077,7 @@ export type ProjectUncheckedCreateWithoutRootFolderInput = {
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutRootFolderInput = {
|
||||
@@ -1065,6 +1102,7 @@ export type ProjectCreateWithoutShareRootInput = {
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutShareRootInput = {
|
||||
@@ -1084,6 +1122,7 @@ export type ProjectUncheckedCreateWithoutShareRootInput = {
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutShareRootInput = {
|
||||
@@ -1119,6 +1158,7 @@ export type ProjectUpdateWithoutAssetsInput = {
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutAssetsInput = {
|
||||
@@ -1138,6 +1178,7 @@ export type ProjectUncheckedUpdateWithoutAssetsInput = {
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUpsertWithoutRootFolderInput = {
|
||||
@@ -1168,6 +1209,7 @@ export type ProjectUpdateWithoutRootFolderInput = {
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutRootFolderInput = {
|
||||
@@ -1187,6 +1229,7 @@ export type ProjectUncheckedUpdateWithoutRootFolderInput = {
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUpsertWithoutShareRootInput = {
|
||||
@@ -1217,6 +1260,7 @@ export type ProjectUpdateWithoutShareRootInput = {
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutShareRootInput = {
|
||||
@@ -1236,6 +1280,7 @@ export type ProjectUncheckedUpdateWithoutShareRootInput = {
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectCreateWithoutInvitesInput = {
|
||||
@@ -1255,6 +1300,7 @@ export type ProjectCreateWithoutInvitesInput = {
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutInvitesInput = {
|
||||
@@ -1274,6 +1320,7 @@ export type ProjectUncheckedCreateWithoutInvitesInput = {
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutInvitesInput = {
|
||||
@@ -1309,6 +1356,7 @@ export type ProjectUpdateWithoutInvitesInput = {
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutInvitesInput = {
|
||||
@@ -1328,6 +1376,7 @@ export type ProjectUncheckedUpdateWithoutInvitesInput = {
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectCreateWithoutMetadataFieldsInput = {
|
||||
@@ -1347,6 +1396,7 @@ export type ProjectCreateWithoutMetadataFieldsInput = {
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutMetadataFieldsInput = {
|
||||
@@ -1366,6 +1416,7 @@ export type ProjectUncheckedCreateWithoutMetadataFieldsInput = {
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutMetadataFieldsInput = {
|
||||
@@ -1401,6 +1452,7 @@ export type ProjectUpdateWithoutMetadataFieldsInput = {
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutMetadataFieldsInput = {
|
||||
@@ -1420,6 +1472,7 @@ export type ProjectUncheckedUpdateWithoutMetadataFieldsInput = {
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectCreateWithoutNotificationsInput = {
|
||||
@@ -1439,6 +1492,7 @@ export type ProjectCreateWithoutNotificationsInput = {
|
||||
invites?: Prisma.InviteCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutNotificationsInput = {
|
||||
@@ -1458,6 +1512,7 @@ export type ProjectUncheckedCreateWithoutNotificationsInput = {
|
||||
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutNotificationsInput = {
|
||||
@@ -1493,6 +1548,7 @@ export type ProjectUpdateWithoutNotificationsInput = {
|
||||
invites?: Prisma.InviteUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutNotificationsInput = {
|
||||
@@ -1512,6 +1568,7 @@ export type ProjectUncheckedUpdateWithoutNotificationsInput = {
|
||||
invites?: Prisma.InviteUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectCreateWithoutCollectionsInput = {
|
||||
@@ -1531,6 +1588,7 @@ export type ProjectCreateWithoutCollectionsInput = {
|
||||
invites?: Prisma.InviteCreateNestedManyWithoutProjectInput
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutCollectionsInput = {
|
||||
@@ -1550,6 +1608,7 @@ export type ProjectUncheckedCreateWithoutCollectionsInput = {
|
||||
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutProjectInput
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutCollectionsInput = {
|
||||
@@ -1585,6 +1644,7 @@ export type ProjectUpdateWithoutCollectionsInput = {
|
||||
invites?: Prisma.InviteUpdateManyWithoutProjectNestedInput
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutCollectionsInput = {
|
||||
@@ -1604,6 +1664,103 @@ export type ProjectUncheckedUpdateWithoutCollectionsInput = {
|
||||
invites?: Prisma.InviteUncheckedUpdateManyWithoutProjectNestedInput
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectCreateWithoutAuditLogsInput = {
|
||||
id?: string
|
||||
name: string
|
||||
coverImageKey?: string | null
|
||||
metadataOverrides?:PrismaJson.MetadataOverrides | Prisma.NullableJsonNullValueInput
|
||||
enableNotification?: boolean
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
team: Prisma.TeamCreateNestedOneWithoutProjectsInput
|
||||
rootFolder?: Prisma.AssetCreateNestedOneWithoutProjectRootFolderInput
|
||||
shareRoot?: Prisma.AssetCreateNestedOneWithoutProjectShareRootInput
|
||||
members?: Prisma.ProjectMemberCreateNestedManyWithoutProjectInput
|
||||
assets?: Prisma.AssetCreateNestedManyWithoutProjectInput
|
||||
metadataFields?: Prisma.MetadataFieldCreateNestedManyWithoutProjectInput
|
||||
invites?: Prisma.InviteCreateNestedManyWithoutProjectInput
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedCreateWithoutAuditLogsInput = {
|
||||
id?: string
|
||||
name: string
|
||||
coverImageKey?: string | null
|
||||
metadataOverrides?:PrismaJson.MetadataOverrides | Prisma.NullableJsonNullValueInput
|
||||
enableNotification?: boolean
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
teamId: string
|
||||
rootFolderId?: string | null
|
||||
shareRootId?: string | null
|
||||
members?: Prisma.ProjectMemberUncheckedCreateNestedManyWithoutProjectInput
|
||||
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutProjectInput
|
||||
metadataFields?: Prisma.MetadataFieldUncheckedCreateNestedManyWithoutProjectInput
|
||||
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutProjectInput
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutProjectInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutProjectInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutProjectInput
|
||||
}
|
||||
|
||||
export type ProjectCreateOrConnectWithoutAuditLogsInput = {
|
||||
where: Prisma.ProjectWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.ProjectCreateWithoutAuditLogsInput, Prisma.ProjectUncheckedCreateWithoutAuditLogsInput>
|
||||
}
|
||||
|
||||
export type ProjectUpsertWithoutAuditLogsInput = {
|
||||
update: Prisma.XOR<Prisma.ProjectUpdateWithoutAuditLogsInput, Prisma.ProjectUncheckedUpdateWithoutAuditLogsInput>
|
||||
create: Prisma.XOR<Prisma.ProjectCreateWithoutAuditLogsInput, Prisma.ProjectUncheckedCreateWithoutAuditLogsInput>
|
||||
where?: Prisma.ProjectWhereInput
|
||||
}
|
||||
|
||||
export type ProjectUpdateToOneWithWhereWithoutAuditLogsInput = {
|
||||
where?: Prisma.ProjectWhereInput
|
||||
data: Prisma.XOR<Prisma.ProjectUpdateWithoutAuditLogsInput, Prisma.ProjectUncheckedUpdateWithoutAuditLogsInput>
|
||||
}
|
||||
|
||||
export type ProjectUpdateWithoutAuditLogsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
coverImageKey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
metadataOverrides?:PrismaJson.MetadataOverrides | Prisma.NullableJsonNullValueInput
|
||||
enableNotification?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
team?: Prisma.TeamUpdateOneRequiredWithoutProjectsNestedInput
|
||||
rootFolder?: Prisma.AssetUpdateOneWithoutProjectRootFolderNestedInput
|
||||
shareRoot?: Prisma.AssetUpdateOneWithoutProjectShareRootNestedInput
|
||||
members?: Prisma.ProjectMemberUpdateManyWithoutProjectNestedInput
|
||||
assets?: Prisma.AssetUpdateManyWithoutProjectNestedInput
|
||||
metadataFields?: Prisma.MetadataFieldUpdateManyWithoutProjectNestedInput
|
||||
invites?: Prisma.InviteUpdateManyWithoutProjectNestedInput
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutAuditLogsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
coverImageKey?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
metadataOverrides?:PrismaJson.MetadataOverrides | Prisma.NullableJsonNullValueInput
|
||||
enableNotification?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
teamId?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
rootFolderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
shareRootId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
members?: Prisma.ProjectMemberUncheckedUpdateManyWithoutProjectNestedInput
|
||||
assets?: Prisma.AssetUncheckedUpdateManyWithoutProjectNestedInput
|
||||
metadataFields?: Prisma.MetadataFieldUncheckedUpdateManyWithoutProjectNestedInput
|
||||
invites?: Prisma.InviteUncheckedUpdateManyWithoutProjectNestedInput
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectCreateManyTeamInput = {
|
||||
@@ -1635,6 +1792,7 @@ export type ProjectUpdateWithoutTeamInput = {
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateWithoutTeamInput = {
|
||||
@@ -1654,6 +1812,7 @@ export type ProjectUncheckedUpdateWithoutTeamInput = {
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutProjectNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutProjectNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutProjectNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutProjectNestedInput
|
||||
}
|
||||
|
||||
export type ProjectUncheckedUpdateManyWithoutTeamInput = {
|
||||
@@ -1681,6 +1840,7 @@ export type ProjectCountOutputType = {
|
||||
notifications: number
|
||||
shareLinks: number
|
||||
collections: number
|
||||
auditLogs: number
|
||||
}
|
||||
|
||||
export type ProjectCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
@@ -1691,6 +1851,7 @@ export type ProjectCountOutputTypeSelect<ExtArgs extends runtime.Types.Extension
|
||||
notifications?: boolean | ProjectCountOutputTypeCountNotificationsArgs
|
||||
shareLinks?: boolean | ProjectCountOutputTypeCountShareLinksArgs
|
||||
collections?: boolean | ProjectCountOutputTypeCountCollectionsArgs
|
||||
auditLogs?: boolean | ProjectCountOutputTypeCountAuditLogsArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1752,6 +1913,13 @@ export type ProjectCountOutputTypeCountCollectionsArgs<ExtArgs extends runtime.T
|
||||
where?: Prisma.CollectionWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* ProjectCountOutputType without action
|
||||
*/
|
||||
export type ProjectCountOutputTypeCountAuditLogsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.AuditLogWhereInput
|
||||
}
|
||||
|
||||
|
||||
export type ProjectSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
@@ -1774,6 +1942,7 @@ export type ProjectSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
notifications?: boolean | Prisma.Project$notificationsArgs<ExtArgs>
|
||||
shareLinks?: boolean | Prisma.Project$shareLinksArgs<ExtArgs>
|
||||
collections?: boolean | Prisma.Project$collectionsArgs<ExtArgs>
|
||||
auditLogs?: boolean | Prisma.Project$auditLogsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ProjectCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["project"]>
|
||||
|
||||
@@ -1834,6 +2003,7 @@ export type ProjectInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs
|
||||
notifications?: boolean | Prisma.Project$notificationsArgs<ExtArgs>
|
||||
shareLinks?: boolean | Prisma.Project$shareLinksArgs<ExtArgs>
|
||||
collections?: boolean | Prisma.Project$collectionsArgs<ExtArgs>
|
||||
auditLogs?: boolean | Prisma.Project$auditLogsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.ProjectCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
export type ProjectIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
@@ -1860,6 +2030,7 @@ export type $ProjectPayload<ExtArgs extends runtime.Types.Extensions.InternalArg
|
||||
notifications: Prisma.$NotificationPayload<ExtArgs>[]
|
||||
shareLinks: Prisma.$ShareLinkPayload<ExtArgs>[]
|
||||
collections: Prisma.$CollectionPayload<ExtArgs>[]
|
||||
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
@@ -2279,6 +2450,7 @@ export interface Prisma__ProjectClient<T, Null = never, ExtArgs extends runtime.
|
||||
notifications<T extends Prisma.Project$notificationsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Project$notificationsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$NotificationPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
shareLinks<T extends Prisma.Project$shareLinksArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Project$shareLinksArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ShareLinkPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
collections<T extends Prisma.Project$collectionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Project$collectionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$CollectionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
auditLogs<T extends Prisma.Project$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Project$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -2924,6 +3096,30 @@ export type Project$collectionsArgs<ExtArgs extends runtime.Types.Extensions.Int
|
||||
distinct?: Prisma.CollectionScalarFieldEnum | Prisma.CollectionScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Project.auditLogs
|
||||
*/
|
||||
export type Project$auditLogsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the AuditLog
|
||||
*/
|
||||
select?: Prisma.AuditLogSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the AuditLog
|
||||
*/
|
||||
omit?: Prisma.AuditLogOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AuditLogInclude<ExtArgs> | null
|
||||
where?: Prisma.AuditLogWhereInput
|
||||
orderBy?: Prisma.AuditLogOrderByWithRelationInput | Prisma.AuditLogOrderByWithRelationInput[]
|
||||
cursor?: Prisma.AuditLogWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.AuditLogScalarFieldEnum | Prisma.AuditLogScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Project without action
|
||||
*/
|
||||
|
||||
+202
@@ -200,6 +200,7 @@ export type TeamWhereInput = {
|
||||
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
|
||||
agents?: Prisma.AgentListRelationFilter
|
||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||
}
|
||||
|
||||
export type TeamOrderByWithRelationInput = {
|
||||
@@ -221,6 +222,7 @@ export type TeamOrderByWithRelationInput = {
|
||||
sandbox?: Prisma.SandboxOrderByWithRelationInput
|
||||
agents?: Prisma.AgentOrderByRelationAggregateInput
|
||||
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
|
||||
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
export type TeamWhereUniqueInput = Prisma.AtLeast<{
|
||||
@@ -245,6 +247,7 @@ export type TeamWhereUniqueInput = Prisma.AtLeast<{
|
||||
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
|
||||
agents?: Prisma.AgentListRelationFilter
|
||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||
}, "id" | "rootFolderId">
|
||||
|
||||
export type TeamOrderByWithAggregationInput = {
|
||||
@@ -289,6 +292,7 @@ export type TeamCreateInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateInput = {
|
||||
@@ -309,6 +313,7 @@ export type TeamUncheckedCreateInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUpdateInput = {
|
||||
@@ -329,6 +334,7 @@ export type TeamUpdateInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateInput = {
|
||||
@@ -349,6 +355,7 @@ export type TeamUncheckedUpdateInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateManyInput = {
|
||||
@@ -600,6 +607,20 @@ export type TeamUpdateOneRequiredWithoutAiUsagesNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutAiUsagesInput, Prisma.TeamUpdateWithoutAiUsagesInput>, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
|
||||
}
|
||||
|
||||
export type TeamCreateNestedOneWithoutAuditLogsInput = {
|
||||
create?: Prisma.XOR<Prisma.TeamCreateWithoutAuditLogsInput, Prisma.TeamUncheckedCreateWithoutAuditLogsInput>
|
||||
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAuditLogsInput
|
||||
connect?: Prisma.TeamWhereUniqueInput
|
||||
}
|
||||
|
||||
export type TeamUpdateOneRequiredWithoutAuditLogsNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.TeamCreateWithoutAuditLogsInput, Prisma.TeamUncheckedCreateWithoutAuditLogsInput>
|
||||
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAuditLogsInput
|
||||
upsert?: Prisma.TeamUpsertWithoutAuditLogsInput
|
||||
connect?: Prisma.TeamWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.TeamUpdateWithoutAuditLogsInput>, Prisma.TeamUncheckedUpdateWithoutAuditLogsInput>
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutSandboxInput = {
|
||||
id?: string
|
||||
name: string
|
||||
@@ -617,6 +638,7 @@ export type TeamCreateWithoutSandboxInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutSandboxInput = {
|
||||
@@ -636,6 +658,7 @@ export type TeamUncheckedCreateWithoutSandboxInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutSandboxInput = {
|
||||
@@ -671,6 +694,7 @@ export type TeamUpdateWithoutSandboxInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutSandboxInput = {
|
||||
@@ -690,6 +714,7 @@ export type TeamUncheckedUpdateWithoutSandboxInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutSkillsInput = {
|
||||
@@ -709,6 +734,7 @@ export type TeamCreateWithoutSkillsInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutSkillsInput = {
|
||||
@@ -728,6 +754,7 @@ export type TeamUncheckedCreateWithoutSkillsInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutSkillsInput = {
|
||||
@@ -763,6 +790,7 @@ export type TeamUpdateWithoutSkillsInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutSkillsInput = {
|
||||
@@ -782,6 +810,7 @@ export type TeamUncheckedUpdateWithoutSkillsInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutMembersInput = {
|
||||
@@ -801,6 +830,7 @@ export type TeamCreateWithoutMembersInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutMembersInput = {
|
||||
@@ -820,6 +850,7 @@ export type TeamUncheckedCreateWithoutMembersInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutMembersInput = {
|
||||
@@ -855,6 +886,7 @@ export type TeamUpdateWithoutMembersInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutMembersInput = {
|
||||
@@ -874,6 +906,7 @@ export type TeamUncheckedUpdateWithoutMembersInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutProjectsInput = {
|
||||
@@ -893,6 +926,7 @@ export type TeamCreateWithoutProjectsInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutProjectsInput = {
|
||||
@@ -912,6 +946,7 @@ export type TeamUncheckedCreateWithoutProjectsInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutProjectsInput = {
|
||||
@@ -947,6 +982,7 @@ export type TeamUpdateWithoutProjectsInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutProjectsInput = {
|
||||
@@ -966,6 +1002,7 @@ export type TeamUncheckedUpdateWithoutProjectsInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutRootFolderInput = {
|
||||
@@ -985,6 +1022,7 @@ export type TeamCreateWithoutRootFolderInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutRootFolderInput = {
|
||||
@@ -1004,6 +1042,7 @@ export type TeamUncheckedCreateWithoutRootFolderInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutRootFolderInput = {
|
||||
@@ -1039,6 +1078,7 @@ export type TeamUpdateWithoutRootFolderInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutRootFolderInput = {
|
||||
@@ -1058,6 +1098,7 @@ export type TeamUncheckedUpdateWithoutRootFolderInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutInvitesInput = {
|
||||
@@ -1077,6 +1118,7 @@ export type TeamCreateWithoutInvitesInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutInvitesInput = {
|
||||
@@ -1096,6 +1138,7 @@ export type TeamUncheckedCreateWithoutInvitesInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutInvitesInput = {
|
||||
@@ -1131,6 +1174,7 @@ export type TeamUpdateWithoutInvitesInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutInvitesInput = {
|
||||
@@ -1150,6 +1194,7 @@ export type TeamUncheckedUpdateWithoutInvitesInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutMetadataFieldsInput = {
|
||||
@@ -1169,6 +1214,7 @@ export type TeamCreateWithoutMetadataFieldsInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
|
||||
@@ -1188,6 +1234,7 @@ export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutMetadataFieldsInput = {
|
||||
@@ -1223,6 +1270,7 @@ export type TeamUpdateWithoutMetadataFieldsInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
|
||||
@@ -1242,6 +1290,7 @@ export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutNotificationsInput = {
|
||||
@@ -1261,6 +1310,7 @@ export type TeamCreateWithoutNotificationsInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutNotificationsInput = {
|
||||
@@ -1280,6 +1330,7 @@ export type TeamUncheckedCreateWithoutNotificationsInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutNotificationsInput = {
|
||||
@@ -1315,6 +1366,7 @@ export type TeamUpdateWithoutNotificationsInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutNotificationsInput = {
|
||||
@@ -1334,6 +1386,7 @@ export type TeamUncheckedUpdateWithoutNotificationsInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutAgentsInput = {
|
||||
@@ -1353,6 +1406,7 @@ export type TeamCreateWithoutAgentsInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutAgentsInput = {
|
||||
@@ -1372,6 +1426,7 @@ export type TeamUncheckedCreateWithoutAgentsInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutAgentsInput = {
|
||||
@@ -1407,6 +1462,7 @@ export type TeamUpdateWithoutAgentsInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutAgentsInput = {
|
||||
@@ -1426,6 +1482,7 @@ export type TeamUncheckedUpdateWithoutAgentsInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutUserMetadataInput = {
|
||||
@@ -1445,6 +1502,7 @@ export type TeamCreateWithoutUserMetadataInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutUserMetadataInput = {
|
||||
@@ -1464,6 +1522,7 @@ export type TeamUncheckedCreateWithoutUserMetadataInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutUserMetadataInput = {
|
||||
@@ -1499,6 +1558,7 @@ export type TeamUpdateWithoutUserMetadataInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutUserMetadataInput = {
|
||||
@@ -1518,6 +1578,7 @@ export type TeamUncheckedUpdateWithoutUserMetadataInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutProvidersInput = {
|
||||
@@ -1537,6 +1598,7 @@ export type TeamCreateWithoutProvidersInput = {
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutProvidersInput = {
|
||||
@@ -1556,6 +1618,7 @@ export type TeamUncheckedCreateWithoutProvidersInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutProvidersInput = {
|
||||
@@ -1591,6 +1654,7 @@ export type TeamUpdateWithoutProvidersInput = {
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutProvidersInput = {
|
||||
@@ -1610,6 +1674,7 @@ export type TeamUncheckedUpdateWithoutProvidersInput = {
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutAiUsagesInput = {
|
||||
@@ -1629,6 +1694,7 @@ export type TeamCreateWithoutAiUsagesInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutAiUsagesInput = {
|
||||
@@ -1648,6 +1714,7 @@ export type TeamUncheckedCreateWithoutAiUsagesInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutAiUsagesInput = {
|
||||
@@ -1683,6 +1750,7 @@ export type TeamUpdateWithoutAiUsagesInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutAiUsagesInput = {
|
||||
@@ -1702,6 +1770,103 @@ export type TeamUncheckedUpdateWithoutAiUsagesInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutAuditLogsInput = {
|
||||
id?: string
|
||||
name: string
|
||||
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
rootFolder?: Prisma.AssetCreateNestedOneWithoutTeamRootFolderInput
|
||||
members?: Prisma.TeamMemberCreateNestedManyWithoutTeamInput
|
||||
projects?: Prisma.ProjectCreateNestedManyWithoutTeamInput
|
||||
metadataFields?: Prisma.MetadataFieldCreateNestedManyWithoutTeamInput
|
||||
invites?: Prisma.InviteCreateNestedManyWithoutTeamInput
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutTeamInput
|
||||
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutTeamInput
|
||||
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutAuditLogsInput = {
|
||||
id?: string
|
||||
name: string
|
||||
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
rootFolderId?: string | null
|
||||
members?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutTeamInput
|
||||
projects?: Prisma.ProjectUncheckedCreateNestedManyWithoutTeamInput
|
||||
metadataFields?: Prisma.MetadataFieldUncheckedCreateNestedManyWithoutTeamInput
|
||||
invites?: Prisma.InviteUncheckedCreateNestedManyWithoutTeamInput
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutTeamInput
|
||||
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutTeamInput
|
||||
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutAuditLogsInput = {
|
||||
where: Prisma.TeamWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.TeamCreateWithoutAuditLogsInput, Prisma.TeamUncheckedCreateWithoutAuditLogsInput>
|
||||
}
|
||||
|
||||
export type TeamUpsertWithoutAuditLogsInput = {
|
||||
update: Prisma.XOR<Prisma.TeamUpdateWithoutAuditLogsInput, Prisma.TeamUncheckedUpdateWithoutAuditLogsInput>
|
||||
create: Prisma.XOR<Prisma.TeamCreateWithoutAuditLogsInput, Prisma.TeamUncheckedCreateWithoutAuditLogsInput>
|
||||
where?: Prisma.TeamWhereInput
|
||||
}
|
||||
|
||||
export type TeamUpdateToOneWithWhereWithoutAuditLogsInput = {
|
||||
where?: Prisma.TeamWhereInput
|
||||
data: Prisma.XOR<Prisma.TeamUpdateWithoutAuditLogsInput, Prisma.TeamUncheckedUpdateWithoutAuditLogsInput>
|
||||
}
|
||||
|
||||
export type TeamUpdateWithoutAuditLogsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
rootFolder?: Prisma.AssetUpdateOneWithoutTeamRootFolderNestedInput
|
||||
members?: Prisma.TeamMemberUpdateManyWithoutTeamNestedInput
|
||||
projects?: Prisma.ProjectUpdateManyWithoutTeamNestedInput
|
||||
metadataFields?: Prisma.MetadataFieldUpdateManyWithoutTeamNestedInput
|
||||
invites?: Prisma.InviteUpdateManyWithoutTeamNestedInput
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutTeamNestedInput
|
||||
userMetadata?: Prisma.UserMetadataUpdateManyWithoutTeamNestedInput
|
||||
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutAuditLogsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
settings?:PrismaJson.Settings | Prisma.NullableJsonNullValueInput
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
rootFolderId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
members?: Prisma.TeamMemberUncheckedUpdateManyWithoutTeamNestedInput
|
||||
projects?: Prisma.ProjectUncheckedUpdateManyWithoutTeamNestedInput
|
||||
metadataFields?: Prisma.MetadataFieldUncheckedUpdateManyWithoutTeamNestedInput
|
||||
invites?: Prisma.InviteUncheckedUpdateManyWithoutTeamNestedInput
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutTeamNestedInput
|
||||
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutTeamNestedInput
|
||||
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
|
||||
@@ -1720,6 +1885,7 @@ export type TeamCountOutputType = {
|
||||
skills: number
|
||||
agents: number
|
||||
aiUsages: number
|
||||
auditLogs: number
|
||||
}
|
||||
|
||||
export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
@@ -1733,6 +1899,7 @@ export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
|
||||
skills?: boolean | TeamCountOutputTypeCountSkillsArgs
|
||||
agents?: boolean | TeamCountOutputTypeCountAgentsArgs
|
||||
aiUsages?: boolean | TeamCountOutputTypeCountAiUsagesArgs
|
||||
auditLogs?: boolean | TeamCountOutputTypeCountAuditLogsArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1815,6 +1982,13 @@ export type TeamCountOutputTypeCountAiUsagesArgs<ExtArgs extends runtime.Types.E
|
||||
where?: Prisma.AiUsageWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* TeamCountOutputType without action
|
||||
*/
|
||||
export type TeamCountOutputTypeCountAuditLogsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.AuditLogWhereInput
|
||||
}
|
||||
|
||||
|
||||
export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
@@ -1835,6 +2009,7 @@ export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
|
||||
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
|
||||
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
|
||||
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
|
||||
auditLogs?: boolean | Prisma.Team$auditLogsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["team"]>
|
||||
|
||||
@@ -1881,6 +2056,7 @@ export type TeamInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
|
||||
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
|
||||
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
|
||||
auditLogs?: boolean | Prisma.Team$auditLogsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
export type TeamIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
@@ -1905,6 +2081,7 @@ export type $TeamPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
sandbox: Prisma.$SandboxPayload<ExtArgs> | null
|
||||
agents: Prisma.$AgentPayload<ExtArgs>[]
|
||||
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
|
||||
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
@@ -2322,6 +2499,7 @@ export interface Prisma__TeamClient<T, Null = never, ExtArgs extends runtime.Typ
|
||||
sandbox<T extends Prisma.Team$sandboxArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$sandboxArgs<ExtArgs>>): Prisma.Prisma__SandboxClient<runtime.Types.Result.GetResult<Prisma.$SandboxPayload<ExtArgs>, T, "findUniqueOrThrow", GlobalOmitOptions> | null, null, ExtArgs, GlobalOmitOptions>
|
||||
agents<T extends Prisma.Team$agentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$agentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AgentPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
aiUsages<T extends Prisma.Team$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
auditLogs<T extends Prisma.Team$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -3035,6 +3213,30 @@ export type Team$aiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalA
|
||||
distinct?: Prisma.AiUsageScalarFieldEnum | Prisma.AiUsageScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Team.auditLogs
|
||||
*/
|
||||
export type Team$auditLogsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the AuditLog
|
||||
*/
|
||||
select?: Prisma.AuditLogSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the AuditLog
|
||||
*/
|
||||
omit?: Prisma.AuditLogOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AuditLogInclude<ExtArgs> | null
|
||||
where?: Prisma.AuditLogWhereInput
|
||||
orderBy?: Prisma.AuditLogOrderByWithRelationInput | Prisma.AuditLogOrderByWithRelationInput[]
|
||||
cursor?: Prisma.AuditLogWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.AuditLogScalarFieldEnum | Prisma.AuditLogScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Team without action
|
||||
*/
|
||||
|
||||
+276
@@ -246,6 +246,7 @@ export type UserWhereInput = {
|
||||
shareLinks?: Prisma.ShareLinkListRelationFilter
|
||||
apiTokens?: Prisma.ApiTokenListRelationFilter
|
||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||
}
|
||||
|
||||
export type UserOrderByWithRelationInput = {
|
||||
@@ -278,6 +279,7 @@ export type UserOrderByWithRelationInput = {
|
||||
shareLinks?: Prisma.ShareLinkOrderByRelationAggregateInput
|
||||
apiTokens?: Prisma.ApiTokenOrderByRelationAggregateInput
|
||||
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
|
||||
auditLogs?: Prisma.AuditLogOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
export type UserWhereUniqueInput = Prisma.AtLeast<{
|
||||
@@ -313,6 +315,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
|
||||
shareLinks?: Prisma.ShareLinkListRelationFilter
|
||||
apiTokens?: Prisma.ApiTokenListRelationFilter
|
||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||
auditLogs?: Prisma.AuditLogListRelationFilter
|
||||
}, "id" | "email">
|
||||
|
||||
export type UserOrderByWithAggregationInput = {
|
||||
@@ -379,6 +382,7 @@ export type UserCreateInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateInput = {
|
||||
@@ -411,6 +415,7 @@ export type UserUncheckedCreateInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUpdateInput = {
|
||||
@@ -443,6 +448,7 @@ export type UserUpdateInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateInput = {
|
||||
@@ -475,6 +481,7 @@ export type UserUncheckedUpdateInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateManyInput = {
|
||||
@@ -861,6 +868,22 @@ export type UserUpdateOneWithoutAiUsagesNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutAiUsagesInput, Prisma.UserUpdateWithoutAiUsagesInput>, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
|
||||
}
|
||||
|
||||
export type UserCreateNestedOneWithoutAuditLogsInput = {
|
||||
create?: Prisma.XOR<Prisma.UserCreateWithoutAuditLogsInput, Prisma.UserUncheckedCreateWithoutAuditLogsInput>
|
||||
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAuditLogsInput
|
||||
connect?: Prisma.UserWhereUniqueInput
|
||||
}
|
||||
|
||||
export type UserUpdateOneWithoutAuditLogsNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.UserCreateWithoutAuditLogsInput, Prisma.UserUncheckedCreateWithoutAuditLogsInput>
|
||||
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAuditLogsInput
|
||||
upsert?: Prisma.UserUpsertWithoutAuditLogsInput
|
||||
disconnect?: Prisma.UserWhereInput | boolean
|
||||
delete?: Prisma.UserWhereInput | boolean
|
||||
connect?: Prisma.UserWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutAuditLogsInput, Prisma.UserUpdateWithoutAuditLogsInput>, Prisma.UserUncheckedUpdateWithoutAuditLogsInput>
|
||||
}
|
||||
|
||||
export type UserCreateWithoutSessionsInput = {
|
||||
id?: string
|
||||
type?: $Enums.UserType
|
||||
@@ -890,6 +913,7 @@ export type UserCreateWithoutSessionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutSessionsInput = {
|
||||
@@ -921,6 +945,7 @@ export type UserUncheckedCreateWithoutSessionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutSessionsInput = {
|
||||
@@ -968,6 +993,7 @@ export type UserUpdateWithoutSessionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutSessionsInput = {
|
||||
@@ -999,6 +1025,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAccountsInput = {
|
||||
@@ -1030,6 +1057,7 @@ export type UserCreateWithoutAccountsInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAccountsInput = {
|
||||
@@ -1061,6 +1089,7 @@ export type UserUncheckedCreateWithoutAccountsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAccountsInput = {
|
||||
@@ -1108,6 +1137,7 @@ export type UserUpdateWithoutAccountsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAccountsInput = {
|
||||
@@ -1139,6 +1169,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAuthTokensInput = {
|
||||
@@ -1170,6 +1201,7 @@ export type UserCreateWithoutAuthTokensInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAuthTokensInput = {
|
||||
@@ -1201,6 +1233,7 @@ export type UserUncheckedCreateWithoutAuthTokensInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAuthTokensInput = {
|
||||
@@ -1248,6 +1281,7 @@ export type UserUpdateWithoutAuthTokensInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAuthTokensInput = {
|
||||
@@ -1279,6 +1313,7 @@ export type UserUncheckedUpdateWithoutAuthTokensInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutTeamMembersInput = {
|
||||
@@ -1310,6 +1345,7 @@ export type UserCreateWithoutTeamMembersInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutTeamMembersInput = {
|
||||
@@ -1341,6 +1377,7 @@ export type UserUncheckedCreateWithoutTeamMembersInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutTeamMembersInput = {
|
||||
@@ -1388,6 +1425,7 @@ export type UserUpdateWithoutTeamMembersInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutTeamMembersInput = {
|
||||
@@ -1419,6 +1457,7 @@ export type UserUncheckedUpdateWithoutTeamMembersInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutShareLinksInput = {
|
||||
@@ -1450,6 +1489,7 @@ export type UserCreateWithoutShareLinksInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutShareLinksInput = {
|
||||
@@ -1481,6 +1521,7 @@ export type UserUncheckedCreateWithoutShareLinksInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutShareLinksInput = {
|
||||
@@ -1528,6 +1569,7 @@ export type UserUpdateWithoutShareLinksInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutShareLinksInput = {
|
||||
@@ -1559,6 +1601,7 @@ export type UserUncheckedUpdateWithoutShareLinksInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAssetsInput = {
|
||||
@@ -1590,6 +1633,7 @@ export type UserCreateWithoutAssetsInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAssetsInput = {
|
||||
@@ -1621,6 +1665,7 @@ export type UserUncheckedCreateWithoutAssetsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAssetsInput = {
|
||||
@@ -1668,6 +1713,7 @@ export type UserUpdateWithoutAssetsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAssetsInput = {
|
||||
@@ -1699,6 +1745,7 @@ export type UserUncheckedUpdateWithoutAssetsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutCommentsInput = {
|
||||
@@ -1730,6 +1777,7 @@ export type UserCreateWithoutCommentsInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCommentsInput = {
|
||||
@@ -1761,6 +1809,7 @@ export type UserUncheckedCreateWithoutCommentsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCommentsInput = {
|
||||
@@ -1797,6 +1846,7 @@ export type UserCreateWithoutCompletionChangedCommentsInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
|
||||
@@ -1828,6 +1878,7 @@ export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCompletionChangedCommentsInput = {
|
||||
@@ -1875,6 +1926,7 @@ export type UserUpdateWithoutCommentsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCommentsInput = {
|
||||
@@ -1906,6 +1958,7 @@ export type UserUncheckedUpdateWithoutCommentsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUpsertWithoutCompletionChangedCommentsInput = {
|
||||
@@ -1948,6 +2001,7 @@ export type UserUpdateWithoutCompletionChangedCommentsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
|
||||
@@ -1979,6 +2033,7 @@ export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutCreatedInvitesInput = {
|
||||
@@ -2010,6 +2065,7 @@ export type UserCreateWithoutCreatedInvitesInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCreatedInvitesInput = {
|
||||
@@ -2041,6 +2097,7 @@ export type UserUncheckedCreateWithoutCreatedInvitesInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCreatedInvitesInput = {
|
||||
@@ -2088,6 +2145,7 @@ export type UserUpdateWithoutCreatedInvitesInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
|
||||
@@ -2119,6 +2177,7 @@ export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutCreatedNotificationsInput = {
|
||||
@@ -2150,6 +2209,7 @@ export type UserCreateWithoutCreatedNotificationsInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
|
||||
@@ -2181,6 +2241,7 @@ export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCreatedNotificationsInput = {
|
||||
@@ -2217,6 +2278,7 @@ export type UserCreateWithoutNotificationsInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutNotificationsInput = {
|
||||
@@ -2248,6 +2310,7 @@ export type UserUncheckedCreateWithoutNotificationsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutNotificationsInput = {
|
||||
@@ -2295,6 +2358,7 @@ export type UserUpdateWithoutCreatedNotificationsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
|
||||
@@ -2326,6 +2390,7 @@ export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUpsertWithoutNotificationsInput = {
|
||||
@@ -2368,6 +2433,7 @@ export type UserUpdateWithoutNotificationsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutNotificationsInput = {
|
||||
@@ -2399,6 +2465,7 @@ export type UserUncheckedUpdateWithoutNotificationsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutTasksInput = {
|
||||
@@ -2430,6 +2497,7 @@ export type UserCreateWithoutTasksInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutTasksInput = {
|
||||
@@ -2461,6 +2529,7 @@ export type UserUncheckedCreateWithoutTasksInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutTasksInput = {
|
||||
@@ -2508,6 +2577,7 @@ export type UserUpdateWithoutTasksInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutTasksInput = {
|
||||
@@ -2539,6 +2609,7 @@ export type UserUncheckedUpdateWithoutTasksInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAgentInput = {
|
||||
@@ -2570,6 +2641,7 @@ export type UserCreateWithoutAgentInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAgentInput = {
|
||||
@@ -2601,6 +2673,7 @@ export type UserUncheckedCreateWithoutAgentInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAgentInput = {
|
||||
@@ -2648,6 +2721,7 @@ export type UserUpdateWithoutAgentInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAgentInput = {
|
||||
@@ -2679,6 +2753,7 @@ export type UserUncheckedUpdateWithoutAgentInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAgentSessionsInput = {
|
||||
@@ -2710,6 +2785,7 @@ export type UserCreateWithoutAgentSessionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAgentSessionsInput = {
|
||||
@@ -2741,6 +2817,7 @@ export type UserUncheckedCreateWithoutAgentSessionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAgentSessionsInput = {
|
||||
@@ -2788,6 +2865,7 @@ export type UserUpdateWithoutAgentSessionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAgentSessionsInput = {
|
||||
@@ -2819,6 +2897,7 @@ export type UserUncheckedUpdateWithoutAgentSessionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutUserMetadataInput = {
|
||||
@@ -2850,6 +2929,7 @@ export type UserCreateWithoutUserMetadataInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutUserMetadataInput = {
|
||||
@@ -2881,6 +2961,7 @@ export type UserUncheckedCreateWithoutUserMetadataInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutUserMetadataInput = {
|
||||
@@ -2928,6 +3009,7 @@ export type UserUpdateWithoutUserMetadataInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutUserMetadataInput = {
|
||||
@@ -2959,6 +3041,7 @@ export type UserUncheckedUpdateWithoutUserMetadataInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutCollectionsInput = {
|
||||
@@ -2990,6 +3073,7 @@ export type UserCreateWithoutCollectionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCollectionsInput = {
|
||||
@@ -3021,6 +3105,7 @@ export type UserUncheckedCreateWithoutCollectionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCollectionsInput = {
|
||||
@@ -3068,6 +3153,7 @@ export type UserUpdateWithoutCollectionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCollectionsInput = {
|
||||
@@ -3099,6 +3185,7 @@ export type UserUncheckedUpdateWithoutCollectionsInput = {
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutApiTokensInput = {
|
||||
@@ -3130,6 +3217,7 @@ export type UserCreateWithoutApiTokensInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutApiTokensInput = {
|
||||
@@ -3161,6 +3249,7 @@ export type UserUncheckedCreateWithoutApiTokensInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutApiTokensInput = {
|
||||
@@ -3208,6 +3297,7 @@ export type UserUpdateWithoutApiTokensInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutApiTokensInput = {
|
||||
@@ -3239,6 +3329,7 @@ export type UserUncheckedUpdateWithoutApiTokensInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAiUsagesInput = {
|
||||
@@ -3270,6 +3361,7 @@ export type UserCreateWithoutAiUsagesInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAiUsagesInput = {
|
||||
@@ -3301,6 +3393,7 @@ export type UserUncheckedCreateWithoutAiUsagesInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAiUsagesInput = {
|
||||
@@ -3348,6 +3441,7 @@ export type UserUpdateWithoutAiUsagesInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAiUsagesInput = {
|
||||
@@ -3379,6 +3473,151 @@ export type UserUncheckedUpdateWithoutAiUsagesInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
auditLogs?: Prisma.AuditLogUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAuditLogsInput = {
|
||||
id?: string
|
||||
type?: $Enums.UserType
|
||||
name: string
|
||||
email: string
|
||||
emailVerified?: boolean
|
||||
image?: string | null
|
||||
password?: string | null
|
||||
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
|
||||
guestEmail?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assets?: Prisma.AssetCreateNestedManyWithoutCreatorInput
|
||||
authTokens?: Prisma.AuthTokenCreateNestedManyWithoutUserInput
|
||||
tasks?: Prisma.TaskCreateNestedManyWithoutCreatorInput
|
||||
teamMembers?: Prisma.TeamMemberCreateNestedManyWithoutUserInput
|
||||
comments?: Prisma.AssetCommentCreateNestedManyWithoutCreatorInput
|
||||
completionChangedComments?: Prisma.AssetCommentCreateNestedManyWithoutCompletionLastChangedByInput
|
||||
createdInvites?: Prisma.InviteCreateNestedManyWithoutInviterInput
|
||||
createdNotifications?: Prisma.NotificationCreateNestedManyWithoutCreatorInput
|
||||
notifications?: Prisma.NotificationCreateNestedManyWithoutUserInput
|
||||
sessions?: Prisma.SessionCreateNestedManyWithoutUserInput
|
||||
accounts?: Prisma.AccountCreateNestedManyWithoutUserInput
|
||||
agent?: Prisma.AgentCreateNestedOneWithoutUserInput
|
||||
agentSessions?: Prisma.AgentSessionCreateNestedManyWithoutUserInput
|
||||
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAuditLogsInput = {
|
||||
id?: string
|
||||
type?: $Enums.UserType
|
||||
name: string
|
||||
email: string
|
||||
emailVerified?: boolean
|
||||
image?: string | null
|
||||
password?: string | null
|
||||
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
|
||||
guestEmail?: string | null
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
assets?: Prisma.AssetUncheckedCreateNestedManyWithoutCreatorInput
|
||||
authTokens?: Prisma.AuthTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
tasks?: Prisma.TaskUncheckedCreateNestedManyWithoutCreatorInput
|
||||
teamMembers?: Prisma.TeamMemberUncheckedCreateNestedManyWithoutUserInput
|
||||
comments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCreatorInput
|
||||
completionChangedComments?: Prisma.AssetCommentUncheckedCreateNestedManyWithoutCompletionLastChangedByInput
|
||||
createdInvites?: Prisma.InviteUncheckedCreateNestedManyWithoutInviterInput
|
||||
createdNotifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutCreatorInput
|
||||
notifications?: Prisma.NotificationUncheckedCreateNestedManyWithoutUserInput
|
||||
sessions?: Prisma.SessionUncheckedCreateNestedManyWithoutUserInput
|
||||
accounts?: Prisma.AccountUncheckedCreateNestedManyWithoutUserInput
|
||||
agent?: Prisma.AgentUncheckedCreateNestedOneWithoutUserInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedCreateNestedManyWithoutUserInput
|
||||
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAuditLogsInput = {
|
||||
where: Prisma.UserWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.UserCreateWithoutAuditLogsInput, Prisma.UserUncheckedCreateWithoutAuditLogsInput>
|
||||
}
|
||||
|
||||
export type UserUpsertWithoutAuditLogsInput = {
|
||||
update: Prisma.XOR<Prisma.UserUpdateWithoutAuditLogsInput, Prisma.UserUncheckedUpdateWithoutAuditLogsInput>
|
||||
create: Prisma.XOR<Prisma.UserCreateWithoutAuditLogsInput, Prisma.UserUncheckedCreateWithoutAuditLogsInput>
|
||||
where?: Prisma.UserWhereInput
|
||||
}
|
||||
|
||||
export type UserUpdateToOneWithWhereWithoutAuditLogsInput = {
|
||||
where?: Prisma.UserWhereInput
|
||||
data: Prisma.XOR<Prisma.UserUpdateWithoutAuditLogsInput, Prisma.UserUncheckedUpdateWithoutAuditLogsInput>
|
||||
}
|
||||
|
||||
export type UserUpdateWithoutAuditLogsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
email?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
|
||||
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assets?: Prisma.AssetUpdateManyWithoutCreatorNestedInput
|
||||
authTokens?: Prisma.AuthTokenUpdateManyWithoutUserNestedInput
|
||||
tasks?: Prisma.TaskUpdateManyWithoutCreatorNestedInput
|
||||
teamMembers?: Prisma.TeamMemberUpdateManyWithoutUserNestedInput
|
||||
comments?: Prisma.AssetCommentUpdateManyWithoutCreatorNestedInput
|
||||
completionChangedComments?: Prisma.AssetCommentUpdateManyWithoutCompletionLastChangedByNestedInput
|
||||
createdInvites?: Prisma.InviteUpdateManyWithoutInviterNestedInput
|
||||
createdNotifications?: Prisma.NotificationUpdateManyWithoutCreatorNestedInput
|
||||
notifications?: Prisma.NotificationUpdateManyWithoutUserNestedInput
|
||||
sessions?: Prisma.SessionUpdateManyWithoutUserNestedInput
|
||||
accounts?: Prisma.AccountUpdateManyWithoutUserNestedInput
|
||||
agent?: Prisma.AgentUpdateOneWithoutUserNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUpdateManyWithoutUserNestedInput
|
||||
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAuditLogsInput = {
|
||||
id?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
type?: Prisma.EnumUserTypeFieldUpdateOperationsInput | $Enums.UserType
|
||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
email?: Prisma.StringFieldUpdateOperationsInput | string
|
||||
emailVerified?: Prisma.BoolFieldUpdateOperationsInput | boolean
|
||||
image?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
password?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
agentSettings?:PrismaJson.AgentSettings | Prisma.NullableJsonNullValueInput
|
||||
guestEmail?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
||||
assets?: Prisma.AssetUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
authTokens?: Prisma.AuthTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
tasks?: Prisma.TaskUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
teamMembers?: Prisma.TeamMemberUncheckedUpdateManyWithoutUserNestedInput
|
||||
comments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
completionChangedComments?: Prisma.AssetCommentUncheckedUpdateManyWithoutCompletionLastChangedByNestedInput
|
||||
createdInvites?: Prisma.InviteUncheckedUpdateManyWithoutInviterNestedInput
|
||||
createdNotifications?: Prisma.NotificationUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
notifications?: Prisma.NotificationUncheckedUpdateManyWithoutUserNestedInput
|
||||
sessions?: Prisma.SessionUncheckedUpdateManyWithoutUserNestedInput
|
||||
accounts?: Prisma.AccountUncheckedUpdateManyWithoutUserNestedInput
|
||||
agent?: Prisma.AgentUncheckedUpdateOneWithoutUserNestedInput
|
||||
agentSessions?: Prisma.AgentSessionUncheckedUpdateManyWithoutUserNestedInput
|
||||
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
|
||||
@@ -3404,6 +3643,7 @@ export type UserCountOutputType = {
|
||||
shareLinks: number
|
||||
apiTokens: number
|
||||
aiUsages: number
|
||||
auditLogs: number
|
||||
}
|
||||
|
||||
export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
@@ -3424,6 +3664,7 @@ export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
|
||||
shareLinks?: boolean | UserCountOutputTypeCountShareLinksArgs
|
||||
apiTokens?: boolean | UserCountOutputTypeCountApiTokensArgs
|
||||
aiUsages?: boolean | UserCountOutputTypeCountAiUsagesArgs
|
||||
auditLogs?: boolean | UserCountOutputTypeCountAuditLogsArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3555,6 +3796,13 @@ export type UserCountOutputTypeCountAiUsagesArgs<ExtArgs extends runtime.Types.E
|
||||
where?: Prisma.AiUsageWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* UserCountOutputType without action
|
||||
*/
|
||||
export type UserCountOutputTypeCountAuditLogsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.AuditLogWhereInput
|
||||
}
|
||||
|
||||
|
||||
export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
@@ -3586,6 +3834,7 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
|
||||
shareLinks?: boolean | Prisma.User$shareLinksArgs<ExtArgs>
|
||||
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
|
||||
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
|
||||
auditLogs?: boolean | Prisma.User$auditLogsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["user"]>
|
||||
|
||||
@@ -3651,6 +3900,7 @@ export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
shareLinks?: boolean | Prisma.User$shareLinksArgs<ExtArgs>
|
||||
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
|
||||
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
|
||||
auditLogs?: boolean | Prisma.User$auditLogsArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
export type UserIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
|
||||
@@ -3677,6 +3927,7 @@ export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
shareLinks: Prisma.$ShareLinkPayload<ExtArgs>[]
|
||||
apiTokens: Prisma.$ApiTokenPayload<ExtArgs>[]
|
||||
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
|
||||
auditLogs: Prisma.$AuditLogPayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
@@ -4105,6 +4356,7 @@ export interface Prisma__UserClient<T, Null = never, ExtArgs extends runtime.Typ
|
||||
shareLinks<T extends Prisma.User$shareLinksArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$shareLinksArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ShareLinkPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
apiTokens<T extends Prisma.User$apiTokensArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$apiTokensArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$ApiTokenPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
aiUsages<T extends Prisma.User$aiUsagesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$aiUsagesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AiUsagePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
auditLogs<T extends Prisma.User$auditLogsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$auditLogsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$AuditLogPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -4964,6 +5216,30 @@ export type User$aiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalA
|
||||
distinct?: Prisma.AiUsageScalarFieldEnum | Prisma.AiUsageScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* User.auditLogs
|
||||
*/
|
||||
export type User$auditLogsArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the AuditLog
|
||||
*/
|
||||
select?: Prisma.AuditLogSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the AuditLog
|
||||
*/
|
||||
omit?: Prisma.AuditLogOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AuditLogInclude<ExtArgs> | null
|
||||
where?: Prisma.AuditLogWhereInput
|
||||
orderBy?: Prisma.AuditLogOrderByWithRelationInput | Prisma.AuditLogOrderByWithRelationInput[]
|
||||
cursor?: Prisma.AuditLogWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.AuditLogScalarFieldEnum | Prisma.AuditLogScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* User without action
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { z } from 'zod'
|
||||
import { AgentType } from '@shumai/db/enums'
|
||||
|
||||
export const agentTypeSchema = z.enum(['chat', 'autofill', 'embedding'])
|
||||
export type AgentType = z.infer<typeof agentTypeSchema>
|
||||
export { AgentType }
|
||||
export const agentTypeSchema = z.nativeEnum(AgentType)
|
||||
|
||||
export const thinkingLevelSchema = z.enum(['off', 'minimal', 'low', 'medium', 'high', 'xhigh'])
|
||||
export type ThinkingLevel = z.infer<typeof thinkingLevelSchema>
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export enum 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',
|
||||
}
|
||||
|
||||
export const auditLogSchema = z.object({
|
||||
id: z.string(),
|
||||
action: z.nativeEnum(AuditAction),
|
||||
teamId: z.string(),
|
||||
userId: z.string().nullable().optional(),
|
||||
projectId: z.string().nullable().optional(),
|
||||
itemId: z.string().nullable().optional(),
|
||||
createdAt: z.string(),
|
||||
})
|
||||
|
||||
export type AuditLog = z.infer<typeof auditLogSchema>
|
||||
|
||||
export const listAuditLogsQuerySchema = z.object({
|
||||
first: z.coerce.number().optional(),
|
||||
after: z.string().optional(),
|
||||
actions: z
|
||||
.union([z.nativeEnum(AuditAction), z.array(z.nativeEnum(AuditAction))])
|
||||
.transform((val) => (Array.isArray(val) ? val : [val]))
|
||||
.optional(),
|
||||
userIds: z
|
||||
.union([z.string(), z.array(z.string())])
|
||||
.transform((val) => (Array.isArray(val) ? val : [val]))
|
||||
.optional(),
|
||||
itemId: z.string().optional(),
|
||||
})
|
||||
|
||||
export type ListAuditLogsQuery = z.infer<typeof listAuditLogsQuerySchema>
|
||||
|
||||
export const listAuditLogsResponseSchema = z.object({
|
||||
nodes: z.array(auditLogSchema),
|
||||
pageInfo: z.object({
|
||||
hasNextPage: z.boolean(),
|
||||
endCursor: z.string().nullable(),
|
||||
}),
|
||||
total: z.number(),
|
||||
})
|
||||
|
||||
export type ListAuditLogsResponse = z.infer<typeof listAuditLogsResponseSchema>
|
||||
@@ -19,3 +19,4 @@ export * from './upload'
|
||||
export * from './user-metadata'
|
||||
export * from './versionStack'
|
||||
export * from './chat'
|
||||
export * from './auditLog'
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { z } from 'zod'
|
||||
import { InviteRole } from '@shumai/db/enums'
|
||||
|
||||
export { InviteRole }
|
||||
|
||||
export const inviteInfoSchema = z.object({
|
||||
code: z.string(),
|
||||
role: z.enum(['editor', 'reviewer', 'owner']),
|
||||
role: z.string(),
|
||||
teamId: z.string(),
|
||||
teamName: z.string(),
|
||||
projectId: z.string().optional(),
|
||||
@@ -14,13 +17,13 @@ export const inviteInfoSchema = z.object({
|
||||
export type InviteInfo = z.infer<typeof inviteInfoSchema>
|
||||
|
||||
export const createTeamInviteRequestSchema = z.object({
|
||||
role: z.enum(['editor', 'reviewer']),
|
||||
role: z.nativeEnum(InviteRole),
|
||||
})
|
||||
|
||||
export type CreateTeamInviteRequest = z.infer<typeof createTeamInviteRequestSchema>
|
||||
|
||||
export const createProjectInviteRequestSchema = z.object({
|
||||
role: z.enum(['editor', 'reviewer']),
|
||||
role: z.nativeEnum(InviteRole),
|
||||
})
|
||||
|
||||
export type CreateProjectInviteRequest = z.infer<typeof createProjectInviteRequestSchema>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { z } from 'zod'
|
||||
import { MetadataFieldScope } from '@shumai/db/enums'
|
||||
|
||||
export { MetadataFieldScope }
|
||||
|
||||
export const FieldType = {
|
||||
text: 'text',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from 'zod'
|
||||
import type { NotificationType } from '@shumai/db'
|
||||
import type { NotificationType } from '@shumai/db/enums'
|
||||
|
||||
export const teamUserInfoSchema = z.object({
|
||||
id: z.string().optional(),
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { z } from 'zod'
|
||||
import { UserType, TeamMemberScope } from '@shumai/db/enums'
|
||||
import { paginationPageInfoSchema, paginationParamsSchema } from './pagination'
|
||||
|
||||
export { UserType, TeamMemberScope }
|
||||
|
||||
export const createTeamRequestSchema = z.object({
|
||||
name: z.string(),
|
||||
})
|
||||
@@ -50,9 +53,9 @@ export const userInfoSchema = z.object({
|
||||
name: z.string(),
|
||||
role: z.enum(['owner', 'editor', 'reviewer', 'bot', 'unknown']),
|
||||
email: z.string().optional(),
|
||||
type: z.enum(['human', 'agent']).optional(),
|
||||
type: z.nativeEnum(UserType).optional(),
|
||||
image: z.string().optional(),
|
||||
scope: z.enum(['team', 'project']).optional(),
|
||||
scope: z.nativeEnum(TeamMemberScope).optional(),
|
||||
})
|
||||
export type UserInfo = z.infer<typeof userInfoSchema>
|
||||
|
||||
|
||||
@@ -0,0 +1,387 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
|
||||
import { useInView } from 'react-intersection-observer'
|
||||
import { client } from '@/ui/api/client'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { AuditAction } from '@shumai/dtos'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/ui/components/ui/card'
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/ui/components/ui/table'
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
|
||||
import { Badge } from '@/ui/components/ui/badge'
|
||||
import { Input } from '@/ui/components/ui/input'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/ui/components/ui/popover'
|
||||
import { Checkbox } from '@/ui/components/ui/checkbox'
|
||||
import { Loader2, Search, Filter, Activity, X } from 'lucide-react'
|
||||
import { formatTimeAgo } from '@/ui/lib/time'
|
||||
|
||||
const ALL_AUDIT_ACTIONS = Object.values(AuditAction)
|
||||
|
||||
interface MemberInfo {
|
||||
id: string
|
||||
userId?: string
|
||||
name?: string
|
||||
image?: string
|
||||
user?: {
|
||||
id: string
|
||||
name?: string
|
||||
image?: string
|
||||
}
|
||||
}
|
||||
|
||||
interface AuditLogsDashboardProps {
|
||||
teamId: string
|
||||
}
|
||||
|
||||
export function AuditLogsDashboard({ teamId }: AuditLogsDashboardProps) {
|
||||
const [selectedActions, setSelectedActions] = useState<AuditAction[]>([])
|
||||
const [selectedUserIds, setSelectedUserIds] = useState<string[]>([])
|
||||
const [itemIdFilter, setItemIdFilter] = useState<string>('')
|
||||
|
||||
const { ref: loadMoreRef, inView } = useInView()
|
||||
|
||||
// Fetch team members for user filter options
|
||||
const { data: membersData } = useQuery({
|
||||
queryKey: ['teams', teamId, 'members'],
|
||||
queryFn: async () => {
|
||||
const res = await client.api.teams[':teamId'].members.$get({
|
||||
param: { teamId },
|
||||
query: {},
|
||||
})
|
||||
if (!res.ok) return []
|
||||
return (await res.json()) as MemberInfo[]
|
||||
},
|
||||
enabled: !!teamId,
|
||||
})
|
||||
|
||||
const teamMembers = membersData || []
|
||||
|
||||
// Infinite query for audit logs
|
||||
const { data, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } =
|
||||
useInfiniteQuery({
|
||||
queryKey: ['teams', teamId, 'audit-logs', selectedActions, selectedUserIds, itemIdFilter],
|
||||
queryFn: async ({ pageParam }) => {
|
||||
const res = await client.api.teams[':teamId']['audit-logs'].$get({
|
||||
param: { teamId },
|
||||
query: {
|
||||
first: '20',
|
||||
after: pageParam ? String(pageParam) : undefined,
|
||||
actions: selectedActions.length > 0 ? selectedActions : undefined,
|
||||
userIds: selectedUserIds.length > 0 ? selectedUserIds : undefined,
|
||||
itemId: itemIdFilter.trim() || undefined,
|
||||
},
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch audit logs')
|
||||
return await res.json()
|
||||
},
|
||||
initialPageParam: '',
|
||||
getNextPageParam: (lastPage) => lastPage.pageInfo.endCursor || undefined,
|
||||
enabled: !!teamId,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (inView && hasNextPage && !isFetchingNextPage) {
|
||||
fetchNextPage()
|
||||
}
|
||||
}, [inView, hasNextPage, isFetchingNextPage, fetchNextPage])
|
||||
|
||||
const allLogs = data?.pages.flatMap((page) => page.nodes) || []
|
||||
const totalCount = data?.pages[0]?.total ?? 0
|
||||
|
||||
const toggleAction = (action: AuditAction) => {
|
||||
setSelectedActions((prev) =>
|
||||
prev.includes(action) ? prev.filter((a) => a !== action) : [...prev, action],
|
||||
)
|
||||
}
|
||||
|
||||
const toggleUser = (userId: string) => {
|
||||
setSelectedUserIds((prev) =>
|
||||
prev.includes(userId) ? prev.filter((u) => u !== userId) : [...prev, userId],
|
||||
)
|
||||
}
|
||||
|
||||
const getActionBadge = (action: string) => {
|
||||
if (action.includes('delete') || action.includes('remove') || action.includes('revoke')) {
|
||||
return (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="bg-destructive/10 text-destructive border-destructive/20 font-mono text-xs"
|
||||
>
|
||||
{action}
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
if (action.includes('create') || action.includes('add')) {
|
||||
return (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 font-mono text-xs"
|
||||
>
|
||||
{action}
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
if (action.includes('update') || action.includes('reparent') || action.includes('copy')) {
|
||||
return (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 font-mono text-xs"
|
||||
>
|
||||
{action}
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="bg-muted text-muted-foreground border-border font-mono text-xs"
|
||||
>
|
||||
{action}
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
|
||||
const memberMap = new Map(teamMembers.map((m) => [m.userId || m.id, m]))
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<Card className="border border-border/50 shadow-xs">
|
||||
<CardHeader className="pb-4">
|
||||
<div className="flex flex-col md:flex-row md:items-center justify-between gap-4">
|
||||
<div>
|
||||
<CardTitle className="text-xl font-bold flex items-center gap-2">
|
||||
<Activity className="h-5 w-5 text-primary" />
|
||||
{m.audit_logs()}
|
||||
</CardTitle>
|
||||
<CardDescription className="mt-1">{m.audit_logs_description()}</CardDescription>
|
||||
</div>
|
||||
{totalCount > 0 && (
|
||||
<Badge variant="secondary" className="w-fit text-xs font-normal">
|
||||
{totalCount} {m.audit_logs()}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Filter Bar */}
|
||||
<div className="mt-4 flex flex-wrap items-center gap-3 pt-4 border-t border-border/40">
|
||||
{/* Action Multi-select */}
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button variant="outline" size="sm" className="h-9 gap-2 text-xs border-dashed">
|
||||
<Filter className="h-3.5 w-3.5" />
|
||||
{m.filter_by_action()}
|
||||
{selectedActions.length > 0 && (
|
||||
<Badge variant="secondary" className="ml-1 px-1.5 py-0 text-[10px]">
|
||||
{selectedActions.length}
|
||||
</Badge>
|
||||
)}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-64 p-2" align="start">
|
||||
<div className="text-xs font-semibold text-muted-foreground px-2 py-1 mb-1">
|
||||
{m.select_actions()}
|
||||
</div>
|
||||
<div className="max-h-60 overflow-y-auto space-y-1 pr-1">
|
||||
{ALL_AUDIT_ACTIONS.map((act) => (
|
||||
<label
|
||||
key={act}
|
||||
className="flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs"
|
||||
>
|
||||
<Checkbox
|
||||
checked={selectedActions.includes(act)}
|
||||
onCheckedChange={() => toggleAction(act)}
|
||||
/>
|
||||
<span className="font-mono">{act}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
{selectedActions.length > 0 && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground"
|
||||
onClick={() => setSelectedActions([])}
|
||||
>
|
||||
Clear Actions
|
||||
</Button>
|
||||
)}
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
|
||||
{/* User Multi-select */}
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button variant="outline" size="sm" className="h-9 gap-2 text-xs border-dashed">
|
||||
<Filter className="h-3.5 w-3.5" />
|
||||
{m.filter_by_user()}
|
||||
{selectedUserIds.length > 0 && (
|
||||
<Badge variant="secondary" className="ml-1 px-1.5 py-0 text-[10px]">
|
||||
{selectedUserIds.length}
|
||||
</Badge>
|
||||
)}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-64 p-2" align="start">
|
||||
<div className="text-xs font-semibold text-muted-foreground px-2 py-1 mb-1">
|
||||
{m.select_users()}
|
||||
</div>
|
||||
<div className="max-h-60 overflow-y-auto space-y-1 pr-1">
|
||||
{teamMembers.map((member) => {
|
||||
const uId = member.userId || member.user?.id || member.id
|
||||
const uName = member.user?.name || member.name || uId
|
||||
const uImage = member.user?.image || member.image
|
||||
return (
|
||||
<label
|
||||
key={uId}
|
||||
className="flex items-center gap-2 px-2 py-1.5 hover:bg-accent rounded-md cursor-pointer text-xs"
|
||||
>
|
||||
<Checkbox
|
||||
checked={selectedUserIds.includes(uId)}
|
||||
onCheckedChange={() => toggleUser(uId)}
|
||||
/>
|
||||
<Avatar className="h-5 w-5">
|
||||
<AvatarImage src={uImage || undefined} />
|
||||
<AvatarFallback className="text-[10px]">
|
||||
{uName.slice(0, 2).toUpperCase()}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="truncate">{uName}</span>
|
||||
</label>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
{selectedUserIds.length > 0 && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="w-full mt-2 h-7 text-xs text-muted-foreground hover:text-foreground"
|
||||
onClick={() => setSelectedUserIds([])}
|
||||
>
|
||||
Clear Users
|
||||
</Button>
|
||||
)}
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
|
||||
{/* Item ID Input */}
|
||||
<div className="relative flex-1 min-w-[200px] max-w-xs">
|
||||
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
|
||||
<Input
|
||||
type="text"
|
||||
placeholder={m.search_item_id()}
|
||||
value={itemIdFilter}
|
||||
onChange={(e) => setItemIdFilter(e.target.value)}
|
||||
className="pl-8 pr-8 h-9 text-xs"
|
||||
/>
|
||||
{itemIdFilter && (
|
||||
<button
|
||||
onClick={() => setItemIdFilter('')}
|
||||
className="absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Reset All Filters */}
|
||||
{(selectedActions.length > 0 || selectedUserIds.length > 0 || itemIdFilter) && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-9 px-2 text-xs text-muted-foreground hover:text-foreground"
|
||||
onClick={() => {
|
||||
setSelectedActions([])
|
||||
setSelectedUserIds([])
|
||||
setItemIdFilter('')
|
||||
}}
|
||||
>
|
||||
Clear all
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent className="p-0">
|
||||
{isLoading ? (
|
||||
<div className="flex h-64 items-center justify-center">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
|
||||
</div>
|
||||
) : isError ? (
|
||||
<div className="p-8 text-center text-sm text-destructive">
|
||||
Failed to load audit logs.
|
||||
</div>
|
||||
) : allLogs.length === 0 ? (
|
||||
<div className="p-12 text-center text-sm text-muted-foreground">
|
||||
{m.no_audit_logs()}
|
||||
</div>
|
||||
) : (
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow className="hover:bg-transparent border-b border-border/50">
|
||||
<TableHead className="w-[180px] text-xs font-semibold">{m.action()}</TableHead>
|
||||
<TableHead className="w-[200px] text-xs font-semibold">{m.user()}</TableHead>
|
||||
<TableHead className="text-xs font-semibold">{m.item_id()}</TableHead>
|
||||
<TableHead className="text-xs font-semibold">{m.project_id()}</TableHead>
|
||||
<TableHead className="w-[160px] text-right text-xs font-semibold">
|
||||
{m.timestamp()}
|
||||
</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{allLogs.map((log) => {
|
||||
const member = log.userId ? memberMap.get(log.userId) : null
|
||||
const userName = member?.user?.name || member?.name || log.userId || 'System'
|
||||
const userImage = member?.user?.image || member?.image
|
||||
|
||||
return (
|
||||
<TableRow key={log.id} className="hover:bg-muted/40 transition-colors">
|
||||
<TableCell className="py-3 font-medium">
|
||||
{getActionBadge(log.action)}
|
||||
</TableCell>
|
||||
<TableCell className="py-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<Avatar className="h-6 w-6">
|
||||
<AvatarImage src={userImage || undefined} />
|
||||
<AvatarFallback className="text-[10px]">
|
||||
{userName.slice(0, 2).toUpperCase()}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="text-xs font-medium text-foreground truncate max-w-[140px]">
|
||||
{userName}
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="py-3 text-xs font-mono text-muted-foreground">
|
||||
{log.itemId || '-'}
|
||||
</TableCell>
|
||||
<TableCell className="py-3 text-xs font-mono text-muted-foreground">
|
||||
{log.projectId || '-'}
|
||||
</TableCell>
|
||||
<TableCell className="py-3 text-right text-xs text-muted-foreground">
|
||||
{formatTimeAgo(log.createdAt)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
})}
|
||||
</TableBody>
|
||||
</Table>
|
||||
)}
|
||||
|
||||
{/* Infinite Scroll sentinel */}
|
||||
<div ref={loadMoreRef} className="py-4 flex justify-center">
|
||||
{isFetchingNextPage && (
|
||||
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -896,5 +896,20 @@
|
||||
"session_type_comment": "Comment",
|
||||
"session_type_chat": "Chat",
|
||||
"session_type_naming": "Naming",
|
||||
"untitled_session": "Untitled Session"
|
||||
"untitled_session": "Untitled Session",
|
||||
"team_category": "Team",
|
||||
"audit_logs": "Audit Logs",
|
||||
"audit_logs_description": "View and monitor all audit logs of team actions.",
|
||||
"filter_by_action": "Filter by Action",
|
||||
"filter_by_user": "Filter by User",
|
||||
"filter_by_item_id": "Filter by Item ID",
|
||||
"action": "Action",
|
||||
"user": "User",
|
||||
"item_id": "Item ID",
|
||||
"project_id": "Project ID",
|
||||
"timestamp": "Timestamp",
|
||||
"no_audit_logs": "No audit logs found",
|
||||
"search_item_id": "Search Item ID...",
|
||||
"select_actions": "Select Actions",
|
||||
"select_users": "Select Users"
|
||||
}
|
||||
|
||||
@@ -896,5 +896,20 @@
|
||||
"session_type_comment": "评论",
|
||||
"session_type_chat": "对话",
|
||||
"session_type_naming": "命名",
|
||||
"untitled_session": "未命名会话"
|
||||
"untitled_session": "未命名会话",
|
||||
"team_category": "团队",
|
||||
"audit_logs": "审计日志",
|
||||
"audit_logs_description": "查看并监控团队操作的所有审计日志。",
|
||||
"filter_by_action": "按操作筛选",
|
||||
"filter_by_user": "按用户筛选",
|
||||
"filter_by_item_id": "按项目/条目 ID 筛选",
|
||||
"action": "操作",
|
||||
"user": "用户",
|
||||
"item_id": "条目 ID",
|
||||
"project_id": "项目 ID",
|
||||
"timestamp": "时间戳",
|
||||
"no_audit_logs": "未找到审计日志",
|
||||
"search_item_id": "搜索条目 ID...",
|
||||
"select_actions": "选择操作",
|
||||
"select_users": "选择用户"
|
||||
}
|
||||
|
||||
+15
@@ -842,4 +842,19 @@ export * from "./session_type_comment.js";
|
||||
export * from "./session_type_chat.js";
|
||||
export * from "./session_type_naming.js";
|
||||
export * from "./untitled_session.js";
|
||||
export * from "./team_category.js";
|
||||
export * from "./audit_logs.js";
|
||||
export * from "./audit_logs_description.js";
|
||||
export * from "./filter_by_action.js";
|
||||
export * from "./filter_by_user.js";
|
||||
export * from "./filter_by_item_id.js";
|
||||
export * from "./action.js";
|
||||
export * from "./user.js";
|
||||
export * from "./item_id.js";
|
||||
export * from "./project_id.js";
|
||||
export * from "./timestamp.js";
|
||||
export * from "./no_audit_logs.js";
|
||||
export * from "./search_item_id.js";
|
||||
export * from "./select_actions.js";
|
||||
export * from "./select_users.js";
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
|
||||
+16
-1
@@ -843,4 +843,19 @@ export * from './no_sessions_found.js'
|
||||
export * from './session_type_comment.js'
|
||||
export * from './session_type_chat.js'
|
||||
export * from './session_type_naming.js'
|
||||
export * from './untitled_session.js'
|
||||
export * from './untitled_session.js'
|
||||
export * from './team_category.js'
|
||||
export * from './audit_logs.js'
|
||||
export * from './audit_logs_description.js'
|
||||
export * from './filter_by_action.js'
|
||||
export * from './filter_by_user.js'
|
||||
export * from './filter_by_item_id.js'
|
||||
export * from './action.js'
|
||||
export * from './user.js'
|
||||
export * from './item_id.js'
|
||||
export * from './project_id.js'
|
||||
export * from './timestamp.js'
|
||||
export * from './no_audit_logs.js'
|
||||
export * from './search_item_id.js'
|
||||
export * from './select_actions.js'
|
||||
export * from './select_users.js'
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Action" |
|
||||
*
|
||||
* @param {ActionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const action: ((inputs?: ActionInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<ActionInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type ActionInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} ActionInputs */
|
||||
|
||||
const en_action = /** @type {(inputs: ActionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Action`)
|
||||
};
|
||||
|
||||
const zh_action = /** @type {(inputs: ActionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`操作`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Action" |
|
||||
*
|
||||
* @param {ActionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const action = /** @type {((inputs?: ActionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<ActionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_action(inputs)
|
||||
return zh_action(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Audit Logs" |
|
||||
*
|
||||
* @param {Audit_LogsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const audit_logs: ((inputs?: Audit_LogsInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Audit_LogsInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Audit_LogsInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Audit_LogsInputs */
|
||||
|
||||
const en_audit_logs = /** @type {(inputs: Audit_LogsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Audit Logs`)
|
||||
};
|
||||
|
||||
const zh_audit_logs = /** @type {(inputs: Audit_LogsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`审计日志`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Audit Logs" |
|
||||
*
|
||||
* @param {Audit_LogsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const audit_logs = /** @type {((inputs?: Audit_LogsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Audit_LogsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_audit_logs(inputs)
|
||||
return zh_audit_logs(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "View and monitor all audit logs of team actions." |
|
||||
*
|
||||
* @param {Audit_Logs_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const audit_logs_description: ((inputs?: Audit_Logs_DescriptionInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Audit_Logs_DescriptionInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Audit_Logs_DescriptionInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Audit_Logs_DescriptionInputs */
|
||||
|
||||
const en_audit_logs_description = /** @type {(inputs: Audit_Logs_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`View and monitor all audit logs of team actions.`)
|
||||
};
|
||||
|
||||
const zh_audit_logs_description = /** @type {(inputs: Audit_Logs_DescriptionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`查看并监控团队操作的所有审计日志。`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "View and monitor all audit logs of team actions." |
|
||||
*
|
||||
* @param {Audit_Logs_DescriptionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const audit_logs_description = /** @type {((inputs?: Audit_Logs_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Audit_Logs_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_audit_logs_description(inputs)
|
||||
return zh_audit_logs_description(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Filter by Action" |
|
||||
*
|
||||
* @param {Filter_By_ActionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const filter_by_action: ((inputs?: Filter_By_ActionInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Filter_By_ActionInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Filter_By_ActionInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Filter_By_ActionInputs */
|
||||
|
||||
const en_filter_by_action = /** @type {(inputs: Filter_By_ActionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Filter by Action`)
|
||||
};
|
||||
|
||||
const zh_filter_by_action = /** @type {(inputs: Filter_By_ActionInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`按操作筛选`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Filter by Action" |
|
||||
*
|
||||
* @param {Filter_By_ActionInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const filter_by_action = /** @type {((inputs?: Filter_By_ActionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Filter_By_ActionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_filter_by_action(inputs)
|
||||
return zh_filter_by_action(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Filter by Item ID" |
|
||||
*
|
||||
* @param {Filter_By_Item_IdInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const filter_by_item_id: ((inputs?: Filter_By_Item_IdInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Filter_By_Item_IdInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Filter_By_Item_IdInputs = {};
|
||||
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Filter_By_Item_IdInputs */
|
||||
|
||||
const en_filter_by_item_id = /** @type {(inputs: Filter_By_Item_IdInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Filter by Item ID`)
|
||||
};
|
||||
|
||||
const zh_filter_by_item_id = /** @type {(inputs: Filter_By_Item_IdInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`按项目/条目 ID 筛选`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Filter by Item ID" |
|
||||
*
|
||||
* @param {Filter_By_Item_IdInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const filter_by_item_id = /** @type {((inputs?: Filter_By_Item_IdInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Filter_By_Item_IdInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_filter_by_item_id(inputs)
|
||||
return zh_filter_by_item_id(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Filter by User" |
|
||||
*
|
||||
* @param {Filter_By_UserInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const filter_by_user: ((inputs?: Filter_By_UserInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Filter_By_UserInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Filter_By_UserInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Filter_By_UserInputs */
|
||||
|
||||
const en_filter_by_user = /** @type {(inputs: Filter_By_UserInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Filter by User`)
|
||||
};
|
||||
|
||||
const zh_filter_by_user = /** @type {(inputs: Filter_By_UserInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`按用户筛选`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Filter by User" |
|
||||
*
|
||||
* @param {Filter_By_UserInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const filter_by_user = /** @type {((inputs?: Filter_By_UserInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Filter_By_UserInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_filter_by_user(inputs)
|
||||
return zh_filter_by_user(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Item ID" |
|
||||
*
|
||||
* @param {Item_IdInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const item_id: ((inputs?: Item_IdInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Item_IdInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Item_IdInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Item_IdInputs */
|
||||
|
||||
const en_item_id = /** @type {(inputs: Item_IdInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Item ID`)
|
||||
};
|
||||
|
||||
const zh_item_id = /** @type {(inputs: Item_IdInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`条目 ID`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Item ID" |
|
||||
*
|
||||
* @param {Item_IdInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const item_id = /** @type {((inputs?: Item_IdInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Item_IdInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_item_id(inputs)
|
||||
return zh_item_id(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "No audit logs found" |
|
||||
*
|
||||
* @param {No_Audit_LogsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const no_audit_logs: ((inputs?: No_Audit_LogsInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<No_Audit_LogsInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type No_Audit_LogsInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} No_Audit_LogsInputs */
|
||||
|
||||
const en_no_audit_logs = /** @type {(inputs: No_Audit_LogsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`No audit logs found`)
|
||||
};
|
||||
|
||||
const zh_no_audit_logs = /** @type {(inputs: No_Audit_LogsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`未找到审计日志`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "No audit logs found" |
|
||||
*
|
||||
* @param {No_Audit_LogsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const no_audit_logs = /** @type {((inputs?: No_Audit_LogsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<No_Audit_LogsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_no_audit_logs(inputs)
|
||||
return zh_no_audit_logs(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Project ID" |
|
||||
*
|
||||
* @param {Project_IdInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const project_id: ((inputs?: Project_IdInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Project_IdInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Project_IdInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Project_IdInputs */
|
||||
|
||||
const en_project_id = /** @type {(inputs: Project_IdInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Project ID`)
|
||||
};
|
||||
|
||||
const zh_project_id = /** @type {(inputs: Project_IdInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`项目 ID`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Project ID" |
|
||||
*
|
||||
* @param {Project_IdInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const project_id = /** @type {((inputs?: Project_IdInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Project_IdInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_project_id(inputs)
|
||||
return zh_project_id(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Search Item ID..." |
|
||||
*
|
||||
* @param {Search_Item_IdInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const search_item_id: ((inputs?: Search_Item_IdInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Search_Item_IdInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Search_Item_IdInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Search_Item_IdInputs */
|
||||
|
||||
const en_search_item_id = /** @type {(inputs: Search_Item_IdInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Search Item ID...`)
|
||||
};
|
||||
|
||||
const zh_search_item_id = /** @type {(inputs: Search_Item_IdInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`搜索条目 ID...`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Search Item ID..." |
|
||||
*
|
||||
* @param {Search_Item_IdInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const search_item_id = /** @type {((inputs?: Search_Item_IdInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Search_Item_IdInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_search_item_id(inputs)
|
||||
return zh_search_item_id(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Select Actions" |
|
||||
*
|
||||
* @param {Select_ActionsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const select_actions: ((inputs?: Select_ActionsInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Select_ActionsInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Select_ActionsInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Select_ActionsInputs */
|
||||
|
||||
const en_select_actions = /** @type {(inputs: Select_ActionsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Select Actions`)
|
||||
};
|
||||
|
||||
const zh_select_actions = /** @type {(inputs: Select_ActionsInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`选择操作`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Select Actions" |
|
||||
*
|
||||
* @param {Select_ActionsInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const select_actions = /** @type {((inputs?: Select_ActionsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_ActionsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_select_actions(inputs)
|
||||
return zh_select_actions(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Select Users" |
|
||||
*
|
||||
* @param {Select_UsersInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const select_users: ((inputs?: Select_UsersInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Select_UsersInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Select_UsersInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Select_UsersInputs */
|
||||
|
||||
const en_select_users = /** @type {(inputs: Select_UsersInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Select Users`)
|
||||
};
|
||||
|
||||
const zh_select_users = /** @type {(inputs: Select_UsersInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`选择用户`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Select Users" |
|
||||
*
|
||||
* @param {Select_UsersInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const select_users = /** @type {((inputs?: Select_UsersInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_UsersInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_select_users(inputs)
|
||||
return zh_select_users(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Team" |
|
||||
*
|
||||
* @param {Team_CategoryInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const team_category: ((inputs?: Team_CategoryInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Team_CategoryInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type Team_CategoryInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} Team_CategoryInputs */
|
||||
|
||||
const en_team_category = /** @type {(inputs: Team_CategoryInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Team`)
|
||||
};
|
||||
|
||||
const zh_team_category = /** @type {(inputs: Team_CategoryInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`团队`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Team" |
|
||||
*
|
||||
* @param {Team_CategoryInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const team_category = /** @type {((inputs?: Team_CategoryInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Team_CategoryInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_team_category(inputs)
|
||||
return zh_team_category(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Timestamp" |
|
||||
*
|
||||
* @param {TimestampInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const timestamp: ((inputs?: TimestampInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<TimestampInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type TimestampInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} TimestampInputs */
|
||||
|
||||
const en_timestamp = /** @type {(inputs: TimestampInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`Timestamp`)
|
||||
};
|
||||
|
||||
const zh_timestamp = /** @type {(inputs: TimestampInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`时间戳`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "Timestamp" |
|
||||
*
|
||||
* @param {TimestampInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const timestamp = /** @type {((inputs?: TimestampInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<TimestampInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_timestamp(inputs)
|
||||
return zh_timestamp(inputs)
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "User" |
|
||||
*
|
||||
* @param {UserInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const user: ((inputs?: UserInputs, options?: {
|
||||
locale?: "en" | "zh";
|
||||
}) => LocalizedString) & import("../runtime.js").MessageMetadata<UserInputs, {
|
||||
locale?: "en" | "zh";
|
||||
}, {}>;
|
||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||
export type UserInputs = {};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||
|
||||
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||
|
||||
/** @typedef {{}} UserInputs */
|
||||
|
||||
const en_user = /** @type {(inputs: UserInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`User`)
|
||||
};
|
||||
|
||||
const zh_user = /** @type {(inputs: UserInputs) => LocalizedString} */ () => {
|
||||
return /** @type {LocalizedString} */ (`用户`)
|
||||
};
|
||||
|
||||
/**
|
||||
* | output |
|
||||
* | --- |
|
||||
* | "User" |
|
||||
*
|
||||
* @param {UserInputs} inputs
|
||||
* @param {{ locale?: "en" | "zh" }} options
|
||||
* @returns {LocalizedString}
|
||||
*/
|
||||
export const user = /** @type {((inputs?: UserInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<UserInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
|
||||
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||
if (locale === "en") return en_user(inputs)
|
||||
return zh_user(inputs)
|
||||
});
|
||||
@@ -6,13 +6,14 @@ import { cn } from '@/ui/lib/utils'
|
||||
import { m } from '@/ui/paraglide/messages.js'
|
||||
import { AiUsageDashboard } from '@/ui/components/dashboard/AiUsageDashboard'
|
||||
import { AgentSessionsDashboard } from '@/ui/components/dashboard/AgentSessionsDashboard'
|
||||
import { BarChart2, Loader2, MessagesSquare, ShieldAlert } from 'lucide-react'
|
||||
import { AuditLogsDashboard } from '@/ui/components/dashboard/AuditLogsDashboard'
|
||||
import { Activity, BarChart2, Loader2, MessagesSquare, ShieldAlert } from 'lucide-react'
|
||||
|
||||
type DashboardTab = 'ai-usage' | 'ai-sessions'
|
||||
type DashboardTab = 'audit-logs' | 'ai-usage' | 'ai-sessions'
|
||||
|
||||
function TeamDashboardPage() {
|
||||
const { teamId } = Route.useParams()
|
||||
const [activeTab, setActiveTab] = useState<DashboardTab>('ai-usage')
|
||||
const [activeTab, setActiveTab] = useState<DashboardTab>('audit-logs')
|
||||
|
||||
const { data: me, isLoading: isMeLoading } = useQuery({
|
||||
queryKey: ['teams', teamId, 'me'],
|
||||
@@ -54,6 +55,28 @@ function TeamDashboardPage() {
|
||||
{m.dashboard()}
|
||||
</div>
|
||||
|
||||
{/* Team Category (Above AI Category) */}
|
||||
<div className="mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border">
|
||||
{m.team_category()}
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={() => setActiveTab('audit-logs')}
|
||||
className={cn(
|
||||
'w-full flex items-center gap-3 px-4 py-3 text-sm font-medium rounded-lg transition-all',
|
||||
activeTab === 'audit-logs'
|
||||
? 'bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-sidebar-border'
|
||||
: 'text-sidebar-foreground/75 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
||||
)}
|
||||
>
|
||||
<Activity className="w-5 h-5" />
|
||||
{m.audit_logs()}
|
||||
{activeTab === 'audit-logs' && (
|
||||
<div className="ml-auto w-1.5 h-1.5 rounded-full bg-sidebar-primary" />
|
||||
)}
|
||||
</button>
|
||||
|
||||
{/* AI Category */}
|
||||
<div className="mt-4 mb-2 px-4 text-xs font-semibold text-sidebar-foreground/60 uppercase tracking-wider pt-4 border-t border-sidebar-border">
|
||||
{m.ai()}
|
||||
</div>
|
||||
@@ -95,6 +118,7 @@ function TeamDashboardPage() {
|
||||
{/* Main Content Area */}
|
||||
<div className="flex-1 overflow-y-auto p-4 md:p-8">
|
||||
<div className="max-w-6xl mx-auto space-y-8">
|
||||
{activeTab === 'audit-logs' && <AuditLogsDashboard teamId={teamId} />}
|
||||
{activeTab === 'ai-usage' && <AiUsageDashboard teamId={teamId} />}
|
||||
{activeTab === 'ai-sessions' && <AgentSessionsDashboard teamId={teamId} />}
|
||||
</div>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"@shumai/core": ["./packages/core/src/index.ts"],
|
||||
"@shumai/core/src/*": ["./packages/core/src/*"],
|
||||
"@shumai/db": ["./packages/db/src/index.ts"],
|
||||
"@shumai/db/enums": ["./packages/db/src/generated/prisma/enums.ts"],
|
||||
"@shumai/db/test": ["./packages/db/src/test.ts"],
|
||||
"@shumai/dtos": ["./packages/dtos/src/index.ts"],
|
||||
"@shumai/workflow-core": ["./packages/workflow-core/src/index.ts"],
|
||||
|
||||
Reference in New Issue
Block a user