|
5 | 5 | CrossAppNodeSchema, |
6 | 6 | CrossAppRelationTypeSchema, |
7 | 7 | CrossAppRelationTripleSchema, |
| 8 | + CrossAppRelation, |
8 | 9 | } from "../crossAppContracts"; |
9 | 10 | import { LocalContentDataInput, LocalConceptDataInput } from "../inputTypes"; |
10 | 11 | import { Enums, CompositeTypes } from "../dbTypes"; |
@@ -155,3 +156,21 @@ export const crossAppRelationTripleSchemaToDbConcept = ({ |
155 | 156 | last_modified: node.modifiedAt?.toISOString(), |
156 | 157 | }); |
157 | 158 | }; |
| 159 | + |
| 160 | +export const crossAppRelationToDbConcept = ( |
| 161 | + node: CrossAppRelation, |
| 162 | +): LocalConceptDataInput => { |
| 163 | + return filterUndefined<LocalConceptDataInput>({ |
| 164 | + // use LocalIds... not ideal |
| 165 | + name: `${node.localId}: ${node.source} -${node.relationType}-> ${node.destination}`, |
| 166 | + source_local_id: node.localId, |
| 167 | + author_local_id: node.authorId, |
| 168 | + schema_represented_by_local_id: node.relationType, |
| 169 | + local_reference_content: { |
| 170 | + source: node.source, |
| 171 | + destination: node.destination, |
| 172 | + }, |
| 173 | + created: node.createdAt?.toISOString(), |
| 174 | + last_modified: node.modifiedAt?.toISOString(), |
| 175 | + }); |
| 176 | +}; |
0 commit comments