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:
2026-05-20 11:05:30 +02:00
parent 34f45a912f
commit def755e1c5
10 changed files with 520 additions and 323 deletions
+27 -5
View File
@@ -277,9 +277,23 @@ class AuthApi {
debugPrint('Response body: ${res.body}');
if (res.statusCode >= 200 && res.statusCode < 300) {
final Map<String, dynamic> json =
jsonDecode(res.body) as Map<String, dynamic>;
return {'error': false, 'data': SyncResponse.fromJson(json)};
try {
final Map<String, dynamic> json =
jsonDecode(res.body) as Map<String, dynamic>;
return {'error': false, 'data': SyncResponse.fromJson(json)};
} catch (e, st) {
debugPrint('SYNC PARSE ERROR -> $e');
debugPrint(st.toString());
debugPrint('SYNC PARSE RAW BODY -> ${res.body}');
return {
'error': true,
'message': 'Error parseando respuesta de sync: $e',
'exception': e.toString(),
'stackTrace': st.toString(),
'body': res.body,
'status': res.statusCode,
};
}
}
// If token expired (401), try to refresh
@@ -298,8 +312,16 @@ class AuthApi {
try {
final dynamic decoded = jsonDecode(res.body);
return {'error': true, 'status': res.statusCode, 'body': decoded};
} catch (_) {
return {'error': true, 'status': res.statusCode, 'body': res.body};
} catch (e, st) {
debugPrint('SYNC HTTP ERROR PARSE FAILED -> $e');
debugPrint(st.toString());
return {
'error': true,
'status': res.statusCode,
'body': res.body,
'exception': e.toString(),
'stackTrace': st.toString(),
};
}
}