Message attachments expires at

This commit is contained in:
2025-05-24 03:21:39 +08:00
parent 2eff4364c9
commit 8da8c4bedd
4 changed files with 111 additions and 78 deletions

View File

@ -18,7 +18,11 @@ public class ChatService(AppDatabase db, FileService fs, IServiceScopeFactory sc
await db.SaveChangesAsync();
var files = message.Attachments.Distinct().ToList();
if (files.Count != 0) await fs.MarkUsageRangeAsync(files, 1);
if (files.Count != 0)
{
await fs.MarkUsageRangeAsync(files, 1);
await fs.SetExpiresRangeAsync(files, Duration.FromDays(30));
}
// Then start the delivery process
// Using ConfigureAwait(false) is correct here since we don't need context to flow