|
@@ -51,7 +51,6 @@ namespace TEAMModelOS.Controllers
|
|
|
//TODO 此API需處理對應前端返回的相關數據
|
|
|
[ProducesDefaultResponseType]
|
|
|
[HttpPost("get-teacher-info")]
|
|
|
-
|
|
|
public async Task<IActionResult> GetTeacherInfo(JsonElement request)
|
|
|
{
|
|
|
//Debug
|
|
@@ -93,6 +92,7 @@ namespace TEAMModelOS.Controllers
|
|
|
if (obj.TryGetProperty("time", out JsonElement time)) {
|
|
|
schoolExtobj.time = obj.GetProperty("time");
|
|
|
}
|
|
|
+ schoolExtobj.size= obj.GetProperty("size");
|
|
|
schoolExtobj.picture = school.RootElement.GetProperty("picture");
|
|
|
schools.Add(schoolExtobj);
|
|
|
}
|
|
@@ -203,13 +203,15 @@ namespace TEAMModelOS.Controllers
|
|
|
jwt.Payload.TryGetValue("picture", out object picture);
|
|
|
List<string> roles = new List<string>();
|
|
|
List<string> permissions = new List<string>();
|
|
|
-
|
|
|
+ int size = 0;
|
|
|
var response = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(id, new PartitionKey($"Teacher-{school_code}"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
-
|
|
|
- if (json.RootElement.TryGetProperty("roles", out JsonElement _roles) && _roles.ValueKind != JsonValueKind.Null)
|
|
|
+ if (json.RootElement.TryGetProperty("size", out JsonElement _size) && _size.ValueKind == JsonValueKind.Number) {
|
|
|
+ size = _size.GetInt32();
|
|
|
+ }
|
|
|
+ if (json.RootElement.TryGetProperty("roles", out JsonElement _roles) && _roles.ValueKind != JsonValueKind.Null)
|
|
|
{
|
|
|
foreach (var obj in _roles.EnumerateArray())
|
|
|
{
|
|
@@ -365,7 +367,7 @@ namespace TEAMModelOS.Controllers
|
|
|
await container.CreateIfNotExistsAsync(PublicAccessType.None); //嘗試創建School容器,如存在則不做任何事,保障容器一定存在
|
|
|
var (blob_uri, blob_sas) = (roles.Contains("admin") || permissions.Contains("schoolAc-upd")) ? _azureStorage.GetBlobContainerSAS(school_code_blob, BlobContainerSasPermissions.Write | BlobContainerSasPermissions.Read | BlobContainerSasPermissions.List | BlobContainerSasPermissions.Delete) : _azureStorage.GetBlobContainerSAS(school_code_blob, BlobContainerSasPermissions.Read | BlobContainerSasPermissions.List| BlobContainerSasPermissions.Write);
|
|
|
|
|
|
- return Ok(new { auth_token, blob_uri, blob_sas, school_base, school_courses, school_syllabus, school_classes , school_rooms });
|
|
|
+ return Ok(new { auth_token, blob_uri, blob_sas, school_base, school_courses, school_syllabus, school_classes , school_rooms , size });
|
|
|
}
|
|
|
|
|
|
[ProducesDefaultResponseType]
|