Link between front-end and back-end

This commit is contained in:
2025-07-09 12:41:00 +02:00
parent 6735ddb5fd
commit 1b261c08bb
31 changed files with 5507 additions and 40 deletions

View File

@ -50,7 +50,7 @@ class DbHelper {
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
type TEXT NOT NULL,
volatege REAL NOT NULL,
voltage REAL NOT NULL,
image_uuid TEXT
)
''');
@ -84,6 +84,16 @@ class DbHelper {
return maps.map((e) => Drone.fromMap(e)).toList();
}
Future<int> updateDrone(Drone drone) async {
final db = await database;
return await db.update(
"drones",
drone.toMap(),
where: "id = ?",
whereArgs: [drone.id],
);
}
Future<int> deleteDrone(int droneId) async {
// TODO: Delete image
final db = await database;
@ -103,6 +113,16 @@ class DbHelper {
return maps.map((e) => Battery.fromMap(e)).toList();
}
Future<int> updateBattery(Battery battery) async {
final db = await database;
return await db.update(
"batteries",
battery.toMap(),
where: "id = ?",
whereArgs: [battery.id],
);
}
Future<int> deleteBattery(int batteryId) async {
// TODO: Delete image
final db = await database;