Skip to content

Commit

Permalink
Updated the usage endpoint to improve per number counting of message …
Browse files Browse the repository at this point in the history
…types.
  • Loading branch information
uncheckederror committed Aug 4, 2023
1 parent 0612968 commit d0ba933
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Messaging/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,11 @@
foreach (var reg in registrations)
{
int inboundMMS = await db.Messages.Where(x => (x.To == reg.AsDialed || x.From.Contains(reg.AsDialed)) && x.MessageSource == MessageSource.Incoming && x.MessageType == MessageType.MMS).CountAsync();
int outboundMMS = await db.Messages.Where(x => (x.To == reg.AsDialed || x.From.Contains(reg.AsDialed)) && x.MessageSource == MessageSource.Outgoing && x.MessageType == MessageType.MMS).CountAsync();
int inboundSMS = await db.Messages.Where(x => (x.To == reg.AsDialed || x.From.Contains(reg.AsDialed)) && x.MessageSource == MessageSource.Incoming && x.MessageType == MessageType.SMS).CountAsync();
int outboundSMS = await db.Messages.Where(x => (x.To == reg.AsDialed || x.From.Contains(reg.AsDialed)) && x.MessageSource == MessageSource.Outgoing && x.MessageType == MessageType.SMS).CountAsync();
int inboundMMS = await db.Messages.Where(x => (x.From == reg.AsDialed || x.To.Contains(reg.AsDialed)) && x.MessageSource == MessageSource.Incoming && x.MessageType == MessageType.MMS).CountAsync();
int outboundMMS = await db.Messages.Where(x => (x.From == reg.AsDialed || x.To.Contains(reg.AsDialed)) && x.MessageSource == MessageSource.Outgoing && x.MessageType == MessageType.MMS).CountAsync();
int inboundSMS = await db.Messages.Where(x => (x.From == reg.AsDialed || x.To.Contains(reg.AsDialed)) && x.MessageSource == MessageSource.Incoming && x.MessageType == MessageType.SMS).CountAsync();
int outboundSMS = await db.Messages.Where(x => (x.From == reg.AsDialed || x.To.Contains(reg.AsDialed)) && x.MessageSource == MessageSource.Outgoing && x.MessageType == MessageType.SMS).CountAsync();
summary.Add(new UsageSummary { AsDialed = reg.AsDialed, InboundMMSCount = inboundMMS, OutboundMMSCount = outboundMMS, InboundSMSCount = inboundSMS, OutboundSMSCount = outboundSMS });
}
Expand Down

0 comments on commit d0ba933

Please sign in to comment.