Skip to content

Commit

Permalink
Test setting parentCojo
Browse files Browse the repository at this point in the history
  • Loading branch information
CarolineDenis committed Oct 23, 2024
1 parent 9354ab6 commit 7faa4ff
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export function COJODialog({
}, [resourceTable]);

const handleCOJOCreation = (
selectedResource?: SpecifyResource<AnySchema>
selectedResource?:
| SpecifyResource<CollectionObject>
| SpecifyResource<CollectionObjectGroup>
): void => {
if (parentResource === undefined) return;

Expand All @@ -76,6 +78,13 @@ export function COJODialog({
newCOJO.set(field, resourceUrl as never);
newCOJO.set('parentCog', parentResourceUrl as never);

if (resourceToUse.specifyTable.name === 'CollectionObjectGroup') {
(resourceToUse as SpecifyResource<CollectionObjectGroup>).set(
'parentCojo',
newCOJO
);
}

collection?.add(newCOJO);
};

Expand Down

0 comments on commit 7faa4ff

Please sign in to comment.