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

[ENG-4681] Add mirage for v2 api #2051

Conversation

brianjgeiger
Copy link
Contributor

@brianjgeiger brianjgeiger commented Nov 13, 2023

Purpose

Make the v2 endpoints work with mirage. This includes a lot of normalization of the API but not the extra features such as extended attributes for providers nor getting the folder lists.

Summary of Changes

  1. Add mirage
  2. Adjust models

Screenshot(s)

Screenshot 2023-11-13 at 1 56 05 PM Screenshot 2023-11-13 at 1 55 22 PM Screenshot 2023-11-13 at 12 35 01 PM Screenshot 2023-11-13 at 11 33 02 AM Screenshot 2023-11-13 at 8 26 31 AM

.models;
const externalAccounts = userAddons.length ? userAddons[0].externalAccounts.models : null;
if (externalAccounts) {
externalAccounts.map((model: ModelInstance<ExternalAccountsModel>) => this.serialize(model).data);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this needs an additional filter on it to filter by provider. I was so happy I got it working that I forgot that step.

Copy link
Contributor

@futa-ikeda futa-ikeda left a comment

Choose a reason for hiding this comment

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

Just a couple "nice-to-have" things. Not sure if they will be relevant, so no need to implement them now if we want this merged soon

mirage/scenarios/dashboard.ts Show resolved Hide resolved
mirage/serializers/node-addon.ts Show resolved Hide resolved
mirage/serializers/user-addon.ts Show resolved Hide resolved
const nodeAddons = schema.nodes
.find(request.params.parentID)['nodeAddons']
.models
.filter((m: ModelInstance<NodeAddonModel>) => filter(m, request))
Copy link
Contributor

Choose a reason for hiding this comment

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

Forgot we have this filter util 👀

@brianjgeiger brianjgeiger merged commit f8b33f1 into CenterForOpenScience:feature/addon-services Nov 13, 2023
9 checks passed
@brianjgeiger brianjgeiger deleted the addons/v2-mirage branch November 13, 2023 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants