update tests

This commit is contained in:
yiling
2026-06-07 19:26:07 +08:00
parent aa8d159dd3
commit 99424aa6e1
4 changed files with 27 additions and 17 deletions
+6 -3
View File
@@ -77,7 +77,8 @@ export class AuthzService {
},
})
if (!pm) throw new HTTPException(403, { message: `User is not a member of project ${projectId}` })
if (!pm)
throw new HTTPException(403, { message: `User is not a member of project ${projectId}` })
return this.checkRole(pm.role, req.permission)
}
@@ -174,7 +175,8 @@ export class AuthzService {
})
return { teamId: proj!.teamId, projectId: field.projectId }
}
if (!field.teamId) throw new HTTPException(403, { message: 'Metadata field has no context' })
if (!field.teamId)
throw new HTTPException(403, { message: 'Metadata field has no context' })
return { teamId: field.teamId }
}
@@ -211,7 +213,8 @@ export class AuthzService {
include: { asset: { include: { project: true } } },
})
if (!comment) throw new HTTPException(404, { message: 'Comment not found' })
if (!comment.asset.project) throw new HTTPException(403, { message: 'Comment asset has no project' })
if (!comment.asset.project)
throw new HTTPException(403, { message: 'Comment asset has no project' })
return { teamId: comment.asset.project.teamId, projectId: comment.asset.projectId! }
}
+2 -6
View File
@@ -185,9 +185,7 @@ export class SearchService {
}
}
const countRes = await this.prismaClient.$queryRaw<{ count: bigint }[]>(
countBuilder.build(),
)
const countRes = await this.prismaClient.$queryRaw<{ count: bigint }[]>(countBuilder.build())
pageInfo.total = Number(countRes[0]?.count || 0)
if (hasNextPage) {
@@ -368,9 +366,7 @@ export class SearchService {
countBuilder.addWhere(Prisma.sql`a.name ILIKE ${'%' + valStr + '%'}`)
}
const countRes = await this.prismaClient.$queryRaw<{ count: bigint }[]>(
countBuilder.build(),
)
const countRes = await this.prismaClient.$queryRaw<{ count: bigint }[]>(countBuilder.build())
pageInfo.total = Number(countRes[0]?.count || 0)
}