♻️ Extract the Storage service to DysonNetwork.Drive microservice
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DysonNetwork.Common.Interfaces;
|
||||
using DysonNetwork.Common.Models;
|
||||
using DysonNetwork.Sphere.Localization;
|
||||
using DysonNetwork.Sphere.Permission;
|
||||
@ -16,7 +17,7 @@ namespace DysonNetwork.Sphere.Chat;
|
||||
[Route("/chat")]
|
||||
public class ChatRoomController(
|
||||
AppDatabase db,
|
||||
FileReferenceService fileRefService,
|
||||
IFileReferenceServiceClient fileRefService,
|
||||
ChatRoomService crs,
|
||||
RealmService rs,
|
||||
ActionLogService als,
|
||||
@ -272,12 +273,12 @@ public class ChatRoomController(
|
||||
if (picture is null) return BadRequest("Invalid picture id, unable to find the file on cloud.");
|
||||
|
||||
// Remove old references for pictures
|
||||
await fileRefService.DeleteResourceReferencesAsync(chatRoom.ResourceIdentifier, "chat.room.picture");
|
||||
await fileRefService.DeleteResourceReferencesAsync(chatRoom.ResourceIdentifier, "chat-room.picture");
|
||||
|
||||
// Add a new reference
|
||||
await fileRefService.CreateReferenceAsync(
|
||||
picture.Id,
|
||||
"chat.room.picture",
|
||||
picture.Id.ToString(),
|
||||
"chat-room.picture",
|
||||
chatRoom.ResourceIdentifier
|
||||
);
|
||||
|
||||
@ -290,12 +291,12 @@ public class ChatRoomController(
|
||||
if (background is null) return BadRequest("Invalid background id, unable to find the file on cloud.");
|
||||
|
||||
// Remove old references for backgrounds
|
||||
await fileRefService.DeleteResourceReferencesAsync(chatRoom.ResourceIdentifier, "chat.room.background");
|
||||
await fileRefService.DeleteResourceReferencesAsync(chatRoom.ResourceIdentifier, "chat-room.background");
|
||||
|
||||
// Add a new reference
|
||||
await fileRefService.CreateReferenceAsync(
|
||||
background.Id,
|
||||
"chat.room.background",
|
||||
background.Id.ToString(),
|
||||
"chat-room.background",
|
||||
chatRoom.ResourceIdentifier
|
||||
);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using DysonNetwork.Pass.Features.Account;
|
||||
using DysonNetwork.Common.Interfaces;
|
||||
using DysonNetwork.Common.Models;
|
||||
using DysonNetwork.Sphere.Chat.Realtime;
|
||||
using DysonNetwork.Sphere.Connection;
|
||||
@ -11,7 +12,7 @@ namespace DysonNetwork.Sphere.Chat;
|
||||
|
||||
public partial class ChatService(
|
||||
AppDatabase db,
|
||||
FileReferenceService fileRefService,
|
||||
IFileReferenceServiceClient fileRefService,
|
||||
IServiceScopeFactory scopeFactory,
|
||||
IRealtimeService realtime,
|
||||
ILogger<ChatService> logger
|
||||
@ -162,10 +163,9 @@ public partial class ChatService(
|
||||
foreach (var file in files)
|
||||
{
|
||||
await fileRefService.CreateReferenceAsync(
|
||||
file.Id,
|
||||
file.Id.ToString(),
|
||||
ChatFileUsageIdentifier,
|
||||
messageResourceId,
|
||||
duration: Duration.FromDays(30)
|
||||
messageResourceId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user