1
0
Fork 0
mirror of synced 2024-07-03 05:20:32 +12:00

Merge branch 'master' into develop

This commit is contained in:
Keviin Åberg Kultalahti 2021-08-13 14:41:49 +02:00
commit f6218d8e0b
2 changed files with 21 additions and 3 deletions

View file

@ -13,8 +13,9 @@
const dispatch = createEventDispatcher()
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
const isoString = e.detail.toISOString()
value = isoString
dispatch("change", isoString)
}
</script>

View file

@ -1,6 +1,10 @@
const CouchDB = require("../index")
const { IncludeDocs, getLinkDocuments } = require("./linkUtils")
const { generateLinkID } = require("../utils")
const {
generateLinkID,
InternalTables,
getUserMetadataParams,
} = require("../utils")
const Sentry = require("@sentry/node")
const { FieldTypes, RelationshipTypes } = require("../../constants")
@ -208,6 +212,19 @@ class LinkController {
const linkedTable = await this._db.get(field.tableId)
const linkedSchema = linkedTable.schema[field.fieldName]
// We need to map the global users to metadata in each app for relationships
if (field.tableId === InternalTables.USER_METADATA) {
const users = await this._db.allDocs(getUserMetadataParams(null, {}))
const metadataRequired = rowField.filter(
userId => !users.rows.some(user => user.id === userId)
)
// ensure non-existing user metadata is created in the app DB
await this._db.bulkDocs(
metadataRequired.map(userId => ({ _id: userId }))
)
}
// iterate through the link IDs in the row field, see if any don't exist already
for (let linkId of rowField) {
if (linkedSchema.relationshipType === RelationshipTypes.ONE_TO_MANY) {