Link between front-end and back-end
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user