Files
UHD_Media_Tool/packages/contracts/src/release-facets.ts
T
rootandClaude Opus 5.5 71b129d85a feat(web): merge search filters into one row and tidy episode versions (POLISH-1)
- H&R becomes a quick-filter facet (yes/no/unknown, with counts) on search
  results and the site resources tab; drop the old free/H&R selects, keep
  size range and sort on the same row (mobile: drawer), single clear button
- legacy free/hr URL params migrate into quick filters; stored selections
  keep the same localStorage key
- search timing and query terms move into TechInfo
- library episode versions: click the whole row to expand, versions listed
  as sibling rows, details only under the selected version, raw values in
  TechInfo
- slot comparison gaps get reason codes (matchGapText in contracts
  reasons.ts): "可换成 2160p", "缺 HDR 版本"

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-29 22:06:32 +08:00

36 lines
1.6 KiB
TypeScript

import { z } from "zod";
import { NonNegInt } from "./common.ts";
// 资源列表快速筛选(SEARCH-3):GET /search/releases 与 GET /sites/{id}/releases 共用。
// 口径实现在 @umt/domain release-facets:同一维度多选为 OR,不同维度为 AND;
// 计数按其它维度的已选条件统计(0 = 在其它条件下没有结果)。
export const FacetCount = z.object({ value: z.string(), label: z.string(), count: NonNegInt });
export type FacetCount = z.infer<typeof FacetCount>;
/**
* 快速筛选参数 qf:`维度:值,值;维度:值`,值经 encodeURIComponent。
* 维度:resolution(2160p/1080p/720p/other)、videoCodec(H.265/H.264/AV1/other)、
* releaseType(disc/remux/encode/webdl/hdtv/other)、site(站点 ID)、promotion(free/2x/50%/other/none)、
* hdr(DV/HDR10/HDR10+/other/SDR)、hr(yes/no/unknown)、releaseGroup(制作组名,不分大小写)、season(季号)、episode(集号 / pack 整季)。
*/
export const QuickFilterParam = z.string().max(4000).optional();
export const ReleaseQuickFacets = z.object({
resolution: z.array(FacetCount),
videoCodec: z.array(FacetCount),
releaseType: z.array(FacetCount),
/** 站点列表(单站)里只有一项 */
site: z.array(FacetCount),
promotion: z.array(FacetCount),
hdr: z.array(FacetCount),
/** H&R:有 / 无 / 未知(POLISH-1) */
hr: z.array(FacetCount),
/** 计数最多的前 20 个 + 已选的 */
releaseGroup: z.array(FacetCount),
/** 没有剧集资源时为空 */
season: z.array(FacetCount),
episode: z.array(FacetCount),
});
export type ReleaseQuickFacets = z.infer<typeof ReleaseQuickFacets>;