Added the checks to check the Designation and Description in contact
This commit is contained in:
parent
ac672d0cc2
commit
a10b24523e
@ -956,6 +956,10 @@ namespace Marco.Pms.Services.Service
|
||||
try
|
||||
{
|
||||
var contact = _mapper.Map<Contact>(createContact);
|
||||
if (string.IsNullOrWhiteSpace(createContact.Name))
|
||||
{
|
||||
contact.Description = string.Empty;
|
||||
}
|
||||
contact.CreatedAt = DateTime.UtcNow;
|
||||
contact.CreatedById = loggedInEmployeeId;
|
||||
contact.TenantId = tenantId;
|
||||
@ -1117,6 +1121,14 @@ namespace Marco.Pms.Services.Service
|
||||
|
||||
// Update the main contact object from DTO
|
||||
var updatedContact = _mapper.Map<Contact>(updateContact);
|
||||
if (string.IsNullOrWhiteSpace(updateContact.Designation))
|
||||
{
|
||||
updatedContact.Designation = string.Empty;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(updateContact.Description))
|
||||
{
|
||||
updatedContact.Description = string.Empty;
|
||||
}
|
||||
updatedContact.TenantId = tenantId;
|
||||
updatedContact.CreatedAt = contact.CreatedAt;
|
||||
updatedContact.CreatedById = contact.CreatedById;
|
||||
@ -3047,14 +3059,25 @@ namespace Marco.Pms.Services.Service
|
||||
|
||||
private async Task<(bool hasAdmin, bool hasManager, bool hasUser)> CheckPermissionsAsync(Guid employeeId)
|
||||
{
|
||||
// Scoping the service provider ensures services are disposed of correctly.
|
||||
// Run all permission checks in parallel.
|
||||
var hasAdminTask = Task.Run(async () =>
|
||||
{
|
||||
using var scope = _serviceScopeFactory.CreateScope();
|
||||
var permissionService = scope.ServiceProvider.GetRequiredService<PermissionServices>();
|
||||
|
||||
// Run all permission checks in parallel.
|
||||
var hasAdminTask = permissionService.HasPermission(PermissionsMaster.DirectoryAdmin, employeeId);
|
||||
var hasManagerTask = permissionService.HasPermission(PermissionsMaster.DirectoryManager, employeeId);
|
||||
var hasUserTask = permissionService.HasPermission(PermissionsMaster.DirectoryUser, employeeId);
|
||||
return await permissionService.HasPermission(PermissionsMaster.DirectoryAdmin, employeeId);
|
||||
});
|
||||
var hasManagerTask = Task.Run(async () =>
|
||||
{
|
||||
using var scope = _serviceScopeFactory.CreateScope();
|
||||
var permissionService = scope.ServiceProvider.GetRequiredService<PermissionServices>();
|
||||
return await permissionService.HasPermission(PermissionsMaster.DirectoryManager, employeeId);
|
||||
});
|
||||
var hasUserTask = Task.Run(async () =>
|
||||
{
|
||||
using var scope = _serviceScopeFactory.CreateScope();
|
||||
var permissionService = scope.ServiceProvider.GetRequiredService<PermissionServices>();
|
||||
return await permissionService.HasPermission(PermissionsMaster.DirectoryUser, employeeId);
|
||||
});
|
||||
|
||||
await Task.WhenAll(hasAdminTask, hasManagerTask, hasUserTask);
|
||||
|
||||
|
@ -1761,7 +1761,8 @@ namespace Marco.Pms.Services.Service
|
||||
|
||||
var data = new Dictionary<string, string>()
|
||||
{
|
||||
{ "Keyword", "Bucket_Modified" }
|
||||
{ "Keyword", "Bucket_Modified" },
|
||||
{"BucketId", bucketId.ToString() }
|
||||
};
|
||||
|
||||
var registrationTokensForNotification = await _context.FCMTokenMappings.Where(ft => assignedEmployeeIds.Contains(ft.EmployeeId) && ft.ExpiredAt >= DateTime.UtcNow).Select(ft => ft.FcmToken).ToListAsync();
|
||||
|
Loading…
x
Reference in New Issue
Block a user