Skip to content

Commit

Permalink
Showing 2 changed files with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -21,12 +21,17 @@ export async function createTablesRecordsMethod(
if (value.isNone()) {
continue
}
const spec = new ReferenceEqual(value.unwrap() as ReferenceFieldValue, field.id)
specs.push(spec)
const referecneValue = value.unwrap() as ReferenceFieldValue
if (referecneValue.value?.length) {
const spec = new ReferenceEqual(value.unwrap() as ReferenceFieldValue, field.id)
specs.push(spec)
}
}

const spec = and(...specs) as Option<RecordComositeSpecification>
await this.repo.updateOneById(table, record, spec)
if (specs.length) {
const spec = and(...specs) as Option<RecordComositeSpecification>
await this.repo.updateOneById(table, record, spec)
}
}
}
}
29 changes: 19 additions & 10 deletions packages/template/src/templates/crm.base.json
Original file line number Diff line number Diff line change
@@ -54,11 +54,30 @@
"id": "company",
"type": "reference",
"option": {
"createSymmetricField": true,
"foreignTable": {
"tableName": "Companies"
}
}
},
"Company Name": {
"id": "companyName",
"type": "rollup",
"option": {
"referenceFieldId": "company",
"rollupFieldId": "name",
"fn": "lookup"
}
},
"Company Industry": {
"id": "companyIndustry",
"type": "rollup",
"option": {
"referenceFieldId": "company",
"rollupFieldId": "industry",
"fn": "lookup"
}
},
"Deals": {
"id": "deals",
"type": "reference",
@@ -1074,16 +1093,6 @@
"Website": {
"id": "website",
"type": "url"
},
"Contacts": {
"id": "contacts",
"type": "reference",
"option": {
"foreignTable": {
"tableName": "Contacts"
},
"createSymmetricField": true
}
}
},
"records": [

0 comments on commit b8fe6d7

Please sign in to comment.