Skip to content

Commit

Permalink
Refactor linkGroups route to use Knex query
Browse files Browse the repository at this point in the history
builder.
  • Loading branch information
IhsenBouallegue committed Nov 15, 2023
1 parent 95355aa commit 31d9aee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/app/api/linkgroups/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ export async function GET(req: NextRequest) {
try {
let items;
if (hubId) {
items = await db.query.linkGroups.findMany({
where: eq(linkGroups.hubId, hubId),
});
items = await db
.select()
.from(linkGroups)
.where(eq(linkGroups.hubId, hubId))
.orderBy(linkGroups.createdAt);
} else {
items = await db.query.linkGroups.findMany();
}
Expand Down

1 comment on commit 31d9aee

@vercel
Copy link

@vercel vercel bot commented on 31d9aee Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.