|
@@ -69,7 +69,25 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
teachers.Add(item);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ if (teachers.IsNotEmpty()) {
|
|
|
+ List<IdNameCode> groupLists = new List<IdNameCode>();
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<IdNameCode>
|
|
|
+ (queryText: $"SELECT c.id, c.name, m.id as code FROM c join m in c.members where c.type='research' and m.id in ({string.Join(",",teachers.Select(x=>$"'{x.id}'"))}) ",
|
|
|
+ requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"GroupList-{school_code}") }))
|
|
|
+ {
|
|
|
+ groupLists.Add(item);
|
|
|
+ }
|
|
|
+ if (groupLists.IsNotEmpty()) {
|
|
|
+ teachers.ForEach(x => {
|
|
|
+ List<IdNameCode> codes = groupLists.FindAll(g => g.code.Equals(x.id));
|
|
|
+ if (codes.IsNotEmpty())
|
|
|
+ {
|
|
|
+ x.groups = codes;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
return Ok(new { teachers });
|
|
|
}
|
|
|
public class ScTeacher
|
|
@@ -84,8 +102,9 @@ namespace TEAMModelOS.Controllers
|
|
|
public int size { get; set; }
|
|
|
public List<string> permissions { get; set; }
|
|
|
public List<string> roles { get; set; }
|
|
|
-
|
|
|
- }
|
|
|
+ public List<IdNameCode> groups { get; set; } = new List<IdNameCode>();
|
|
|
+
|
|
|
+ }
|
|
|
/// <summary>
|
|
|
/// 取得某位老師的權限
|
|
|
/// </summary>
|