feat: refactor server with shelf_static, return JSON responses, add API docs

This commit is contained in:
dmit.b
2026-05-09 09:12:44 +03:00
parent cd85f5f2db
commit 97db1b6b58
46 changed files with 172153 additions and 24 deletions
+6 -6
View File
@@ -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()),