Skip to content

Commit

Permalink
Add RelatedHermesDocument model attributes (#371)
Browse files Browse the repository at this point in the history
* Fix and expand RelatedHermesDocument type

* Update list-item-test.ts

* Revert out-of-scope changes

* Add more attributes to RelatedHermesDocument

* Add new attrs to Go API

* Revert out-of-scope change

* go fmt

---------

Co-authored-by: Josh Freda <[email protected]>
  • Loading branch information
jeffdaley and jfreda authored Oct 20, 2023
1 parent 34dafd3 commit 48f146b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
18 changes: 13 additions & 5 deletions internal/api/documents_related_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ type externalLinkRelatedResourceGetResponse struct {
}

type hermesDocumentRelatedResourceGetResponse struct {
GoogleFileID string `json:"googleFileID"`
Title string `json:"title"`
DocumentType string `json:"documentType"`
DocumentNumber string `json:"documentNumber"`
SortOrder int `json:"sortOrder"`
GoogleFileID string `json:"googleFileID"`
Title string `json:"title"`
DocumentType string `json:"documentType"`
DocumentNumber string `json:"documentNumber"`
SortOrder int `json:"sortOrder"`
Status string `json:"status"`
Owners []string `json:"owners"`
OwnerPhotos []string `json:"ownerPhotos"`
Product string `json:"product"`
}

func documentsResourceRelatedResourcesHandler(
Expand Down Expand Up @@ -153,6 +157,10 @@ func documentsResourceRelatedResourcesHandler(
DocumentType: doc.DocType,
DocumentNumber: doc.DocNumber,
SortOrder: hdrr.RelatedResource.SortOrder,
Status: doc.Status,
Owners: doc.Owners,
OwnerPhotos: doc.OwnerPhotos,
Product: doc.Product,
})
}

Expand Down
4 changes: 4 additions & 0 deletions web/app/components/related-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export interface RelatedHermesDocument {
documentType: string;
documentNumber: string;
sortOrder: number;
status: string;
owners?: string[];
ownerPhotos?: string[];
product?: string;
}

export enum RelatedResourcesScope {
Expand Down
3 changes: 3 additions & 0 deletions web/app/components/related-resources/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ export default class RelatedResourcesAddComponent extends Component<RelatedResou
title: attrs.title,
documentType: attrs.docType,
documentNumber: attrs.docNumber,
owners: attrs.owners,
ownerPhotos: attrs.ownerPhotos,
product: attrs.product,
sortOrder: 1,
} as RelatedHermesDocument;

Expand Down
4 changes: 4 additions & 0 deletions web/mirage/factories/related-hermes-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ export default Factory.extend({
documentNumber() {
return `LAB-00${this.id}`;
},
status: "In review",
product: "Labs",
owners: ["[email protected]"],
ownerPhotos: ["https://placehold.co/100x100"],
});

0 comments on commit 48f146b

Please sign in to comment.