|
@@ -963,7 +963,7 @@ namespace TEAMModelOS.Controllers
|
|
|
c.period,
|
|
|
c.periodType,
|
|
|
c.zymusicstds,c.code,
|
|
|
- count = artAttachments.Where(z => z.artId.Equals(c.id)).SelectMany(k => k.files).ToList().Count
|
|
|
+ count = artAttachments.Where(z => z.artId.Equals(c.id)).ToList().Count
|
|
|
|
|
|
});
|
|
|
return Ok(new { arts = newArts ,token});
|
|
@@ -1075,6 +1075,18 @@ namespace TEAMModelOS.Controllers
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
if (!element.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
if (!element.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ ArtAttachment attachment = new();
|
|
|
+ var res = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemStreamAsync(id.ToString(), new PartitionKey($"ArtAttachment-{code}"));
|
|
|
+ if (res.Status == 200)
|
|
|
+ {
|
|
|
+ using var json = await JsonDocument.ParseAsync(res.ContentStream);
|
|
|
+ attachment = json.ToObject<ArtAttachment>();
|
|
|
+
|
|
|
+ }
|
|
|
+ List<Attachment> atts = attachment.files;
|
|
|
+ foreach (Attachment att in atts) {
|
|
|
+ await _azureStorage.GetBlobServiceClient().DeleteBlobs(_dingDing, code.GetString(), new List<string> { $"{att.blob}" });
|
|
|
+ }
|
|
|
await client.GetContainer("TEAMModelOS", "Student").DeleteItemStreamAsync(id.GetString(), new PartitionKey($"ArtAttachment-{code}"));
|
|
|
return Ok();
|
|
|
}
|