Setting up basic API Structure

This commit is contained in:
2026-08-28 14:54:54 +02:00
parent 968228cbc3
commit b3a13cd5a2
18 changed files with 974 additions and 0 deletions
@@ -0,0 +1,18 @@
import 'package:ac_web/Api/Dtos/ReportDto.dart';
import 'package:ac_web/Api/Services/ApiServiceBase.dart';
/// Access to the backend `ReportsController` (`/reports`).
class ReportsService extends ApiServiceBase {
const ReportsService(super.client);
@override
String get controllerRoute => 'reports';
/// `GET /reports` - all reports, newest first.
Future<List<ReportDto>> getReports() async {
final reports = await client.getList(route(), ReportDto.fromJson);
final sorted = List<ReportDto>.of(reports);
sorted.sort((left, right) => right.timestamp.compareTo(left.timestamp));
return sorted;
}
}