Add media url to MediaModel+Start work on tonenized search query model
Some checks failed
Build and Push Image / build-and-push (push) Has been cancelled

This commit is contained in:
2025-07-12 18:08:46 -04:00
parent 8536d335bc
commit b85bcd1c7a
5 changed files with 25 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ namespace AobaServer.Controllers;
public class MediaController(AobaService aobaService, ILogger<MediaController> logger) : Controller
{
[HttpGet("{id}")]
[HttpGet("{id}/*")]
[ResponseCache(Duration = int.MaxValue)]
public async Task<IActionResult> MediaAsync(ObjectId id, [FromServices] MongoClient client, CancellationToken cancellationToken)
{
@@ -58,6 +59,7 @@ public class MediaController(AobaService aobaService, ILogger<MediaController> l
}
[HttpGet("/t/{id}")]
[ResponseCache(Duration = int.MaxValue)]
public async Task<IActionResult> ThumbAsync(ObjectId id, [FromServices] ThumbnailService thumbnailService, CancellationToken cancellationToken = default)
{
var thumb = await thumbnailService.GetThumbnailByFileIdAsync(id, cancellationToken);

View File

@@ -82,6 +82,7 @@ message MediaModel {
int32 viewCount = 5;
Id owner = 6;
string thumbUrl = 7;
string mediaUrl = 8;
}
enum MediaType {
@@ -99,3 +100,14 @@ message ShareXResponse {
string error = 2;
}
}
message SearchQuery {
optional string queryText = 1;
repeated Filter filters = 2;
}
message Filter {
string key = 1;
repeated string values = 2;
}

View File

@@ -56,6 +56,7 @@ public static class ProtoExtensions
Owner = media.Owner.ToId(),
ViewCount = media.ViewCount,
ThumbUrl = thumbUrl,
MediaUrl = media.GetMediaUrl()
};
}