2.3.0-rc2
This commit is contained in:
@@ -224,6 +224,12 @@ public sealed class PersonnelController(
|
||||
[FromQuery] PersonnelQuery query,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var roles = currentUserDataScope.Current.Roles;
|
||||
var canReadFullProfile = roles.Any(role =>
|
||||
role is SystemRoles.SuperAdmin or
|
||||
SystemRoles.AcademicAdmin or
|
||||
SystemRoles.CollegeAdmin or
|
||||
SystemRoles.Counselor);
|
||||
var page = NormalizePage(query.Page);
|
||||
var pageSize = NormalizePageSize(query.PageSize);
|
||||
var source = ApplyStudentScope(db.Students.AsNoTracking());
|
||||
@@ -268,9 +274,26 @@ public sealed class PersonnelController(
|
||||
x.EnrollmentDate,
|
||||
x.Status,
|
||||
x.DateOfBirth,
|
||||
EnglishName = canReadFullProfile ? x.EnglishName : null,
|
||||
IdCardNumber = canReadFullProfile ? x.IdCardNumber : null,
|
||||
Nationality = canReadFullProfile ? x.Nationality : null,
|
||||
Ethnicity = canReadFullProfile ? x.Ethnicity : null,
|
||||
PoliticalStatus = canReadFullProfile ? x.PoliticalStatus : null,
|
||||
NativePlace = canReadFullProfile ? x.NativePlace : null,
|
||||
HouseholdAddress = canReadFullProfile ? x.HouseholdAddress : null,
|
||||
CurrentAddress = canReadFullProfile ? x.CurrentAddress : null,
|
||||
PostalCode = canReadFullProfile ? x.PostalCode : null,
|
||||
x.Phone,
|
||||
x.Email,
|
||||
x.Notes,
|
||||
Qq = canReadFullProfile ? x.Qq : null,
|
||||
x.WeChat,
|
||||
x.EmergencyContactName,
|
||||
x.EmergencyContactRelationship,
|
||||
x.EmergencyContactPhone,
|
||||
x.SpecialTags,
|
||||
x.SpecialNeeds,
|
||||
Biography = canReadFullProfile ? x.Biography : null,
|
||||
Notes = canReadFullProfile ? x.Notes : null,
|
||||
x.UserId,
|
||||
x.CreatedAt
|
||||
})
|
||||
@@ -304,8 +327,26 @@ public sealed class PersonnelController(
|
||||
EnrollmentDate = request.EnrollmentDate,
|
||||
Status = request.Status,
|
||||
DateOfBirth = request.DateOfBirth,
|
||||
EnglishName = Normalize(request.EnglishName),
|
||||
IdCardNumber = Normalize(request.IdCardNumber),
|
||||
Nationality = Normalize(request.Nationality),
|
||||
Ethnicity = Normalize(request.Ethnicity),
|
||||
PoliticalStatus = Normalize(request.PoliticalStatus),
|
||||
NativePlace = Normalize(request.NativePlace),
|
||||
HouseholdAddress = Normalize(request.HouseholdAddress),
|
||||
CurrentAddress = Normalize(request.CurrentAddress),
|
||||
PostalCode = Normalize(request.PostalCode),
|
||||
Phone = Normalize(request.Phone),
|
||||
Email = Normalize(request.Email),
|
||||
Qq = Normalize(request.Qq),
|
||||
WeChat = Normalize(request.WeChat),
|
||||
EmergencyContactName = Normalize(request.EmergencyContactName),
|
||||
EmergencyContactRelationship = Normalize(
|
||||
request.EmergencyContactRelationship),
|
||||
EmergencyContactPhone = Normalize(request.EmergencyContactPhone),
|
||||
SpecialTags = Normalize(request.SpecialTags),
|
||||
SpecialNeeds = Normalize(request.SpecialNeeds),
|
||||
Biography = Normalize(request.Biography),
|
||||
Notes = Normalize(request.Notes)
|
||||
};
|
||||
db.Students.Add(entity);
|
||||
@@ -343,8 +384,26 @@ public sealed class PersonnelController(
|
||||
entity.EnrollmentDate = request.EnrollmentDate;
|
||||
entity.Status = request.Status;
|
||||
entity.DateOfBirth = request.DateOfBirth;
|
||||
entity.EnglishName = Normalize(request.EnglishName);
|
||||
entity.IdCardNumber = Normalize(request.IdCardNumber);
|
||||
entity.Nationality = Normalize(request.Nationality);
|
||||
entity.Ethnicity = Normalize(request.Ethnicity);
|
||||
entity.PoliticalStatus = Normalize(request.PoliticalStatus);
|
||||
entity.NativePlace = Normalize(request.NativePlace);
|
||||
entity.HouseholdAddress = Normalize(request.HouseholdAddress);
|
||||
entity.CurrentAddress = Normalize(request.CurrentAddress);
|
||||
entity.PostalCode = Normalize(request.PostalCode);
|
||||
entity.Phone = Normalize(request.Phone);
|
||||
entity.Email = Normalize(request.Email);
|
||||
entity.Qq = Normalize(request.Qq);
|
||||
entity.WeChat = Normalize(request.WeChat);
|
||||
entity.EmergencyContactName = Normalize(request.EmergencyContactName);
|
||||
entity.EmergencyContactRelationship = Normalize(
|
||||
request.EmergencyContactRelationship);
|
||||
entity.EmergencyContactPhone = Normalize(request.EmergencyContactPhone);
|
||||
entity.SpecialTags = Normalize(request.SpecialTags);
|
||||
entity.SpecialNeeds = Normalize(request.SpecialNeeds);
|
||||
entity.Biography = Normalize(request.Biography);
|
||||
entity.Notes = Normalize(request.Notes);
|
||||
return await SaveNoContentAsync(cancellationToken);
|
||||
}
|
||||
@@ -522,8 +581,25 @@ public sealed record StudentRequest(
|
||||
DateOnly EnrollmentDate,
|
||||
StudentStatus Status,
|
||||
DateOnly? DateOfBirth,
|
||||
[MaxLength(100)] string? EnglishName,
|
||||
[MaxLength(30)] string? IdCardNumber,
|
||||
[MaxLength(50)] string? Nationality,
|
||||
[MaxLength(50)] string? Ethnicity,
|
||||
[MaxLength(50)] string? PoliticalStatus,
|
||||
[MaxLength(100)] string? NativePlace,
|
||||
[MaxLength(300)] string? HouseholdAddress,
|
||||
[MaxLength(300)] string? CurrentAddress,
|
||||
[MaxLength(20)] string? PostalCode,
|
||||
[MaxLength(30)] string? Phone,
|
||||
[EmailAddress, MaxLength(100)] string? Email,
|
||||
[MaxLength(30)] string? Qq,
|
||||
[MaxLength(60)] string? WeChat,
|
||||
[MaxLength(50)] string? EmergencyContactName,
|
||||
[MaxLength(30)] string? EmergencyContactRelationship,
|
||||
[MaxLength(30)] string? EmergencyContactPhone,
|
||||
[MaxLength(300)] string? SpecialTags,
|
||||
[MaxLength(1000)] string? SpecialNeeds,
|
||||
[MaxLength(1000)] string? Biography,
|
||||
[MaxLength(500)] string? Notes);
|
||||
|
||||
public sealed record TeacherAccountActivationRequest(
|
||||
|
||||
Reference in New Issue
Block a user