Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RelatedHermesDocument model attributes #371

Merged
merged 9 commits into from
Oct 20, 2023
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"],
});