Add deep links for pending approval notifications

This commit is contained in:
biss committed 2026-08-17 20:50:56 +08:00
1 parent ce8982dba9
commit 4c95edb678
9 files changed
+191 -34

No files matched your search

@@ -212,7 +212,8 @@ public sealed class CourseAdjustmentsController(
Guid? academicTermId,
int page = 1,
int pageSize = 20,
CancellationToken cancellationToken = default)
CancellationToken cancellationToken = default,
Guid? adjustmentId = null)
{
if (page < 1 || pageSize is < 1 or > 100)
return ValidationProblem("页码必须大于 0,且每页条数应在 1 至 100 之间。");
@@ -223,7 +224,9 @@ public sealed class CourseAdjustmentsController(
if (scope.Scope == DataScope.College)
source = source.Where(x =>
x.TeachingTask!.Course!.CollegeId == scope.RestrictedCollegeId);
if (academicTermId.HasValue)
if (adjustmentId.HasValue)
source = source.Where(x => x.Id == adjustmentId.Value);
else if (academicTermId.HasValue)
source = source.Where(x =>
x.TeachingTask!.AcademicTermId == academicTermId);
@@ -324,7 +327,7 @@ public sealed class CourseAdjustmentsController(
SystemRoles.CollegeAdmin,
$"新的{tl}申请",
$"《{taskInfo.Name}》提交了{tl}申请,请及时审核。",
taskInfo.CollegeId, "/course-adjustments", cancellationToken,
taskInfo.CollegeId, $"/course-adjustments?adjustmentId={adj.Id}", cancellationToken,
NotificationCategory.Schedule);
}
}
@@ -377,13 +380,13 @@ public sealed class CourseAdjustmentsController(
$"新的{TypeLabel(adj.Type)}申请",
$"《{courseName}》提交了{TypeLabel(adj.Type)}申请,请及时审核。",
adj.TeachingTask.Course.CollegeId,
"/course-adjustments", cancellationToken,
$"/course-adjustments?adjustmentId={adj.Id}", cancellationToken,
NotificationCategory.Schedule);
await NotificationService.SendToRoleAsync(db,
SystemRoles.AcademicAdmin,
$"新的{TypeLabel(adj.Type)}申请",
$"《{courseName}》提交了{TypeLabel(adj.Type)}申请。",
null, "/course-adjustments", cancellationToken,
null, $"/course-adjustments?adjustmentId={adj.Id}", cancellationToken,
NotificationCategory.Schedule);
return NoContent();
}