Skip to content

Commit b957e9a

Browse files
authored
Fix task order in tutorials (#1508)
1 parent fc1550f commit b957e9a

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

examples/tutorials/TodoApp/src/server/queries.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ export const getTasks = async (args, context) => {
66
}
77
return context.entities.Task.findMany({
88
where: { user: { id: context.user.id } },
9+
orderBy: { id: 'asc' },
910
})
1011
}

examples/tutorials/TodoAppTs/src/server/queries.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ export const getTasks: GetTasks<void, Task[]> = async (args, context) => {
88
}
99
return context.entities.Task.findMany({
1010
where: { user: { id: context.user.id } },
11+
orderBy: { id: 'asc' },
1112
})
1213
}

web/docs/tutorial/05-queries.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ Next, create a new file `src/server/queries.ts` and define the TypeScript functi
8181

8282
```js title="src/server/queries.js"
8383
export const getTasks = async (args, context) => {
84-
return context.entities.Task.findMany({})
84+
return context.entities.Task.findMany({
85+
orderBy: { id: 'asc' },
86+
})
8587
}
8688
```
8789

@@ -93,7 +95,9 @@ import { Task } from '@wasp/entities'
9395
import { GetTasks } from '@wasp/queries/types'
9496

9597
export const getTasks: GetTasks<void, Task[]> = async (args, context) => {
96-
return context.entities.Task.findMany({})
98+
return context.entities.Task.findMany({
99+
orderBy: { id: 'asc' },
100+
})
97101
}
98102
```
99103

web/docs/tutorial/07-auth.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ export const getTasks = async (args, context) => {
330330
}
331331
return context.entities.Task.findMany({
332332
where: { user: { id: context.user.id } },
333+
orderBy: { id: 'asc' },
333334
})
334335
}
335336
```
@@ -348,6 +349,7 @@ export const getTasks: GetTasks<void, Task[]> = async (args, context) => {
348349
}
349350
return context.entities.Task.findMany({
350351
where: { user: { id: context.user.id } },
352+
orderBy: { id: 'asc' },
351353
})
352354
}
353355
```

0 commit comments

Comments
 (0)