|
@@ -34,7 +34,7 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- {"abilityId":"册别id:0baf00db-0768-4b62-a8f7-280f6bcebf71","scope":"school","abilityCode":"册别分区键"}
|
|
|
|
|
|
+ {"areaId":"册别id:0baf00db-0768-4b62-a8f7-280f6bcebf71","scope":"school","abilityCode":"册别分区键"}
|
|
*/
|
|
*/
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 查找能力点
|
|
/// 查找能力点
|
|
@@ -52,13 +52,38 @@ namespace TEAMModelOS.Controllers
|
|
StandardFile file = null;
|
|
StandardFile file = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<StandardFile>($"{_areaId}",partitionKey:new Azure.Cosmos.PartitionKey ("StandardFile"));
|
|
|
|
- return Ok(new {});
|
|
|
|
|
|
+ file= await client.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<StandardFile>($"{_areaId}",partitionKey:new Azure.Cosmos.PartitionKey ("StandardFile"));
|
|
|
|
+ return Ok(new { file });
|
|
}
|
|
}
|
|
catch (CosmosException ex)
|
|
catch (CosmosException ex)
|
|
- {
|
|
|
|
-
|
|
|
|
- return Ok(new { file });
|
|
|
|
|
|
+ {
|
|
|
|
+ return Ok(new { file, error = ex.Status });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ {"areaId":"册别id:0baf00db-0768-4b62-a8f7-280f6bcebf71","scope":"school","abilityCode":"册别分区键"}
|
|
|
|
+ */
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 保存
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="request"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
|
+ [HttpPost("upsert")]
|
|
|
|
+ [AuthToken(Roles = "teacher,student,admin,area")]
|
|
|
|
+ public async Task<IActionResult> upsert(StandardFile file)
|
|
|
|
+ {
|
|
|
|
+ var client = _azureCosmos.GetCosmosClient();
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ file.pk = "StandardFile";
|
|
|
|
+ file.code = "StandardFile";
|
|
|
|
+ file = await client.GetContainer(Constant.TEAMModelOS, "Normal").UpsertItemAsync<StandardFile>(file, partitionKey: new Azure.Cosmos.PartitionKey("StandardFile"));
|
|
|
|
+ return Ok(new { file, });
|
|
|
|
+ }
|
|
|
|
+ catch (CosmosException ex)
|
|
|
|
+ {
|
|
|
|
+ return Ok(new {error= ex.Status });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|