From ed24f1c08f485f2752839ae114b9392cd83626dd Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sat, 29 Mar 2025 12:01:21 +0330 Subject: [PATCH] #478 users --- .../ContributionStatsController.cs | 10 ++++++- RMuseum/RMuseum.xml | 13 ++++++++++ RMuseum/Services/IContributionStatsService.cs | 6 +++++ .../ContributionStatsService.cs | 26 +++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/RMuseum/Controllers/ContributionStatsController.cs b/RMuseum/Controllers/ContributionStatsController.cs index 9acf53ab..d676634b 100644 --- a/RMuseum/Controllers/ContributionStatsController.cs +++ b/RMuseum/Controllers/ContributionStatsController.cs @@ -10,7 +10,6 @@ using RSecurityBackend.Models.Generic; using System; using System.Collections.Generic; using System.Net; -using System.Net.NetworkInformation; using System.Threading.Tasks; using System.Windows.Forms; @@ -348,6 +347,7 @@ namespace RMuseum.Controllers /// poetspeclines /// poetpix /// usernotes + /// users (Days and UserIds are invalid) /// /// [HttpGet("{dataType}/summary")] @@ -456,6 +456,14 @@ namespace RMuseum.Controllers result = res.Result; } break; + case "users": + { + var res = await _service.GetUsersSummedUpStatsAsync(); + if (!string.IsNullOrEmpty(res.ExceptionString)) + return BadRequest(res.ExceptionString); + result = res.Result; + } + break; default: return BadRequest($"Invalid value for the paramater: dataType = {dataType}"); } diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index e68ac54c..8f18b724 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -832,6 +832,7 @@ poetspeclines poetpix usernotes + users (Days and UserIds are invalid) @@ -16056,6 +16057,12 @@ + + + summed up stats of users (Days and UserIds are invalid) + + + users grouped by signup date @@ -19259,6 +19266,12 @@ + + + summed up stats of users (Days and UserIds are invalid) + + + approved edits daily diff --git a/RMuseum/Services/IContributionStatsService.cs b/RMuseum/Services/IContributionStatsService.cs index 565ff0ad..b784df79 100644 --- a/RMuseum/Services/IContributionStatsService.cs +++ b/RMuseum/Services/IContributionStatsService.cs @@ -18,6 +18,12 @@ namespace RMuseum.Services /// Task> GetUserContributionsAsync(Guid userId); + /// + /// summed up stats of users (Days and UserIds are invalid) + /// + /// + Task> GetUsersSummedUpStatsAsync(); + /// /// users grouped by signup date /// diff --git a/RMuseum/Services/Implementation/ContributionStatsService.cs b/RMuseum/Services/Implementation/ContributionStatsService.cs index e975c092..76527b60 100644 --- a/RMuseum/Services/Implementation/ContributionStatsService.cs +++ b/RMuseum/Services/Implementation/ContributionStatsService.cs @@ -78,6 +78,32 @@ namespace RMuseum.Services.Implementation } } + /// + /// summed up stats of users (Days and UserIds are invalid) + /// + /// + public async Task> GetUsersSummedUpStatsAsync() + { + try + { + return new RServiceResult + ( + new SummedUpViewModel() + { + Days = -1, + TotalCount = await _context.Users.CountAsync(), + UserIds = -1, + } + ); + + } + catch (Exception e) + { + return new RServiceResult(null, e.ToString()); + } + } + + /// /// approved edits daily