feat(search): relevance ranking + websearch_to_tsquery (#13)
CI / backend (push) Successful in 1m13s
CI / frontend (push) Successful in 27s
Deploy Staging / deploy (push) Successful in 44s
CI / backend (pull_request) Successful in 1m12s
CI / frontend (pull_request) Successful in 21s
Security / secrets (push) Successful in 5s
Security / dependencies (push) Successful in 1m3s
Security / secrets (pull_request) Successful in 4s
Security / dependencies (pull_request) Successful in 1m3s
CI / backend (push) Successful in 1m13s
CI / frontend (push) Successful in 27s
Deploy Staging / deploy (push) Successful in 44s
CI / backend (pull_request) Successful in 1m12s
CI / frontend (pull_request) Successful in 21s
Security / secrets (push) Successful in 5s
Security / dependencies (push) Successful in 1m3s
Security / secrets (pull_request) Successful in 4s
Security / dependencies (pull_request) Successful in 1m3s
This commit was merged in pull request #13.
This commit is contained in:
@@ -133,13 +133,13 @@ public class AnalyticsService : IAnalyticsService
|
||||
var emails = _db.Emails.Where(e => e.UserId == userId);
|
||||
|
||||
var allMail = await emails.CountAsync(ct);
|
||||
var inbox = await emails.CountAsync(e => e.IsInInbox, ct);
|
||||
var unread = await emails.CountAsync(e => e.IsUnread, ct);
|
||||
var inbox = await emails.CountAsync(e => e.IsInInbox, ct);
|
||||
var unread = await emails.CountAsync(e => e.IsUnread, ct);
|
||||
var starred = await emails.CountAsync(e => e.IsStarred, ct);
|
||||
var trash = await emails.CountAsync(e => e.IsTrashed, ct);
|
||||
var large = await emails.CountAsync(e => e.SizeEstimateBytes > 5_000_000, ct);
|
||||
var cutoff = DateTimeOffset.UtcNow.AddYears(-1);
|
||||
var old = await emails.CountAsync(e => e.SentAtUtc < cutoff, ct);
|
||||
var trash = await emails.CountAsync(e => e.IsTrashed, ct);
|
||||
var large = await emails.CountAsync(e => e.SizeEstimateBytes > 5_000_000, ct);
|
||||
var cutoff = DateTimeOffset.UtcNow.AddYears(-1);
|
||||
var old = await emails.CountAsync(e => e.SentAtUtc < cutoff, ct);
|
||||
|
||||
// Label-backed counts (SENT / DRAFT / SPAM are system Gmail labels)
|
||||
async Task<int> LabelCount(string gmailId)
|
||||
@@ -153,9 +153,9 @@ public class AnalyticsService : IAnalyticsService
|
||||
: 0;
|
||||
}
|
||||
|
||||
var sent = await LabelCount("SENT");
|
||||
var sent = await LabelCount("SENT");
|
||||
var drafts = await LabelCount("DRAFT");
|
||||
var spam = await LabelCount("SPAM");
|
||||
var spam = await LabelCount("SPAM");
|
||||
|
||||
// Category → smart-folder slug mapping
|
||||
var catCounts = await emails
|
||||
@@ -167,31 +167,31 @@ public class AnalyticsService : IAnalyticsService
|
||||
|
||||
var smartFolders = new Dictionary<string, int>
|
||||
{
|
||||
["automated"] = Cat(EmailCategory.Notification),
|
||||
["finance"] = Cat(EmailCategory.Finance),
|
||||
["social"] = Cat(EmailCategory.Social),
|
||||
["shopping"] = Cat(EmailCategory.Shopping) + Cat(EmailCategory.Promotional),
|
||||
["noreply"] = Cat(EmailCategory.Notification),
|
||||
["gaming"] = Cat(EmailCategory.Gaming),
|
||||
["sales"] = Cat(EmailCategory.SeasonalSales),
|
||||
["ridesharing"] = Cat(EmailCategory.RideSharing),
|
||||
["food"] = Cat(EmailCategory.FoodDelivery),
|
||||
["wellness"] = Cat(EmailCategory.Wellness),
|
||||
["automated"] = Cat(EmailCategory.Notification),
|
||||
["finance"] = Cat(EmailCategory.Finance),
|
||||
["social"] = Cat(EmailCategory.Social),
|
||||
["shopping"] = Cat(EmailCategory.Shopping) + Cat(EmailCategory.Promotional),
|
||||
["noreply"] = Cat(EmailCategory.Notification),
|
||||
["gaming"] = Cat(EmailCategory.Gaming),
|
||||
["sales"] = Cat(EmailCategory.SeasonalSales),
|
||||
["ridesharing"] = Cat(EmailCategory.RideSharing),
|
||||
["food"] = Cat(EmailCategory.FoodDelivery),
|
||||
["wellness"] = Cat(EmailCategory.Wellness),
|
||||
// New categories
|
||||
["travel"] = Cat(EmailCategory.Travel),
|
||||
["travel"] = Cat(EmailCategory.Travel),
|
||||
["subscriptions"] = Cat(EmailCategory.Subscriptions),
|
||||
["parcels"] = Cat(EmailCategory.Parcels),
|
||||
["recruitment"] = Cat(EmailCategory.Recruitment),
|
||||
["events"] = Cat(EmailCategory.Events),
|
||||
["security"] = Cat(EmailCategory.SecurityAlerts),
|
||||
["healthcare"] = Cat(EmailCategory.Healthcare),
|
||||
["education"] = Cat(EmailCategory.Education),
|
||||
["news"] = Cat(EmailCategory.NewsMedia),
|
||||
["property"] = Cat(EmailCategory.PropertyUtilities),
|
||||
["charity"] = Cat(EmailCategory.Charity),
|
||||
["government"] = Cat(EmailCategory.Government),
|
||||
["crypto"] = Cat(EmailCategory.CryptoInvesting),
|
||||
["family"] = Cat(EmailCategory.FamilySchool),
|
||||
["parcels"] = Cat(EmailCategory.Parcels),
|
||||
["recruitment"] = Cat(EmailCategory.Recruitment),
|
||||
["events"] = Cat(EmailCategory.Events),
|
||||
["security"] = Cat(EmailCategory.SecurityAlerts),
|
||||
["healthcare"] = Cat(EmailCategory.Healthcare),
|
||||
["education"] = Cat(EmailCategory.Education),
|
||||
["news"] = Cat(EmailCategory.NewsMedia),
|
||||
["property"] = Cat(EmailCategory.PropertyUtilities),
|
||||
["charity"] = Cat(EmailCategory.Charity),
|
||||
["government"] = Cat(EmailCategory.Government),
|
||||
["crypto"] = Cat(EmailCategory.CryptoInvesting),
|
||||
["family"] = Cat(EmailCategory.FamilySchool),
|
||||
};
|
||||
|
||||
return new SidebarCountsDto(inbox, allMail, unread, starred, sent, drafts, trash, spam, large, old, smartFolders);
|
||||
|
||||
Reference in New Issue
Block a user