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
+6 -4
View File
@@ -120,6 +120,11 @@ describe('TeamService', () => {
const user = await prisma.user.create({
data: { name: 'Human', email: `human-${Date.now()}@example.com`, password: 'pw' },
})
const team = await teamService.createTeam(user, {
name: 'Test Team',
})
const bot = await prisma.user.create({
data: {
name: 'Bot',
@@ -128,6 +133,7 @@ describe('TeamService', () => {
type: 'agent',
agent: {
create: {
teamId: team.id,
type: 'chat',
enabled: true,
config: {
@@ -139,10 +145,6 @@ describe('TeamService', () => {
},
})
const team = await teamService.createTeam(user, {
name: 'Test Team',
})
await teamService.joinTeam({
teamId: team.id,
userId: bot.id,