diff --git a/RMuseum/Controllers/ContributionStatsController.cs b/RMuseum/Controllers/ContributionStatsController.cs
index 99335f4a..9acf53ab 100644
--- a/RMuseum/Controllers/ContributionStatsController.cs
+++ b/RMuseum/Controllers/ContributionStatsController.cs
@@ -57,7 +57,8 @@ namespace RMuseum.Controllers
/// pinterestlinks
/// poetspeclines
/// poetpix
- /// usernotes
+ /// usernotes,
+ /// users
///
///
///
@@ -169,6 +170,19 @@ namespace RMuseum.Controllers
pagedResult = res.Result;
}
break;
+ case "users":
+ {
+ if(userId != null)
+ {
+ return BadRequest($"useriId parameter is not supported for this dataType");
+ }
+ var res = await _service.GetUsersGroupedByDateAsync(paging);
+ if (!string.IsNullOrEmpty(res.ExceptionString))
+ return BadRequest(res.ExceptionString);
+ pagedResult = res.Result;
+ }
+ break;
+
default:
return BadRequest($"Invalid value for the paramater: dataType = {dataType}");
}
diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index a9b6d816..e68ac54c 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -785,7 +785,8 @@
pinterestlinks
poetspeclines
poetpix
- usernotes
+ usernotes,
+ users
@@ -16055,6 +16056,13 @@
+
+
+ users grouped by signup date
+
+
+
+
approved edits daily
@@ -19244,6 +19252,13 @@
+
+
+ users grouped by signup date
+
+
+
+
approved edits daily
diff --git a/RMuseum/Services/IContributionStatsService.cs b/RMuseum/Services/IContributionStatsService.cs
index 919a0ce0..565ff0ad 100644
--- a/RMuseum/Services/IContributionStatsService.cs
+++ b/RMuseum/Services/IContributionStatsService.cs
@@ -18,6 +18,14 @@ namespace RMuseum.Services
///
Task> GetUserContributionsAsync(Guid userId);
+ ///
+ /// users grouped by signup date
+ ///
+ ///
+ ///
+ Task> GetUsersGroupedByDateAsync(PagingParameterModel paging);
+
+
///
/// approved edits daily
///
diff --git a/RMuseum/Services/Implementation/ContributionStatsService.cs b/RMuseum/Services/Implementation/ContributionStatsService.cs
index f2bba7a6..e975c092 100644
--- a/RMuseum/Services/Implementation/ContributionStatsService.cs
+++ b/RMuseum/Services/Implementation/ContributionStatsService.cs
@@ -52,6 +52,33 @@ namespace RMuseum.Services.Implementation
}
}
+ ///
+ /// users grouped by signup date
+ ///
+ ///
+ ///
+ public async Task> GetUsersGroupedByDateAsync(PagingParameterModel paging)
+ {
+ try
+ {
+ return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByDateViewModel[] Tracks)>(
+ await QueryablePaginator.Paginate(
+ _context.Users
+ .GroupBy(a => a.CreateDate.Date)
+ .Select(a => new GroupedByDateViewModel()
+ {
+ Date = a.Key.Date.ToString(),
+ Number = a.Count(),
+ }).OrderByDescending(s => s.Date)
+ , paging));
+ }
+ catch (Exception e)
+ {
+ return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByDateViewModel[] Tracks)>((null, null), e.ToString());
+ }
+ }
+
+
///
/// approved edits daily
///