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