improvement for the backend api

This commit is contained in:
ivannoskov
2025-11-19 12:56:04 +03:00
parent b0a9934220
commit d4672ea32b
40 changed files with 2383 additions and 3313 deletions

View File

@@ -5,33 +5,20 @@
import { api } from "./client";
import type {
TargetChannel,
TargetChannelDetail,
TargetChannelQueryParams,
TargetChannelUpdateRequest,
ListResponse,
TargetChannelsListResponse,
SuccessResponse,
} from "@/lib/types/api";
export const channelsApi = {
/**
* Get list of target channels
* GET /api/v1/target_channels
*/
list: (params?: TargetChannelQueryParams) =>
api.get<ListResponse<TargetChannel>>("/target-channels", { params }),
/**
* Get target channel details
*/
get: (id: string) => api.get<TargetChannelDetail>(`/target-channels/${id}`),
/**
* Update target channel (is_active)
*/
update: (id: string, data: TargetChannelUpdateRequest) =>
api.patch<TargetChannel>(`/target-channels/${id}`, data),
list: () => api.get<TargetChannelsListResponse>("/target_channels"),
/**
* Delete (disconnect) target channel
* DELETE /api/v1/target_channels/{channel_id}
*/
delete: (id: string) => api.delete<SuccessResponse>(`/target-channels/${id}`),
delete: (id: string) => api.delete<SuccessResponse>(`/target_channels/${id}`),
};