Sort by descending

This commit is contained in:
Owen
2025-10-29 16:16:25 -07:00
parent 5542873368
commit c6f7be40df
3 changed files with 6 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ import { db, requestAuditLog, resources } from "@server/db";
import { registry } from "@server/openApi";
import { NextFunction } from "express";
import { Request, Response } from "express";
import { eq, gt, lt, and, count } from "drizzle-orm";
import { eq, gt, lt, and, count, desc } from "drizzle-orm";
import { OpenAPITags } from "@server/openApi";
import { z } from "zod";
import createHttpError from "http-errors";
@@ -123,7 +123,7 @@ export function queryRequest(data: Q) {
eq(requestAuditLog.resourceId, resources.resourceId)
) // TODO: Is this efficient?
.where(getWhere(data))
.orderBy(requestAuditLog.timestamp);
.orderBy(desc(requestAuditLog.timestamp));
}
export function countRequestQuery(data: Q) {