From a8f8e0f4d7c9c09c684aae4df5bda08616a761f6 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 2 Oct 2024 10:49:43 -0700 Subject: [PATCH 01/26] Change parentCojo rel from many-to-one to one-to-many --- specifyweb/specify/datamodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 68f6fea9cc9..ab19ef59781 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojos', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True), + Relationship(name='parentCojos', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), From d424cf8467de29f8bb8b7478125a5f07acbf7800 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:01:13 -0700 Subject: [PATCH 02/26] Change relationship in types.ts --- specifyweb/frontend/js_src/lib/components/DataModel/types.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 01deed86547..3eb1c3c17af 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -6497,7 +6497,9 @@ export type CollectionObjectGroup = { readonly yesno2: boolean | null; readonly yesno3: boolean | null; }; - readonly toOneDependent: RR; + readonly toOneDependent: { + readonly parentcojos: RA; + }; readonly toOneIndependent: { readonly cogtype: CollectionObjectGroupType; readonly collection: Collection | null; @@ -6506,7 +6508,6 @@ export type CollectionObjectGroup = { }; readonly toManyDependent: { readonly cojo: RA; - readonly parentcojos: RA; }; readonly toManyIndependent: RR; }; From a9df40f2aade42853dec38a7e536f403320e18f5 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:26:06 -0700 Subject: [PATCH 03/26] Singularise parentcojo --- specifyweb/frontend/js_src/lib/components/DataModel/types.ts | 2 +- specifyweb/specify/datamodel.py | 4 ++-- specifyweb/specify/migrations/0002_geo.py | 2 +- specifyweb/specify/models.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 3eb1c3c17af..5a79e523a8f 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -6498,7 +6498,7 @@ export type CollectionObjectGroup = { readonly yesno3: boolean | null; }; readonly toOneDependent: { - readonly parentcojos: RA; + readonly parentcojo: CollectionObjectGroupJoin | null; }; readonly toOneIndependent: { readonly cogtype: CollectionObjectGroupType; diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index ab19ef59781..d6c5fd43cfb 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojos', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), @@ -8328,7 +8328,7 @@ ], relationships=[ - Relationship(name='parentCog', type='many-to-one', required=True, relatedModelName='CollectionObjectGroup', column='ParentCOGID', otherSideName='parentcojos'), + Relationship(name='parentCog', type='many-to-one', required=True, relatedModelName='CollectionObjectGroup', column='ParentCOGID', otherSideName='parentcojo'), Relationship(name='childCog', type='one-to-one', required=False, relatedModelName='CollectionObjectGroup', column='ChildCOGID', otherSideName='cojo'), Relationship(name='childCo', type='one-to-one', required=False, relatedModelName='CollectionObject', column='ChildCOID', otherSideName='cojo'), ], diff --git a/specifyweb/specify/migrations/0002_geo.py b/specifyweb/specify/migrations/0002_geo.py index e44b6383be0..62694775646 100644 --- a/specifyweb/specify/migrations/0002_geo.py +++ b/specifyweb/specify/migrations/0002_geo.py @@ -290,7 +290,7 @@ def revert_cosolidated_python_django_migration_operations(apps, schema_editor): ('yesno1', models.BooleanField(blank=True, db_column='YesNo1', null=True)), ('yesno2', models.BooleanField(blank=True, db_column='YesNo2', null=True)), ('yesno3', models.BooleanField(blank=True, db_column='YesNo3', null=True)), - ('parentcog', models.ForeignKey(db_column='ParentCOGID', null=False, on_delete=django.db.models.deletion.CASCADE, related_name='parentcojos', to='specify.collectionobjectgroup')), + ('parentcog', models.ForeignKey(db_column='ParentCOGID', null=False, on_delete=django.db.models.deletion.CASCADE, related_name='parentcojo', to='specify.collectionobjectgroup')), ('childcog', models.OneToOneField(db_column='ChildCOGID', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cojo', to='specify.collectionobjectgroup')), ('childco', models.OneToOneField(db_column='ChildCOID', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cojo', to='specify.collectionobject')), ], diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index be904e1df91..3a6405bda3a 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -7600,7 +7600,7 @@ class Collectionobjectgroupjoin(models.Model): # aka. CoJo or CogJoin yesno3 = models.BooleanField(blank=True, null=True, unique=False, db_column='YesNo3', db_index=False) # Relationships: Many-to-One - parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='parentcojos', null=False, on_delete=models.CASCADE) + parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='parentcojo', null=False, on_delete=models.CASCADE) # Relationships: One-to-One childcog = models.OneToOneField('CollectionObjectGroup', db_column='ChildCOGID', related_name='cojo', null=True, on_delete=models.CASCADE) From a7abe24cd40faafcfabd778419fe0b2d3d664908 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:37:44 -0700 Subject: [PATCH 04/26] Revert --- specifyweb/specify/datamodel.py | 2 +- specifyweb/specify/migrations/0002_geo.py | 2 +- specifyweb/specify/models.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index d6c5fd43cfb..217c85ab934 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8328,7 +8328,7 @@ ], relationships=[ - Relationship(name='parentCog', type='many-to-one', required=True, relatedModelName='CollectionObjectGroup', column='ParentCOGID', otherSideName='parentcojo'), + Relationship(name='parentCog', type='many-to-one', required=True, relatedModelName='CollectionObjectGroup', column='ParentCOGID', otherSideName='parentcojos'), Relationship(name='childCog', type='one-to-one', required=False, relatedModelName='CollectionObjectGroup', column='ChildCOGID', otherSideName='cojo'), Relationship(name='childCo', type='one-to-one', required=False, relatedModelName='CollectionObject', column='ChildCOID', otherSideName='cojo'), ], diff --git a/specifyweb/specify/migrations/0002_geo.py b/specifyweb/specify/migrations/0002_geo.py index 62694775646..e44b6383be0 100644 --- a/specifyweb/specify/migrations/0002_geo.py +++ b/specifyweb/specify/migrations/0002_geo.py @@ -290,7 +290,7 @@ def revert_cosolidated_python_django_migration_operations(apps, schema_editor): ('yesno1', models.BooleanField(blank=True, db_column='YesNo1', null=True)), ('yesno2', models.BooleanField(blank=True, db_column='YesNo2', null=True)), ('yesno3', models.BooleanField(blank=True, db_column='YesNo3', null=True)), - ('parentcog', models.ForeignKey(db_column='ParentCOGID', null=False, on_delete=django.db.models.deletion.CASCADE, related_name='parentcojo', to='specify.collectionobjectgroup')), + ('parentcog', models.ForeignKey(db_column='ParentCOGID', null=False, on_delete=django.db.models.deletion.CASCADE, related_name='parentcojos', to='specify.collectionobjectgroup')), ('childcog', models.OneToOneField(db_column='ChildCOGID', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cojo', to='specify.collectionobjectgroup')), ('childco', models.OneToOneField(db_column='ChildCOID', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='cojo', to='specify.collectionobject')), ], diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index 3a6405bda3a..be904e1df91 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -7600,7 +7600,7 @@ class Collectionobjectgroupjoin(models.Model): # aka. CoJo or CogJoin yesno3 = models.BooleanField(blank=True, null=True, unique=False, db_column='YesNo3', db_index=False) # Relationships: Many-to-One - parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='parentcojo', null=False, on_delete=models.CASCADE) + parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='parentcojos', null=False, on_delete=models.CASCADE) # Relationships: One-to-One childcog = models.OneToOneField('CollectionObjectGroup', db_column='ChildCOGID', related_name='cojo', null=True, on_delete=models.CASCADE) From cb1d3247d4ca6c717ebbf1631208b7008a3a2b8b Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:48:25 -0700 Subject: [PATCH 05/26] i. --- specifyweb/specify/datamodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 217c85ab934..0c80afabf5a 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True, column='collectionobjectgroupjoinid'), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), From 1125e2f2769a2deaaebf32795d9edd8fb2774c15 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:48:59 -0700 Subject: [PATCH 06/26] Add id --- specifyweb/specify/datamodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 0c80afabf5a..ef4fc08185c 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True, column='collectionobjectgroupjoinid'), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True, column='CollectionObjectGroupJoinID'), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), From 313b3d7d6c9c58d37c525fd0ecaff7e40416f078 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 08:32:20 -0700 Subject: [PATCH 07/26] Update relationships for parentcojo --- specifyweb/frontend/js_src/lib/components/DataModel/types.ts | 4 +++- specifyweb/specify/datamodel.py | 3 ++- specifyweb/specify/models.py | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 5a79e523a8f..74680bf268f 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -6537,7 +6537,9 @@ export type CollectionObjectGroupJoin = { readonly parentcog: CollectionObjectGroup; }; readonly toManyDependent: RR; - readonly toManyIndependent: RR; + readonly toManyIndependent: { + readonly collectionObjectGroups: RA; + }; }; export type CollectionObjectGroupType = { readonly tableName: 'CollectionObjectGroupType'; diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index ef4fc08185c..5fe6b68d0ae 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True, column='CollectionObjectGroupJoinID'), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), @@ -8331,6 +8331,7 @@ Relationship(name='parentCog', type='many-to-one', required=True, relatedModelName='CollectionObjectGroup', column='ParentCOGID', otherSideName='parentcojos'), Relationship(name='childCog', type='one-to-one', required=False, relatedModelName='CollectionObjectGroup', column='ChildCOGID', otherSideName='cojo'), Relationship(name='childCo', type='one-to-one', required=False, relatedModelName='CollectionObject', column='ChildCOID', otherSideName='cojo'), + Relationship(name='collectionobjectgroups', type='one-to-many',required=False, relatedModelName='CollectionObjectGroup', otherSideName='parentCojo'), ], fieldAliases=[ diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index be904e1df91..89a5e65a796 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -7569,6 +7569,7 @@ class Collectionobjectgroup(models.Model): # aka. Cog cogtype = models.ForeignKey('CollectionObjectGroupType', db_column='COGTypeID', related_name='collectionobjectgroups', null=False, on_delete=protect_with_blockers) createdbyagent = models.ForeignKey('Agent', db_column='CreatedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) modifiedbyagent = models.ForeignKey('Agent', db_column='ModifiedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) + parentcojo = models.ForeignKey('parentCojo', db_column='ParentCojoID', related_name='collectionobjectgroups', null=True, on_delete=protect_with_blockers) class Meta: db_table = 'collectionobjectgroup' @@ -7600,7 +7601,7 @@ class Collectionobjectgroupjoin(models.Model): # aka. CoJo or CogJoin yesno3 = models.BooleanField(blank=True, null=True, unique=False, db_column='YesNo3', db_index=False) # Relationships: Many-to-One - parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='parentcojos', null=False, on_delete=models.CASCADE) + # parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='parentcojos', null=False, on_delete=models.CASCADE) # Relationships: One-to-One childcog = models.OneToOneField('CollectionObjectGroup', db_column='ChildCOGID', related_name='cojo', null=True, on_delete=models.CASCADE) From 273322efac16cd10c6d1278d4f5c826f5d519fff Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 08:54:28 -0700 Subject: [PATCH 08/26] Add column --- specifyweb/specify/datamodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 5fe6b68d0ae..ccc2eb6c26f 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='parentCog', dependent=True), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='ParentCojoID', otherSideName='parentCog', dependent=True), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), From f119c4901306978eb2b27e95fdbe245c28085fcf Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:19:09 -0700 Subject: [PATCH 09/26] new id column --- specifyweb/specify/datamodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index ccc2eb6c26f..95a9ab0c74f 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='ParentCojoID', otherSideName='parentCog', dependent=True), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='parentCog', dependent=True), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), From d570e09fa3472a7f615c6326ab3b83c11e8a99bf Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:14:54 -0700 Subject: [PATCH 10/26] test --- .../frontend/js_src/lib/components/DataModel/types.ts | 10 ++++------ specifyweb/specify/datamodel.py | 4 ++-- specifyweb/specify/models.py | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index 74680bf268f..f08c0238871 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -6497,10 +6497,9 @@ export type CollectionObjectGroup = { readonly yesno2: boolean | null; readonly yesno3: boolean | null; }; - readonly toOneDependent: { - readonly parentcojo: CollectionObjectGroupJoin | null; - }; + readonly toOneDependent: {}; readonly toOneIndependent: { + readonly parentcojo: CollectionObjectGroupJoin | null; readonly cogtype: CollectionObjectGroupType; readonly collection: Collection | null; readonly createdByAgent: Agent | null; @@ -6535,11 +6534,10 @@ export type CollectionObjectGroupJoin = { readonly childco: CollectionObject | null; readonly childcog: CollectionObjectGroup | null; readonly parentcog: CollectionObjectGroup; + readonly collectionObjectGroup: CollectionObjectGroup; }; readonly toManyDependent: RR; - readonly toManyIndependent: { - readonly collectionObjectGroups: RA; - }; + readonly toManyIndependent: {}; }; export type CollectionObjectGroupType = { readonly tableName: 'CollectionObjectGroupType'; diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 95a9ab0c74f..0383c6ae862 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='parentCog', dependent=True), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='collectionobjectgroup', dependent=True), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), @@ -8331,7 +8331,7 @@ Relationship(name='parentCog', type='many-to-one', required=True, relatedModelName='CollectionObjectGroup', column='ParentCOGID', otherSideName='parentcojos'), Relationship(name='childCog', type='one-to-one', required=False, relatedModelName='CollectionObjectGroup', column='ChildCOGID', otherSideName='cojo'), Relationship(name='childCo', type='one-to-one', required=False, relatedModelName='CollectionObject', column='ChildCOID', otherSideName='cojo'), - Relationship(name='collectionobjectgroups', type='one-to-many',required=False, relatedModelName='CollectionObjectGroup', otherSideName='parentCojo'), + Relationship(name='collectionobjectgroup', type='one-to-many',required=False, relatedModelName='CollectionObjectGroup', otherSideName='parentCojo'), ], fieldAliases=[ diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index 89a5e65a796..9bb3f1b2c08 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -7601,7 +7601,7 @@ class Collectionobjectgroupjoin(models.Model): # aka. CoJo or CogJoin yesno3 = models.BooleanField(blank=True, null=True, unique=False, db_column='YesNo3', db_index=False) # Relationships: Many-to-One - # parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='parentcojos', null=False, on_delete=models.CASCADE) + parentcog = models.ForeignKey('CollectionObjectGroup', db_column='ParentCOGID', related_name='parentcojos', null=False, on_delete=models.CASCADE) # Relationships: One-to-One childcog = models.OneToOneField('CollectionObjectGroup', db_column='ChildCOGID', related_name='cojo', null=True, on_delete=models.CASCADE) From 5ae298db2d48dbe41e1372a62015cb03cde9ab0a Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:19:41 -0700 Subject: [PATCH 11/26] Chnage table name --- specifyweb/specify/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index 9bb3f1b2c08..dd20aee56f1 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -7569,7 +7569,7 @@ class Collectionobjectgroup(models.Model): # aka. Cog cogtype = models.ForeignKey('CollectionObjectGroupType', db_column='COGTypeID', related_name='collectionobjectgroups', null=False, on_delete=protect_with_blockers) createdbyagent = models.ForeignKey('Agent', db_column='CreatedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) modifiedbyagent = models.ForeignKey('Agent', db_column='ModifiedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) - parentcojo = models.ForeignKey('parentCojo', db_column='ParentCojoID', related_name='collectionobjectgroups', null=True, on_delete=protect_with_blockers) + parentcojo = models.ForeignKey('CollectionObjectGroupJoin', db_column='ParentCojoID', related_name='collectionobjectgroups', null=True, on_delete=protect_with_blockers) class Meta: db_table = 'collectionobjectgroup' From 8c389338fb436df54e179fa24ab86b913e954b0b Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:32:31 -0700 Subject: [PATCH 12/26] Add types --- .env | 22 +++++++++---------- .../js_src/lib/components/DataModel/types.ts | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.env b/.env index 9805c57c8fc..89390fa1fd7 100644 --- a/.env +++ b/.env @@ -1,16 +1,16 @@ DATABASE_HOST=mariadb DATABASE_PORT=3306 -MYSQL_ROOT_PASSWORD=password -DATABASE_NAME=specify - -# When running Specify 7 for the first time or during updates that -# require migrations, ensure that the MASTER_NAME and MASTER_PASSWORD -# are set to the root username and password. This will ensure proper -# execution of Django migrations during the initial setup. -# After launching Specify and verifying the update is complete, you can +MYSQL_ROOT_PASSWORD=root +DATABASE_NAME=ciscollections_2_15_24 + +# When running Specify 7 for the first time or during updates that +# require migrations, ensure that the MASTER_NAME and MASTER_PASSWORD +# are set to the root username and password. This will ensure proper +# execution of Django migrations during the ixnitial setup. +# After launching Specify and verifying the update is complete, you can # safely replace these credentials with the master SQL user name and password. MASTER_NAME=root -MASTER_PASSWORD=password +MASTER_PASSWORD=root # Make sure to set the `SECRET_KEY` to a unique value SECRET_KEY=change_this_to_some_unique_random_string @@ -36,7 +36,7 @@ CELERY_RESULT_BACKEND=redis://redis/1 LOG_LEVEL=WARNING # Set this variable to `true` to run Specify 7 in debug mode. This -# should only be used during development and troubleshooting and not -# during general use. Django applications leak memory when operated +# should only be used during development and troubleshooting and not +# during general use. Django applications leak memory when operated # continuously in debug mode. SP7_DEBUG=true diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index f08c0238871..cdc939e583a 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -6497,7 +6497,7 @@ export type CollectionObjectGroup = { readonly yesno2: boolean | null; readonly yesno3: boolean | null; }; - readonly toOneDependent: {}; + readonly toOneDependent: RR; readonly toOneIndependent: { readonly parentcojo: CollectionObjectGroupJoin | null; readonly cogtype: CollectionObjectGroupType; @@ -6537,7 +6537,7 @@ export type CollectionObjectGroupJoin = { readonly collectionObjectGroup: CollectionObjectGroup; }; readonly toManyDependent: RR; - readonly toManyIndependent: {}; + readonly toManyIndependent: RR; }; export type CollectionObjectGroupType = { readonly tableName: 'CollectionObjectGroupType'; From 918114f60dc50ddabe4ecc67e6ab22cf60fb4eef Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:33:56 -0700 Subject: [PATCH 13/26] env --- .env | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 89390fa1fd7..65425c8632c 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ DATABASE_HOST=mariadb DATABASE_PORT=3306 -MYSQL_ROOT_PASSWORD=root -DATABASE_NAME=ciscollections_2_15_24 +MYSQL_ROOT_PASSWORD=password +DATABASE_NAME=specify # When running Specify 7 for the first time or during updates that # require migrations, ensure that the MASTER_NAME and MASTER_PASSWORD @@ -10,7 +10,7 @@ DATABASE_NAME=ciscollections_2_15_24 # After launching Specify and verifying the update is complete, you can # safely replace these credentials with the master SQL user name and password. MASTER_NAME=root -MASTER_PASSWORD=root +MASTER_PASSWORD=password # Make sure to set the `SECRET_KEY` to a unique value SECRET_KEY=change_this_to_some_unique_random_string From e1bb5f098c872d496135c9cc9b067c574d6844bd Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:59:17 -0700 Subject: [PATCH 14/26] chnage db column --- specifyweb/specify/datamodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 0383c6ae862..d47e8a41d02 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='collectionobjectgroup', dependent=True), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='ParentCojoID', otherSideName='collectionobjectgroup', dependent=True), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), From f97713805887c5e28c5204fec96ab9b41a074862 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:18:09 -0700 Subject: [PATCH 15/26] Test --- specifyweb/specify/datamodel.py | 2 +- specifyweb/specify/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index d47e8a41d02..0383c6ae862 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='ParentCojoID', otherSideName='collectionobjectgroup', dependent=True), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='collectionobjectgroup', dependent=True), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index dd20aee56f1..52a39dda0ac 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -7569,7 +7569,7 @@ class Collectionobjectgroup(models.Model): # aka. Cog cogtype = models.ForeignKey('CollectionObjectGroupType', db_column='COGTypeID', related_name='collectionobjectgroups', null=False, on_delete=protect_with_blockers) createdbyagent = models.ForeignKey('Agent', db_column='CreatedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) modifiedbyagent = models.ForeignKey('Agent', db_column='ModifiedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) - parentcojo = models.ForeignKey('CollectionObjectGroupJoin', db_column='ParentCojoID', related_name='collectionobjectgroups', null=True, on_delete=protect_with_blockers) + parentcojo = models.ForeignKey('CollectionObjectGroupJoin', db_column='CollectionObjectGroupJoinID', related_name='collectionobjectgroups', null=True, on_delete=protect_with_blockers) class Meta: db_table = 'collectionobjectgroup' From 2911639fd42a141cfde437a936066b3b8d066af5 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:28:15 -0700 Subject: [PATCH 16/26] Remove s --- specifyweb/specify/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/models.py b/specifyweb/specify/models.py index 52a39dda0ac..a9df684c58b 100644 --- a/specifyweb/specify/models.py +++ b/specifyweb/specify/models.py @@ -7569,7 +7569,7 @@ class Collectionobjectgroup(models.Model): # aka. Cog cogtype = models.ForeignKey('CollectionObjectGroupType', db_column='COGTypeID', related_name='collectionobjectgroups', null=False, on_delete=protect_with_blockers) createdbyagent = models.ForeignKey('Agent', db_column='CreatedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) modifiedbyagent = models.ForeignKey('Agent', db_column='ModifiedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers) - parentcojo = models.ForeignKey('CollectionObjectGroupJoin', db_column='CollectionObjectGroupJoinID', related_name='collectionobjectgroups', null=True, on_delete=protect_with_blockers) + parentcojo = models.ForeignKey('CollectionObjectGroupJoin', db_column='CollectionObjectGroupJoinID', related_name='collectionobjectgroup', null=True, on_delete=protect_with_blockers) class Meta: db_table = 'collectionobjectgroup' From c57d4077d8fa57543d1a371eb401f2c421e62db4 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:40:57 -0700 Subject: [PATCH 17/26] add column --- specifyweb/specify/datamodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 0383c6ae862..3b46c4fc7f4 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8290,7 +8290,7 @@ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='collectionobjectgroup', dependent=True), - Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), + Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True, column='CollectionObjectGroupJoinID'), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), ], From d2d79db1c6f9bbb592373effb3fae306a4037e6e Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:04:48 -0700 Subject: [PATCH 18/26] T --- specifyweb/specify/datamodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 3b46c4fc7f4..0383c6ae862 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8290,7 +8290,7 @@ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='collectionobjectgroup', dependent=True), - Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True, column='CollectionObjectGroupJoinID'), + Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), ], From 75d0412f92feaa9b9e92bc1c108d0e6db713f5e0 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:18:42 -0700 Subject: [PATCH 19/26] Migration --- .../0004_collectionobjectgroup_parentcojo.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 specifyweb/specify/migrations/0004_collectionobjectgroup_parentcojo.py diff --git a/specifyweb/specify/migrations/0004_collectionobjectgroup_parentcojo.py b/specifyweb/specify/migrations/0004_collectionobjectgroup_parentcojo.py new file mode 100644 index 00000000000..7206f55c5c8 --- /dev/null +++ b/specifyweb/specify/migrations/0004_collectionobjectgroup_parentcojo.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.15 on 2024-10-07 19:18 + +from django.db import migrations, models +import specifyweb.specify.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('specify', '0003_cotype_picklist'), + ] + + operations = [ + migrations.AddField( + model_name='collectionobjectgroup', + name='parentcojo', + field=models.ForeignKey(db_column='CollectionObjectGroupJoinID', null=True, on_delete=specifyweb.specify.models.protect_with_blockers, related_name='collectionobjectgroup', to='specify.collectionobjectgroupjoin'), + ), + ] From 63655facd7c06dd9891d9d0b76295416e044c014 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:10:19 -0700 Subject: [PATCH 20/26] Remove dependent --- specifyweb/specify/datamodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/specify/datamodel.py b/specifyweb/specify/datamodel.py index 0383c6ae862..4c60175417f 100644 --- a/specifyweb/specify/datamodel.py +++ b/specifyweb/specify/datamodel.py @@ -8289,7 +8289,7 @@ relationships=[ Relationship(name='collection', type='many-to-one', required=False, relatedModelName='Collection', column='CollectionID'), Relationship(name='cogType', type='many-to-one', required=True, relatedModelName='CollectionObjectGroupType', column='COGTypeID'), - Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='collectionobjectgroup', dependent=True), + Relationship(name='parentCojo', type='many-to-one', required=False, relatedModelName='CollectionObjectGroupJoin',column='CollectionObjectGroupJoinID', otherSideName='collectionobjectgroup'), Relationship(name='cojo', type='one-to-many', required=False, relatedModelName='CollectionObjectGroupJoin', otherSideName='childCog', dependent=True), Relationship(name='createdByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='CreatedByAgentID'), Relationship(name='modifiedByAgent', type='many-to-one', required=False, relatedModelName='Agent', column='ModifiedByAgentID'), From f1e932f178a1f0b873bafb5c515c5f3081bf7875 Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:17:03 -0700 Subject: [PATCH 21/26] Run rgenerateschema --- .../js_src/lib/components/DataModel/types.ts | 205 +++++++++--------- 1 file changed, 102 insertions(+), 103 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts index cdc939e583a..3fce17fbbe6 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/types.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/types.ts @@ -3,8 +3,8 @@ * Afterward, some manual edits have been made. Those are marked with * "NOTE:" comments * - * Schema version: 2.11 - * Date generated: July 17, 2024 + * Schema version: 2.12 + * Date generated: October 07, 2024 * * The dataModel types were generated using the following code snippet. * After schema changes, it needs to be regenerated like this: @@ -233,20 +233,20 @@ export type Tables = { export type Accession = { readonly tableName: 'Accession'; readonly fields: { - readonly accessionNumber: string; readonly accessionCondition: string | null; - readonly dateAccessioned: string | null; + readonly accessionNumber: string; readonly actualTotalCountAmt: number | null; readonly collectionObjectCount: number | null; + readonly dateAccessioned: string | null; readonly dateAcknowledged: string | null; - readonly remarks: string | null; + readonly dateReceived: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; readonly number1: number | null; readonly number2: number | null; readonly preparationCount: number | null; - readonly dateReceived: string | null; + readonly remarks: string | null; readonly status: string | null; readonly text1: string | null; readonly text2: string | null; @@ -452,10 +452,10 @@ export type Agent = { readonly initials: string | null; readonly integer1: number | null; readonly integer2: number | null; + readonly interests: string | null; readonly jobTitle: string | null; readonly lastName: string | null; readonly middleInitial: string | null; - readonly interests: string | null; readonly remarks: string | null; readonly suffix: string | null; readonly text1: string | null; @@ -488,8 +488,8 @@ export type Agent = { readonly agentAttachments: RA; readonly agentGeographies: RA; readonly agentSpecialties: RA; - readonly identifiers: RA; readonly groups: RA; + readonly identifiers: RA; readonly variants: RA; }; readonly toManyIndependent: { @@ -920,13 +920,13 @@ export type BorrowMaterial = { readonly tableName: 'BorrowMaterial'; readonly fields: { readonly collectionMemberId: number; + readonly description: string | null; readonly inComments: string | null; readonly materialNumber: string; readonly outComments: string | null; readonly quantity: number | null; readonly quantityResolved: number | null; readonly quantityReturned: number | null; - readonly description: string | null; readonly text1: string | null; readonly text2: string | null; readonly timestampCreated: string; @@ -973,12 +973,12 @@ export type CollectingEvent = { readonly endDatePrecision: number | null; readonly endDateVerbatim: string | null; readonly endTime: number | null; - readonly stationFieldNumber: string | null; - readonly method: string | null; readonly guid: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly remarks: string | null; + readonly method: string | null; + readonly stationFieldNumber: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; readonly reservedText1: string | null; @@ -1070,10 +1070,6 @@ export type CollectingEventAttr = { export type CollectingEventAttribute = { readonly tableName: 'CollectingEventAttribute'; readonly fields: { - readonly text8: string | null; - readonly text5: string | null; - readonly text4: string | null; - readonly text9: string | null; readonly integer1: number | null; readonly integer10: number | null; readonly integer2: number | null; @@ -1084,11 +1080,11 @@ export type CollectingEventAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; - readonly number12: number | null; - readonly number13: number | null; readonly number1: number | null; readonly number10: number | null; readonly number11: number | null; + readonly number12: number | null; + readonly number13: number | null; readonly number2: number | null; readonly number3: number | null; readonly number4: number | null; @@ -1098,22 +1094,26 @@ export type CollectingEventAttribute = { readonly number8: number | null; readonly number9: number | null; readonly remarks: string | null; - readonly text6: string | null; readonly text1: string | null; readonly text10: string | null; readonly text11: string | null; + readonly text12: string | null; readonly text13: string | null; readonly text14: string | null; readonly text15: string | null; readonly text16: string | null; readonly text17: string | null; readonly text2: string | null; + readonly text3: string | null; + readonly text4: string | null; + readonly text5: string | null; + readonly text6: string | null; readonly text7: string | null; + readonly text8: string | null; + readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text12: string | null; readonly version: number | null; - readonly text3: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -1154,7 +1154,6 @@ export type CollectingTrip = { readonly tableName: 'CollectingTrip'; readonly fields: { readonly cruise: string | null; - readonly text2: string | null; readonly date1: string | null; readonly date1Precision: number | null; readonly date2: string | null; @@ -1172,6 +1171,8 @@ export type CollectingTrip = { readonly startDatePrecision: number | null; readonly startDateVerbatim: string | null; readonly startTime: number | null; + readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -1183,7 +1184,6 @@ export type CollectingTrip = { readonly timestampModified: string | null; readonly collectingTripName: string | null; readonly version: number | null; - readonly text1: string | null; readonly vessel: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; @@ -1359,49 +1359,50 @@ export type Collection = { export type CollectionObject = { readonly tableName: 'CollectionObject'; readonly fields: { + readonly modifier: string | null; + readonly catalogedDate: string | null; + readonly projectNumber: string | null; readonly actualTotalCountAmt: number | null; readonly availability: string | null; - readonly catalogNumber: string | null; - readonly catalogedDate: string | null; readonly catalogedDatePrecision: number | null; readonly catalogedDateVerbatim: string | null; readonly collectionMemberId: number; readonly countAmt: number | null; - readonly reservedText: string | null; - readonly timestampModified: string | null; readonly date1: string | null; readonly date1Precision: number | null; readonly deaccessioned: boolean | null; + readonly timestampModified: string | null; readonly embargoReason: string | null; readonly embargoReleaseDate: string | null; readonly embargoReleaseDatePrecision: number | null; readonly embargoStartDate: string | null; readonly embargoStartDatePrecision: number | null; + readonly yesNo2: boolean | null; + readonly fieldNumber: string | null; readonly guid: string | null; + readonly text2: string | null; readonly integer1: number | null; readonly integer2: number | null; - readonly text2: string | null; readonly inventoryDate: string | null; readonly inventoryDatePrecision: number | null; - readonly modifier: string | null; - readonly name: string | null; + readonly description: string | null; readonly notifications: string | null; readonly numberOfDuplicates: number | null; - readonly number1: number | null; - readonly number2: number | null; readonly objectCondition: string | null; readonly ocr: string | null; + readonly name: string | null; readonly altCatalogNumber: string | null; - readonly projectNumber: string | null; + readonly text1: string | null; + readonly yesNo1: boolean | null; readonly remarks: string | null; readonly reservedInteger3: number | null; readonly reservedInteger4: number | null; + readonly reservedText: string | null; readonly reservedText2: string | null; readonly reservedText3: string | null; readonly restrictions: string | null; readonly sgrStatus: number | null; - readonly text1: string | null; - readonly description: string | null; + readonly catalogNumber: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -1412,11 +1413,10 @@ export type CollectionObject = { readonly totalCountAmt: number | null; readonly totalValue: number | null; readonly uniqueIdentifier: string | null; + readonly number1: number | null; readonly version: number | null; readonly visibility: number | null; - readonly fieldNumber: string | null; - readonly yesNo1: boolean | null; - readonly yesNo2: boolean | null; + readonly number2: number | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; readonly yesNo5: boolean | null; @@ -1429,16 +1429,16 @@ export type CollectionObject = { readonly accession: Accession | null; readonly agent1: Agent | null; readonly appraisal: Appraisal | null; - readonly cataloger: Agent | null; + readonly collectingEvent: CollectingEvent | null; readonly collection: Collection; readonly collectionObjectType: CollectionObjectType; readonly container: Container | null; readonly containerOwner: Container | null; readonly createdByAgent: Agent | null; readonly currentDetermination: Determination | null; + readonly cataloger: Agent | null; readonly modifiedByAgent: Agent | null; readonly embargoAuthority: Agent | null; - readonly collectingEvent: CollectingEvent | null; readonly fieldNotebookPage: FieldNotebookPage | null; readonly inventorizedBy: Agent | null; readonly paleoContext: PaleoContext | null; @@ -1505,12 +1505,23 @@ export type CollectionObjectAttr = { export type CollectionObjectAttribute = { readonly tableName: 'CollectionObjectAttribute'; readonly fields: { + readonly number1: number | null; + readonly text4: string | null; readonly bottomDistance: number | null; readonly collectionMemberId: number; + readonly text11: string | null; + readonly text12: string | null; + readonly text10: string | null; + readonly text2: string | null; + readonly number37: number | null; readonly date1: string | null; readonly date1Precision: number | null; + readonly remarks: string | null; + readonly text15: string | null; readonly direction: string | null; readonly distanceUnits: string | null; + readonly text6: string | null; + readonly number2: number | null; readonly integer1: number | null; readonly integer10: number | null; readonly integer2: number | null; @@ -1521,18 +1532,18 @@ export type CollectionObjectAttribute = { readonly integer7: number | null; readonly integer8: number | null; readonly integer9: number | null; - readonly number12: number | null; - readonly number13: number | null; - readonly number1: number | null; + readonly number38: number | null; + readonly text7: string | null; readonly number10: number | null; readonly number11: number | null; + readonly number12: number | null; + readonly number13: number | null; readonly number14: number | null; readonly number15: number | null; readonly number16: number | null; readonly number17: number | null; readonly number18: number | null; readonly number19: number | null; - readonly number2: number | null; readonly number20: number | null; readonly number21: number | null; readonly number22: number | null; @@ -1551,27 +1562,20 @@ export type CollectionObjectAttribute = { readonly number34: number | null; readonly number35: number | null; readonly number36: number | null; - readonly number37: number | null; - readonly number38: number | null; readonly number39: number | null; readonly number4: number | null; readonly number40: number | null; - readonly number41: number | null; readonly number42: number | null; readonly number5: number | null; readonly number6: number | null; readonly number7: number | null; readonly number8: number | null; readonly number9: number | null; + readonly positionState: string | null; + readonly text3: string | null; + readonly text5: string | null; readonly text13: string | null; readonly text14: string | null; - readonly text1: string | null; - readonly positionState: string | null; - readonly text10: string | null; - readonly remarks: string | null; - readonly text8: string | null; - readonly text11: string | null; - readonly text15: string | null; readonly text16: string | null; readonly text17: string | null; readonly text18: string | null; @@ -1586,7 +1590,6 @@ export type CollectionObjectAttribute = { readonly text27: string | null; readonly text28: string | null; readonly text29: string | null; - readonly text3: string | null; readonly text30: string | null; readonly text31: string | null; readonly text32: string | null; @@ -1597,18 +1600,15 @@ export type CollectionObjectAttribute = { readonly text37: string | null; readonly text38: string | null; readonly text39: string | null; - readonly text4: string | null; readonly text40: string | null; - readonly text5: string | null; - readonly text6: string | null; - readonly text7: string | null; readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text12: string | null; readonly topDistance: number | null; + readonly text1: string | null; readonly version: number | null; - readonly text2: string | null; + readonly text8: string | null; + readonly number41: number | null; readonly yesNo1: boolean | null; readonly yesNo10: boolean | null; readonly yesNo11: boolean | null; @@ -2182,9 +2182,7 @@ export type DNASequence = { readonly compT: number | null; readonly extractionDate: string | null; readonly extractionDatePrecision: number | null; - readonly text2: string | null; readonly genbankAccessionNumber: string | null; - readonly text1: string | null; readonly geneSequence: string | null; readonly moleculeType: string | null; readonly number1: number | null; @@ -2194,6 +2192,8 @@ export type DNASequence = { readonly sequenceDate: string | null; readonly sequenceDatePrecision: number | null; readonly targetMarker: string | null; + readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; @@ -2286,8 +2286,8 @@ export type DNASequencingRun = { readonly runByAgent: Agent | null; }; readonly toManyDependent: { - readonly citations: RA; readonly attachments: RA; + readonly citations: RA; }; readonly toManyIndependent: RR; }; @@ -2356,11 +2356,10 @@ export type DataType = { export type Deaccession = { readonly tableName: 'Deaccession'; readonly fields: { - readonly timestampModified: string | null; readonly date1: string | null; readonly date2: string | null; - readonly deaccessionNumber: string; readonly deaccessionDate: string | null; + readonly deaccessionNumber: string; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -2379,6 +2378,7 @@ export type Deaccession = { readonly text4: string | null; readonly text5: string | null; readonly timestampCreated: string; + readonly timestampModified: string | null; readonly totalItems: number | null; readonly totalPreps: number | null; readonly type: string | null; @@ -2447,15 +2447,14 @@ export type Determination = { readonly tableName: 'Determination'; readonly fields: { readonly addendum: string | null; + readonly text1: string | null; readonly alternateName: string | null; readonly collectionMemberId: number; readonly confidence: string | null; readonly isCurrent: boolean; readonly determinedDate: string | null; readonly determinedDatePrecision: number | null; - readonly featureOrBasis: string | null; readonly guid: string | null; - readonly yesNo1: boolean | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -2471,8 +2470,6 @@ export type Determination = { readonly qualifier: string | null; readonly remarks: string | null; readonly subSpQualifier: string | null; - readonly text1: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -2481,9 +2478,12 @@ export type Determination = { readonly text8: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; + readonly text2: string | null; readonly typeStatusName: string | null; readonly varQualifier: string | null; + readonly featureOrBasis: string | null; readonly version: number | null; + readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; readonly yesNo4: boolean | null; @@ -2495,8 +2495,8 @@ export type Determination = { readonly createdByAgent: Agent | null; readonly determiner: Agent | null; readonly modifiedByAgent: Agent | null; - readonly preferredTaxon: Taxon | null; readonly taxon: Taxon | null; + readonly preferredTaxon: Taxon | null; }; readonly toManyDependent: { readonly determinationCitations: RA; @@ -3334,8 +3334,8 @@ export type Gift = { readonly srcTaxonomy: string | null; readonly specialConditions: string | null; readonly status: string | null; - readonly text2: string | null; readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3704,7 +3704,6 @@ export type Loan = { readonly dateClosed: string | null; readonly dateReceived: string | null; readonly yesNo1: boolean | null; - readonly text2: string | null; readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; @@ -3726,6 +3725,7 @@ export type Loan = { readonly specialConditions: string | null; readonly status: string | null; readonly text1: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3851,8 +3851,11 @@ export type LoanReturnPreparation = { export type Locality = { readonly tableName: 'Locality'; readonly fields: { + readonly text1: string | null; + readonly text2: string | null; readonly datum: string | null; readonly elevationAccuracy: number | null; + readonly elevationMethod: string | null; readonly gml: string | null; readonly guid: string | null; readonly latLongMethod: string | null; @@ -3877,8 +3880,6 @@ export type Locality = { readonly sgrStatus: number | null; readonly shortName: string | null; readonly srcLatLongUnit: number; - readonly text1: string | null; - readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -3890,7 +3891,6 @@ export type Locality = { readonly verbatimLongitude: string | null; readonly version: number | null; readonly visibility: number | null; - readonly elevationMethod: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; @@ -4384,10 +4384,12 @@ export type Preparation = { readonly sampleNumber: string | null; readonly status: string | null; readonly storageLocation: string | null; + readonly text1: string | null; readonly text10: string | null; readonly text11: string | null; readonly text12: string | null; readonly text13: string | null; + readonly text2: string | null; readonly text3: string | null; readonly text4: string | null; readonly text5: string | null; @@ -4397,10 +4399,8 @@ export type Preparation = { readonly text9: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; - readonly text1: string | null; - readonly yesNo1: boolean | null; readonly version: number | null; - readonly text2: string | null; + readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; readonly yesNo3: boolean | null; }; @@ -4777,10 +4777,7 @@ export type RecordSetItem = { export type ReferenceWork = { readonly tableName: 'ReferenceWork'; readonly fields: { - readonly text1: string | null; - readonly workDate: string | null; readonly doi: string | null; - readonly text2: string | null; readonly guid: string | null; readonly isPublished: boolean | null; readonly isbn: string | null; @@ -4791,6 +4788,8 @@ export type ReferenceWork = { readonly placeOfPublication: string | null; readonly publisher: string | null; readonly remarks: string | null; + readonly text1: string | null; + readonly text2: string | null; readonly timestampCreated: string; readonly timestampModified: string | null; readonly title: string; @@ -4799,6 +4798,7 @@ export type ReferenceWork = { readonly url: string | null; readonly version: number | null; readonly volume: string | null; + readonly workDate: string | null; readonly yesNo1: boolean | null; readonly yesNo2: boolean | null; }; @@ -4896,9 +4896,9 @@ export type RepositoryAgreementAttachment = { export type Shipment = { readonly tableName: 'Shipment'; readonly fields: { - readonly numberOfPackages: number | null; readonly insuredForAmount: string | null; readonly shipmentMethod: string | null; + readonly numberOfPackages: number | null; readonly number1: number | null; readonly number2: number | null; readonly remarks: string | null; @@ -5612,6 +5612,7 @@ export type Taxon = { readonly colStatus: string | null; readonly commonName: string | null; readonly cultivarName: string | null; + readonly environmentalProtectionStatus: string | null; readonly esaStatus: string | null; readonly fullName: string | null; readonly groupNumber: string | null; @@ -5635,7 +5636,6 @@ export type Taxon = { readonly number3: number | null; readonly number4: number | null; readonly number5: number | null; - readonly environmentalProtectionStatus: string | null; readonly rankId: number; readonly remarks: string | null; readonly source: string | null; @@ -6460,8 +6460,8 @@ export type CollectionObjectType = { readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; - readonly timestampcreated: string; - readonly timestampmodified: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly version: number | null; }; readonly toOneDependent: RR; @@ -6490,8 +6490,8 @@ export type CollectionObjectGroup = { readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; - readonly timestampcreated: string; - readonly timestampmodified: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly version: number | null; readonly yesno1: boolean | null; readonly yesno2: boolean | null; @@ -6499,15 +6499,13 @@ export type CollectionObjectGroup = { }; readonly toOneDependent: RR; readonly toOneIndependent: { - readonly parentcojo: CollectionObjectGroupJoin | null; - readonly cogtype: CollectionObjectGroupType; + readonly cogType: CollectionObjectGroupType; readonly collection: Collection | null; readonly createdByAgent: Agent | null; readonly modifiedByAgent: Agent | null; + readonly parentCojo: CollectionObjectGroupJoin | null; }; - readonly toManyDependent: { - readonly cojo: RA; - }; + readonly toManyDependent: { readonly cojo: RA }; readonly toManyIndependent: RR; }; export type CollectionObjectGroupJoin = { @@ -6516,14 +6514,14 @@ export type CollectionObjectGroupJoin = { readonly integer1: number | null; readonly integer2: number | null; readonly integer3: number | null; - readonly isprimary: boolean; - readonly issubstrate: boolean; + readonly isPrimary: boolean; + readonly isSubstrate: boolean; readonly precedence: number; readonly text1: string | null; readonly text2: string | null; readonly text3: string | null; - readonly timestampcreated: string; - readonly timestampmodified: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly version: number | null; readonly yesno1: boolean | null; readonly yesno2: boolean | null; @@ -6531,20 +6529,21 @@ export type CollectionObjectGroupJoin = { }; readonly toOneDependent: RR; readonly toOneIndependent: { - readonly childco: CollectionObject | null; - readonly childcog: CollectionObjectGroup | null; - readonly parentcog: CollectionObjectGroup; - readonly collectionObjectGroup: CollectionObjectGroup; + readonly childCo: CollectionObject | null; + readonly childCog: CollectionObjectGroup | null; + readonly parentCog: CollectionObjectGroup; }; readonly toManyDependent: RR; - readonly toManyIndependent: RR; + readonly toManyIndependent: { + readonly collectionobjectgroup: RA; + }; }; export type CollectionObjectGroupType = { readonly tableName: 'CollectionObjectGroupType'; readonly fields: { readonly name: string; - readonly timestampcreated: string; - readonly timestampmodified: string | null; + readonly timestampCreated: string; + readonly timestampModified: string | null; readonly type: string; readonly version: number | null; }; From efe03a7877f03b0354f6c396f3d311285923136d Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:21:44 -0700 Subject: [PATCH 22/26] Fix format parentCog --- specifyweb/frontend/js_src/lib/components/Forms/parentTables.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/Forms/parentTables.ts b/specifyweb/frontend/js_src/lib/components/Forms/parentTables.ts index 172b03af809..d7dc69bbd9d 100644 --- a/specifyweb/frontend/js_src/lib/components/Forms/parentTables.ts +++ b/specifyweb/frontend/js_src/lib/components/Forms/parentTables.ts @@ -71,7 +71,7 @@ const overrides: { CommonNameTx: 'taxon', BorrowReturnMaterial: 'borrowMaterial', CollectionObject: undefined, - CollectionObjectGroupJoin: 'parentcog', + CollectionObjectGroupJoin: 'parentCog', CollectionRelationship: undefined, Collector: 'collectingEvent', DNASequencingRun: 'dnaSequence', From 8744dc5ed2849ad307a6b1d1accebdf97b634d6b Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:43:53 -0700 Subject: [PATCH 23/26] Renma migration file --- ...p_parentcojo.py => 0005_collectionobjectgroup_parentcojo.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename specifyweb/specify/migrations/{0004_collectionobjectgroup_parentcojo.py => 0005_collectionobjectgroup_parentcojo.py} (92%) diff --git a/specifyweb/specify/migrations/0004_collectionobjectgroup_parentcojo.py b/specifyweb/specify/migrations/0005_collectionobjectgroup_parentcojo.py similarity index 92% rename from specifyweb/specify/migrations/0004_collectionobjectgroup_parentcojo.py rename to specifyweb/specify/migrations/0005_collectionobjectgroup_parentcojo.py index 7206f55c5c8..dc116f75a48 100644 --- a/specifyweb/specify/migrations/0004_collectionobjectgroup_parentcojo.py +++ b/specifyweb/specify/migrations/0005_collectionobjectgroup_parentcojo.py @@ -7,7 +7,7 @@ class Migration(migrations.Migration): dependencies = [ - ('specify', '0003_cotype_picklist'), + ('specify', '0004_stratigraphy_age'), ] operations = [ From 5a9fe94928adf697180547f52235ea0eb4040b37 Mon Sep 17 00:00:00 2001 From: melton-jason Date: Tue, 8 Oct 2024 14:42:17 -0500 Subject: [PATCH 24/26] Always respect options to collection fetch calls --- .../lib/components/DataModel/collectionApi.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/collectionApi.ts b/specifyweb/frontend/js_src/lib/components/DataModel/collectionApi.ts index df7270973ce..7effed034b9 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/collectionApi.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/collectionApi.ts @@ -27,14 +27,19 @@ function notSupported() { throw new Error('method is not supported'); } -async function fakeFetch() { +async function fakeFetch(rawOptions) { + const options = { + ...rawOptions, + }; + if (typeof options.success === 'function') + options.success.call(options.context, this, undefined, options); return this; } async function lazyFetch(options) { assert(this instanceof LazyCollection); if (this._fetch) return this._fetch; - if (this.related?.isNew()) return this; + if (this.related?.isNew()) return fakeFetch.call(this, options); this._neverFetched = false; @@ -119,7 +124,9 @@ export const DependentCollection = Base.extend({ getFetchOffset() { return 0; }, - fetch: fakeFetch, + async fetch(options) { + return fakeFetch.call(this, options); + }, sync: notSupported, create: notSupported, }); @@ -258,7 +265,7 @@ export const IndependentCollection = LazyCollection.extend({ }, async fetch(options) { // If the related is being fetched, don't try and fetch the collection - if (this.related._fetch !== null) return this; + if (this.related._fetch !== null) return fakeFetch.call(this, options); this.filters[this.field.name.toLowerCase()] = this.related.id; From d3821701a4c039df7edb57376603654bab9bb5af Mon Sep 17 00:00:00 2001 From: melton-jason Date: Tue, 8 Oct 2024 14:59:32 -0500 Subject: [PATCH 25/26] Write test for collection fetch options --- .../DataModel/__tests__/collectionApi.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/__tests__/collectionApi.test.ts b/specifyweb/frontend/js_src/lib/components/DataModel/__tests__/collectionApi.test.ts index 42735c60009..1c88f40f0a7 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/__tests__/collectionApi.test.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/__tests__/collectionApi.test.ts @@ -407,6 +407,24 @@ describe('Independent Collection', () => { expect(collection.removed).toStrictEqual(new Set()); }); + test('success options respected', async () => { + const accession = new tables.Accession.Resource(); + + expect(accession.isNew()).toBe(true); + + const collection = new tables.CollectionObject.IndependentCollection({ + related: accession, + field: tables.CollectionObject.strictGetRelationship('accession'), + }) as Collection; + + await collection.fetch({ + success: (collection) => { + collection.add(new tables.CollectionObject.Resource()); + }, + } as CollectionFetchFilters); + expect(collection.models).toHaveLength(1); + }); + overrideAjax('/api/specify/collectionobject/200/', { id: 200, resource_uri: getResourceApiUrl('CollectionObject', 200), From ad2a9d53fa1283b4e38fa308313a6ed1704fd757 Mon Sep 17 00:00:00 2001 From: melton-jason Date: Tue, 8 Oct 2024 15:05:40 -0500 Subject: [PATCH 26/26] Fix type error in test --- .../lib/components/DataModel/__tests__/collectionApi.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/__tests__/collectionApi.test.ts b/specifyweb/frontend/js_src/lib/components/DataModel/__tests__/collectionApi.test.ts index 1c88f40f0a7..3ea9b454cea 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/__tests__/collectionApi.test.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/__tests__/collectionApi.test.ts @@ -162,7 +162,8 @@ describe('Independent Collection', () => { ); await collection.fetch(); - expect(collection).toHaveLength(collection._totalCount); + // eslint-disable-next-line jest/prefer-to-have-length + expect(collection.length).toBe(collection._totalCount); }); test('specified offset', async () => {