mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-24 01:07:50 +00:00
fix mongo driver and kanban view
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
78c13683f1
commit
b73e2e1a4c
@ -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 })
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user