mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-28 19:08:01 +00:00
list accounts (#733)
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
141ca67842
commit
484ff08b05
@ -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')
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user