Add deep links for pending approval notifications
This commit is contained in:
1 parent
ce8982dba9
commit
4c95edb678
9 files changed
+191
-34
No files matched your search
@@ -8,6 +8,7 @@ using Jiaowu.Api.Infrastructure.Auth;
|
||||
using Jiaowu.Api.Infrastructure.Caching;
|
||||
using Jiaowu.Api.Infrastructure.Grades;
|
||||
using Jiaowu.Api.Infrastructure.Persistence;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -163,6 +164,20 @@ public sealed class GradesPaginationTests
|
||||
await db.Database.EnsureCreatedAsync();
|
||||
|
||||
var college = new College { Code = "CS", Name = "计算机学院" };
|
||||
var collegeAdminRole = new ApplicationRole
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Name = SystemRoles.CollegeAdmin,
|
||||
NormalizedName = SystemRoles.CollegeAdmin.ToUpperInvariant()
|
||||
};
|
||||
var collegeAdmin = new ApplicationUser
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
UserName = "college-admin",
|
||||
NormalizedUserName = "COLLEGE-ADMIN",
|
||||
DisplayName = "学院管理员",
|
||||
CollegeId = college.Id
|
||||
};
|
||||
var major = new Major
|
||||
{
|
||||
Code = "080901",
|
||||
@@ -230,7 +245,22 @@ public sealed class GradesPaginationTests
|
||||
}
|
||||
]
|
||||
};
|
||||
db.AddRange(college, major, administrativeClass, term, course, task, student, sheet);
|
||||
db.AddRange(
|
||||
college,
|
||||
collegeAdminRole,
|
||||
collegeAdmin,
|
||||
new IdentityUserRole<Guid>
|
||||
{
|
||||
UserId = collegeAdmin.Id,
|
||||
RoleId = collegeAdminRole.Id
|
||||
},
|
||||
major,
|
||||
administrativeClass,
|
||||
term,
|
||||
course,
|
||||
task,
|
||||
student,
|
||||
sheet);
|
||||
await db.SaveChangesAsync();
|
||||
db.ChangeTracker.Clear();
|
||||
|
||||
@@ -244,6 +274,11 @@ public sealed class GradesPaginationTests
|
||||
await db.GradeSheets.Where(x => x.Id == sheet.Id)
|
||||
.Select(x => x.Status)
|
||||
.SingleAsync());
|
||||
Assert.Equal(
|
||||
$"/grades?sheetId={sheet.Id}",
|
||||
await db.Notifications.Where(x => x.Title == "成绩单待审核")
|
||||
.Select(x => x.LinkUrl)
|
||||
.SingleAsync());
|
||||
|
||||
var approvedSheet = await db.GradeSheets.SingleAsync(x => x.Id == sheet.Id);
|
||||
approvedSheet.Status = GradeSheetStatus.Approved;
|
||||
|
||||
Reference in new issue
Block a user