|
@@ -70,9 +70,8 @@ namespace TEAMModelOS.Controllers
|
|
|
/// <returns></returns>
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpPost("get-teacher-all")]
|
|
|
- [AuthToken(Roles = "teacher,admin,student")]
|
|
|
-
|
|
|
#if !DEBUG
|
|
|
+ [AuthToken(Roles = "teacher,admin,student")]
|
|
|
[Authorize(Roles = "IES")]
|
|
|
#endif
|
|
|
|
|
@@ -86,6 +85,8 @@ namespace TEAMModelOS.Controllers
|
|
|
List<ScTeacher> teachers = new List<ScTeacher>();
|
|
|
try
|
|
|
{
|
|
|
+ School school = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>(school_code.GetString(), new PartitionKey("Base"));
|
|
|
+ List<Subject> subjects = school.period.SelectMany(c => c.subjects).ToList();
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIteratorSql<ScTeacher>
|
|
|
(queryText: $"SELECT c.subjectIds, c.id, c.name, c.picture ,c.status, c.job, c.createTime, ARRAY_LENGTH(c.permissions) as permissionCount,c.permissions,c.roles , c.size FROM c",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{school_code}") }))
|
|
@@ -94,6 +95,12 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
item.createTime = item.createTime / 1000;
|
|
|
}
|
|
|
+ foreach (var subId in item.subjectIds) {
|
|
|
+ string sname = string.Empty;
|
|
|
+ sname = subjects.Where(c => c.id.Equals(subId)).FirstOrDefault()?.name;
|
|
|
+ item.subjectNames.Add(sname);
|
|
|
+
|
|
|
+ }
|
|
|
teachers.Add(item);
|
|
|
}
|
|
|
|
|
@@ -414,6 +421,7 @@ namespace TEAMModelOS.Controllers
|
|
|
public List<string> permissions { get; set; }
|
|
|
public List<string> roles { get; set; }
|
|
|
public List<string> subjectIds { get; set; }
|
|
|
+ public List<string> subjectNames { get; set; } = new List<string>();
|
|
|
public List<IdNameCode> groups { get; set; } = new List<IdNameCode>();
|
|
|
public string note { get; set; }
|
|
|
public string phone { get; set; }
|