Ashutosh_Task#513 #96
@ -707,7 +707,16 @@ namespace MarcoBMS.Services.Controllers
|
||||
if (string.IsNullOrEmpty(Image.Base64Data))
|
||||
return BadRequest(ApiResponse<object>.ErrorResponse("Base64 data is missing", "Base64 data is missing", 400));
|
||||
|
||||
objectKey = await _s3Service.UploadFileAsync(Image.Base64Data, TenantId, "attendance");
|
||||
//If base64 has a data URI prefix, strip it
|
||||
var base64 = Image.Base64Data.Contains(",")
|
||||
? Image.Base64Data.Substring(Image.Base64Data.IndexOf(",") + 1)
|
||||
: Image.Base64Data;
|
||||
|
||||
string fileType = _s3Service.GetContentTypeFromBase64(base64);
|
||||
string fileName = _s3Service.GenerateFileName(fileType, TenantId, "attendance");
|
||||
|
||||
string objectKey = $"tenant-{TenantId}/Employee/{recordAttendanceDot.EmployeeID}/Attendance/{fileName}";
|
||||
await _s3Service.UploadFileAsync(base64, fileType, objectKey);
|
||||
preSignedUrl = _s3Service.GeneratePreSignedUrlAsync(objectKey);
|
||||
|
||||
document = new Document
|
||||
@ -722,6 +731,7 @@ namespace MarcoBMS.Services.Controllers
|
||||
};
|
||||
_context.Documents.Add(document);
|
||||
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user