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

New backend API #9

Merged
merged 12 commits into from
Apr 4, 2023
Merged

New backend API #9

merged 12 commits into from
Apr 4, 2023

Conversation

jdtech3
Copy link
Contributor

@jdtech3 jdtech3 commented Apr 3, 2023

Resolves #6 with new backend API of form:

 {
  "ff5892a7-b5c9-4a25-97bd-663b2cff5bd7": {
    "created-by": "khang nguyen",
    "parent-id": "b7985ca8-94f4-4a30-ae61-8af2126019bd",
    "last-edited": "2023-02-20T17:51:00.000Z",
    "qualifier": "SHALL",
    "collection": [
      "Volume Allocation & Placement"
    ],
    "verification-plan": [
      "TVAC Testing Plan"
    ],
    "system": "Tree Visualizer",
    "rationale": "To allow UTAT Space Systems members to graphically view the relationships between entries",
    "trades": [
      "Spacecraft Bus Stack Order Selection"
    ],
    "last-edited-by": "David",
    "stakeholder": [
      "Mechanical",
      "Power",
      "Thermal"
    ],
    "mission": "FINCH",
    "description": "ADCS shall consistently know FINCH’s location relative to the SUN and Earth Position",
    "title": "FINCH-ADCS-AttitudeDetermination",
    "url": "https://www.notion.so/FINCH-Power-Batteries-74331bc1129c417c850a0a5ca0deb759"
  },

[...]

}

Note: this is slightly different from description in #6 due to Requirements DB changes.

@jdtech3 jdtech3 requested review from DM1122 and stephanieyflu April 3, 2023 01:57
@jdtech3 jdtech3 self-assigned this Apr 3, 2023
@jdtech3 jdtech3 added the enhancement New feature or request label Apr 3, 2023
@jdtech3 jdtech3 added this to the MVP (Build V1) milestone Apr 3, 2023
@jdtech3 jdtech3 linked an issue Apr 3, 2023 that may be closed by this pull request
Copy link
Contributor

@DM1122 DM1122 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking solid, great work @jdtech3. I left a few comments about how we can align with the dependecy injection pattern more closely. The advantage of doing so being that it ensures your objects or functions which want to use a given service do not have to know how to construct those services.

Comment on lines 7 to 18
router.get('/', async function(req, res, next) {
let data = await notionService.getRequirementsData();
let data = await notionService.getRequirements('vis');
let nodes_json = JSON.stringify(data.nodes);
let edges_json = JSON.stringify(data.edges);
res.render('index', { title: 'TreeVisualizer' , nodes: nodes_json, edges: edges_json});
});

// GET : JSON API
router.get('/api/requirements', async function(req, res, next) {
let data = await notionService.getRequirementsData();
let data = await notionService.getRequirements('api');
res.json(data);
});
Copy link
Contributor

@DM1122 DM1122 Apr 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the use case for each of these two routes? Do we need both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not, no. Honestly it's probably not great practice, but the legacy demo functionality is serving as an easy sanity test to see whether data is being fetched from the Notion API correctly—JSON is hard to read, but if vis graph generates, data is probably fine.

Having said that, no real need, should I remove?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, your call to make, if its a quality of life feature we can keep both

jdtech3 and others added 3 commits April 4, 2023 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement new spec for frontend <~> backend API
2 participants