Skip to content

Commit

Permalink
WIP clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
nickvisut committed Dec 22, 2024
1 parent 31c9d14 commit f4327f5
Showing 1 changed file with 50 additions and 49 deletions.
99 changes: 50 additions & 49 deletions src/backend/routers/iep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,42 +354,6 @@ export const iep = router({
return result;
}),

//.innerJoin("task", "benchmark.benchmark_id", "task.benchmark_id")
// .innerJoin("goal", "benchmark.goal_id", "goal.goal_id")
// .innerJoin("iep", "goal.iep_id", "iep.iep_id")
// .innerJoin("student", "iep.student_id", "student.student_id")

// "task.task_id",
// "student.first_name",
// "student.last_name",
// "goal.category",
// "benchmark.description",
// "benchmark.instructions",
// "benchmark.frequency",
// "benchmark.number_of_trials",
// "benchmark.benchmark_id",
// "task.due_date",
// "task.seen",
// "task.trial_count",

// .select([
// "benchmark.description",
// "benchmark.instructions",
// "benchmark.frequency",
// "benchmark.number_of_trials",
// "benchmark.benchmark_id",
// ])

// {
// benchmark: {
// id,
// title,
// desc,
// assignees: [
// { id:, name }
// ]
// }
// }
getBenchmark: hasCaseManager
.input(
z.object({
Expand All @@ -399,25 +363,25 @@ export const iep = router({
.query(async (req) => {
const { benchmark_id } = req.input;

// NOTE: existing code
const result = await req.ctx.db
.selectFrom("benchmark")
.where("benchmark.benchmark_id", "=", benchmark_id)
.selectAll() // works
// .select("*") // doesn't work, but maybe it'll work if we do the function form
.execute();
return result;

// // NOTE: no errors, but the app may blow up b/c we're returning multiple rows
// // NOTE: existing code
// const result = await req.ctx.db
// .selectFrom("benchmark")
// .innerJoin("task", "benchmark.benchmark_id", "task.benchmark_id")
// .innerJoin("user", "task.assignee_id", "user.user_id")
// .where("benchmark.benchmark_id", "=", benchmark_id)
// .selectAll()
// .selectAll() // works
// // .select("*") // doesn't work, but maybe it'll work if we do the function form
// .execute();
// return result;

// NOTE: no errors, but the app may blow up b/c we're returning multiple rows
const result = await req.ctx.db
.selectFrom("benchmark")
.innerJoin("task", "benchmark.benchmark_id", "task.benchmark_id")
.innerJoin("user", "task.assignee_id", "user.user_id")
.where("benchmark.benchmark_id", "=", benchmark_id)
.selectAll()
.execute();
return result;

// const result = await req.ctx.db
// .selectFrom("benchmark")
// .innerJoin("task", "benchmark.benchmark_id", "task.benchmark_id")
Expand Down Expand Up @@ -458,6 +422,43 @@ export const iep = router({
// return result;
}),

//.innerJoin("task", "benchmark.benchmark_id", "task.benchmark_id")
// .innerJoin("goal", "benchmark.goal_id", "goal.goal_id")
// .innerJoin("iep", "goal.iep_id", "iep.iep_id")
// .innerJoin("student", "iep.student_id", "student.student_id")

// "task.task_id",
// "student.first_name",
// "student.last_name",
// "goal.category",
// "benchmark.description",
// "benchmark.instructions",
// "benchmark.frequency",
// "benchmark.number_of_trials",
// "benchmark.benchmark_id",
// "task.due_date",
// "task.seen",
// "task.trial_count",

// .select([
// "benchmark.description",
// "benchmark.instructions",
// "benchmark.frequency",
// "benchmark.number_of_trials",
// "benchmark.benchmark_id",
// ])

// {
// benchmark: {
// id,
// title,
// desc,
// assignees: [
// { id:, name }
// ]
// }
// }

getBenchmarkByAssignee: hasCaseManager
.input(
z.object({
Expand Down

0 comments on commit f4327f5

Please sign in to comment.