@@ -80,8 +80,8 @@ export class CouchDbNoteRepository extends NoteRepository {
8080 id : doc . _id ,
8181 title : doc . title ,
8282 content : doc . content ,
83- createdAt : doc . createdAt ,
84- updatedAt : doc . updatedAt
83+ createdAt : new Date ( doc . createdAt ) ,
84+ updatedAt : new Date ( doc . updatedAt )
8585 } ) ;
8686 } ) . filter ( note => note !== null ) ;
8787 return notes ;
@@ -103,8 +103,8 @@ export class CouchDbNoteRepository extends NoteRepository {
103103 id : doc . _id ,
104104 title : doc . title ,
105105 content : doc . content ,
106- createdAt : doc . createdAt ,
107- updatedAt : doc . updatedAt
106+ createdAt : new Date ( doc . createdAt ) ,
107+ updatedAt : new Date ( doc . updatedAt )
108108 } ) ;
109109 } catch ( error ) {
110110 if ( error . statusCode === 404 ) {
@@ -137,8 +137,8 @@ export class CouchDbNoteRepository extends NoteRepository {
137137 id : result . id ,
138138 title : doc . title ,
139139 content : doc . content ,
140- createdAt : doc . createdAt ,
141- updatedAt : doc . updatedAt
140+ createdAt : new Date ( doc . createdAt ) ,
141+ updatedAt : new Date ( doc . updatedAt )
142142 } ) ;
143143 } catch ( error ) {
144144 console . error ( 'Failed to create note:' , error ) ;
@@ -185,8 +185,8 @@ export class CouchDbNoteRepository extends NoteRepository {
185185 id : id ,
186186 title : note . title ,
187187 content : note . content ,
188- createdAt : currentDoc . createdAt ,
189- updatedAt : updatedDoc . updatedAt
188+ createdAt : new Date ( currentDoc . createdAt ) ,
189+ updatedAt : new Date ( updatedDoc . updatedAt )
190190 } ) ;
191191 } catch ( error ) {
192192 console . error ( `Failed to update note with ID ${ id } :` , error ) ;
@@ -204,29 +204,23 @@ export class CouchDbNoteRepository extends NoteRepository {
204204 */
205205 async delete ( id ) {
206206 try {
207-
208207 // Get the current document
209208 let doc ;
210209 try {
211210 doc = await this . db . get ( id ) ;
212- console . log ( 'Document to delete:' , doc ) ;
213211 } catch ( error ) {
214212 if ( error . statusCode === 404 ) {
215- console . log ( `Note ${ id } not found` ) ;
216213 return false ;
217214 }
218215 throw error ;
219216 }
220-
221- const result = await this . db . destroy ( id , doc . _rev ) ;
222- console . log ( 'Delete result:' , result ) ;
217+ await this . db . destroy ( id , doc . _rev ) ;
223218 return true ;
224219 } catch ( error ) {
225- console . error ( `Failed to delete note with ID ${ id } :` , error ) ;
226220 if ( error . statusCode === 404 ) {
227- console . log ( `Note ${ id } not found` ) ;
228221 return false ;
229222 }
223+ console . error ( `Failed to delete note with ID ${ id } :` , error ) ;
230224 throw error ;
231225 }
232226 }
0 commit comments