Add JWT auth for protected routes, add /reg endpoint, remove /user endpoints

This commit is contained in:
dmit.b
2026-05-08 13:38:52 +03:00
parent 49bb854ca2
commit 3124629e6c
9 changed files with 109 additions and 145 deletions
+4 -10
View File
@@ -1,19 +1,15 @@
class Geoposition {
final int id;
final int userId;
final double xValue;
final double yValue;
final DateTime datetime;
final Duration lifetime;
final DateTime lastUpdate;
final DateTime expiresAt;
Geoposition({
required this.id,
required this.userId,
required this.xValue,
required this.yValue,
required this.datetime,
required this.lifetime,
required this.lastUpdate,
required this.expiresAt,
});
@@ -22,7 +18,7 @@ class Geoposition {
'id': id,
'x': xValue,
'y': yValue,
'datetime': datetime.toIso8601String(),
'lastUpdate': lastUpdate.toIso8601String(),
'remainingSeconds': expiresAt.difference(DateTime.now()).inSeconds,
};
}
@@ -30,11 +26,9 @@ class Geoposition {
factory Geoposition.fromMap(Map<String, dynamic> map) {
return Geoposition(
id: map['id'],
userId: map['user_id'],
xValue: map['x_value'].toDouble(),
yValue: map['y_value'].toDouble(),
datetime: map['datetime'] as DateTime,
lifetime: Duration(seconds: map['lifetime']),
lastUpdate: map['last_update'] as DateTime,
expiresAt: map['expires_at'] as DateTime,
);
}