feat: add SQLite data layer, local auth and security settings
- Add offline-first SQLite architecture with DatabaseHelper singleton, 12 CREATE TABLE statements and full seed data on first launch - Add 10 models (fromMap/toMap) and 12 DAOs with CRUD + getPendientes() - Add ApiAuthService (JWT via SharedPreferences) and Sincronizador skeleton - Move login auth from SQLite to SharedPreferences with SHA-256 PIN hash; default PIN 123456, platform-independent (no native plugin required) - Add seguridad_page.dart: change PIN form (current → new → confirm) - Add Cerrar Sesión with confirmation dialog and full stack clear - Redesign settings_page.dart with AppColors dark theme; add Sistema section with "Inicializar base de datos" and "Inicializar sincronización" - Fix Linux desktop: sqflite_common_ffi with platform detection in DatabaseHelper - Fix ScrollController conflict on Linux: primary: false on all IndexedStack pages - Update plan_proyecto.md with session 2–3 progress and auth roadmap Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
8f13d57839
commit
1184ab5fe2
@@ -0,0 +1,39 @@
|
||||
class Acceso {
|
||||
final int id;
|
||||
final int usuarioId;
|
||||
final int puertaId;
|
||||
final String timestamp;
|
||||
final bool autorizado;
|
||||
final String metodo; // pin / remoto / biometrico
|
||||
final bool sincronizado;
|
||||
|
||||
const Acceso({
|
||||
required this.id,
|
||||
required this.usuarioId,
|
||||
required this.puertaId,
|
||||
required this.timestamp,
|
||||
this.autorizado = false,
|
||||
this.metodo = 'pin',
|
||||
this.sincronizado = false,
|
||||
});
|
||||
|
||||
factory Acceso.fromMap(Map<String, dynamic> m) => Acceso(
|
||||
id: m['id'] as int,
|
||||
usuarioId: m['usuario_id'] as int,
|
||||
puertaId: m['puerta_id'] as int,
|
||||
timestamp: m['timestamp'] as String,
|
||||
autorizado: (m['autorizado'] as int) == 1,
|
||||
metodo: m['metodo'] as String,
|
||||
sincronizado: (m['sincronizado'] as int) == 1,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
'id': id,
|
||||
'usuario_id': usuarioId,
|
||||
'puerta_id': puertaId,
|
||||
'timestamp': timestamp,
|
||||
'autorizado': autorizado ? 1 : 0,
|
||||
'metodo': metodo,
|
||||
'sincronizado': sincronizado ? 1 : 0,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user