fix mongo driver and kanban view

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-09-06 19:56:50 +02:00
parent 78c13683f1
commit b73e2e1a4c
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
2 changed files with 8 additions and 3 deletions
plugins/view-resources/src/components
server/mongo/src

View File

@ -39,7 +39,7 @@ import { _ID_SEPARATOR } from '@anticrm/platform';
export let config: string[]
let states: State[] = []
let objects: (Doc & { state: Ref<State> })[]
let objects: (Doc & { state: Ref<State> })[] = []
const statesQuery = createQuery()
$: statesQuery.query(core.class.State, { space }, result => { states = result })

View File

@ -13,7 +13,7 @@
// limitations under the License.
//
import type { Tx, Ref, Doc, Class, DocumentQuery, FindResult, FindOptions, TxCreateDoc } from '@anticrm/core'
import type { Tx, Ref, Doc, Class, DocumentQuery, FindResult, FindOptions, TxCreateDoc, TxUpdateDoc } from '@anticrm/core'
import core, { TxProcessor, Hierarchy, DOMAIN_TX, SortingOrder } from '@anticrm/core'
import type { DbAdapter, TxAdapter } from '@anticrm/server-core'
@ -95,9 +95,14 @@ class MongoAdapter extends MongoAdapterBase {
protected override async txCreateDoc (tx: TxCreateDoc<Doc>): Promise<void> {
const doc = TxProcessor.createDoc2Doc(tx)
const domain = this.hierarchy.getDomain(doc._class)
console.log('mongo', domain, doc)
await this.db.collection(domain).insertOne(translateDoc(doc))
}
protected override async txUpdateDoc (tx: TxUpdateDoc<Doc>): Promise<void> {
const domain = this.hierarchy.getDomain(tx.objectClass)
const result = await this.db.collection(domain).updateOne({ _id: tx.objectId }, { $set: tx.operations })
console.log('update result', result)
}
}
class MongoTxAdapter extends MongoAdapterBase implements TxAdapter {