Skip to content

Remove Hardcoded Data in Archive #86

@GauriRajesh733

Description

@GauriRajesh733

Why

Currently publication data is hardcoded in the Archive frontend pages (individual publication view, all publications view). This needs to be updated so the backend endpoints are called to get all the anthologies.

Acceptance Criteria

  • Create some seed data examples and scripts under backend/src/seed using 826 Notion Archive for Anthologies and Stories
  • Remove hard-coded mock data in all publications and individual publication views
  • Implement getAnthologies() and getStoriesByAnthology(anthology id) in apiClient.ts

Notes

See mock-data.ts to see examples of mock data that are currently being displayed in the archive.
See notes for #63 PR to see how frontend data classes have been modified to match backend entities.
See notes for #60 PR to see example of where mock data needs to be replaced, specifically for displaying publication authors.

What To Do

Anthology Seed Data

See format of index.ts, seed-stories.ts, and stories.seed.ts under backend/src/seeds.
Add a few anthology examples from 826 Notion Archive (we haven't figured out the best way to export this yet so 2-3 examples is okay for testing this ticket) to anthologies.seed.ts and any other seed files as needed. Create seed-anthologies.ts and then call this in index.ts. You will also need to create seed data for stories within the anthologies you created but again a few examples is good for this ticket! Run npx nx seed backend and check that the data was added in pgadmin.

All Publications View

In index.tsx, data is fetched from /api/anthologies (create getAnthologies method in apiClient.ts and use here instead of fetch) and if any error occurs the mock data is used.

Individual Publication View

In publication-view.tsx, similar to index.tsx, the mock data is displayed if any error occurs when calling the backend endpoint.
Here, getStoriesByAnthology also needs to be implemented (see #60 for details) in apiClient.ts so the authors across stories in 1 anthology can be displayed. So along with mock anthology data, mock stories data also needs to be replaced.



Note: there should be an error for apiClient.getStoriesByAnthology because it needs to be implemented. The if statement on line 248 can be removed once it is added.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions