Skip to content

Commit

Permalink
Fix list generic endpoint default order by (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
G4brym authored Jan 8, 2025
1 parent cd1ba5e commit 5986b0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chanfana",
"version": "2.5.3",
"version": "2.5.4",
"description": "OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router and more!",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion src/endpoints/d1/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class D1ListEndpoint<HandleArgs extends Array<object> = Array<object>> ex
where = `WHERE ${conditions.join(" AND ")}`;
}

let orderBy = `ORDER BY ${this.defaultOrderBy || this.meta.model.primaryKeys[0]} DESC`;
let orderBy = `ORDER BY ${this.defaultOrderBy || `${this.meta.model.primaryKeys[0]} DESC`}`;
if (filters.options.order_by) {
orderBy = `ORDER BY ${filters.options.order_by} ${filters.options.order_by_direction || "ASC"}`;
}
Expand Down

0 comments on commit 5986b0d

Please sign in to comment.