From f47586710b5537064c1244d33caa1bacb686a417 Mon Sep 17 00:00:00 2001 From: "ashutosh.nehete" Date: Wed, 11 Jun 2025 10:21:39 +0530 Subject: [PATCH] Add basic implementation and add in record attendance API for testing --- .../Controllers/AttendanceController.cs | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/Marco.Pms.Services/Controllers/AttendanceController.cs b/Marco.Pms.Services/Controllers/AttendanceController.cs index 8cbd053..ad40093 100644 --- a/Marco.Pms.Services/Controllers/AttendanceController.cs +++ b/Marco.Pms.Services/Controllers/AttendanceController.cs @@ -562,13 +562,7 @@ namespace MarcoBMS.Services.Controllers Activity = attendance.Activity, JobRoleName = employee.JobRole.Name }; - var sendActivity = 0; - 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); + await _signalR.Clients.All.SendAsync("Attendance", new { LoggedInUserId = currentEmployee.Id, ProjectId = recordAttendanceDot.ProjectID, Response = vm }); _logger.LogInfo("Attendance for employee {FirstName} {LastName} has been marked", employee.FirstName ?? string.Empty, employee.LastName ?? string.Empty); return Ok(ApiResponse.SuccessResponse(vm, "Attendance marked successfully.", 200)); } @@ -707,16 +701,7 @@ namespace MarcoBMS.Services.Controllers if (string.IsNullOrEmpty(Image.Base64Data)) return BadRequest(ApiResponse.ErrorResponse("Base64 data is missing", "Base64 data is missing", 400)); - //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); + objectKey = await _s3Service.UploadFileAsync(Image.Base64Data, TenantId, "attendance"); preSignedUrl = _s3Service.GeneratePreSignedUrlAsync(objectKey); document = new Document