allow limiting opinion count
This commit is contained in:
@@ -45,7 +45,13 @@ export const userRoute = router({
|
||||
)
|
||||
.query(
|
||||
async ({ input }) =>
|
||||
await getAllUser(input.offset, input.limit, input.group, input.zone)
|
||||
await getAllUser(
|
||||
input.offset,
|
||||
input.limit,
|
||||
input.opinionCount,
|
||||
input.group,
|
||||
input.zone
|
||||
)
|
||||
),
|
||||
createUser: publicProcedure
|
||||
.input(
|
||||
@@ -73,13 +79,16 @@ export const userRoute = router({
|
||||
async function getAllUser(
|
||||
offset: number,
|
||||
limit: number,
|
||||
opinionLimit: number,
|
||||
group?: number,
|
||||
zone?: number
|
||||
) {
|
||||
let users = await db.query.user.findMany({
|
||||
with: {
|
||||
group: true,
|
||||
opinions: true,
|
||||
opinions: {
|
||||
limit: opinionLimit,
|
||||
},
|
||||
zone: {
|
||||
with: { province: true },
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user