list accounts (#733)

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-12-27 13:02:31 +01:00 committed by GitHub
parent 141ca67842
commit 484ff08b05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -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 <name>')
.description('drop account')

View File

@ -212,6 +212,15 @@ export async function listWorkspaces (db: Db): Promise<Workspace[]> {
.toArray()
}
/**
* @public
*/
export async function listAccounts (db: Db): Promise<Account[]> {
return await db.collection<Account>(ACCOUNT_COLLECTION)
.find({})
.toArray()
}
/**
* @public
*/