Search with sticker packs

This commit is contained in:
2025-08-20 14:02:34 +08:00
parent e8d8dcbb2d
commit 85fef30c7f

View File

@@ -42,7 +42,8 @@ public class StickerController(
[FromQuery] int offset = 0, [FromQuery] int offset = 0,
[FromQuery] int take = 20, [FromQuery] int take = 20,
[FromQuery(Name = "pub")] string? pubName = null, [FromQuery(Name = "pub")] string? pubName = null,
[FromQuery(Name = "order")] string? order = null [FromQuery(Name = "order")] string? order = null,
[FromQuery(Name = "query")] string? query = null
) )
{ {
Publisher.Publisher? publisher = null; Publisher.Publisher? publisher = null;
@@ -61,6 +62,14 @@ public class StickerController(
}; };
} }
if (!string.IsNullOrWhiteSpace(query))
{
queryable = queryable.Where(p =>
EF.Functions.ILike(p.Name, $"%{query}%") ||
EF.Functions.ILike(p.Description, $"%{query}%")
);
}
var totalCount = await queryable var totalCount = await queryable
.CountAsync(); .CountAsync();
var packs = await queryable var packs = await queryable