refactor: Update Note and Category models to use 'id' instead of 'uuid', and adjust related database operations
- Changed 'uuid' to 'id' in Note and Category models for consistency. - Updated database operations in NoteRepository to reflect the new 'id' field. - Modified sync models to accommodate changes in Note and Category structures. - Adjusted the handling of notes and categories during synchronization. - Refactored the note editor and home screen to use the new 'id' field. - Ensured that the 'isDirty' flag is properly set and utilized across models.
This commit is contained in:
@@ -89,7 +89,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_isNewNote = widget.note?.id == null;
|
||||
_isNewNote = widget.note == null;
|
||||
|
||||
if (_isNewNote) {
|
||||
final DateTime now = DateTime.now();
|
||||
@@ -98,7 +98,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
body: '',
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
index: 0,
|
||||
position: 0,
|
||||
);
|
||||
} else {
|
||||
_currentNote = widget.note!;
|
||||
@@ -143,6 +143,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
title: title.isEmpty ? 'Sin título' : title,
|
||||
body: body,
|
||||
updatedAt: DateTime.now(),
|
||||
isDirty: true,
|
||||
);
|
||||
|
||||
_complete(updatedNote);
|
||||
|
||||
Reference in New Issue
Block a user