Skip to content

Commit d7e24c8

Browse files
committed
feat(api): add timestamp update for PUT requests
- Add server-side timestamp update for data modification - Ensure 'updatedAt' field is always synchronized with the last modification time - Improve data consistency and tracking
1 parent 4347fd0 commit d7e24c8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

routes/api/v1/data/[id]/index.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ Future<Response> _handlePut(
185185
throw const BadRequestException('Missing or invalid request body.');
186186
}
187187

188+
// Standardize timestamp before model creation
189+
requestBody['updatedAt'] = DateTime.now().toUtc().toIso8601String();
190+
188191
// Deserialize using ModelConfig's fromJson, catching TypeErrors locally
189192
dynamic itemToUpdate;
190193
try {

0 commit comments

Comments
 (0)