BOS-63: Changed/added/refactored frontend data classes#72
BOS-63: Changed/added/refactored frontend data classes#72robpatterson13 wants to merge 1 commit intomainfrom
Conversation
GauriRajesh733
left a comment
There was a problem hiding this comment.
looks really good!! just added comments on small changes we made to the backend entities after the client meeting that would be nice to have reflected in the frontend interfaces too!
| PERFECT_BOUND = 'PerfectBound', | ||
| SIGNATURE = 'Signature', | ||
| } | ||
|
|
There was a problem hiding this comment.
After the client meeting we made some changes to the anthology backend entity so that general book info and additional metadata such as production info are stored separately. For Anthology, the only fields needed are id, title, description, published_year, programs, status, pub_level, photo_url, isbn, and shopify_url. For the other production related information, I would create an additional interface called ProductionInfo that stores id, anthology_id, design_files_link, cover_image_file_link, binding_type, dimensions, printing_cost, print_run, weight_in_grams, page_count, and printed_by. You can see more details on the updated backend entities in our ticket notes for this week!
| @@ -0,0 +1,5 @@ | |||
| export interface InventoryLocation { | |||
There was a problem hiding this comment.
We now have an inventory-holding join table in the backend that has an id, inventory_id, anthology_id, and num_copies. However since we only have to display this info on the frontend it might be convenient to just store id, inventory_name, anthology_name, and num_copies in InventoryLocation.
| import { Author } from './author'; | ||
| import { Genre } from './genre'; | ||
| import { Theme } from './theme'; | ||
|
|
There was a problem hiding this comment.
After client meeting added an additional draft_status field (see checkbox columns in Document Tracker tab for stories in an anthology in OMCHAI Tracker). I will check with Josie about this but I think draft_status should be DraftStatus[] where DraftStatus is an enum that can be (Submission1, Submission2, Submission3, AuthorApproval, FileConsent, AuthorBio, InManuscript, CopyEdit1, CopyEdit2, PubTeamProofread, ContactInfo). This is definitely something I did not think of when we were writing this ticket initially so if you think there's a better way to keep track of these checks for a stories I'm open to ideas!!
| SIGNATURE = 'Signature', | ||
| } | ||
|
|
||
| export class Anthology { |
There was a problem hiding this comment.
I would change Anthology to an interface and make the methods free-standing getters since a publication will need be edited in the tracker view!
| export interface Story { | ||
| id: number; | ||
| title: string; | ||
| anthology_id: number; |
There was a problem hiding this comment.
author can be Author instead of Author[]
| id: number; | ||
| title: string; | ||
| anthology_id: number; | ||
| authors: Author[]; |
There was a problem hiding this comment.
genres and themes can both be changed to string[]!
ℹ️ Issue
Closes #63
📝 Description
Added
Genre,InventoryLocation,Theme,Author, andStoryinterfaces, addedLibraryclass, and refactoredAnthologyinterface to a) be a class, and b) pull author, genre, and theme information from fields instead of being hardcoded as part of theAnthologyclass.Additionally, refactored parts of the frontend logic to match the new structure of the objects and ensure that object data is loaded correctly (ex. authors show on publication card, genres/themes show as tags and info, etc.)
Finally, updated static anthologies to use new structures.
✔️ Verification
The static data can be found in
apps/frontend/src/utils/mock-data.ts.🏕️ Future Work / Notes
Some visual problems with the tags being displayed: for example, having a large number of tags for a certain anthology will cause them to run off screen. Additionally, inventory information (names and num_copies) are close together, causing name of inventory locations to wrap when they should be displayed in a single line.