Skip to content

Commit

Permalink
fix registration default
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhelp committed Oct 5, 2024
1 parent 52db3b5 commit a4d6525
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/lib/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export interface NewEventFormProps {
}

export interface getAllEventsOptions {
ascending?: boolean;
descending?: boolean;
}
7 changes: 4 additions & 3 deletions packages/db/functions/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ export function createNewEvent(event: eventInsertType) {
}

export function getAllEvents(options?: getAllEventsOptions) {
const orderByClause = options?.ascending
? [asc(events.startTime)]
: [desc(events.startTime)];
const orderByClause = options?.descending
? [desc(events.startTime)]
: [asc(events.startTime)]

return db.query.events.findMany({
orderBy: orderByClause,
});
Expand Down

0 comments on commit a4d6525

Please sign in to comment.