mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-28 12:52:57 +03:00
feat: add query members
This commit is contained in:
parent
cdf07fd7c2
commit
48264edf91
@ -384,6 +384,20 @@ export class DataCenter {
|
||||
return (await blobStorage?.set(blob)) || '';
|
||||
}
|
||||
|
||||
/**
|
||||
* get members of a workspace
|
||||
* @param workspaceId
|
||||
*/
|
||||
async getMembers(workspaceId: string) {
|
||||
const workspaceInfo = this._workspaceUnitCollection.find(workspaceId);
|
||||
assert(workspaceInfo, 'Workspace not found');
|
||||
const provider = this.providerMap.get(workspaceInfo.provider);
|
||||
if (provider) {
|
||||
return await provider.getWorkspaceMembers(workspaceId);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
onMessage(cb: (message: Message) => void) {
|
||||
return this._messageCenter.onMessage(cb);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import { storage } from './storage.js';
|
||||
import assert from 'assert';
|
||||
import { WebsocketProvider } from './sync.js';
|
||||
// import { IndexedDBProvider } from '../local/indexeddb';
|
||||
import { getApis } from './apis/index.js';
|
||||
import { getApis, Member } from './apis/index.js';
|
||||
import type { Apis, WorkspaceDetail, Callback } from './apis';
|
||||
import { setDefaultAvatar } from '../utils.js';
|
||||
import { MessageCode } from '../../message';
|
||||
@ -365,4 +365,8 @@ export class AffineProvider extends BaseProvider {
|
||||
token.clear();
|
||||
storage.removeItem('token');
|
||||
}
|
||||
|
||||
public override async getWorkspaceMembers(id: string) {
|
||||
return this._apis.getWorkspaceMembers({ id });
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import { MessageCenter } from '../message';
|
||||
import { Logger, User } from '../types';
|
||||
import type { WorkspaceUnitCollectionScope } from '../workspace-unit-collection';
|
||||
import type { WorkspaceUnitCtorParams } from '../workspace-unit';
|
||||
import { Member } from './affine/apis';
|
||||
|
||||
const defaultLogger = () => {
|
||||
return;
|
||||
@ -213,4 +214,14 @@ export class BaseProvider {
|
||||
from;
|
||||
return to;
|
||||
}
|
||||
|
||||
/**
|
||||
* get workspace members
|
||||
* @param {string} workspaceId
|
||||
* @returns
|
||||
*/
|
||||
public getWorkspaceMembers(workspaceId: string): Promise<Member[]> {
|
||||
workspaceId;
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user