feat(frontend): ScheduleConfig V2 types, weekday schema, export update

This commit is contained in:
2026-03-17 14:39:19 +01:00
parent 20e80ac28e
commit bd498b9bcb
8 changed files with 63 additions and 10 deletions

View File

@@ -4,6 +4,8 @@ import { useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { api } from "@/lib/api";
import type { ChannelImportData } from "@/app/(main)/dashboard/components/import-channel-dialog";
import { WEEKDAYS } from "@/lib/types";
import type { Weekday } from "@/lib/types";
export function useImportChannel(token: string | null) {
const queryClient = useQueryClient();
@@ -26,7 +28,11 @@ export function useImportChannel(token: string | null) {
await api.channels.update(
created.id,
{
schedule_config: { blocks: data.blocks },
schedule_config: {
day_blocks: Object.fromEntries(
WEEKDAYS.map(d => [d, d === 'monday' ? data.blocks : []])
) as Record<Weekday, typeof data.blocks>,
},
recycle_policy: data.recycle_policy,
},
token,