凭证下载审计优化
This commit is contained in:
@@ -606,7 +606,7 @@ public sealed record EvaluationScoreRequest(
|
||||
|
||||
public sealed record TeacherEvaluationTaskResult(
|
||||
Guid SetupId,
|
||||
string Name,
|
||||
string SetupName,
|
||||
TeacherEvaluationTask Task,
|
||||
int StudentCount,
|
||||
double AverageTotal,
|
||||
|
||||
@@ -227,14 +227,24 @@ public sealed class OfficialDocumentsController(
|
||||
[Authorize(Roles = Managers)]
|
||||
public async Task<ActionResult> DownloadHistory(
|
||||
Guid id,
|
||||
CancellationToken cancellationToken)
|
||||
CancellationToken cancellationToken,
|
||||
int page = 1,
|
||||
int pageSize = 20)
|
||||
{
|
||||
if (page < 1 || pageSize is < 1 or > 100)
|
||||
return ValidationProblem("页码必须大于 0,且每页条数应在 1 至 100 之间。");
|
||||
|
||||
if (!await AccessibleDocuments().AnyAsync(x => x.Id == id, cancellationToken))
|
||||
return NotFound();
|
||||
|
||||
return Ok(await db.OfficialDocumentDownloads.AsNoTracking()
|
||||
var source = db.OfficialDocumentDownloads.AsNoTracking()
|
||||
.Where(x => x.OfficialDocumentId == id)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.ThenByDescending(x => x.Id);
|
||||
var total = await source.CountAsync(cancellationToken);
|
||||
var items = await source
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.Select(x => new
|
||||
{
|
||||
x.Id,
|
||||
@@ -244,7 +254,8 @@ public sealed class OfficialDocumentsController(
|
||||
x.IpAddress,
|
||||
x.UserAgent
|
||||
})
|
||||
.ToListAsync(cancellationToken));
|
||||
.ToListAsync(cancellationToken);
|
||||
return Ok(new PagedResult<object>(items, total, page, pageSize));
|
||||
}
|
||||
|
||||
[HttpPost("{id:guid}/invalidate")]
|
||||
|
||||
Reference in New Issue
Block a user