feat: add Swagger UI docs, custom CORS middleware, and request logging

- Add Swagger UI files and updated API spec for Family Safety Tracker
- Replace shelf_cors_headers with custom CORS middleware in server.dart
- Add request_logger middleware with timing for auth and geo routes
- Add REGISTRATION_SECRET_KEY to .env for registration validation
- Remove postgres port exposure from docker-compose.yml
- Update opencode.json model configuration
- Add crypto dependency and update Flutter web assets
This commit is contained in:
dmit.b
2026-05-15 17:43:53 +03:00
parent 6b4c599981
commit fde96c0197
25 changed files with 53278 additions and 49937 deletions
+26
View File
@@ -0,0 +1,26 @@
void logRequest({
required String method,
required String url,
required int status,
required Duration duration,
DateTime? startTime,
String? body,
Map<String, String>? responseHeaders,
}) {
final start = startTime ?? DateTime.now();
final timestamp = start.toIso8601String();
final durationMs = duration.inMilliseconds;
final bodyPreview = body != null && body.length > 500 ? '${body.substring(0, 500)}...' : body;
print('[$timestamp] $method $url -> $status (${durationMs}ms)');
if (bodyPreview != null && bodyPreview.isNotEmpty) {
print(' Body: $bodyPreview');
}
if (responseHeaders != null) {
final contentType = responseHeaders['content-type'];
if (contentType != null) {
print(' Content-Type: $contentType');
}
}
print('');
}