Fix: link share_id to geo_id so /watch returns correct position
This commit is contained in:
@@ -61,13 +61,14 @@ class AuthRoutes {
|
||||
|
||||
Future<Response> _watch(Request request, String login) async {
|
||||
final uniqueId = request.url.queryParameters['unique_id'];
|
||||
final geoId = database.getGeoIdByShareId(uniqueId!);
|
||||
|
||||
if (!database.isValidShareId(uniqueId!)) {
|
||||
if (geoId == null) {
|
||||
await database.createLog(login, 'Accessed invalid share link');
|
||||
return Response(404, body: jsonEncode({'error': 'Share link not found'}), headers: {'Content-Type': 'application/json'});
|
||||
}
|
||||
|
||||
final position = await database.getLatestPosition();
|
||||
final position = await database.getPositionById(geoId);
|
||||
|
||||
if (position == null) {
|
||||
await database.createLog(login, 'Accessed share link - no position');
|
||||
|
||||
Reference in New Issue
Block a user