Commit 224197f 1 parent 7a30ff2 commit 224197f Copy full SHA for 224197f
File tree 2 files changed +5
-2
lines changed
src/app/semana/dia/[dia]/components
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export default async function Categorias({ params }: { params: number }) {
16
16
email : session ?. user ?. email ,
17
17
} ,
18
18
} ,
19
- } ) ) as CategoriaType [ ] ;
19
+ } ) ) . sort ( ( a , b ) => a . title . localeCompare ( b . title ) ) as CategoriaType [ ] ;
20
20
}
21
21
22
22
let categories : CategoriaType [ ] = await getCategories ( ) ;
Original file line number Diff line number Diff line change @@ -5,12 +5,13 @@ import { getServerSession } from "next-auth";
5
5
import Header from "./components/Header" ;
6
6
import TarefasGrid from "./components/TarefasGrid" ;
7
7
import { ModalTaskProvider } from "./providers/modalTaskProvider" ;
8
+ import { hourToTime } from "@/utils/hourToTime" ;
8
9
9
10
export default async function Tarefas ( { params } : { params : number } ) {
10
11
const session = await getServerSession ( authOptions ) ;
11
12
12
13
async function getTasks ( ) {
13
- return await prisma . task . findMany ( {
14
+ let tarefas = await prisma . task . findMany ( {
14
15
where : {
15
16
day : params ,
16
17
User : {
@@ -21,6 +22,8 @@ export default async function Tarefas({ params }: { params: number }) {
21
22
Categorie : true
22
23
}
23
24
} ) as TarefaType [ ]
25
+ let newTarefas = tarefas . sort ( ( a , b ) => hourToTime ( { time : a . primeira_hora } ) - hourToTime ( { time : b . primeira_hora } ) )
26
+ return newTarefas
24
27
}
25
28
26
29
let tarefas : TarefaType [ ] = await getTasks ( ) ;
You can’t perform that action at this time.
0 commit comments