Skip to content

Commit

Permalink
update data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
thebkht committed Oct 25, 2023
2 parents 810011d + 2fe810c commit fe9446f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/(Main)/[username]/[url]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export default async function PostView({ params }: { params: { username: string,
_count: { select: { comments: true } }
}
},
_count: { select: { posts: true, Followers: true, Following: true } },
_count: { select: { posts: true, Followers: true, Followings: true } },
Followers: true,
Following: true
Followings: true
}
});

Expand All @@ -40,7 +40,7 @@ export default async function PostView({ params }: { params: { username: string,
author: {
include: {
Followers: true,
Following: true
Followings: true
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/api/posts/[username]/[url]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function GET(
select: {
posts: true,
Followers: true,
Following: true,
Followings: true,
},
},
posts: {
Expand Down
2 changes: 1 addition & 1 deletion app/api/posts/[username]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function GET(
select: {
posts: true,
Followers: true,
Following: true,
Followings: true,
},
},
posts: {
Expand Down
2 changes: 1 addition & 1 deletion app/api/users/[username]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function GET(req: Request, { params }: { params: { username: string
following: true
}
},
Following: {
Followings: {
include: {
follower: true
}
Expand Down
4 changes: 2 additions & 2 deletions app/api/users/top/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export async function GET(request: NextRequest) {
const topUsers = await postgres.user.findMany({
include: {
Followers: true,
Following: true,
Followings: true,
posts: true,
},
take: 5,
where: {
id: {
not: userid,
},
Following: {
Followings: {
none: {
followerId: userid,
},
Expand Down

0 comments on commit fe9446f

Please sign in to comment.