feat: refactor server with shelf_static, return JSON responses, add API docs
This commit is contained in:
@@ -221,7 +221,7 @@ class DatabaseProvider {
|
||||
|
||||
final row = results.first;
|
||||
return Geoposition(
|
||||
id: int.parse(row[0].toString()),
|
||||
id: row[0].toString(),
|
||||
xValue: double.parse(row[1].toString()),
|
||||
yValue: double.parse(row[2].toString()),
|
||||
lastUpdate: DateTime.parse(row[3].toString()),
|
||||
@@ -230,7 +230,7 @@ class DatabaseProvider {
|
||||
}
|
||||
|
||||
Future<Geoposition> updatePosition(
|
||||
int id,
|
||||
String id,
|
||||
double x,
|
||||
double y,
|
||||
) async {
|
||||
@@ -253,7 +253,7 @@ class DatabaseProvider {
|
||||
|
||||
final row = results.first;
|
||||
return Geoposition(
|
||||
id: int.parse(row[0].toString()),
|
||||
id: row[0].toString(),
|
||||
xValue: double.parse(row[1].toString()),
|
||||
yValue: double.parse(row[2].toString()),
|
||||
lastUpdate: DateTime.parse(row[3].toString()),
|
||||
@@ -261,10 +261,10 @@ class DatabaseProvider {
|
||||
);
|
||||
}
|
||||
|
||||
Future<Geoposition?> getLatestPosition() async {
|
||||
Future<Geoposition?> getLatestPosition() async {
|
||||
final results = await _dbConnection.execute(
|
||||
Sql.named('''
|
||||
SELECT x_value, y_value, last_update, expires_at
|
||||
SELECT id, x_value, y_value, last_update, expires_at
|
||||
FROM geopositions
|
||||
WHERE expires_at > NOW()
|
||||
ORDER BY last_update DESC
|
||||
@@ -276,7 +276,7 @@ class DatabaseProvider {
|
||||
|
||||
final row = results.first;
|
||||
return Geoposition(
|
||||
id: int.parse(row[0].toString()),
|
||||
id: row[0].toString(),
|
||||
xValue: double.parse(row[1].toString()),
|
||||
yValue: double.parse(row[2].toString()),
|
||||
lastUpdate: DateTime.parse(row[3].toString()),
|
||||
|
||||
Reference in New Issue
Block a user