| 1234567891011121314151617181920212223242526272829303132333435363738 |
- export interface DemandBelongItem {
- id: number
- name: string | null
- category_id: number
- reason: string | null
- }
- export interface DemandBelongResponse {
- items: DemandBelongItem[]
- }
- export interface DemandVideoItem {
- vid: string
- title: string | null
- inspiration_points_json: string | null
- purpose_points_json: string | null
- key_points_json: string | null
- }
- export interface DemandVideosResponse {
- demand_belong_id: number
- name: string | null
- category_id: number
- videos: DemandVideoItem[]
- }
- /** category_id → demands belonging to that category */
- export type DemandsByCategory = Record<number, DemandBelongItem[]>
- export function groupDemandsByCategory(items: DemandBelongItem[]): DemandsByCategory {
- const map: DemandsByCategory = {}
- for (const item of items) {
- const key = item.category_id
- if (!map[key]) map[key] = []
- map[key].push(item)
- }
- return map
- }
|