mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 04:18:20 +00:00
feat(ai-usage): add team and member token usage tracking and APIs
This commit is contained in:
@@ -95,6 +95,84 @@ describe('Agent Activities', () => {
|
||||
expect(piAgent.createAgentSession).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should subscribe to harness events and record usage for assistant message_end events', async () => {
|
||||
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
|
||||
const spyRecordUsage = vi.spyOn(aiUsageService, 'recordUsage').mockResolvedValue()
|
||||
|
||||
let subscribeListener!: (event: unknown) => Promise<void>
|
||||
const mockHarness = {
|
||||
subscribe: vi.fn().mockImplementation((listener) => {
|
||||
subscribeListener = listener
|
||||
}),
|
||||
prompt: vi.fn().mockImplementation(async () => {
|
||||
// Trigger assistant message end event during turn
|
||||
if (subscribeListener) {
|
||||
await subscribeListener({
|
||||
type: 'message_end',
|
||||
message: {
|
||||
role: 'assistant',
|
||||
usage: {
|
||||
input: 150,
|
||||
output: 75,
|
||||
cacheRead: 25,
|
||||
totalTokens: 225,
|
||||
cost: { total: 0.0015 },
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
return {
|
||||
content: [{ type: 'text', text: 'Subscribed response' }],
|
||||
usage: { input: 150, output: 75 },
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
const mockSession = {
|
||||
getEntries: vi.fn().mockResolvedValue([]),
|
||||
getStorage: vi.fn().mockReturnValue({ sessionId: 'mock-session-id' }),
|
||||
}
|
||||
|
||||
vi.mocked(piAgent.createAgentSession).mockResolvedValue({
|
||||
session: mockSession as unknown as Session<DatabaseSessionMetadata>,
|
||||
harness: mockHarness as unknown as AgentHarness,
|
||||
})
|
||||
|
||||
const context = {
|
||||
agent: { id: 'b1', provider: { name: 'google' }, modelRef: { modelId: 'gemini' } },
|
||||
dbProviders: [],
|
||||
teamSkills: [],
|
||||
allowedDomains: [],
|
||||
} as unknown as AgentExecutionContext
|
||||
|
||||
const res = await agentChatActivity({
|
||||
teamId: 'team123',
|
||||
agentId: 'b1',
|
||||
message: 'Hi',
|
||||
imageUrls: [],
|
||||
projectId: 'p1',
|
||||
folderId: 'f1',
|
||||
sessionId: 'mock-session-id',
|
||||
userId: 'user123',
|
||||
context,
|
||||
})
|
||||
|
||||
expect(res.text).toBe('Subscribed response')
|
||||
expect(res.usage.inputTokens).toBe(150)
|
||||
expect(res.usage.outputTokens).toBe(75)
|
||||
expect(res.usage.cacheReadTokens).toBe(25)
|
||||
expect(res.usage.cost).toBe(0.0015)
|
||||
expect(spyRecordUsage).toHaveBeenCalledWith({
|
||||
teamId: 'team123',
|
||||
userId: 'user123',
|
||||
inputTokens: 150,
|
||||
outputTokens: 75,
|
||||
cacheReadTokens: 25,
|
||||
totalTokens: 225,
|
||||
cost: 0.0015,
|
||||
})
|
||||
})
|
||||
|
||||
it('should register local cancellation handler and call harness.abort when cancelled in local mode', async () => {
|
||||
let resolvePrompt!: (value: {
|
||||
content: Array<{ type: string; text: string } | { type: string }>
|
||||
|
||||
@@ -25,11 +25,15 @@ import {
|
||||
type DbProviderInfo,
|
||||
} from '../index'
|
||||
|
||||
import { aiUsageService } from '@shumai/core/src/ai-usage/ai-usage'
|
||||
import { UpdateAssetMetadataRequest } from '@shumai/dtos'
|
||||
|
||||
export interface Usage {
|
||||
inputTokens: number
|
||||
outputTokens: number
|
||||
cacheReadTokens: number
|
||||
totalTokens: number
|
||||
cost: number
|
||||
model: string
|
||||
}
|
||||
|
||||
@@ -209,8 +213,58 @@ If you need to create files in the local filesystem (for example, a temporary fi
|
||||
} as unknown as SessionTreeEntry)
|
||||
}
|
||||
|
||||
let totalInputTokens = 0
|
||||
let totalOutputTokens = 0
|
||||
let totalCacheReadTokens = 0
|
||||
let grandTotalTokens = 0
|
||||
let totalCost = 0
|
||||
|
||||
if (typeof harness.subscribe === 'function') {
|
||||
harness.subscribe(async (event) => {
|
||||
if (event.type === 'message_end' && event.message.role === 'assistant') {
|
||||
const assistantMsg = event.message
|
||||
const u = assistantMsg.usage
|
||||
if (u) {
|
||||
const inputTokens = u.input || 0
|
||||
const outputTokens = u.output || 0
|
||||
const cacheReadTokens = u.cacheRead || 0
|
||||
const totalTokens = u.totalTokens || inputTokens + outputTokens
|
||||
const cost = u.cost?.total || 0
|
||||
|
||||
totalInputTokens += inputTokens
|
||||
totalOutputTokens += outputTokens
|
||||
totalCacheReadTokens += cacheReadTokens
|
||||
grandTotalTokens += totalTokens
|
||||
totalCost += cost
|
||||
|
||||
try {
|
||||
await aiUsageService.recordUsage({
|
||||
teamId: params.teamId,
|
||||
userId: params.userId,
|
||||
inputTokens,
|
||||
outputTokens,
|
||||
cacheReadTokens,
|
||||
totalTokens,
|
||||
cost,
|
||||
})
|
||||
} catch (err) {
|
||||
logger.error({ err }, 'Failed to record AI usage')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const assistantMessage = await harness.prompt(params.prompt, { images: imagesToPass })
|
||||
|
||||
if (totalInputTokens === 0 && totalOutputTokens === 0 && assistantMessage.usage) {
|
||||
totalInputTokens = assistantMessage.usage.input || 0
|
||||
totalOutputTokens = assistantMessage.usage.output || 0
|
||||
totalCacheReadTokens = assistantMessage.usage.cacheRead || 0
|
||||
grandTotalTokens = assistantMessage.usage.totalTokens || totalInputTokens + totalOutputTokens
|
||||
totalCost = assistantMessage.usage.cost?.total || 0
|
||||
}
|
||||
|
||||
const sessionEntries = await session.getEntries()
|
||||
sessionEntries.forEach((entry) => {
|
||||
if (entry.type === 'message') {
|
||||
@@ -243,8 +297,11 @@ If you need to create files in the local filesystem (for example, a temporary fi
|
||||
|
||||
const usage: Usage = {
|
||||
model: modelId,
|
||||
inputTokens: assistantMessage.usage?.input || 0,
|
||||
outputTokens: assistantMessage.usage?.output || 0,
|
||||
inputTokens: totalInputTokens,
|
||||
outputTokens: totalOutputTokens,
|
||||
cacheReadTokens: totalCacheReadTokens,
|
||||
totalTokens: grandTotalTokens,
|
||||
cost: totalCost,
|
||||
}
|
||||
|
||||
const storage = session.getStorage()
|
||||
|
||||
+17
-17
@@ -7,21 +7,21 @@ import {
|
||||
} from '@earendil-works/pi-agent-core'
|
||||
import { NodeExecutionEnv } from '@earendil-works/pi-agent-core/node'
|
||||
import { getModel } from '@earendil-works/pi-ai/compat'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { Type, type TSchema } from '@sinclair/typebox'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { agentService } from '@shumai/core/src/agent/agent'
|
||||
import { DatabaseSessionStorage } from './database-session-storage'
|
||||
import { createAnalyzeImageTool } from './tools/analyze-image'
|
||||
import { createScreenshotTool } from './tools/screenshot'
|
||||
import { createReadPdfPagesTool } from './tools/read-pdf-pages'
|
||||
import { createCreateFileTool } from './tools/create-file'
|
||||
import { createCreateFolderTool } from './tools/create-folder'
|
||||
import { createCreateVersionTool } from './tools/create-version'
|
||||
import { createListAssetsTool } from './tools/list-assets'
|
||||
import { createReadPdfPagesTool } from './tools/read-pdf-pages'
|
||||
import { createReadSkillTool } from './tools/read-skill'
|
||||
import { createSandboxedBashTool } from './tools/sandboxed-bash'
|
||||
import { createScreenshotTool } from './tools/screenshot'
|
||||
|
||||
export interface DbModelInfo {
|
||||
modelId: string
|
||||
@@ -380,15 +380,15 @@ export function formatSkillsForPrompt(
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
import { registerWorkflow, registerActivities } from '@shumai/workflow-core'
|
||||
import { WorkflowTaskType } from '@shumai/db'
|
||||
import { agentEmbeddingMedia } from './workflows/agent-embedding'
|
||||
import { queryEmbeddingForSearch } from './workflows/query-embedding-for-search'
|
||||
import { agentAutofillMedia } from './workflows/agent-autofill'
|
||||
import { agentChat } from './workflows/agent-chat'
|
||||
import { agentToolCall } from './workflows/agent-tool-call'
|
||||
import { registerActivities, registerWorkflow } from '@shumai/workflow-core'
|
||||
import * as agentActivities from './activities/agent'
|
||||
import * as aiActivities from './activities/ai'
|
||||
import { agentAutofillMedia } from './workflows/agent-autofill'
|
||||
import { agentChat } from './workflows/agent-chat'
|
||||
import { agentEmbeddingMedia } from './workflows/agent-embedding'
|
||||
import { agentToolCall } from './workflows/agent-tool-call'
|
||||
import { queryEmbeddingForSearch } from './workflows/query-embedding-for-search'
|
||||
|
||||
export function initAgentWorkflows() {
|
||||
registerWorkflow(WorkflowTaskType.ai_embedding, agentEmbeddingMedia)
|
||||
@@ -401,19 +401,19 @@ export function initAgentWorkflows() {
|
||||
registerActivities(aiActivities)
|
||||
}
|
||||
|
||||
export * from './database-session-storage'
|
||||
export * from './activities/agent'
|
||||
export {
|
||||
extractAiMetadataActivity,
|
||||
generateEmbeddingActivity,
|
||||
generateImageEmbeddingActivity,
|
||||
generateTextEmbeddingActivity,
|
||||
generateVideoChunkEmbeddingActivity,
|
||||
type ExtractAiMetadataParams,
|
||||
type GeneratedEmbedding,
|
||||
type GenerateEmbeddingParams,
|
||||
generateEmbeddingActivity,
|
||||
type GenerateTextEmbeddingParams,
|
||||
generateTextEmbeddingActivity,
|
||||
type ExtractAiMetadataParams,
|
||||
extractAiMetadataActivity,
|
||||
generateImageEmbeddingActivity,
|
||||
generateVideoChunkEmbeddingActivity,
|
||||
} from './activities/ai'
|
||||
export * from './database-session-storage'
|
||||
export * from './workflows/agent-autofill'
|
||||
export * from './workflows/agent-chat'
|
||||
export * from './workflows/agent-embedding'
|
||||
|
||||
@@ -37,6 +37,13 @@ vi.mock('@shumai/core/src/user/api-token', () => ({
|
||||
},
|
||||
}))
|
||||
|
||||
vi.mock('@shumai/core/src/ai-usage/ai-usage', () => ({
|
||||
aiUsageService: {
|
||||
recordUsage: vi.fn(),
|
||||
getTeamUsageStats: vi.fn(),
|
||||
},
|
||||
}))
|
||||
|
||||
describe('team api', () => {
|
||||
const app = new Hono().use('*', authMiddleware).route('/', teamRoute)
|
||||
let mockCreateTeam: any // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
@@ -403,5 +410,66 @@ describe('team api', () => {
|
||||
expect(data).toEqual({ success: true })
|
||||
expect(apiTokenService.deleteToken).toHaveBeenCalledWith('user1', 'token1')
|
||||
})
|
||||
|
||||
it('GET /teams/:teamId/ai-usage returns team usage stats for owner', async () => {
|
||||
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
|
||||
vi.mocked(aiUsageService.getTeamUsageStats).mockResolvedValue({
|
||||
timeframe: '30d',
|
||||
team: {
|
||||
inputTokens: 1000,
|
||||
outputTokens: 500,
|
||||
cacheReadTokens: 200,
|
||||
totalTokens: 1500,
|
||||
cost: 0.005,
|
||||
},
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/ai-usage?timeframe=30d')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.team.totalTokens).toBe(1500)
|
||||
expect(authzService.hasPermission).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: 't1',
|
||||
}),
|
||||
)
|
||||
expect(aiUsageService.getTeamUsageStats).toHaveBeenCalledWith({
|
||||
teamId: 't1',
|
||||
timeframe: '30d',
|
||||
userId: undefined,
|
||||
})
|
||||
})
|
||||
|
||||
it('GET /teams/:teamId/ai-usage?userId=user1 returns specific member usage stats', async () => {
|
||||
const { aiUsageService } = await import('@shumai/core/src/ai-usage/ai-usage')
|
||||
vi.mocked(aiUsageService.getTeamUsageStats).mockResolvedValue({
|
||||
timeframe: '7d',
|
||||
member: {
|
||||
userId: 'user1',
|
||||
userName: 'Test User',
|
||||
userEmail: 'user1@example.com',
|
||||
role: 'owner',
|
||||
inputTokens: 400,
|
||||
outputTokens: 200,
|
||||
cacheReadTokens: 50,
|
||||
totalTokens: 600,
|
||||
cost: 0.002,
|
||||
},
|
||||
})
|
||||
|
||||
const res = await app.request('/teams/t1/ai-usage?timeframe=7d&userId=user1')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
const data = await res.json()
|
||||
expect(data.member.userId).toBe('user1')
|
||||
expect(aiUsageService.getTeamUsageStats).toHaveBeenCalledWith({
|
||||
teamId: 't1',
|
||||
timeframe: '7d',
|
||||
userId: 'user1',
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -15,8 +15,9 @@ import {
|
||||
updateTeamMemberRoleRequestSchema,
|
||||
createApiTokenRequestSchema,
|
||||
} from '@shumai/dtos'
|
||||
import { updateUserMetadataRequestSchema } 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 type { Prisma } from '@shumai/db'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
@@ -313,5 +314,25 @@ const route = new Hono<{ Variables: { user: User } }>()
|
||||
await apiTokenService.deleteToken(user.id, tokenId)
|
||||
return c.json({ success: true })
|
||||
})
|
||||
.get('/teams/:teamId/ai-usage', zValidator('query', getTeamAiUsageQuerySchema), async (c) => {
|
||||
const user = c.get('user')
|
||||
const teamId = c.req.param('teamId')
|
||||
const { timeframe, userId } = c.req.valid('query')
|
||||
|
||||
await authzService.hasPermission({
|
||||
user,
|
||||
permission: Permission.Admin,
|
||||
type: ResourceType.Team,
|
||||
id: teamId,
|
||||
})
|
||||
|
||||
const stats = await aiUsageService.getTeamUsageStats({
|
||||
teamId,
|
||||
timeframe,
|
||||
userId,
|
||||
})
|
||||
|
||||
return c.json(stats)
|
||||
})
|
||||
|
||||
export default route
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { prisma } from '@shumai/db'
|
||||
import { setupTestDbHooks } from '@shumai/db/test'
|
||||
import { aiUsageService } from './ai-usage'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
|
||||
describe('AiUsageService', () => {
|
||||
setupTestDbHooks()
|
||||
|
||||
async function createTestTeamAndUser() {
|
||||
const user = await prisma.user.create({
|
||||
data: {
|
||||
name: 'Usage Test User',
|
||||
email: `usage-test-${Date.now()}-${Math.random()}@example.com`,
|
||||
},
|
||||
})
|
||||
|
||||
const team = await prisma.team.create({
|
||||
data: {
|
||||
name: 'Usage Test Team',
|
||||
},
|
||||
})
|
||||
|
||||
const teamMember = await prisma.teamMember.create({
|
||||
data: {
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
role: 'owner',
|
||||
},
|
||||
})
|
||||
|
||||
return { user, team, teamMember }
|
||||
}
|
||||
|
||||
it('records usage for both team total and specific member', async () => {
|
||||
const { team, user } = await createTestTeamAndUser()
|
||||
|
||||
const now = new Date()
|
||||
await aiUsageService.recordUsage({
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
inputTokens: 100,
|
||||
outputTokens: 50,
|
||||
cacheReadTokens: 20,
|
||||
totalTokens: 150,
|
||||
cost: 0.001,
|
||||
timestamp: now,
|
||||
})
|
||||
|
||||
// Verify database rows
|
||||
const records = await prisma.aiUsage.findMany({
|
||||
where: { teamId: team.id },
|
||||
})
|
||||
|
||||
expect(records).toHaveLength(2)
|
||||
|
||||
const teamRecord = records.find((r) => r.userId === null)
|
||||
expect(teamRecord).toBeDefined()
|
||||
expect(teamRecord?.inputTokens).toBe(100)
|
||||
expect(teamRecord?.outputTokens).toBe(50)
|
||||
expect(teamRecord?.cacheReadTokens).toBe(20)
|
||||
expect(teamRecord?.totalTokens).toBe(150)
|
||||
expect(teamRecord?.cost).toBeCloseTo(0.001)
|
||||
|
||||
const memberRecord = records.find((r) => r.userId === user.id)
|
||||
expect(memberRecord).toBeDefined()
|
||||
expect(memberRecord?.inputTokens).toBe(100)
|
||||
expect(memberRecord?.outputTokens).toBe(50)
|
||||
expect(memberRecord?.cacheReadTokens).toBe(20)
|
||||
expect(memberRecord?.totalTokens).toBe(150)
|
||||
expect(memberRecord?.cost).toBeCloseTo(0.001)
|
||||
})
|
||||
|
||||
it('increments existing hourly buckets for team and member', async () => {
|
||||
const { team, user } = await createTestTeamAndUser()
|
||||
|
||||
const now = new Date()
|
||||
await aiUsageService.recordUsage({
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
inputTokens: 100,
|
||||
outputTokens: 50,
|
||||
cacheReadTokens: 10,
|
||||
totalTokens: 150,
|
||||
cost: 0.001,
|
||||
timestamp: now,
|
||||
})
|
||||
|
||||
await aiUsageService.recordUsage({
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
inputTokens: 200,
|
||||
outputTokens: 100,
|
||||
cacheReadTokens: 30,
|
||||
totalTokens: 300,
|
||||
cost: 0.002,
|
||||
timestamp: now,
|
||||
})
|
||||
|
||||
const teamStats = await aiUsageService.getTeamUsageStats({
|
||||
teamId: team.id,
|
||||
timeframe: '1h',
|
||||
})
|
||||
|
||||
expect(teamStats.team).toBeDefined()
|
||||
expect(teamStats.team?.inputTokens).toBe(300)
|
||||
expect(teamStats.team?.outputTokens).toBe(150)
|
||||
expect(teamStats.team?.cacheReadTokens).toBe(40)
|
||||
expect(teamStats.team?.totalTokens).toBe(450)
|
||||
expect(teamStats.team?.cost).toBeCloseTo(0.003)
|
||||
|
||||
const memberStats = await aiUsageService.getTeamUsageStats({
|
||||
teamId: team.id,
|
||||
timeframe: '1h',
|
||||
userId: user.id,
|
||||
})
|
||||
|
||||
expect(memberStats.member).toBeDefined()
|
||||
expect(memberStats.member?.userId).toBe(user.id)
|
||||
expect(memberStats.member?.inputTokens).toBe(300)
|
||||
expect(memberStats.member?.outputTokens).toBe(150)
|
||||
expect(memberStats.member?.cacheReadTokens).toBe(40)
|
||||
expect(memberStats.member?.totalTokens).toBe(450)
|
||||
expect(memberStats.member?.cost).toBeCloseTo(0.003)
|
||||
})
|
||||
|
||||
it('handles background system tasks with no userId', async () => {
|
||||
const { team } = await createTestTeamAndUser()
|
||||
|
||||
await aiUsageService.recordUsage({
|
||||
teamId: team.id,
|
||||
userId: null,
|
||||
inputTokens: 50,
|
||||
outputTokens: 25,
|
||||
cacheReadTokens: 5,
|
||||
totalTokens: 75,
|
||||
cost: 0.0005,
|
||||
})
|
||||
|
||||
const records = await prisma.aiUsage.findMany({
|
||||
where: { teamId: team.id },
|
||||
})
|
||||
|
||||
expect(records).toHaveLength(1)
|
||||
expect(records[0].userId).toBeNull()
|
||||
expect(records[0].inputTokens).toBe(50)
|
||||
})
|
||||
|
||||
it('filters statistics correctly by timeframe', async () => {
|
||||
const { team, user } = await createTestTeamAndUser()
|
||||
|
||||
const now = new Date()
|
||||
|
||||
// 30 minutes ago (within 1h)
|
||||
const recent = new Date(now.getTime() - 30 * 60 * 1000)
|
||||
// 2 hours ago (within 24h, outside 1h)
|
||||
const twoHoursAgo = new Date(now.getTime() - 2 * 60 * 60 * 1000)
|
||||
// 3 days ago (within 7d, outside 24h)
|
||||
const threeDaysAgo = new Date(now.getTime() - 3 * 24 * 60 * 60 * 1000)
|
||||
|
||||
await aiUsageService.recordUsage({
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
inputTokens: 100,
|
||||
outputTokens: 50,
|
||||
cacheReadTokens: 10,
|
||||
totalTokens: 150,
|
||||
cost: 0.001,
|
||||
timestamp: recent,
|
||||
})
|
||||
|
||||
await aiUsageService.recordUsage({
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
inputTokens: 200,
|
||||
outputTokens: 100,
|
||||
cacheReadTokens: 20,
|
||||
totalTokens: 300,
|
||||
cost: 0.002,
|
||||
timestamp: twoHoursAgo,
|
||||
})
|
||||
|
||||
await aiUsageService.recordUsage({
|
||||
teamId: team.id,
|
||||
userId: user.id,
|
||||
inputTokens: 400,
|
||||
outputTokens: 200,
|
||||
cacheReadTokens: 40,
|
||||
totalTokens: 600,
|
||||
cost: 0.004,
|
||||
timestamp: threeDaysAgo,
|
||||
})
|
||||
|
||||
// 1h timeframe should only include recent
|
||||
const stats1h = await aiUsageService.getTeamUsageStats({
|
||||
teamId: team.id,
|
||||
timeframe: '1h',
|
||||
})
|
||||
expect(stats1h.team?.inputTokens).toBe(100)
|
||||
|
||||
// 24h timeframe should include recent + 2 hours ago
|
||||
const stats24h = await aiUsageService.getTeamUsageStats({
|
||||
teamId: team.id,
|
||||
timeframe: '24h',
|
||||
})
|
||||
expect(stats24h.team?.inputTokens).toBe(300)
|
||||
|
||||
// 7d timeframe should include all 3
|
||||
const stats7d = await aiUsageService.getTeamUsageStats({
|
||||
teamId: team.id,
|
||||
timeframe: '7d',
|
||||
})
|
||||
expect(stats7d.team?.inputTokens).toBe(700)
|
||||
})
|
||||
|
||||
it('throws 404 when querying non-existent team member', async () => {
|
||||
const { team } = await createTestTeamAndUser()
|
||||
|
||||
await expect(
|
||||
aiUsageService.getTeamUsageStats({
|
||||
teamId: team.id,
|
||||
timeframe: '30d',
|
||||
userId: 'non-existent-user-id',
|
||||
}),
|
||||
).rejects.toThrow(HTTPException)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,209 @@
|
||||
import { prisma } from '@shumai/db'
|
||||
import type { TeamUsageStatsResponse, Timeframe } from '@shumai/dtos'
|
||||
import { HTTPException } from 'hono/http-exception'
|
||||
|
||||
export interface RecordUsageParams {
|
||||
teamId: string
|
||||
userId?: string | null
|
||||
inputTokens: number
|
||||
outputTokens: number
|
||||
cacheReadTokens: number
|
||||
totalTokens: number
|
||||
cost: number
|
||||
timestamp?: Date
|
||||
}
|
||||
|
||||
export interface GetTeamUsageStatsParams {
|
||||
teamId: string
|
||||
timeframe: Timeframe
|
||||
userId?: string
|
||||
}
|
||||
|
||||
export class AiUsageService {
|
||||
private async incrementBucket(params: {
|
||||
teamId: string
|
||||
userId: string | null
|
||||
periodStart: Date
|
||||
inputTokens: number
|
||||
outputTokens: number
|
||||
cacheReadTokens: number
|
||||
totalTokens: number
|
||||
cost: number
|
||||
}): Promise<void> {
|
||||
const existing = await prisma.aiUsage.findFirst({
|
||||
where: {
|
||||
teamId: params.teamId,
|
||||
userId: params.userId,
|
||||
periodStart: params.periodStart,
|
||||
},
|
||||
})
|
||||
|
||||
if (existing) {
|
||||
await prisma.aiUsage.update({
|
||||
where: { id: existing.id },
|
||||
data: {
|
||||
inputTokens: { increment: params.inputTokens },
|
||||
outputTokens: { increment: params.outputTokens },
|
||||
cacheReadTokens: { increment: params.cacheReadTokens },
|
||||
totalTokens: { increment: params.totalTokens },
|
||||
cost: { increment: params.cost },
|
||||
},
|
||||
})
|
||||
} else {
|
||||
await prisma.aiUsage.create({
|
||||
data: {
|
||||
teamId: params.teamId,
|
||||
userId: params.userId,
|
||||
periodStart: params.periodStart,
|
||||
inputTokens: params.inputTokens,
|
||||
outputTokens: params.outputTokens,
|
||||
cacheReadTokens: params.cacheReadTokens,
|
||||
totalTokens: params.totalTokens,
|
||||
cost: params.cost,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async recordUsage(params: RecordUsageParams): Promise<void> {
|
||||
const timestamp = params.timestamp ?? new Date()
|
||||
const periodStart = new Date(timestamp)
|
||||
periodStart.setMinutes(0, 0, 0)
|
||||
periodStart.setMilliseconds(0)
|
||||
|
||||
// 1. Update/create Team Total record (userId = null)
|
||||
await this.incrementBucket({
|
||||
teamId: params.teamId,
|
||||
userId: null,
|
||||
periodStart,
|
||||
inputTokens: params.inputTokens,
|
||||
outputTokens: params.outputTokens,
|
||||
cacheReadTokens: params.cacheReadTokens,
|
||||
totalTokens: params.totalTokens,
|
||||
cost: params.cost,
|
||||
})
|
||||
|
||||
// 2. If triggered by a team member, update/create Member Usage record (userId = params.userId)
|
||||
if (params.userId) {
|
||||
await this.incrementBucket({
|
||||
teamId: params.teamId,
|
||||
userId: params.userId,
|
||||
periodStart,
|
||||
inputTokens: params.inputTokens,
|
||||
outputTokens: params.outputTokens,
|
||||
cacheReadTokens: params.cacheReadTokens,
|
||||
totalTokens: params.totalTokens,
|
||||
cost: params.cost,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async getTeamUsageStats(params: GetTeamUsageStatsParams): Promise<TeamUsageStatsResponse> {
|
||||
const now = new Date()
|
||||
const since = new Date(now)
|
||||
|
||||
switch (params.timeframe) {
|
||||
case '1h':
|
||||
since.setHours(since.getHours() - 1)
|
||||
break
|
||||
case '24h':
|
||||
since.setDate(since.getDate() - 1)
|
||||
break
|
||||
case '7d':
|
||||
since.setDate(since.getDate() - 7)
|
||||
break
|
||||
case '30d':
|
||||
since.setDate(since.getDate() - 30)
|
||||
break
|
||||
}
|
||||
|
||||
if (!params.userId) {
|
||||
// Return Team-Level Usage (userId = null)
|
||||
const teamRecords = await prisma.aiUsage.findMany({
|
||||
where: {
|
||||
teamId: params.teamId,
|
||||
userId: null,
|
||||
periodStart: { gte: since },
|
||||
},
|
||||
})
|
||||
|
||||
let inputTokens = 0
|
||||
let outputTokens = 0
|
||||
let cacheReadTokens = 0
|
||||
let totalTokens = 0
|
||||
let cost = 0
|
||||
|
||||
for (const r of teamRecords) {
|
||||
inputTokens += r.inputTokens
|
||||
outputTokens += r.outputTokens
|
||||
cacheReadTokens += r.cacheReadTokens
|
||||
totalTokens += r.totalTokens
|
||||
cost += r.cost
|
||||
}
|
||||
|
||||
return {
|
||||
timeframe: params.timeframe,
|
||||
team: {
|
||||
inputTokens,
|
||||
outputTokens,
|
||||
cacheReadTokens,
|
||||
totalTokens,
|
||||
cost: Math.round(cost * 1000000) / 1000000,
|
||||
},
|
||||
}
|
||||
} else {
|
||||
// Return Specific Member Usage
|
||||
const teamMember = await prisma.teamMember.findFirst({
|
||||
where: {
|
||||
teamId: params.teamId,
|
||||
userId: params.userId,
|
||||
},
|
||||
include: { user: true },
|
||||
})
|
||||
|
||||
if (!teamMember) {
|
||||
throw new HTTPException(404, { message: 'Team member not found' })
|
||||
}
|
||||
|
||||
const memberRecords = await prisma.aiUsage.findMany({
|
||||
where: {
|
||||
teamId: params.teamId,
|
||||
userId: params.userId,
|
||||
periodStart: { gte: since },
|
||||
},
|
||||
})
|
||||
|
||||
let inputTokens = 0
|
||||
let outputTokens = 0
|
||||
let cacheReadTokens = 0
|
||||
let totalTokens = 0
|
||||
let cost = 0
|
||||
|
||||
for (const r of memberRecords) {
|
||||
inputTokens += r.inputTokens
|
||||
outputTokens += r.outputTokens
|
||||
cacheReadTokens += r.cacheReadTokens
|
||||
totalTokens += r.totalTokens
|
||||
cost += r.cost
|
||||
}
|
||||
|
||||
return {
|
||||
timeframe: params.timeframe,
|
||||
member: {
|
||||
userId: teamMember.user.id,
|
||||
userName: teamMember.user.name,
|
||||
userEmail: teamMember.user.email,
|
||||
userImage: teamMember.user.image,
|
||||
role: teamMember.role,
|
||||
inputTokens,
|
||||
outputTokens,
|
||||
cacheReadTokens,
|
||||
totalTokens,
|
||||
cost: Math.round(cost * 1000000) / 1000000,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const aiUsageService = new AiUsageService()
|
||||
@@ -21,3 +21,4 @@ export * from './versionStack/versionStack'
|
||||
export * from './hyrumtoken'
|
||||
export * from './pagination'
|
||||
export * from './chat/chat'
|
||||
export * from './ai-usage/ai-usage'
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "ai_usages" (
|
||||
"id" TEXT NOT NULL,
|
||||
"team_id" TEXT NOT NULL,
|
||||
"user_id" TEXT,
|
||||
"period_start" TIMESTAMP(3) NOT NULL,
|
||||
"input_tokens" INTEGER NOT NULL DEFAULT 0,
|
||||
"output_tokens" INTEGER NOT NULL DEFAULT 0,
|
||||
"cache_read_tokens" INTEGER NOT NULL DEFAULT 0,
|
||||
"total_tokens" INTEGER NOT NULL DEFAULT 0,
|
||||
"cost" DOUBLE PRECISION NOT NULL DEFAULT 0,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "ai_usages_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ai_usages_team_id_period_start_idx" ON "ai_usages"("team_id", "period_start");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ai_usages_team_id_user_id_period_start_idx" ON "ai_usages"("team_id", "user_id", "period_start");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_team_id_fkey" FOREIGN KEY ("team_id") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ai_usages" ADD CONSTRAINT "ai_usages_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -155,6 +155,7 @@ model User {
|
||||
collections Collection[] @relation("UserToCollection")
|
||||
shareLinks ShareLink[] @relation("UserToShareLink")
|
||||
apiTokens ApiToken[] @relation("UserToApiToken")
|
||||
aiUsages AiUsage[] @relation("UserToAiUsage")
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -237,6 +238,7 @@ model Team {
|
||||
skills Skill[] @relation("TeamToSkill")
|
||||
sandbox Sandbox? @relation("TeamToSandbox")
|
||||
agents Agent[] @relation("TeamToAgent")
|
||||
aiUsages AiUsage[] @relation("TeamToAiUsage")
|
||||
|
||||
@@map("teams")
|
||||
}
|
||||
@@ -814,3 +816,25 @@ model ApiToken {
|
||||
|
||||
@@map("api_tokens")
|
||||
}
|
||||
|
||||
model AiUsage {
|
||||
id String @id @default(ulid())
|
||||
teamId String @map("team_id")
|
||||
userId String? @map("user_id")
|
||||
periodStart DateTime @map("period_start")
|
||||
inputTokens Int @default(0) @map("input_tokens")
|
||||
outputTokens Int @default(0) @map("output_tokens")
|
||||
cacheReadTokens Int @default(0) @map("cache_read_tokens")
|
||||
totalTokens Int @default(0) @map("total_tokens")
|
||||
cost Float @default(0) @map("cost")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
team Team @relation("TeamToAiUsage", fields: [teamId], references: [id], onDelete: Cascade)
|
||||
user User? @relation("UserToAiUsage", fields: [userId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@map("ai_usages")
|
||||
@@index([teamId, periodStart])
|
||||
@@index([teamId, userId, periodStart])
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -182,3 +182,8 @@ export type Collection = Prisma.CollectionModel
|
||||
*
|
||||
*/
|
||||
export type ApiToken = Prisma.ApiTokenModel
|
||||
/**
|
||||
* Model AiUsage
|
||||
*
|
||||
*/
|
||||
export type AiUsage = Prisma.AiUsageModel
|
||||
|
||||
+5
@@ -206,3 +206,8 @@ export type Collection = Prisma.CollectionModel
|
||||
*
|
||||
*/
|
||||
export type ApiToken = Prisma.ApiTokenModel
|
||||
/**
|
||||
* Model AiUsage
|
||||
*
|
||||
*/
|
||||
export type AiUsage = Prisma.AiUsageModel
|
||||
|
||||
@@ -643,6 +643,33 @@ export type EnumAgentSessionTypeWithAggregatesFilter<$PrismaModel = never> = {
|
||||
_max?: Prisma.NestedEnumAgentSessionTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type FloatFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatFilter<$PrismaModel> | number
|
||||
}
|
||||
|
||||
export type FloatWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatWithAggregatesFilter<$PrismaModel> | number
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedStringFilter<$PrismaModel = never> = {
|
||||
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
|
||||
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
|
||||
@@ -1218,4 +1245,20 @@ export type NestedEnumAgentSessionTypeWithAggregatesFilter<$PrismaModel = never>
|
||||
_max?: Prisma.NestedEnumAgentSessionTypeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedFloatWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
|
||||
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
|
||||
not?: Prisma.NestedFloatWithAggregatesFilter<$PrismaModel> | number
|
||||
_count?: Prisma.NestedIntFilter<$PrismaModel>
|
||||
_avg?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_sum?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_min?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
_max?: Prisma.NestedFloatFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
|
||||
|
||||
+14
-4
File diff suppressed because one or more lines are too long
+95
-2
@@ -416,7 +416,8 @@ export const ModelName = {
|
||||
Model: 'Model',
|
||||
Provider: 'Provider',
|
||||
Collection: 'Collection',
|
||||
ApiToken: 'ApiToken'
|
||||
ApiToken: 'ApiToken',
|
||||
AiUsage: 'AiUsage'
|
||||
} as const
|
||||
|
||||
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
||||
@@ -432,7 +433,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"
|
||||
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"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -2878,6 +2879,80 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
AiUsage: {
|
||||
payload: Prisma.$AiUsagePayload<ExtArgs>
|
||||
fields: Prisma.AiUsageFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.AiUsageFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.AiUsageFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.AiUsageFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.AiUsageFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.AiUsageFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.AiUsageCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.AiUsageCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.AiUsageCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.AiUsageDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.AiUsageUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.AiUsageDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.AiUsageUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.AiUsageUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.AiUsageUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AiUsagePayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.AiUsageAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateAiUsage>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.AiUsageGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AiUsageGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.AiUsageCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AiUsageCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} & {
|
||||
other: {
|
||||
@@ -3392,6 +3467,23 @@ export const ApiTokenScalarFieldEnum = {
|
||||
export type ApiTokenScalarFieldEnum = (typeof ApiTokenScalarFieldEnum)[keyof typeof ApiTokenScalarFieldEnum]
|
||||
|
||||
|
||||
export const AiUsageScalarFieldEnum = {
|
||||
id: 'id',
|
||||
teamId: 'teamId',
|
||||
userId: 'userId',
|
||||
periodStart: 'periodStart',
|
||||
inputTokens: 'inputTokens',
|
||||
outputTokens: 'outputTokens',
|
||||
cacheReadTokens: 'cacheReadTokens',
|
||||
totalTokens: 'totalTokens',
|
||||
cost: 'cost',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
|
||||
|
||||
|
||||
export const SortOrder = {
|
||||
asc: 'asc',
|
||||
desc: 'desc'
|
||||
@@ -3889,6 +3981,7 @@ export type GlobalOmitConfig = {
|
||||
provider?: Prisma.ProviderOmit
|
||||
collection?: Prisma.CollectionOmit
|
||||
apiToken?: Prisma.ApiTokenOmit
|
||||
aiUsage?: Prisma.AiUsageOmit
|
||||
}
|
||||
|
||||
/* Types for Logging */
|
||||
|
||||
@@ -83,7 +83,8 @@ export const ModelName = {
|
||||
Model: 'Model',
|
||||
Provider: 'Provider',
|
||||
Collection: 'Collection',
|
||||
ApiToken: 'ApiToken'
|
||||
ApiToken: 'ApiToken',
|
||||
AiUsage: 'AiUsage'
|
||||
} as const
|
||||
|
||||
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
|
||||
@@ -577,6 +578,23 @@ export const ApiTokenScalarFieldEnum = {
|
||||
export type ApiTokenScalarFieldEnum = (typeof ApiTokenScalarFieldEnum)[keyof typeof ApiTokenScalarFieldEnum]
|
||||
|
||||
|
||||
export const AiUsageScalarFieldEnum = {
|
||||
id: 'id',
|
||||
teamId: 'teamId',
|
||||
userId: 'userId',
|
||||
periodStart: 'periodStart',
|
||||
inputTokens: 'inputTokens',
|
||||
outputTokens: 'outputTokens',
|
||||
cacheReadTokens: 'cacheReadTokens',
|
||||
totalTokens: 'totalTokens',
|
||||
cost: 'cost',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
} as const
|
||||
|
||||
export type AiUsageScalarFieldEnum = (typeof AiUsageScalarFieldEnum)[keyof typeof AiUsageScalarFieldEnum]
|
||||
|
||||
|
||||
export const SortOrder = {
|
||||
asc: 'asc',
|
||||
desc: 'desc'
|
||||
|
||||
+1
@@ -41,4 +41,5 @@ export type * from './models/Model.ts'
|
||||
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 './commonInputTypes.ts'
|
||||
+1808
File diff suppressed because it is too large
Load Diff
+194
@@ -199,6 +199,7 @@ export type TeamWhereInput = {
|
||||
skills?: Prisma.SkillListRelationFilter
|
||||
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
|
||||
agents?: Prisma.AgentListRelationFilter
|
||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||
}
|
||||
|
||||
export type TeamOrderByWithRelationInput = {
|
||||
@@ -219,6 +220,7 @@ export type TeamOrderByWithRelationInput = {
|
||||
skills?: Prisma.SkillOrderByRelationAggregateInput
|
||||
sandbox?: Prisma.SandboxOrderByWithRelationInput
|
||||
agents?: Prisma.AgentOrderByRelationAggregateInput
|
||||
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
export type TeamWhereUniqueInput = Prisma.AtLeast<{
|
||||
@@ -242,6 +244,7 @@ export type TeamWhereUniqueInput = Prisma.AtLeast<{
|
||||
skills?: Prisma.SkillListRelationFilter
|
||||
sandbox?: Prisma.XOR<Prisma.SandboxNullableScalarRelationFilter, Prisma.SandboxWhereInput> | null
|
||||
agents?: Prisma.AgentListRelationFilter
|
||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||
}, "id" | "rootFolderId">
|
||||
|
||||
export type TeamOrderByWithAggregationInput = {
|
||||
@@ -285,6 +288,7 @@ export type TeamCreateInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateInput = {
|
||||
@@ -304,6 +308,7 @@ export type TeamUncheckedCreateInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUpdateInput = {
|
||||
@@ -323,6 +328,7 @@ export type TeamUpdateInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateInput = {
|
||||
@@ -342,6 +348,7 @@ export type TeamUncheckedUpdateInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateManyInput = {
|
||||
@@ -579,6 +586,20 @@ export type TeamUpdateOneRequiredWithoutProvidersNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutProvidersInput, Prisma.TeamUpdateWithoutProvidersInput>, Prisma.TeamUncheckedUpdateWithoutProvidersInput>
|
||||
}
|
||||
|
||||
export type TeamCreateNestedOneWithoutAiUsagesInput = {
|
||||
create?: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
|
||||
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAiUsagesInput
|
||||
connect?: Prisma.TeamWhereUniqueInput
|
||||
}
|
||||
|
||||
export type TeamUpdateOneRequiredWithoutAiUsagesNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
|
||||
connectOrCreate?: Prisma.TeamCreateOrConnectWithoutAiUsagesInput
|
||||
upsert?: Prisma.TeamUpsertWithoutAiUsagesInput
|
||||
connect?: Prisma.TeamWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.TeamUpdateToOneWithWhereWithoutAiUsagesInput, Prisma.TeamUpdateWithoutAiUsagesInput>, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutSandboxInput = {
|
||||
id?: string
|
||||
name: string
|
||||
@@ -595,6 +616,7 @@ export type TeamCreateWithoutSandboxInput = {
|
||||
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutSandboxInput = {
|
||||
@@ -613,6 +635,7 @@ export type TeamUncheckedCreateWithoutSandboxInput = {
|
||||
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutSandboxInput = {
|
||||
@@ -647,6 +670,7 @@ export type TeamUpdateWithoutSandboxInput = {
|
||||
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutSandboxInput = {
|
||||
@@ -665,6 +689,7 @@ export type TeamUncheckedUpdateWithoutSandboxInput = {
|
||||
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutSkillsInput = {
|
||||
@@ -683,6 +708,7 @@ export type TeamCreateWithoutSkillsInput = {
|
||||
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutSkillsInput = {
|
||||
@@ -701,6 +727,7 @@ export type TeamUncheckedCreateWithoutSkillsInput = {
|
||||
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutSkillsInput = {
|
||||
@@ -735,6 +762,7 @@ export type TeamUpdateWithoutSkillsInput = {
|
||||
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutSkillsInput = {
|
||||
@@ -753,6 +781,7 @@ export type TeamUncheckedUpdateWithoutSkillsInput = {
|
||||
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutMembersInput = {
|
||||
@@ -771,6 +800,7 @@ export type TeamCreateWithoutMembersInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutMembersInput = {
|
||||
@@ -789,6 +819,7 @@ export type TeamUncheckedCreateWithoutMembersInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutMembersInput = {
|
||||
@@ -823,6 +854,7 @@ export type TeamUpdateWithoutMembersInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutMembersInput = {
|
||||
@@ -841,6 +873,7 @@ export type TeamUncheckedUpdateWithoutMembersInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutProjectsInput = {
|
||||
@@ -859,6 +892,7 @@ export type TeamCreateWithoutProjectsInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutProjectsInput = {
|
||||
@@ -877,6 +911,7 @@ export type TeamUncheckedCreateWithoutProjectsInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutProjectsInput = {
|
||||
@@ -911,6 +946,7 @@ export type TeamUpdateWithoutProjectsInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutProjectsInput = {
|
||||
@@ -929,6 +965,7 @@ export type TeamUncheckedUpdateWithoutProjectsInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutRootFolderInput = {
|
||||
@@ -947,6 +984,7 @@ export type TeamCreateWithoutRootFolderInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutRootFolderInput = {
|
||||
@@ -965,6 +1003,7 @@ export type TeamUncheckedCreateWithoutRootFolderInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutRootFolderInput = {
|
||||
@@ -999,6 +1038,7 @@ export type TeamUpdateWithoutRootFolderInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutRootFolderInput = {
|
||||
@@ -1017,6 +1057,7 @@ export type TeamUncheckedUpdateWithoutRootFolderInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutInvitesInput = {
|
||||
@@ -1035,6 +1076,7 @@ export type TeamCreateWithoutInvitesInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutInvitesInput = {
|
||||
@@ -1053,6 +1095,7 @@ export type TeamUncheckedCreateWithoutInvitesInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutInvitesInput = {
|
||||
@@ -1087,6 +1130,7 @@ export type TeamUpdateWithoutInvitesInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutInvitesInput = {
|
||||
@@ -1105,6 +1149,7 @@ export type TeamUncheckedUpdateWithoutInvitesInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutMetadataFieldsInput = {
|
||||
@@ -1123,6 +1168,7 @@ export type TeamCreateWithoutMetadataFieldsInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
|
||||
@@ -1141,6 +1187,7 @@ export type TeamUncheckedCreateWithoutMetadataFieldsInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutMetadataFieldsInput = {
|
||||
@@ -1175,6 +1222,7 @@ export type TeamUpdateWithoutMetadataFieldsInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
|
||||
@@ -1193,6 +1241,7 @@ export type TeamUncheckedUpdateWithoutMetadataFieldsInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutNotificationsInput = {
|
||||
@@ -1211,6 +1260,7 @@ export type TeamCreateWithoutNotificationsInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutNotificationsInput = {
|
||||
@@ -1229,6 +1279,7 @@ export type TeamUncheckedCreateWithoutNotificationsInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutNotificationsInput = {
|
||||
@@ -1263,6 +1314,7 @@ export type TeamUpdateWithoutNotificationsInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutNotificationsInput = {
|
||||
@@ -1281,6 +1333,7 @@ export type TeamUncheckedUpdateWithoutNotificationsInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutAgentsInput = {
|
||||
@@ -1299,6 +1352,7 @@ export type TeamCreateWithoutAgentsInput = {
|
||||
providers?: Prisma.ProviderCreateNestedManyWithoutTeamInput
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutAgentsInput = {
|
||||
@@ -1317,6 +1371,7 @@ export type TeamUncheckedCreateWithoutAgentsInput = {
|
||||
providers?: Prisma.ProviderUncheckedCreateNestedManyWithoutTeamInput
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutAgentsInput = {
|
||||
@@ -1351,6 +1406,7 @@ export type TeamUpdateWithoutAgentsInput = {
|
||||
providers?: Prisma.ProviderUpdateManyWithoutTeamNestedInput
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutAgentsInput = {
|
||||
@@ -1369,6 +1425,7 @@ export type TeamUncheckedUpdateWithoutAgentsInput = {
|
||||
providers?: Prisma.ProviderUncheckedUpdateManyWithoutTeamNestedInput
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutUserMetadataInput = {
|
||||
@@ -1387,6 +1444,7 @@ export type TeamCreateWithoutUserMetadataInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutUserMetadataInput = {
|
||||
@@ -1405,6 +1463,7 @@ export type TeamUncheckedCreateWithoutUserMetadataInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutUserMetadataInput = {
|
||||
@@ -1439,6 +1498,7 @@ export type TeamUpdateWithoutUserMetadataInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutUserMetadataInput = {
|
||||
@@ -1457,6 +1517,7 @@ export type TeamUncheckedUpdateWithoutUserMetadataInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutProvidersInput = {
|
||||
@@ -1475,6 +1536,7 @@ export type TeamCreateWithoutProvidersInput = {
|
||||
skills?: Prisma.SkillCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutProvidersInput = {
|
||||
@@ -1493,6 +1555,7 @@ export type TeamUncheckedCreateWithoutProvidersInput = {
|
||||
skills?: Prisma.SkillUncheckedCreateNestedManyWithoutTeamInput
|
||||
sandbox?: Prisma.SandboxUncheckedCreateNestedOneWithoutTeamInput
|
||||
agents?: Prisma.AgentUncheckedCreateNestedManyWithoutTeamInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutTeamInput
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutProvidersInput = {
|
||||
@@ -1527,6 +1590,7 @@ export type TeamUpdateWithoutProvidersInput = {
|
||||
skills?: Prisma.SkillUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutProvidersInput = {
|
||||
@@ -1545,6 +1609,99 @@ export type TeamUncheckedUpdateWithoutProvidersInput = {
|
||||
skills?: Prisma.SkillUncheckedUpdateManyWithoutTeamNestedInput
|
||||
sandbox?: Prisma.SandboxUncheckedUpdateOneWithoutTeamNestedInput
|
||||
agents?: Prisma.AgentUncheckedUpdateManyWithoutTeamNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutTeamNestedInput
|
||||
}
|
||||
|
||||
export type TeamCreateWithoutAiUsagesInput = {
|
||||
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
|
||||
}
|
||||
|
||||
export type TeamUncheckedCreateWithoutAiUsagesInput = {
|
||||
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
|
||||
}
|
||||
|
||||
export type TeamCreateOrConnectWithoutAiUsagesInput = {
|
||||
where: Prisma.TeamWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
|
||||
}
|
||||
|
||||
export type TeamUpsertWithoutAiUsagesInput = {
|
||||
update: Prisma.XOR<Prisma.TeamUpdateWithoutAiUsagesInput, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
|
||||
create: Prisma.XOR<Prisma.TeamCreateWithoutAiUsagesInput, Prisma.TeamUncheckedCreateWithoutAiUsagesInput>
|
||||
where?: Prisma.TeamWhereInput
|
||||
}
|
||||
|
||||
export type TeamUpdateToOneWithWhereWithoutAiUsagesInput = {
|
||||
where?: Prisma.TeamWhereInput
|
||||
data: Prisma.XOR<Prisma.TeamUpdateWithoutAiUsagesInput, Prisma.TeamUncheckedUpdateWithoutAiUsagesInput>
|
||||
}
|
||||
|
||||
export type TeamUpdateWithoutAiUsagesInput = {
|
||||
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
|
||||
}
|
||||
|
||||
export type TeamUncheckedUpdateWithoutAiUsagesInput = {
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -1562,6 +1719,7 @@ export type TeamCountOutputType = {
|
||||
providers: number
|
||||
skills: number
|
||||
agents: number
|
||||
aiUsages: number
|
||||
}
|
||||
|
||||
export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
@@ -1574,6 +1732,7 @@ export type TeamCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
|
||||
providers?: boolean | TeamCountOutputTypeCountProvidersArgs
|
||||
skills?: boolean | TeamCountOutputTypeCountSkillsArgs
|
||||
agents?: boolean | TeamCountOutputTypeCountAgentsArgs
|
||||
aiUsages?: boolean | TeamCountOutputTypeCountAiUsagesArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1649,6 +1808,13 @@ export type TeamCountOutputTypeCountAgentsArgs<ExtArgs extends runtime.Types.Ext
|
||||
where?: Prisma.AgentWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* TeamCountOutputType without action
|
||||
*/
|
||||
export type TeamCountOutputTypeCountAiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.AiUsageWhereInput
|
||||
}
|
||||
|
||||
|
||||
export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
@@ -1668,6 +1834,7 @@ export type TeamSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
|
||||
skills?: boolean | Prisma.Team$skillsArgs<ExtArgs>
|
||||
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
|
||||
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
|
||||
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["team"]>
|
||||
|
||||
@@ -1713,6 +1880,7 @@ export type TeamInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
skills?: boolean | Prisma.Team$skillsArgs<ExtArgs>
|
||||
sandbox?: boolean | Prisma.Team$sandboxArgs<ExtArgs>
|
||||
agents?: boolean | Prisma.Team$agentsArgs<ExtArgs>
|
||||
aiUsages?: boolean | Prisma.Team$aiUsagesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.TeamCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
export type TeamIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
@@ -1736,6 +1904,7 @@ export type $TeamPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
skills: Prisma.$SkillPayload<ExtArgs>[]
|
||||
sandbox: Prisma.$SandboxPayload<ExtArgs> | null
|
||||
agents: Prisma.$AgentPayload<ExtArgs>[]
|
||||
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
@@ -2152,6 +2321,7 @@ export interface Prisma__TeamClient<T, Null = never, ExtArgs extends runtime.Typ
|
||||
skills<T extends Prisma.Team$skillsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.Team$skillsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$SkillPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
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>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -2841,6 +3011,30 @@ export type Team$agentsArgs<ExtArgs extends runtime.Types.Extensions.InternalArg
|
||||
distinct?: Prisma.AgentScalarFieldEnum | Prisma.AgentScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Team.aiUsages
|
||||
*/
|
||||
export type Team$aiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the AiUsage
|
||||
*/
|
||||
select?: Prisma.AiUsageSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the AiUsage
|
||||
*/
|
||||
omit?: Prisma.AiUsageOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AiUsageInclude<ExtArgs> | null
|
||||
where?: Prisma.AiUsageWhereInput
|
||||
orderBy?: Prisma.AiUsageOrderByWithRelationInput | Prisma.AiUsageOrderByWithRelationInput[]
|
||||
cursor?: Prisma.AiUsageWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.AiUsageScalarFieldEnum | Prisma.AiUsageScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Team without action
|
||||
*/
|
||||
|
||||
+268
@@ -245,6 +245,7 @@ export type UserWhereInput = {
|
||||
collections?: Prisma.CollectionListRelationFilter
|
||||
shareLinks?: Prisma.ShareLinkListRelationFilter
|
||||
apiTokens?: Prisma.ApiTokenListRelationFilter
|
||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||
}
|
||||
|
||||
export type UserOrderByWithRelationInput = {
|
||||
@@ -276,6 +277,7 @@ export type UserOrderByWithRelationInput = {
|
||||
collections?: Prisma.CollectionOrderByRelationAggregateInput
|
||||
shareLinks?: Prisma.ShareLinkOrderByRelationAggregateInput
|
||||
apiTokens?: Prisma.ApiTokenOrderByRelationAggregateInput
|
||||
aiUsages?: Prisma.AiUsageOrderByRelationAggregateInput
|
||||
}
|
||||
|
||||
export type UserWhereUniqueInput = Prisma.AtLeast<{
|
||||
@@ -310,6 +312,7 @@ export type UserWhereUniqueInput = Prisma.AtLeast<{
|
||||
collections?: Prisma.CollectionListRelationFilter
|
||||
shareLinks?: Prisma.ShareLinkListRelationFilter
|
||||
apiTokens?: Prisma.ApiTokenListRelationFilter
|
||||
aiUsages?: Prisma.AiUsageListRelationFilter
|
||||
}, "id" | "email">
|
||||
|
||||
export type UserOrderByWithAggregationInput = {
|
||||
@@ -375,6 +378,7 @@ export type UserCreateInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateInput = {
|
||||
@@ -406,6 +410,7 @@ export type UserUncheckedCreateInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUpdateInput = {
|
||||
@@ -437,6 +442,7 @@ export type UserUpdateInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateInput = {
|
||||
@@ -468,6 +474,7 @@ export type UserUncheckedUpdateInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateManyInput = {
|
||||
@@ -838,6 +845,22 @@ export type UserUpdateOneRequiredWithoutApiTokensNestedInput = {
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutApiTokensInput, Prisma.UserUpdateWithoutApiTokensInput>, Prisma.UserUncheckedUpdateWithoutApiTokensInput>
|
||||
}
|
||||
|
||||
export type UserCreateNestedOneWithoutAiUsagesInput = {
|
||||
create?: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
|
||||
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAiUsagesInput
|
||||
connect?: Prisma.UserWhereUniqueInput
|
||||
}
|
||||
|
||||
export type UserUpdateOneWithoutAiUsagesNestedInput = {
|
||||
create?: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
|
||||
connectOrCreate?: Prisma.UserCreateOrConnectWithoutAiUsagesInput
|
||||
upsert?: Prisma.UserUpsertWithoutAiUsagesInput
|
||||
disconnect?: Prisma.UserWhereInput | boolean
|
||||
delete?: Prisma.UserWhereInput | boolean
|
||||
connect?: Prisma.UserWhereUniqueInput
|
||||
update?: Prisma.XOR<Prisma.XOR<Prisma.UserUpdateToOneWithWhereWithoutAiUsagesInput, Prisma.UserUpdateWithoutAiUsagesInput>, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
|
||||
}
|
||||
|
||||
export type UserCreateWithoutSessionsInput = {
|
||||
id?: string
|
||||
type?: $Enums.UserType
|
||||
@@ -866,6 +889,7 @@ export type UserCreateWithoutSessionsInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutSessionsInput = {
|
||||
@@ -896,6 +920,7 @@ export type UserUncheckedCreateWithoutSessionsInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutSessionsInput = {
|
||||
@@ -942,6 +967,7 @@ export type UserUpdateWithoutSessionsInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutSessionsInput = {
|
||||
@@ -972,6 +998,7 @@ export type UserUncheckedUpdateWithoutSessionsInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAccountsInput = {
|
||||
@@ -1002,6 +1029,7 @@ export type UserCreateWithoutAccountsInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAccountsInput = {
|
||||
@@ -1032,6 +1060,7 @@ export type UserUncheckedCreateWithoutAccountsInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAccountsInput = {
|
||||
@@ -1078,6 +1107,7 @@ export type UserUpdateWithoutAccountsInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAccountsInput = {
|
||||
@@ -1108,6 +1138,7 @@ export type UserUncheckedUpdateWithoutAccountsInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAuthTokensInput = {
|
||||
@@ -1138,6 +1169,7 @@ export type UserCreateWithoutAuthTokensInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAuthTokensInput = {
|
||||
@@ -1168,6 +1200,7 @@ export type UserUncheckedCreateWithoutAuthTokensInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAuthTokensInput = {
|
||||
@@ -1214,6 +1247,7 @@ export type UserUpdateWithoutAuthTokensInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAuthTokensInput = {
|
||||
@@ -1244,6 +1278,7 @@ export type UserUncheckedUpdateWithoutAuthTokensInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutTeamMembersInput = {
|
||||
@@ -1274,6 +1309,7 @@ export type UserCreateWithoutTeamMembersInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutTeamMembersInput = {
|
||||
@@ -1304,6 +1340,7 @@ export type UserUncheckedCreateWithoutTeamMembersInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutTeamMembersInput = {
|
||||
@@ -1350,6 +1387,7 @@ export type UserUpdateWithoutTeamMembersInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutTeamMembersInput = {
|
||||
@@ -1380,6 +1418,7 @@ export type UserUncheckedUpdateWithoutTeamMembersInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutShareLinksInput = {
|
||||
@@ -1410,6 +1449,7 @@ export type UserCreateWithoutShareLinksInput = {
|
||||
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutShareLinksInput = {
|
||||
@@ -1440,6 +1480,7 @@ export type UserUncheckedCreateWithoutShareLinksInput = {
|
||||
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutShareLinksInput = {
|
||||
@@ -1486,6 +1527,7 @@ export type UserUpdateWithoutShareLinksInput = {
|
||||
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutShareLinksInput = {
|
||||
@@ -1516,6 +1558,7 @@ export type UserUncheckedUpdateWithoutShareLinksInput = {
|
||||
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAssetsInput = {
|
||||
@@ -1546,6 +1589,7 @@ export type UserCreateWithoutAssetsInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAssetsInput = {
|
||||
@@ -1576,6 +1620,7 @@ export type UserUncheckedCreateWithoutAssetsInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAssetsInput = {
|
||||
@@ -1622,6 +1667,7 @@ export type UserUpdateWithoutAssetsInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAssetsInput = {
|
||||
@@ -1652,6 +1698,7 @@ export type UserUncheckedUpdateWithoutAssetsInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutCommentsInput = {
|
||||
@@ -1682,6 +1729,7 @@ export type UserCreateWithoutCommentsInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCommentsInput = {
|
||||
@@ -1712,6 +1760,7 @@ export type UserUncheckedCreateWithoutCommentsInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCommentsInput = {
|
||||
@@ -1747,6 +1796,7 @@ export type UserCreateWithoutCompletionChangedCommentsInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
|
||||
@@ -1777,6 +1827,7 @@ export type UserUncheckedCreateWithoutCompletionChangedCommentsInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCompletionChangedCommentsInput = {
|
||||
@@ -1823,6 +1874,7 @@ export type UserUpdateWithoutCommentsInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCommentsInput = {
|
||||
@@ -1853,6 +1905,7 @@ export type UserUncheckedUpdateWithoutCommentsInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUpsertWithoutCompletionChangedCommentsInput = {
|
||||
@@ -1894,6 +1947,7 @@ export type UserUpdateWithoutCompletionChangedCommentsInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
|
||||
@@ -1924,6 +1978,7 @@ export type UserUncheckedUpdateWithoutCompletionChangedCommentsInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutCreatedInvitesInput = {
|
||||
@@ -1954,6 +2009,7 @@ export type UserCreateWithoutCreatedInvitesInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCreatedInvitesInput = {
|
||||
@@ -1984,6 +2040,7 @@ export type UserUncheckedCreateWithoutCreatedInvitesInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCreatedInvitesInput = {
|
||||
@@ -2030,6 +2087,7 @@ export type UserUpdateWithoutCreatedInvitesInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
|
||||
@@ -2060,6 +2118,7 @@ export type UserUncheckedUpdateWithoutCreatedInvitesInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutCreatedNotificationsInput = {
|
||||
@@ -2090,6 +2149,7 @@ export type UserCreateWithoutCreatedNotificationsInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
|
||||
@@ -2120,6 +2180,7 @@ export type UserUncheckedCreateWithoutCreatedNotificationsInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCreatedNotificationsInput = {
|
||||
@@ -2155,6 +2216,7 @@ export type UserCreateWithoutNotificationsInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutNotificationsInput = {
|
||||
@@ -2185,6 +2247,7 @@ export type UserUncheckedCreateWithoutNotificationsInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutNotificationsInput = {
|
||||
@@ -2231,6 +2294,7 @@ export type UserUpdateWithoutCreatedNotificationsInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
|
||||
@@ -2261,6 +2325,7 @@ export type UserUncheckedUpdateWithoutCreatedNotificationsInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUpsertWithoutNotificationsInput = {
|
||||
@@ -2302,6 +2367,7 @@ export type UserUpdateWithoutNotificationsInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutNotificationsInput = {
|
||||
@@ -2332,6 +2398,7 @@ export type UserUncheckedUpdateWithoutNotificationsInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutTasksInput = {
|
||||
@@ -2362,6 +2429,7 @@ export type UserCreateWithoutTasksInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutTasksInput = {
|
||||
@@ -2392,6 +2460,7 @@ export type UserUncheckedCreateWithoutTasksInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutTasksInput = {
|
||||
@@ -2438,6 +2507,7 @@ export type UserUpdateWithoutTasksInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutTasksInput = {
|
||||
@@ -2468,6 +2538,7 @@ export type UserUncheckedUpdateWithoutTasksInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAgentInput = {
|
||||
@@ -2498,6 +2569,7 @@ export type UserCreateWithoutAgentInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAgentInput = {
|
||||
@@ -2528,6 +2600,7 @@ export type UserUncheckedCreateWithoutAgentInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAgentInput = {
|
||||
@@ -2574,6 +2647,7 @@ export type UserUpdateWithoutAgentInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAgentInput = {
|
||||
@@ -2604,6 +2678,7 @@ export type UserUncheckedUpdateWithoutAgentInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAgentSessionsInput = {
|
||||
@@ -2634,6 +2709,7 @@ export type UserCreateWithoutAgentSessionsInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAgentSessionsInput = {
|
||||
@@ -2664,6 +2740,7 @@ export type UserUncheckedCreateWithoutAgentSessionsInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAgentSessionsInput = {
|
||||
@@ -2710,6 +2787,7 @@ export type UserUpdateWithoutAgentSessionsInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAgentSessionsInput = {
|
||||
@@ -2740,6 +2818,7 @@ export type UserUncheckedUpdateWithoutAgentSessionsInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutUserMetadataInput = {
|
||||
@@ -2770,6 +2849,7 @@ export type UserCreateWithoutUserMetadataInput = {
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutUserMetadataInput = {
|
||||
@@ -2800,6 +2880,7 @@ export type UserUncheckedCreateWithoutUserMetadataInput = {
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutUserMetadataInput = {
|
||||
@@ -2846,6 +2927,7 @@ export type UserUpdateWithoutUserMetadataInput = {
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutUserMetadataInput = {
|
||||
@@ -2876,6 +2958,7 @@ export type UserUncheckedUpdateWithoutUserMetadataInput = {
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutCollectionsInput = {
|
||||
@@ -2906,6 +2989,7 @@ export type UserCreateWithoutCollectionsInput = {
|
||||
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutCollectionsInput = {
|
||||
@@ -2936,6 +3020,7 @@ export type UserUncheckedCreateWithoutCollectionsInput = {
|
||||
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedCreateNestedManyWithoutUserInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutCollectionsInput = {
|
||||
@@ -2982,6 +3067,7 @@ export type UserUpdateWithoutCollectionsInput = {
|
||||
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutCollectionsInput = {
|
||||
@@ -3012,6 +3098,7 @@ export type UserUncheckedUpdateWithoutCollectionsInput = {
|
||||
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
apiTokens?: Prisma.ApiTokenUncheckedUpdateManyWithoutUserNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutApiTokensInput = {
|
||||
@@ -3042,6 +3129,7 @@ export type UserCreateWithoutApiTokensInput = {
|
||||
userMetadata?: Prisma.UserMetadataCreateNestedManyWithoutUserInput
|
||||
collections?: Prisma.CollectionCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkCreateNestedManyWithoutCreatorInput
|
||||
aiUsages?: Prisma.AiUsageCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutApiTokensInput = {
|
||||
@@ -3072,6 +3160,7 @@ export type UserUncheckedCreateWithoutApiTokensInput = {
|
||||
userMetadata?: Prisma.UserMetadataUncheckedCreateNestedManyWithoutUserInput
|
||||
collections?: Prisma.CollectionUncheckedCreateNestedManyWithoutCreatorInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedCreateNestedManyWithoutCreatorInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedCreateNestedManyWithoutUserInput
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutApiTokensInput = {
|
||||
@@ -3118,6 +3207,7 @@ export type UserUpdateWithoutApiTokensInput = {
|
||||
userMetadata?: Prisma.UserMetadataUpdateManyWithoutUserNestedInput
|
||||
collections?: Prisma.CollectionUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUpdateManyWithoutCreatorNestedInput
|
||||
aiUsages?: Prisma.AiUsageUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutApiTokensInput = {
|
||||
@@ -3148,6 +3238,147 @@ export type UserUncheckedUpdateWithoutApiTokensInput = {
|
||||
userMetadata?: Prisma.UserMetadataUncheckedUpdateManyWithoutUserNestedInput
|
||||
collections?: Prisma.CollectionUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
shareLinks?: Prisma.ShareLinkUncheckedUpdateManyWithoutCreatorNestedInput
|
||||
aiUsages?: Prisma.AiUsageUncheckedUpdateManyWithoutUserNestedInput
|
||||
}
|
||||
|
||||
export type UserCreateWithoutAiUsagesInput = {
|
||||
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
|
||||
}
|
||||
|
||||
export type UserUncheckedCreateWithoutAiUsagesInput = {
|
||||
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
|
||||
}
|
||||
|
||||
export type UserCreateOrConnectWithoutAiUsagesInput = {
|
||||
where: Prisma.UserWhereUniqueInput
|
||||
create: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
|
||||
}
|
||||
|
||||
export type UserUpsertWithoutAiUsagesInput = {
|
||||
update: Prisma.XOR<Prisma.UserUpdateWithoutAiUsagesInput, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
|
||||
create: Prisma.XOR<Prisma.UserCreateWithoutAiUsagesInput, Prisma.UserUncheckedCreateWithoutAiUsagesInput>
|
||||
where?: Prisma.UserWhereInput
|
||||
}
|
||||
|
||||
export type UserUpdateToOneWithWhereWithoutAiUsagesInput = {
|
||||
where?: Prisma.UserWhereInput
|
||||
data: Prisma.XOR<Prisma.UserUpdateWithoutAiUsagesInput, Prisma.UserUncheckedUpdateWithoutAiUsagesInput>
|
||||
}
|
||||
|
||||
export type UserUpdateWithoutAiUsagesInput = {
|
||||
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
|
||||
}
|
||||
|
||||
export type UserUncheckedUpdateWithoutAiUsagesInput = {
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -3172,6 +3403,7 @@ export type UserCountOutputType = {
|
||||
collections: number
|
||||
shareLinks: number
|
||||
apiTokens: number
|
||||
aiUsages: number
|
||||
}
|
||||
|
||||
export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
@@ -3191,6 +3423,7 @@ export type UserCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.I
|
||||
collections?: boolean | UserCountOutputTypeCountCollectionsArgs
|
||||
shareLinks?: boolean | UserCountOutputTypeCountShareLinksArgs
|
||||
apiTokens?: boolean | UserCountOutputTypeCountApiTokensArgs
|
||||
aiUsages?: boolean | UserCountOutputTypeCountAiUsagesArgs
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3315,6 +3548,13 @@ export type UserCountOutputTypeCountApiTokensArgs<ExtArgs extends runtime.Types.
|
||||
where?: Prisma.ApiTokenWhereInput
|
||||
}
|
||||
|
||||
/**
|
||||
* UserCountOutputType without action
|
||||
*/
|
||||
export type UserCountOutputTypeCountAiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
where?: Prisma.AiUsageWhereInput
|
||||
}
|
||||
|
||||
|
||||
export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||
id?: boolean
|
||||
@@ -3345,6 +3585,7 @@ export type UserSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = r
|
||||
collections?: boolean | Prisma.User$collectionsArgs<ExtArgs>
|
||||
shareLinks?: boolean | Prisma.User$shareLinksArgs<ExtArgs>
|
||||
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
|
||||
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}, ExtArgs["result"]["user"]>
|
||||
|
||||
@@ -3409,6 +3650,7 @@ export type UserInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
collections?: boolean | Prisma.User$collectionsArgs<ExtArgs>
|
||||
shareLinks?: boolean | Prisma.User$shareLinksArgs<ExtArgs>
|
||||
apiTokens?: boolean | Prisma.User$apiTokensArgs<ExtArgs>
|
||||
aiUsages?: boolean | Prisma.User$aiUsagesArgs<ExtArgs>
|
||||
_count?: boolean | Prisma.UserCountOutputTypeDefaultArgs<ExtArgs>
|
||||
}
|
||||
export type UserIncludeCreateManyAndReturn<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {}
|
||||
@@ -3434,6 +3676,7 @@ export type $UserPayload<ExtArgs extends runtime.Types.Extensions.InternalArgs =
|
||||
collections: Prisma.$CollectionPayload<ExtArgs>[]
|
||||
shareLinks: Prisma.$ShareLinkPayload<ExtArgs>[]
|
||||
apiTokens: Prisma.$ApiTokenPayload<ExtArgs>[]
|
||||
aiUsages: Prisma.$AiUsagePayload<ExtArgs>[]
|
||||
}
|
||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||
id: string
|
||||
@@ -3861,6 +4104,7 @@ export interface Prisma__UserClient<T, Null = never, ExtArgs extends runtime.Typ
|
||||
collections<T extends Prisma.User$collectionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.User$collectionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$CollectionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||
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>
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
@@ -4696,6 +4940,30 @@ export type User$apiTokensArgs<ExtArgs extends runtime.Types.Extensions.Internal
|
||||
distinct?: Prisma.ApiTokenScalarFieldEnum | Prisma.ApiTokenScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* User.aiUsages
|
||||
*/
|
||||
export type User$aiUsagesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||
/**
|
||||
* Select specific fields to fetch from the AiUsage
|
||||
*/
|
||||
select?: Prisma.AiUsageSelect<ExtArgs> | null
|
||||
/**
|
||||
* Omit specific fields from the AiUsage
|
||||
*/
|
||||
omit?: Prisma.AiUsageOmit<ExtArgs> | null
|
||||
/**
|
||||
* Choose, which related nodes to fetch as well
|
||||
*/
|
||||
include?: Prisma.AiUsageInclude<ExtArgs> | null
|
||||
where?: Prisma.AiUsageWhereInput
|
||||
orderBy?: Prisma.AiUsageOrderByWithRelationInput | Prisma.AiUsageOrderByWithRelationInput[]
|
||||
cursor?: Prisma.AiUsageWhereUniqueInput
|
||||
take?: number
|
||||
skip?: number
|
||||
distinct?: Prisma.AiUsageScalarFieldEnum | Prisma.AiUsageScalarFieldEnum[]
|
||||
}
|
||||
|
||||
/**
|
||||
* User without action
|
||||
*/
|
||||
|
||||
@@ -14,3 +14,34 @@ export const aiProviderSettingsSchema = z.object({
|
||||
})
|
||||
|
||||
export type AiProviderSettings = z.infer<typeof aiProviderSettingsSchema>
|
||||
|
||||
export const timeframeSchema = z.enum(['1h', '24h', '7d', '30d'])
|
||||
export type Timeframe = z.infer<typeof timeframeSchema>
|
||||
|
||||
export const getTeamAiUsageQuerySchema = z.object({
|
||||
timeframe: timeframeSchema.default('30d'),
|
||||
userId: z.string().optional(),
|
||||
})
|
||||
export type GetTeamAiUsageQuery = z.infer<typeof getTeamAiUsageQuerySchema>
|
||||
|
||||
export interface AiUsageMetrics {
|
||||
inputTokens: number
|
||||
outputTokens: number
|
||||
cacheReadTokens: number
|
||||
totalTokens: number
|
||||
cost: number
|
||||
}
|
||||
|
||||
export interface MemberAiUsageMetrics extends AiUsageMetrics {
|
||||
userId: string
|
||||
userName: string
|
||||
userEmail: string
|
||||
userImage?: string | null
|
||||
role: string
|
||||
}
|
||||
|
||||
export interface TeamUsageStatsResponse {
|
||||
timeframe: Timeframe
|
||||
team?: AiUsageMetrics
|
||||
member?: MemberAiUsageMetrics
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user