Firebase_Implementation #135

Merged
ashutosh.nehete merged 62 commits from Firebase_Implementation into main 2025-09-20 12:11:54 +00:00
3 changed files with 14 additions and 12 deletions
Showing only changes of commit 20b12cfcd4 - Show all commits

View File

@ -1026,7 +1026,7 @@ namespace Marco.Pms.Services.Service
Body = $"New Contact \"{contact.Name}\" is created by {name} in your bucket"
};
await _firebase.SendContactAsync(contactVM.BucketIds, notification, tenantId);
await _firebase.SendContactAsync(contact.Id, contactVM.BucketIds, notification, tenantId);
});
@ -1496,7 +1496,7 @@ namespace Marco.Pms.Services.Service
Body = $"Contact \"{contact.Name}\" is updated by {name} in your bucket"
};
await _firebase.SendContactAsync(contactVM.BucketIds, notification, tenantId);
await _firebase.SendContactAsync(updateContact.Id, contactVM.BucketIds, notification, tenantId);
}
});
@ -1591,7 +1591,7 @@ namespace Marco.Pms.Services.Service
};
}
await _firebase.SendContactAsync(bucketIds, notification, tenantId);
await _firebase.SendContactAsync(contact.Id, bucketIds, notification, tenantId);
}
});
@ -2074,7 +2074,7 @@ namespace Marco.Pms.Services.Service
Body = $"New note added at Contact \"{contact.Name}\" by {name} in your bucket"
};
await _firebase.SendContactNoteAsync(bucketIds, notification, tenantId);
await _firebase.SendContactNoteAsync(contact.Id, bucketIds, notification, tenantId);
});
@ -2207,7 +2207,7 @@ namespace Marco.Pms.Services.Service
Body = $"Note updated at Contact \"{contact.Name}\" by {name} in your bucket"
};
await _firebase.SendContactNoteAsync(bucketIds, notification, tenantId);
await _firebase.SendContactNoteAsync(contact.Id, bucketIds, notification, tenantId);
});
@ -2346,7 +2346,7 @@ namespace Marco.Pms.Services.Service
Body = $"Note deleted at Contact \"{contact.Name}\" by {name} in your bucket"
};
}
await _firebase.SendContactNoteAsync(bucketIds, notification, tenantId);
await _firebase.SendContactNoteAsync(contact.Id, bucketIds, notification, tenantId);
});

View File

@ -1624,7 +1624,7 @@ namespace Marco.Pms.Services.Service
}
// Directory Controller
public async Task SendContactAsync(List<Guid> bucketIds, Notification notification, Guid tenantId)
public async Task SendContactAsync(Guid contactId, List<Guid> bucketIds, Notification notification, Guid tenantId)
{
await using var _context = await _dbContextFactory.CreateDbContextAsync();
using var scope = _serviceScopeFactory.CreateScope();
@ -1660,14 +1660,15 @@ namespace Marco.Pms.Services.Service
var data = new Dictionary<string, string>()
{
{ "Keyword", "Contact_Modified" }
{ "Keyword", "Contact_Modified" },
{ "ContactId", contactId.ToString() }
};
var registrationTokensForNotification = await _context.FCMTokenMappings.Where(ft => assignedEmployeeIds.Contains(ft.EmployeeId) && ft.ExpiredAt >= DateTime.UtcNow).Select(ft => ft.FcmToken).ToListAsync();
await SendMessageToMultipleDevicesWithDataAsync(registrationTokensForNotification, notification, data);
}
public async Task SendContactNoteAsync(List<Guid> bucketIds, Notification notification, Guid tenantId)
public async Task SendContactNoteAsync(Guid contactId, List<Guid> bucketIds, Notification notification, Guid tenantId)
{
await using var _context = await _dbContextFactory.CreateDbContextAsync();
using var scope = _serviceScopeFactory.CreateScope();
@ -1703,7 +1704,8 @@ namespace Marco.Pms.Services.Service
var data = new Dictionary<string, string>()
{
{ "Keyword", "Contact_Note_Modified" }
{ "Keyword", "Contact_Note_Modified" },
{ "ContactId", contactId.ToString() }
};
var registrationTokensForNotification = await _context.FCMTokenMappings.Where(ft => assignedEmployeeIds.Contains(ft.EmployeeId) && ft.ExpiredAt >= DateTime.UtcNow).Select(ft => ft.FcmToken).ToListAsync();

View File

@ -24,8 +24,8 @@ namespace Marco.Pms.Services.Service.ServiceInterfaces
Task SendModifyProjectMessageAsync(Project project, string name, bool IsExist, Guid tenantId);
Task SendExpenseMessageAsync(Expenses expenses, string name, Guid tenantId);
Task SendContactAsync(List<Guid> bucketIds, Notification notification, Guid tenantId);
Task SendContactNoteAsync(List<Guid> bucketIds, Notification notification, Guid tenantId);
Task SendContactAsync(Guid contactId, List<Guid> bucketIds, Notification notification, Guid tenantId);
Task SendContactNoteAsync(Guid contactId, List<Guid> bucketIds, Notification notification, Guid tenantId);
Task SendBucketAsync(Guid bucketId, Notification notification, Guid tenantId);
Task SendAssignBucketAsync(List<Guid> employeeIds, Notification notification, Guid tenantId);