From 689272d7e0fbc3ecb016513cc47fde6d26f306e5 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Mon, 12 Aug 2024 11:51:10 -0400 Subject: [PATCH] Collapse contributor fields into a single field (#11) --- README.md | 4 +++- cmd/sheetsStructs.go | 8 +------- go.mod | 3 +-- go.sum | 2 -- workbench/workbench.gen.go | 8 +------- 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 5dbeefe..3c77073 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ Drupal/Islandora go library Generate an Open API spec based on your Islandora data model ``` -./go-islandora generate node-structs \ +go-islandora generate node-structs \ --node-cex-yaml=path/to/drupal/config/sync/node.type.islandora_object.yml \ --output=api.yml + +go-islandora generate sheets-structs --output=workbench.yml ``` diff --git a/cmd/sheetsStructs.go b/cmd/sheetsStructs.go index 8efff1a..54ddedf 100644 --- a/cmd/sheetsStructs.go +++ b/cmd/sheetsStructs.go @@ -71,13 +71,7 @@ func sheetsFields() []CsvColumn { "Title": "title", "Full Title": "field_full_title", "Make Public (Y/N)": "published", - "Contributor Name 1": "field_linked_agent.name", - "Contributor Relator 1": "field_linked_agent.rel_type", - "Contributor Type 1": "field_linked_agent.vid", - "ORCID Number 1": "field_linked_agent.entity.field_identifier.attr0=orcid", - "Contributor Status 1": "field_linked_agent.entity.field_contributor_status", - "Contributor Email 1": "field_linked_agent.entity.field_email", - "Contributor Institution 1": "field_linked_agent.entity.field_relationships", + "Contributor": "field_linked_agent", "Related Department": "field_department_name", "Resource Type": "field_resource_type", "Genre (Getty AAT)": "field_genre", diff --git a/go.mod b/go.mod index 49d620f..ba943db 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.22.2 require ( github.com/gocarina/gocsv v0.0.0-20240520201108-78e41c74b4b1 github.com/oapi-codegen/oapi-codegen/v2 v2.3.0 + github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 - golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 gopkg.in/yaml.v2 v2.4.0 ) @@ -22,7 +22,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect golang.org/x/mod v0.18.0 // indirect golang.org/x/text v0.15.0 // indirect diff --git a/go.sum b/go.sum index 4622532..75f6c8f 100644 --- a/go.sum +++ b/go.sum @@ -42,8 +42,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= diff --git a/workbench/workbench.gen.go b/workbench/workbench.gen.go index 65e42c4..836c30c 100644 --- a/workbench/workbench.gen.go +++ b/workbench/workbench.gen.go @@ -23,12 +23,7 @@ type SheetsCsv struct { CaptureDevice *string `csv:"field_note.attr0=capture-device" json:"Capture Device,omitempty"` CatalogOrArchivesSpaceURL *string `csv:"field_identifier.attr0=uri" json:"Catalog or ArchivesSpace URL,omitempty"` ChildSortOrder *string `csv:"field_weight" json:"Child Sort Order,omitempty"` - ContributorEmail1 *string `csv:"field_linked_agent.entity.field_email" json:"Contributor Email 1,omitempty"` - ContributorInstitution1 *string `csv:"field_linked_agent.entity.field_relationships" json:"Contributor Institution 1,omitempty"` - ContributorName1 *string `csv:"field_linked_agent.name" json:"Contributor Name 1,omitempty"` - ContributorRelator1 *string `csv:"field_linked_agent.rel_type" json:"Contributor Relator 1,omitempty"` - ContributorStatus1 *string `csv:"field_linked_agent.entity.field_contributor_status" json:"Contributor Status 1,omitempty"` - ContributorType1 *string `csv:"field_linked_agent.vid" json:"Contributor Type 1,omitempty"` + Contributor *string `csv:"field_linked_agent" json:"Contributor,omitempty"` CreationDate *string `csv:"field_edtf_date_issued" json:"Creation Date,omitempty"` DOI *string `csv:"field_identifier.attr0=doi" json:"DOI,omitempty"` DateCaptured *string `csv:"field_edtf_date_captured" json:"Date Captured,omitempty"` @@ -50,7 +45,6 @@ type SheetsCsv struct { LocalRestriction *string `csv:"field_local_restriction" json:"Local Restriction,omitempty"` MakePublicYN *string `csv:"published" json:"Make Public (Y/N),omitempty"` NodeID *string `csv:"nid" json:"Node ID,omitempty"` - ORCIDNumber1 *string `csv:"field_linked_agent.entity.field_identifier.attr0=orcid" json:"ORCID Number 1,omitempty"` ObjectModel *string `csv:"field_model" json:"Object Model,omitempty"` PPI *string `csv:"field_note.attr0=ppi" json:"PPI,omitempty"` PageCount *string `csv:"field_extent.attr0=page" json:"Page Count,omitempty"`