mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 20:34:28 +00:00
update tests
This commit is contained in:
@@ -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! }
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user