refactor: add getConverseInfo call action in sdk

pull/150/head
moonrailgun 2 years ago
parent 923b373403
commit 5e38294fee

@ -1,6 +1,6 @@
{
"name": "tailchat-types",
"version": "1.0.2",
"version": "1.0.3",
"description": "Tailchat model types",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",

@ -24,3 +24,21 @@ export interface ChatMessage {
updatedAt?: string;
}
export const chatConverseType = [
'DM', // 私信
'Multi', // 多人会话
'Group', // 群组
] as const;
export type ChatConverseType = (typeof chatConverseType)[number];
export interface ChatConverse {
_id: string;
name?: string;
type: ChatConverseType;
members: string[];
}

@ -1,6 +1,6 @@
{
"name": "tailchat-server-sdk",
"version": "0.0.16",
"version": "0.0.17",
"description": "",
"main": "dist/index.js",
"bin": {
@ -58,6 +58,6 @@
"mongoose": "6.1.1",
"path-to-regexp": "^6.2.1",
"ramda-adjunct": "^4.0.0",
"tailchat-types": "workspace:^"
"tailchat-types": "workspace:*"
}
}

@ -5,6 +5,7 @@ import {
PERMISSION,
TcPureContext,
} from '../../index';
import type { ChatConverseStruct } from '../../structs/chat';
export function call(ctx: TcPureContext) {
return {
@ -98,6 +99,16 @@ export function call(ctx: TcPureContext) {
userId: String(userId),
});
},
/**
*
*/
async getConverseInfo(
converseId: string
): Promise<ChatConverseStruct | null> {
return await ctx.call('chat.converse.findConverseInfo', {
converseId,
});
},
/**
*
*/

@ -67,3 +67,5 @@ export interface BasicInboxItem {
}
export type InboxStruct = InboxItem;
export type { ChatConverse as ChatConverseStruct } from 'tailchat-types';

Loading…
Cancel
Save