Skip to content

Commit

Permalink
Update query based on schema
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarvz committed Aug 28, 2024
1 parent 7daa3a1 commit f37d897
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/web/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ web.get("/", async (c) => {
// FIXME: Investigate why this breaks in production build
const userWithLatestStar = await db.query.users.findFirst({
with: {
interactions: {
where: ({ eventType }, { eq }) => eq(eventType, "star.created"),
events: {
where: ({ eventName, eventAction }, { and, eq }) =>
and(eq(eventName, "star"), eq(eventAction, "created")),
orderBy: ({ createdAt }, { asc }) => asc(createdAt),
},
},
});

const props: DashboardProps = {
latestStar: userWithLatestStar?.githubHandle,
latestStar: userWithLatestStar?.handle,
};

return c.render(<Dashboard {...props} />, {
Expand Down

0 comments on commit f37d897

Please sign in to comment.