Add basic implementation and add in record attendance API for testing
This commit is contained in:
parent
b21d30c18e
commit
f47586710b
@ -562,13 +562,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
Activity = attendance.Activity,
|
Activity = attendance.Activity,
|
||||||
JobRoleName = employee.JobRole.Name
|
JobRoleName = employee.JobRole.Name
|
||||||
};
|
};
|
||||||
var sendActivity = 0;
|
await _signalR.Clients.All.SendAsync("Attendance", new { LoggedInUserId = currentEmployee.Id, ProjectId = recordAttendanceDot.ProjectID, Response = vm });
|
||||||
if (recordAttendanceDot.Id == Guid.Empty)
|
|
||||||
{
|
|
||||||
sendActivity = 1;
|
|
||||||
}
|
|
||||||
var notification = new { LoggedInUserId = currentEmployee.Id, Keyword = "Attendance", Activity = sendActivity, ProjectId = attendance.ProjectID, Response = vm };
|
|
||||||
await _signalR.Clients.All.SendAsync("NotificationEventHandler", notification);
|
|
||||||
_logger.LogInfo("Attendance for employee {FirstName} {LastName} has been marked", employee.FirstName ?? string.Empty, employee.LastName ?? string.Empty);
|
_logger.LogInfo("Attendance for employee {FirstName} {LastName} has been marked", employee.FirstName ?? string.Empty, employee.LastName ?? string.Empty);
|
||||||
return Ok(ApiResponse<object>.SuccessResponse(vm, "Attendance marked successfully.", 200));
|
return Ok(ApiResponse<object>.SuccessResponse(vm, "Attendance marked successfully.", 200));
|
||||||
}
|
}
|
||||||
@ -707,16 +701,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
if (string.IsNullOrEmpty(Image.Base64Data))
|
if (string.IsNullOrEmpty(Image.Base64Data))
|
||||||
return BadRequest(ApiResponse<object>.ErrorResponse("Base64 data is missing", "Base64 data is missing", 400));
|
return BadRequest(ApiResponse<object>.ErrorResponse("Base64 data is missing", "Base64 data is missing", 400));
|
||||||
|
|
||||||
//If base64 has a data URI prefix, strip it
|
objectKey = await _s3Service.UploadFileAsync(Image.Base64Data, TenantId, "attendance");
|
||||||
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);
|
preSignedUrl = _s3Service.GeneratePreSignedUrlAsync(objectKey);
|
||||||
|
|
||||||
document = new Document
|
document = new Document
|
||||||
|
Loading…
x
Reference in New Issue
Block a user