feat: Implement document upload functionality and update agent profile edit screen UI with a new back icon.

This commit is contained in:
pradeepkumar
2026-03-09 06:33:55 +05:30
parent f1003be757
commit d800b14280
4 changed files with 532 additions and 180 deletions

View File

@@ -96,6 +96,30 @@ class ProfileRepository {
}
}
/// Get presigned upload URL for documents.
/// Returns { uploadUrl: String, key: String, publicUrl: String }
Future<Map<String, String>> getDocumentUploadUrl(
String fileName, String contentType) async {
try {
final response = await _dio.post('/upload/presigned-url', data: {
'filename': fileName,
'contentType': contentType,
});
final data = response.data['data'] as Map<String, dynamic>;
return {
'uploadUrl': data['uploadUrl'] as String,
'key': data['key'] as String,
'publicUrl': (data['publicUrl'] ?? data['key'] ?? '') as String,
};
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to get document upload URL',
statusCode: e.response?.statusCode,
);
}
}
/// Delete avatar from S3: DELETE /upload/{encodedKey}
Future<void> deleteAvatar(String key) async {
try {