mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
762 B
TypeScript
46 lines
762 B
TypeScript
import { request } from '../api/request';
|
|
|
|
export enum GroupPanelType {
|
|
TEXT = 0,
|
|
GROUP = 1,
|
|
PLUGIN = 2,
|
|
}
|
|
|
|
export interface GroupMember {
|
|
role: string; // 角色
|
|
userId: string;
|
|
}
|
|
|
|
export interface GroupPanel {
|
|
id: string; // 在群组中唯一
|
|
name: string;
|
|
parentId?: string;
|
|
type: GroupPanelType;
|
|
}
|
|
|
|
export interface GroupInfo {
|
|
_id: string;
|
|
name: string;
|
|
avatar?: string;
|
|
creator: string;
|
|
members: GroupMember[];
|
|
panels: GroupPanel[];
|
|
}
|
|
|
|
/**
|
|
* 创建群组
|
|
* @param name 群组名
|
|
* @param panels 初始面板
|
|
*/
|
|
export async function createGroup(
|
|
name: string,
|
|
panels: GroupPanel[]
|
|
): Promise<GroupInfo> {
|
|
const { data } = await request.post('/api/group/createGroup', {
|
|
name,
|
|
panels,
|
|
});
|
|
|
|
return data;
|
|
}
|