forked from xiongyuxing/tiku-backend.net
feat: add catalog readonly endpoints
This commit is contained in:
103
Tiku.Application/Catalog/CatalogQueryModels.cs
Normal file
103
Tiku.Application/Catalog/CatalogQueryModels.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Domain.Catalog;
|
||||
|
||||
namespace Tiku.Application.Catalog;
|
||||
|
||||
public sealed record CatalogList<TItem>(IReadOnlyCollection<TItem> Items);
|
||||
|
||||
public sealed record CatalogFilter(
|
||||
Guid TenantId,
|
||||
Guid? RegionId = null,
|
||||
Guid? ModuleId = null,
|
||||
Guid? ParentId = null,
|
||||
bool ParentIsRoot = false,
|
||||
Guid? SchoolId = null,
|
||||
Guid? MajorId = null,
|
||||
Guid? SubjectId = null,
|
||||
Guid? NodeId = null,
|
||||
string? Keyword = null,
|
||||
string? Type = null,
|
||||
int? Limit = null);
|
||||
|
||||
public sealed record RegionCatalogItem(
|
||||
Guid Id,
|
||||
string? LegacyId,
|
||||
string Name,
|
||||
string? Code,
|
||||
string? ShortName,
|
||||
string? FullName,
|
||||
string? Icon,
|
||||
string? Pinyin,
|
||||
int Order,
|
||||
bool IsHot);
|
||||
|
||||
public sealed record RegionModuleCatalogItem(
|
||||
Guid Id,
|
||||
string? LegacyId,
|
||||
Guid? RegionId,
|
||||
string Name,
|
||||
string? Type,
|
||||
string? Icon,
|
||||
string? Color,
|
||||
string? TextColor,
|
||||
string? Description,
|
||||
string? Route,
|
||||
int Order,
|
||||
bool IsPrimarySchoolModule);
|
||||
|
||||
public sealed record ModuleNodeCatalogItem(
|
||||
Guid Id,
|
||||
string? LegacyId,
|
||||
Guid? RegionId,
|
||||
Guid? ModuleId,
|
||||
Guid? ParentId,
|
||||
string? LegacyParentId,
|
||||
ModuleNodeType Type,
|
||||
string Name,
|
||||
string? Path,
|
||||
int Order,
|
||||
JsonElement Metadata);
|
||||
|
||||
public sealed record SchoolCatalogItem(
|
||||
Guid Id,
|
||||
string? LegacyId,
|
||||
Guid? RegionId,
|
||||
Guid? ModuleId,
|
||||
string Name,
|
||||
string? ProfessionalExamDate,
|
||||
JsonElement Metadata);
|
||||
|
||||
public sealed record MajorCatalogItem(
|
||||
Guid Id,
|
||||
string? LegacyId,
|
||||
Guid? RegionId,
|
||||
Guid? SchoolId,
|
||||
string Name,
|
||||
string? Description,
|
||||
string? StudyTips,
|
||||
int Order);
|
||||
|
||||
public sealed record SubjectCatalogItem(
|
||||
Guid Id,
|
||||
string? LegacyId,
|
||||
Guid? RegionId,
|
||||
Guid? ModuleId,
|
||||
Guid? SchoolId,
|
||||
Guid? MajorId,
|
||||
Guid? NodeId,
|
||||
string Name,
|
||||
SubjectType? Type,
|
||||
string? Icon,
|
||||
string? Description,
|
||||
JsonElement Stats,
|
||||
int Order);
|
||||
|
||||
public sealed record CategoryCatalogItem(
|
||||
Guid Id,
|
||||
string? LegacyId,
|
||||
Guid? SubjectId,
|
||||
Guid? NodeId,
|
||||
string Name,
|
||||
CategoryType? CategoryType,
|
||||
int Order,
|
||||
int? SvipQuestionLimit);
|
||||
32
Tiku.Application/Catalog/ICatalogQueryService.cs
Normal file
32
Tiku.Application/Catalog/ICatalogQueryService.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace Tiku.Application.Catalog;
|
||||
|
||||
public interface ICatalogQueryService
|
||||
{
|
||||
Task<CatalogList<RegionCatalogItem>> GetRegionsAsync(
|
||||
CatalogFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<CatalogList<RegionModuleCatalogItem>> GetRegionModulesAsync(
|
||||
CatalogFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<CatalogList<ModuleNodeCatalogItem>> GetModuleNodesAsync(
|
||||
CatalogFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<CatalogList<SchoolCatalogItem>> GetSchoolsAsync(
|
||||
CatalogFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<CatalogList<MajorCatalogItem>> GetMajorsAsync(
|
||||
CatalogFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<CatalogList<SubjectCatalogItem>> GetSubjectsAsync(
|
||||
CatalogFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<CatalogList<CategoryCatalogItem>> GetCategoriesAsync(
|
||||
CatalogFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
}
|
||||
Reference in New Issue
Block a user