BMC : Remove id property from NotificationModel
This commit is contained in:
parent
84cb9d4251
commit
7617b41df0
@ -12,8 +12,8 @@ namespace BCS.BMC.FirebaseCloudMessaging.Dto
|
||||
{
|
||||
[FirestoreProperty]
|
||||
public string FcmToken { get; set; }
|
||||
[FirestoreProperty]
|
||||
public List<string> Id { get; set; }
|
||||
//[FirestoreProperty]
|
||||
//public List<string> Id { get; set; }
|
||||
[FirestoreProperty]
|
||||
public string Message { get; set; }
|
||||
[FirestoreProperty]
|
||||
@ -26,6 +26,6 @@ namespace BCS.BMC.FirebaseCloudMessaging.Dto
|
||||
[FirestoreProperty]
|
||||
public bool Status { get; set; }
|
||||
[FirestoreProperty]
|
||||
public int UserId { get; set; }
|
||||
public List<string> UserId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace BCS.BMC.FirebaseCloudMessaging.Dto
|
||||
//public List<string> Title { get; set; }
|
||||
//[JsonProperty("body")]
|
||||
public string FcmToken { get; set; }
|
||||
public List<string> Id { get; set; }
|
||||
//public List<string> Id { get; set; }
|
||||
public string Message { get; set; }
|
||||
public DateTime? MessageSentDateTime { get; set; }
|
||||
|
||||
@ -27,7 +27,8 @@ namespace BCS.BMC.FirebaseCloudMessaging.Dto
|
||||
public string SenderName { get; set; }
|
||||
|
||||
public bool Status { get; set; }
|
||||
public int UserId { get; set; }
|
||||
public List<string> UserId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
//[AutoMapFrom(typeof(NotificationModel))]
|
||||
|
@ -69,7 +69,7 @@ namespace BCS.BMC.Web.Controllers
|
||||
FireStoreNotificationModel data = new FireStoreNotificationModel();
|
||||
|
||||
data.FcmToken = notification.FcmToken;
|
||||
data.Id = notification.Id;
|
||||
// data.Id = notification.Id;
|
||||
data.Message = notification.Message;
|
||||
//data.MessageSentDateTime = notification.MessageSentDateTime;
|
||||
data.MessageSentDateTime = DateTime.UtcNow;
|
||||
@ -77,14 +77,14 @@ namespace BCS.BMC.Web.Controllers
|
||||
data.SenderName = notification.SenderName;
|
||||
data.Status= notification.Status;
|
||||
data.UserId = notification.UserId;
|
||||
await db.Collection("BMC_Notification").Document().SetAsync(data);
|
||||
foreach (var item in notification.Id)
|
||||
|
||||
foreach (var item in notification.UserId)
|
||||
{
|
||||
int userId = Convert.ToInt32(item);
|
||||
var getTokenDetails = _firebaseToken.GetAllList().Where(x => x.UserId == userId).FirstOrDefault();
|
||||
List<string> tokenList = new List<string>();
|
||||
tokenList.Add(getTokenDetails.FcmToken.ToString());
|
||||
|
||||
await db.Collection("BMC_Notification").Document().SetAsync(data);
|
||||
|
||||
if (getTokenDetails != null)
|
||||
{
|
||||
@ -104,21 +104,22 @@ namespace BCS.BMC.Web.Controllers
|
||||
sendNotificationInfo.notification = notifications;
|
||||
await SendNotification(sendNotificationInfo);
|
||||
}
|
||||
}
|
||||
|
||||
var entity = new FirebaseCloudMessageDetails();
|
||||
entity.UserId = notification.UserId;
|
||||
entity.UserId = userId;
|
||||
entity.SenderImageurl = notification.SenderImageurl;
|
||||
entity.SenderName = notification.SenderName;
|
||||
entity.MessageSentDateTime = notification.MessageSentDateTime;
|
||||
entity.Status = notification.Status;
|
||||
entity.Message = notification.Message;
|
||||
|
||||
if(entity != null)
|
||||
if (entity != null)
|
||||
{
|
||||
await _firebaseCloudMessageDetails.InsertAndGetIdAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user