Browse Source

修正BI老師加入學校管理者之問題

upon 1 year ago
parent
commit
cb08a6e7de
1 changed files with 6 additions and 0 deletions
  1. 6 0
      TEAMModelBI/Controllers/BISchool/SchoolController.cs

+ 6 - 0
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -822,6 +822,12 @@ namespace TEAMModelBI.Controllers.BISchool
                             schoolTeacher.roles.Add("admin");
                             schoolTeacher.status = "join";
                             schoolTeacher = await cosmosClient.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<SchoolTeacher>(schoolTeacher, schoolTeacher.id, new PartitionKey($"Teacher-{schoolId}"));
+
+                            #region 同時更新teacher的school.status
+                            var school = teacher.schools.Find(f => f.schoolId.Equals($"{schoolId}"));
+                            school.status = "join";
+                            await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Teacher>(teacher, teacher.id, new PartitionKey("Base"));                            
+                            #endregion
                             strMsg.Append($"并设置管理员,学校信息{schoolName}【{schoolId}】");
                         }
                         else