mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-17 18:05:42 +02:00
list accounts (#733)
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
+12
-1
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user