feat(agent): add teamId foreign key to agent table and refactor service queries

This commit is contained in:
yiling
2026-05-21 20:41:37 +08:00
parent 6e2ff8a003
commit 2c106bbb77
16 changed files with 498 additions and 71 deletions
+15 -1
View File
@@ -47,12 +47,19 @@ describe('WorkflowService', () => {
contentType: 'audio/mpeg',
})
const team = await prisma.team.create({
data: { name: 'Transcription Team' },
})
const project = await prisma.project.create({
data: { name: 'Transcription Project', teamId: team.id },
})
const asset = await prisma.asset.create({
data: {
name: 'test.mp3',
key: 'test/test.mp3',
status: 'uploaded',
type: 'file',
projectId: project.id,
},
})
@@ -84,6 +91,12 @@ describe('WorkflowService', () => {
}, 15000)
it('should process ai_embedding task locally', async () => {
const team = await prisma.team.create({
data: { name: 'Embedding Team' },
})
const project = await prisma.project.create({
data: { name: 'Embedding Project', teamId: team.id },
})
const asset = await prisma.asset.create({
data: {
name: 'test.png',
@@ -91,6 +104,7 @@ describe('WorkflowService', () => {
status: 'uploaded',
type: 'file',
mediaType: 'image/png',
projectId: project.id,
},
})
@@ -99,7 +113,7 @@ describe('WorkflowService', () => {
assetId: asset.id,
type: WorkflowTaskType.ai_embedding,
status: WorkflowTaskStatus.pending,
teamId: 'test-team', // Needs a teamId for embeddings
teamId: team.id,
},
})