#478 ContributionStatsController
This commit is contained in:
parent
75d75cd265
commit
4115089504
78
RMuseum/Controllers/ContributionStatsController.cs
Normal file
78
RMuseum/Controllers/ContributionStatsController.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using RMuseum.Models.Generic.ViewModels;
|
||||
using RMuseum.Services;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RMuseum.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/contributions")]
|
||||
public class ContributionStatsController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// approved edits daily
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("poem/corrections/daily")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<GroupedByDateViewModel>))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetApprovedEditsGroupedByDateAsync([FromQuery] PagingParameterModel paging, Guid? userId = null)
|
||||
{
|
||||
var pagedResult = await _service.GetApprovedEditsGroupedByDateAsync(paging, userId);
|
||||
if (!string.IsNullOrEmpty(pagedResult.ExceptionString))
|
||||
return BadRequest(pagedResult.ExceptionString);
|
||||
|
||||
// Paging Header
|
||||
HttpContext.Response.Headers.Append("paging-headers", JsonConvert.SerializeObject(pagedResult.Result.PagingMeta));
|
||||
|
||||
return Ok(pagedResult.Result.Tracks);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// approved edits grouped by user
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="day"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("poem/corrections/by/user")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<GroupedByUserViewModel>))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetApprovedEditsGroupedByUserAsync([FromQuery] PagingParameterModel paging,DateTime? day, Guid? userId)
|
||||
{
|
||||
var pagedResult = await _service.GetApprovedEditsGroupedByUserAsync(paging, day, userId);
|
||||
if (!string.IsNullOrEmpty(pagedResult.ExceptionString))
|
||||
return BadRequest(pagedResult.ExceptionString);
|
||||
|
||||
// Paging Header
|
||||
HttpContext.Response.Headers.Append("paging-headers", JsonConvert.SerializeObject(pagedResult.Result.PagingMeta));
|
||||
|
||||
return Ok(pagedResult.Result.Tracks);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// service
|
||||
/// </summary>
|
||||
protected readonly IContributionStatsService _service;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="service"></param>
|
||||
public ContributionStatsController(IContributionStatsService service)
|
||||
{
|
||||
_service = service;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -762,6 +762,34 @@
|
||||
<param name="auditLogService">
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.ContributionStatsController.GetApprovedEditsGroupedByDateAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
approved edits daily
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.ContributionStatsController.GetApprovedEditsGroupedByUserAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.DateTime},System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
approved edits grouped by user
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="day"></param>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:RMuseum.Controllers.ContributionStatsController._service">
|
||||
<summary>
|
||||
service
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.ContributionStatsController.#ctor(RMuseum.Services.IContributionStatsService)">
|
||||
<summary>
|
||||
constructor
|
||||
</summary>
|
||||
<param name="service"></param>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.DonationAccountingController.GetDonations">
|
||||
<summary>
|
||||
returns all donations
|
||||
|
||||
Loading…
Reference in New Issue
Block a user