refactor(server): 移动call指令到sdk中

pull/49/head
moonrailgun 3 years ago
parent 9f7f31fac0
commit 56ac064506

@ -82,7 +82,7 @@
// 输入框
.ant-input {
color: rgba(255, 255, 255, 0.65);
color: rgba(255, 255, 255, 0.85);
background-color: transparent;
border-color: rgba(255, 255, 255, 0.12);

@ -0,0 +1,4 @@
/**
* id
*/
export const SYSTEM_USERID = '000000000000000000000000';

@ -12,6 +12,7 @@ export type {
} from './services/types';
export { parseLanguageFromHead } from './services/lib/i18n/parser';
export { t } from './services/lib/i18n';
export { call } from './services/lib/call';
export {
config,
buildUploadUrl,
@ -32,6 +33,8 @@ export type { UserStruct } from './structs/user';
// db
export * as db from './db';
export * from './const';
// other
export { Utils, Errors } from 'moleculer';

@ -1,7 +1,4 @@
import type { TcContext } from 'tailchat-server-sdk';
import type { Group } from '../models/group/group';
import type { User } from '../models/user/user';
import { SYSTEM_USERID } from './const';
import { GroupStruct, UserStruct, SYSTEM_USERID, TcContext } from '../../index';
export function call(ctx: TcContext) {
return {
@ -61,7 +58,7 @@ export function call(ctx: TcContext) {
/**
*
*/
async getUserInfo(userId: string): Promise<User> {
async getUserInfo(userId: string): Promise<UserStruct> {
return await ctx.call('user.getUserInfo', {
userId,
});
@ -69,7 +66,7 @@ export function call(ctx: TcContext) {
/**
*
*/
async getGroupInfo(groupId: string): Promise<Group> {
async getGroupInfo(groupId: string): Promise<GroupStruct> {
return await ctx.call('group.getGroupInfo', {
groupId,
});

@ -6,12 +6,12 @@ import {
TcService,
TcContext,
UserStruct,
call,
} from 'tailchat-server-sdk';
import type {
ConverseDocument,
ConverseModel,
} from '../../../models/chat/converse';
import { call } from '../../../lib/call';
interface ConverseService
extends TcService,

@ -19,8 +19,8 @@ import {
TcContext,
TcDbService,
PureContext,
call,
} from 'tailchat-server-sdk';
import { call } from '../../../lib/call';
import moment from 'moment';
import { PERMISSION } from '../../../lib/role';

@ -1,5 +1,4 @@
import _ from 'lodash';
import { call } from '../../../lib/call';
import { NoPermissionError } from '../../../lib/errors';
import type {
GroupInvite,
@ -11,6 +10,7 @@ import {
TcContext,
TcDbService,
PureContext,
call,
} from 'tailchat-server-sdk';
import { PERMISSION } from '../../../lib/role';

Loading…
Cancel
Save