|
@@ -436,15 +436,15 @@ namespace TEAMModelOS.Controllers
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpPost("push")]
|
|
|
public async Task<IActionResult> Push(JsonElement json) {
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ string force = $"{json.GetProperty("force")}";
|
|
|
string areaIdJson = $"{json.GetProperty("areaId")}";
|
|
|
List<string> schools = json.GetProperty("schools").ToObject<List<string>>();
|
|
|
List<string> pushTeachers = json.GetProperty("pushTeachers").ToObject<List<string>>();
|
|
|
- (List<ScsResult> results, List<PushFail> fails, List<Dictionary<string, object>> dicts)= await PushData(areaIdJson, schools, pushTeachers);
|
|
|
+ (List<ScsResult> results, List<PushFail> fails, List<Dictionary<string, object>> dicts)= await PushData(areaIdJson, schools, pushTeachers, force);
|
|
|
return Ok(new { data = new { results, fails, dicts } });
|
|
|
}
|
|
|
- private async Task<(List<ScsResult> results, List<PushFail> fails, List<Dictionary<string, object>> dicts)> PushData(string areaIdJson, List<string> schools, List<string> pushTeachers) {
|
|
|
+ private async Task<(List<ScsResult> results, List<PushFail> fails, List<Dictionary<string, object>> dicts)> PushData(string areaIdJson, List<string> schools, List<string> pushTeachers,string force="0") {
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
Dictionary<string, Dictionary<string, object>> pushDatas = new Dictionary<string, Dictionary<string, object>>();
|
|
|
List<Dictionary<string, object>> dicts = new List<Dictionary<string, object>>();
|
|
@@ -515,6 +515,9 @@ namespace TEAMModelOS.Controllers
|
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TeacherTrain>(queryText: queryText.ToString(),
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TeacherTrain-{school}") }))
|
|
|
{
|
|
|
+ if (force.Equals("1")) {
|
|
|
+ item.pushes = new HashSet<string>();
|
|
|
+ }
|
|
|
trains.Add(item);
|
|
|
}
|
|
|
}
|