mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
The 'lib/' rule (intended for Python virtualenv at repo root) was matching panel/src/lib/, hiding the entire panel API client + utility tree from git. Anchored Python build-artifact rules to the repo root with a leading slash so they only match at the top level. Adds 28 panel/src/lib files that should have been tracked from day one.
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
/**
|
|
* Groups API Client
|
|
*
|
|
* API functions for group management within channels.
|
|
*/
|
|
|
|
import api from "./client";
|
|
import { isMockMode } from "@/lib/mock-data";
|
|
import type { Group } from "@/types";
|
|
|
|
// =============================================================================
|
|
// Types
|
|
// =============================================================================
|
|
|
|
export interface GroupCreate {
|
|
channel_id: string;
|
|
name: string;
|
|
hierarchy_level?: number;
|
|
}
|
|
|
|
// =============================================================================
|
|
// API Client
|
|
// =============================================================================
|
|
|
|
export const groupsApi = {
|
|
/**
|
|
* Create a new group within a channel
|
|
*/
|
|
create: async (group: GroupCreate): Promise<Group> => {
|
|
if (isMockMode()) {
|
|
return {
|
|
id: `group-${Date.now()}`,
|
|
name: group.name,
|
|
hierarchy_level: group.hierarchy_level ?? 0,
|
|
is_active: true,
|
|
total_messages: 0,
|
|
active_session_id: null,
|
|
};
|
|
}
|
|
const { data } = await api.post<Group>("/groups", group);
|
|
return data;
|
|
},
|
|
|
|
/**
|
|
* Get a group by ID
|
|
*/
|
|
get: async (groupId: string): Promise<Group> => {
|
|
if (isMockMode()) {
|
|
return {
|
|
id: groupId,
|
|
name: "Mock Group",
|
|
hierarchy_level: 0,
|
|
is_active: true,
|
|
total_messages: 0,
|
|
active_session_id: null,
|
|
};
|
|
}
|
|
const { data } = await api.get<Group>(`/groups/${groupId}`);
|
|
return data;
|
|
},
|
|
};
|