-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate get evaluations query to Drizzle on API Frontend #160
Migrate get evaluations query to Drizzle on API Frontend #160
Conversation
Vidya Haikal seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
2f7bbb3
to
dc9eb13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, though left small comments. Regarding the deletion you mentioned: it is fine to only delete the unused frontend code. If you feel like setting up rust and building app-server is a little too much, we will remove the redundant backend code ourselves
frontend/app/api/projects/[projectId]/evaluations/[evaluationId]/route.ts
Outdated
Show resolved
Hide resolved
filters: [], | ||
baseQuery, | ||
orderBy: desc(sql`created_at`), | ||
}); | ||
return Response.json(result); | ||
} else { | ||
const baseQuery = db.$with('base').as(db.select().from(evaluations)); | ||
|
||
return Response.json(result); | ||
const result = await paginatedGet<any, Evaluation>({ | ||
table: evaluations, | ||
baseFilters: [eq(sql`project_id`, projectId)], | ||
filters: [], | ||
baseQuery, | ||
orderBy: desc(sql`created_at`) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we've simplified paginated get a bit, sorry about that. If you could pull/merge the latest dev
into your branch? It now looks like this:
const result = await paginatedGet<any, Evaluation>({
table: evaluations,
filters: [eq(evaluations.projectId, projectId)],
orderBy: desc(evaluations.createdAt),
});
frontend/app/api/projects/[projectId]/evaluations/[evaluationId]/route.ts
Outdated
Show resolved
Hide resolved
# Conflicts: # frontend/app/api/projects/[projectId]/evaluations/route.ts
8023955
to
8a0fdb3
Compare
Thanks @haikalvidya, amazing work! This looks good to me. Let me know once/if you've tested this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to f9ebdd8 in 1 minute and 7 seconds
More details
- Looked at
368
lines of code in7
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. frontend/app/api/projects/[projectId]/evaluations/route.ts:69
- Draft comment:
TheDELETE
function does not execute the delete operation. You need to call.execute()
to perform the deletion. Consider adding:
.execute()
- Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_Y0siwNPKFaxaIofL
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
filters: [eq(evaluations.projectId, projectId)], | ||
orderBy: desc(evaluations.createdAt), | ||
}); | ||
if (groupId && !groupId.trim()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition if (groupId && !groupId.trim())
seems incorrect. It should check if groupId
is not empty after trimming. Consider changing it to:
if (groupId && !groupId.trim()) { | |
if (groupId && groupId.trim()) |
Hey @dinmukhamedm sorry for late response, I haven't been able to test the changes yet due to some reasons (I DM'ed you about it on discord). However, I think the code is ready for review. |
} | ||
} | ||
const evaluationInfoRes = await fetch( | ||
`/api/projects/${params.projectId}/evaluations/${params.evaluationId}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haikalvidya sorry, hadn't realized at first, but this will neither compile nor we should keep it here. Let's move the logic from the routes directly to this file (as util functions) and remove the API routes if they are unused. Also, please address the Ellipsis comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oohh, alright, will work on that today
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you kindly review my latest commit again?, i have tested the changes, and it is running well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qq: did you test everything locally?
@@ -22,20 +26,82 @@ export default async function EvaluationPage({ | |||
redirect('/sign-in'); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this (and its imports), middleware now protects all project/* and projects/* routes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have updated the code upon this matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work! Thanks!
closed #81
Important
Migrated evaluation fetching logic to Drizzle ORM on the frontend, removing old SQLX-based backend implementation.
get_evaluation_datapoint
function fromevaluations.rs
.get_evaluation_datapoint
service frommain.rs
.route.ts
fordatapoints
underfrontend/app/api/projects/[projectId]/evaluations/[evaluationId]
.route.ts
forevaluations
to use Drizzle ORM for fetching evaluations and results.page.tsx
to fetch evaluation info and evaluations using new API endpoints.route.ts
for fetching evaluations and results.route.ts
for evaluations.get_evaluations
to handlegroupId
filtering inroute.ts
.This description was created by for f9ebdd8. It will automatically update as commits are pushed.