|
@@ -35,15 +35,28 @@ namespace TEAMModelFunction
|
|
_azureRedis = azureRedis;
|
|
_azureRedis = azureRedis;
|
|
_configuration = configuration;
|
|
_configuration = configuration;
|
|
}
|
|
}
|
|
|
|
+ //[FunctionName("Common")]
|
|
|
|
+ //public async Task Common([Microsoft.Azure.Functions.Worker.CosmosDBTriggerAttribute(
|
|
|
|
+ // databaseName: "TEAMModelOS",
|
|
|
|
+ // containerName: "Common",
|
|
|
|
+ // Connection = "Azure:Cosmos:ConnectionString",
|
|
|
|
+ // LeaseContainerName = "leases",
|
|
|
|
+ // LeaseContainerPrefix = "TEAMModelOS",
|
|
|
|
+ // CreateLeaseContainerIfNotExists =true)]string josn, ILogger log)
|
|
|
|
+ //{
|
|
|
|
+ // IReadOnlyList<Document> inputs = new List<Document>();
|
|
|
|
+
|
|
|
|
|
|
[FunctionName("Common")]
|
|
[FunctionName("Common")]
|
|
- public async Task Common([CosmosDBTrigger(
|
|
|
|
- databaseName: "TEAMModelOS",
|
|
|
|
- collectionName: "Common",
|
|
|
|
- ConnectionStringSetting = "Azure:Cosmos:ConnectionString",
|
|
|
|
- LeaseCollectionName = "leases",
|
|
|
|
- LeaseCollectionPrefix = "TEAMModelOS")]IReadOnlyList<Document> inputs, ILogger log)
|
|
|
|
|
|
+ public async Task Common([Microsoft.Azure.WebJobs.CosmosDBTriggerAttribute(
|
|
|
|
+ databaseName: "TEAMModelOS",
|
|
|
|
+ collectionName: "Common",
|
|
|
|
+ ConnectionStringSetting = "Azure:Cosmos:ConnectionString",
|
|
|
|
+ LeaseCollectionName = "leases",
|
|
|
|
+ LeaseCollectionPrefix = "TEAMModelOS",
|
|
|
|
+ CreateLeaseCollectionIfNotExists =true)]IReadOnlyList<Document> inputs, ILogger log)
|
|
{
|
|
{
|
|
|
|
+
|
|
if (inputs != null && inputs.Count > 0)
|
|
if (inputs != null && inputs.Count > 0)
|
|
{
|
|
{
|
|
log.LogInformation("Documents modified " + inputs.Count);
|
|
log.LogInformation("Documents modified " + inputs.Count);
|
|
@@ -95,25 +108,25 @@ namespace TEAMModelFunction
|
|
switch (pk)
|
|
switch (pk)
|
|
{
|
|
{
|
|
case "Exam":
|
|
case "Exam":
|
|
- TriggerExam.Trigger(_azureCosmos, _serviceBus, _azureStorage, _dingDing, client, input, code, stime, etime, school);
|
|
|
|
|
|
+ await TriggerExam.Trigger(_azureCosmos, _serviceBus, _azureStorage, _dingDing, client, input, code, stime, etime, school);
|
|
break;
|
|
break;
|
|
case "Vote":
|
|
case "Vote":
|
|
- TriggerVote.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
|
|
|
|
+ await TriggerVote.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
break;
|
|
break;
|
|
case "Survey":
|
|
case "Survey":
|
|
- TriggerSurvey.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
|
|
|
|
+ await TriggerSurvey.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
break;
|
|
break;
|
|
case "Correct":
|
|
case "Correct":
|
|
- TriggerCorrect.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis);
|
|
|
|
|
|
+ await TriggerCorrect.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis);
|
|
break;
|
|
break;
|
|
case "ExamLite":
|
|
case "ExamLite":
|
|
- TriggerExamLite.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
|
|
|
|
+ await TriggerExamLite.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
break;
|
|
break;
|
|
case "Study":
|
|
case "Study":
|
|
- TriggerStudy.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
|
|
|
|
+ await TriggerStudy.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
break;
|
|
break;
|
|
case "Homework":
|
|
case "Homework":
|
|
- TriggerHomework.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
|
|
|
|
+ await TriggerHomework.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
|
|
break;
|
|
break;
|
|
|
|
|
|
}
|
|
}
|