From d293a9637928cfb3469024a0c0fca5dbd46e07aa Mon Sep 17 00:00:00 2001 From: Khamraj Rohit Date: Mon, 26 May 2025 10:09:13 -0400 Subject: [PATCH] thumbnail service wip --- AobaCore/Extensions.cs | 3 ++ AobaCore/Models/MeidaThumbnail.cs | 5 ++++ AobaCore/{ => Services}/AccountsService.cs | 2 +- .../AobaIndexCreationService.cs | 2 +- AobaCore/{ => Services}/AobaService.cs | 2 +- AobaCore/Services/ThumbnailService.cs | 28 +++++++++++++++++++ AobaServer/Controllers/Api/MediaApi.cs | 4 +-- AobaServer/Controllers/AuthController.cs | 2 +- AobaServer/Controllers/MediaController.cs | 2 +- AobaServer/Services/AobaAuthService.cs | 2 +- AobaServer/Services/AobaRpcService.cs | 2 +- 11 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 AobaCore/Models/MeidaThumbnail.cs rename AobaCore/{ => Services}/AccountsService.cs (98%) rename AobaCore/{ => Services}/AobaIndexCreationService.cs (95%) rename AobaCore/{ => Services}/AobaService.cs (98%) create mode 100644 AobaCore/Services/ThumbnailService.cs diff --git a/AobaCore/Extensions.cs b/AobaCore/Extensions.cs index 691cb35..e05b947 100644 --- a/AobaCore/Extensions.cs +++ b/AobaCore/Extensions.cs @@ -1,4 +1,7 @@ global using MaybeError; + +using AobaCore.Services; + using Microsoft.Extensions.DependencyInjection; using MongoDB.Driver; diff --git a/AobaCore/Models/MeidaThumbnail.cs b/AobaCore/Models/MeidaThumbnail.cs new file mode 100644 index 0000000..b7ea5ca --- /dev/null +++ b/AobaCore/Models/MeidaThumbnail.cs @@ -0,0 +1,5 @@ +namespace AobaCore.Models; + +internal class MeidaThumbnail +{ +} \ No newline at end of file diff --git a/AobaCore/AccountsService.cs b/AobaCore/Services/AccountsService.cs similarity index 98% rename from AobaCore/AccountsService.cs rename to AobaCore/Services/AccountsService.cs index 2386321..354c5d3 100644 --- a/AobaCore/AccountsService.cs +++ b/AobaCore/Services/AccountsService.cs @@ -12,7 +12,7 @@ using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; -namespace AobaCore; +namespace AobaCore.Services; public class AccountsService(IMongoDatabase db) { public readonly IMongoCollection _users = db.GetCollection("users"); diff --git a/AobaCore/AobaIndexCreationService.cs b/AobaCore/Services/AobaIndexCreationService.cs similarity index 95% rename from AobaCore/AobaIndexCreationService.cs rename to AobaCore/Services/AobaIndexCreationService.cs index 7412a39..0e8360e 100644 --- a/AobaCore/AobaIndexCreationService.cs +++ b/AobaCore/Services/AobaIndexCreationService.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.Hosting; using MongoDB.Driver; -namespace AobaCore; +namespace AobaCore.Services; public class AobaIndexCreationService(IMongoDatabase db): BackgroundService { diff --git a/AobaCore/AobaService.cs b/AobaCore/Services/AobaService.cs similarity index 98% rename from AobaCore/AobaService.cs rename to AobaCore/Services/AobaService.cs index e7869ea..918db8a 100644 --- a/AobaCore/AobaService.cs +++ b/AobaCore/Services/AobaService.cs @@ -6,7 +6,7 @@ using MongoDB.Bson; using MongoDB.Driver; using MongoDB.Driver.GridFS; -namespace AobaCore; +namespace AobaCore.Services; public class AobaService(IMongoDatabase db) { diff --git a/AobaCore/Services/ThumbnailService.cs b/AobaCore/Services/ThumbnailService.cs new file mode 100644 index 0000000..d97ecdf --- /dev/null +++ b/AobaCore/Services/ThumbnailService.cs @@ -0,0 +1,28 @@ +using AobaCore.Models; + +using MongoDB.Bson; +using MongoDB.Driver; +using MongoDB.Driver.GridFS; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AobaCore.Services; +internal class ThumbnailService(IMongoDatabase db, AobaService aobaService) +{ + private readonly GridFSBucket _gridfs = new GridFSBucket(db); + private readonly IMongoCollection _thumbnails = db.GetCollection("thumbs"); + + public async Task GetThumbnailAsync(ObjectId id) + { + + } + + public async Task GenerateThumbnailAsync(ObjectId id) + { + + } +} diff --git a/AobaServer/Controllers/Api/MediaApi.cs b/AobaServer/Controllers/Api/MediaApi.cs index 8c60738..3977c99 100644 --- a/AobaServer/Controllers/Api/MediaApi.cs +++ b/AobaServer/Controllers/Api/MediaApi.cs @@ -1,5 +1,5 @@ -using AobaCore; -using AobaCore.Models; +using AobaCore.Models; +using AobaCore.Services; using AobaServer.Utils; diff --git a/AobaServer/Controllers/AuthController.cs b/AobaServer/Controllers/AuthController.cs index f69414a..41cf584 100644 --- a/AobaServer/Controllers/AuthController.cs +++ b/AobaServer/Controllers/AuthController.cs @@ -1,4 +1,4 @@ -using AobaCore; +using AobaCore.Services; using AobaServer.Models; using AobaServer.Utils; diff --git a/AobaServer/Controllers/MediaController.cs b/AobaServer/Controllers/MediaController.cs index 4878bb1..b08c406 100644 --- a/AobaServer/Controllers/MediaController.cs +++ b/AobaServer/Controllers/MediaController.cs @@ -1,4 +1,4 @@ -using AobaCore; +using AobaCore.Services; using HeyRed.Mime; diff --git a/AobaServer/Services/AobaAuthService.cs b/AobaServer/Services/AobaAuthService.cs index fc90c08..5ab9b23 100644 --- a/AobaServer/Services/AobaAuthService.cs +++ b/AobaServer/Services/AobaAuthService.cs @@ -1,7 +1,7 @@ using Aoba.RPC.Auth; -using AobaCore; using AobaCore.Models; +using AobaCore.Services; using AobaServer.Models; using AobaServer.Utils; diff --git a/AobaServer/Services/AobaRpcService.cs b/AobaServer/Services/AobaRpcService.cs index 607d7c4..433ef54 100644 --- a/AobaServer/Services/AobaRpcService.cs +++ b/AobaServer/Services/AobaRpcService.cs @@ -1,6 +1,6 @@ using Aoba.RPC; -using AobaCore; +using AobaCore.Services; using AobaServer.Models; using AobaServer.Utils;