11import { FastifyInstance } from "fastify" ;
22import { INotesService } from "../../../services/notes/NotesServiceInterface" ;
3- import { Note , NoteCollaborators , NotePreview , NoteUpdate , NoteWithoutMetadata } from "../../../shared/dto/NoteDto" ;
3+ import { NoteUpdate , NoteWithoutMetadata } from "../../../shared/dto/NoteDto" ;
44import { extractJwtPayload } from "../../../shared/utils/jwt/PayloadExtractor" ;
55import { extractToken } from "../../../shared/utils/common/TokenExtractor" ;
66import { AddCollaboratorSchema , CreateNoteSchema , DeleteNoteSchema , GetNoteCollaboratorsSchema , GetNoteSchema , GetNotesSchema , RemoveCollaboratorSchema , UpdateNoteSchema } from "../../validation/schemas/NoteSchemas" ;
@@ -44,7 +44,7 @@ export class NotesHandler implements Handler {
4444 Querystring : {
4545 limit : number ,
4646 offset : number ,
47- sort : "ASC" | "DESC" ,
47+ date_sort : "ASC" | "DESC" ,
4848 tags : string [ ]
4949 } ,
5050 } > ( "/notes/my" ,
@@ -57,12 +57,9 @@ export class NotesHandler implements Handler {
5757 extractToken ( request )
5858 )
5959
60- const limit = request . query . limit
61- const skip = request . query . offset
62- const sort = request . query . sort
63- const tags = request . query . tags
60+ const { limit, offset, date_sort, tags} = request . query
6461
65- const notes = await this . notesService . getMyNotes ( login , { tags, limit, skip , sort } )
62+ const notes = await this . notesService . getMyNotes ( login , { tags, limit, offset , date_sort } )
6663 if ( isException ( notes ) ) {
6764 reply . code ( notes . statusCode ) . send ( notes )
6865 return
@@ -92,7 +89,7 @@ export class NotesHandler implements Handler {
9289 const sort = request . query . sort
9390 const tags = request . query . tags
9491
95- const notes = await this . notesService . getCollaboratedNotes ( login , { tags, limit, skip, sort} )
92+ const notes = await this . notesService . getCollaboratedNotes ( login , { tags, limit, offset : skip , date_sort : sort } )
9693 if ( isException ( notes ) ) {
9794 reply . code ( notes . statusCode ) . send ( notes )
9895 return
0 commit comments