diff --git a/dev/tool/src/index.ts b/dev/tool/src/index.ts index 134a1fec19..9d62654aca 100644 --- a/dev/tool/src/index.ts +++ b/dev/tool/src/index.ts @@ -22,7 +22,8 @@ import { dropAccount, dropWorkspace, getAccount, - listWorkspaces + listWorkspaces, + listAccounts } from '@anticrm/account' import contact, { combineName } from '@anticrm/contact' import core, { TxOperations } from '@anticrm/core' @@ -187,6 +188,16 @@ program }) }) +program + .command('show-accounts') + .description('Show accounts') + .action(async () => { + return await withDatabase(mongodbUri, async (db) => { + const accountsJSON = JSON.stringify(await listAccounts(db), null, 2) + console.info(accountsJSON) + }) + }) + program .command('drop-account ') .description('drop account') diff --git a/server/account/src/index.ts b/server/account/src/index.ts index f039de01d0..a03ff07ca7 100644 --- a/server/account/src/index.ts +++ b/server/account/src/index.ts @@ -212,6 +212,15 @@ export async function listWorkspaces (db: Db): Promise { .toArray() } +/** + * @public + */ +export async function listAccounts (db: Db): Promise { + return await db.collection(ACCOUNT_COLLECTION) + .find({}) + .toArray() +} + /** * @public */