|
@@ -105,18 +105,30 @@ namespace TEAMModelOS.Controllers.Client
|
|
|
{
|
|
|
LessonRecord lessonRecord = await client.GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<LessonRecord>($"{_lessonId}", new PartitionKey(code));
|
|
|
List<LessonUpdate> updates = _grant_types.ToObject<List<LessonUpdate>>();
|
|
|
+ bool hasGrant_types = false;
|
|
|
if (_grant_types.ValueKind.Equals(JsonValueKind.Array))
|
|
|
{
|
|
|
if (updates.IsEmpty())
|
|
|
{
|
|
|
updates.Add(new LessonUpdate { grant_type = "up-base" });
|
|
|
}
|
|
|
+ else {
|
|
|
+ hasGrant_types = true;
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
updates.Add(new LessonUpdate { grant_type = "up-base" });
|
|
|
}
|
|
|
var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
|
|
|
- var messageChange = new ServiceBusMessage(request.ToJsonString());
|
|
|
+ string msg = null;
|
|
|
+ if (hasGrant_types)
|
|
|
+ {
|
|
|
+ msg = request.ToJsonString();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ msg = new { lesson_id = $"{_lessonId}", tmdid = $"{_tmdid}", grant_types = updates, school = $"{_school}", scope = $"{_scope}" }.ToJsonString();
|
|
|
+ }
|
|
|
+ var messageChange = new ServiceBusMessage(msg);
|
|
|
messageChange.ApplicationProperties.Add("name", "LessonRecordEvent");
|
|
|
await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageChange);
|
|
|
return Ok(new { status = 200 });
|