mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
job ordering
This commit is contained in:
parent
cd47aef985
commit
41891a4540
2 changed files with 4 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { db } from "@/app/db/db";
|
||||
import { tasks } from "@/app/db/schema/tasks/tasks";
|
||||
import { subTasks } from "@/app/db/schema/tasks/subtask";
|
||||
import { eq, desc, count, sql } from "drizzle-orm";
|
||||
import { eq, count, sql } from "drizzle-orm";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export async function GET(
|
||||
|
|
@ -31,7 +31,7 @@ export async function GET(
|
|||
.leftJoin(subTasks, eq(subTasks.taskId, tasks.id))
|
||||
.where(eq(tasks.sourceId, portfolioId))
|
||||
.groupBy(tasks.id)
|
||||
.orderBy(desc(tasks.jobStarted))
|
||||
.orderBy(sql`${tasks.jobStarted} desc nulls last`)
|
||||
.limit(limit)
|
||||
.offset(offset);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { db } from "@/app/db/db";
|
||||
import { subTasks } from "@/app/db/schema/tasks/subtask";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { eq, sql } from "drizzle-orm";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export async function GET(
|
||||
|
|
@ -13,7 +13,7 @@ export async function GET(
|
|||
.select()
|
||||
.from(subTasks)
|
||||
.where(eq(subTasks.taskId, taskId))
|
||||
.orderBy(subTasks.jobStarted);
|
||||
.orderBy(sql`${subTasks.jobStarted} asc nulls last`);
|
||||
|
||||
return NextResponse.json(taskSubTasks);
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue