|
@@ -56,12 +56,12 @@ namespace TEAMModelOS.Controllers
|
|
[ProducesDefaultResponseType]
|
|
[ProducesDefaultResponseType]
|
|
//[AuthToken(Roles = "admin")]
|
|
//[AuthToken(Roles = "admin")]
|
|
[HttpPost("upsert")]
|
|
[HttpPost("upsert")]
|
|
- public async Task<IActionResult> Upsert(School requert)
|
|
|
|
|
|
+ public async Task<IActionResult> Upsert(TEAMModelOS.SDK.Models.School requert)
|
|
{
|
|
{
|
|
var (_, _, _, school) = HttpContext.GetAuthTokenInfo();
|
|
var (_, _, _, school) = HttpContext.GetAuthTokenInfo();
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- School schoolInfo = new School();
|
|
|
|
|
|
+ TEAMModelOS.SDK.Models.School schoolInfo = new TEAMModelOS.SDK.Models.School();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var schoolContainer = client.GetContainer("TEAMModelOS", "School");
|
|
var schoolContainer = client.GetContainer("TEAMModelOS", "School");
|
|
var response = await schoolContainer.ReadItemStreamAsync(requert.id, new PartitionKey($"Base"));
|
|
var response = await schoolContainer.ReadItemStreamAsync(requert.id, new PartitionKey($"Base"));
|
|
@@ -124,7 +124,7 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
if (!requert.TryGetProperty("school_code", out JsonElement school_code)) return BadRequest();
|
|
if (!requert.TryGetProperty("school_code", out JsonElement school_code)) return BadRequest();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
- List<School> schools = new List<School>();
|
|
|
|
|
|
+ List<TEAMModelOS.SDK.Models.School> schools = new List<TEAMModelOS.SDK.Models.School>();
|
|
var query = $"select c.id,c.pk,c.code, c.name,c.region,c.province,c.city,c.timeZone,c.picture,c.size,c.period,c.campuses from c where c.id ='{school_code}'";
|
|
var query = $"select c.id,c.pk,c.code, c.name,c.region,c.province,c.city,c.timeZone,c.picture,c.size,c.period,c.campuses from c where c.id ='{school_code}'";
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
{
|
|
{
|
|
@@ -134,7 +134,7 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
{
|
|
{
|
|
- schools.Add(obj.ToObject<School>());
|
|
|
|
|
|
+ schools.Add(obj.ToObject<TEAMModelOS.SDK.Models.School>());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|