feat: Implement document upload functionality and update agent profile edit screen UI with a new back icon.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user