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

ref: add home, order, orders, and account profile urls to shop object #5145

Merged
merged 22 commits into from
Apr 25, 2019

Conversation

kieckhafer
Copy link
Member

@kieckhafer kieckhafer commented Apr 24, 2019

Resolves #5144 (non-UI parts)
Impact: minor
Type: refactor

Issue

The API does not know what the storefront URLs are, so it can't use proper URLs when generating emails or redirecting after password resets, etc.

Solution

  • Add the following fields to Shop schema. They have been grouped in a storefrontUrls object on shop. They are all String type and optional with no default value:

    • storefrontHomeUrl
    • storefrontOrderUrl (can have :orderReferenceId and :orderToken in the string)
    • storefrontOrdersUrl (can have :accountId in the string)
    • storefrontAccountProfileUrl (can have :accountId in the string)
  • Add a new GraphQL mutation, updateShopUrls that allows admins to update these new fields.

Breaking changes

None

Testing

  1. Go to the admin panel's shop settings.
  2. Add urls for the various fields
  3. See the URL's have been added to the Shop object in the DB
  4. Change the values
  5. See the values have been changed
  6. Only pass 1 or 2 of the Urls, and see only those update
query {
  primaryShop {
    _id
    storefrontUrls {
      storefrontHomeUrl
      storefrontOrderUrl
      storefrontOrdersUrl
      storefrontAccountProfileUrl
    }
  }
}
mutation {
  updateShopUrls(
    input: {
    	shopId: "SHOP-ID-GOES-HERE",
        storefrontUrls: {
          storefrontHomeUrl: "storefrontHomeUrl updateTest",
          storefrontOrderUrl: " storefrontOrderUrl updateTest",
          storefrontOrdersUrl: "storefrontOrdersUrl updateTest",
          storefrontAccountProfileUrl: null
       }
     }
  ) {
    clientMutationId
    shop {
      _id
      storefrontUrls {
        storefrontHomeUrl
        storefrontOrderUrl
        storefrontOrdersUrl
        storefrontAccountProfileUrl
      }
    }
  }
}

Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
@kieckhafer kieckhafer changed the base branch from master to develop April 24, 2019 16:55
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
@kieckhafer kieckhafer marked this pull request as ready for review April 24, 2019 23:47
@kieckhafer
Copy link
Member Author

kieckhafer commented Apr 24, 2019

@aldeed @mikemurray this is the non-UI work for #5144. Will do UI next, but separately, so that all the blocked tickets mentioned in #5144 can be moved on.

@aldeed also working on separating the four URL's so that they can be independently updated in a GQL query, we can squeeze that in here, or add that in the UI PR.

Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
aldeed
aldeed previously requested changes Apr 25, 2019
Copy link
Contributor

@aldeed aldeed left a comment

Choose a reason for hiding this comment

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

A few minor things

Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
Signed-off-by: Erik Kieckhafer <ek@ato.la>
@kieckhafer kieckhafer requested a review from aldeed April 25, 2019 16:59
@kieckhafer
Copy link
Member Author

@aldeed Ready for another look.

Made fixes based on your comments. also added code so now you can update each URL independently: 7b880ae

Signed-off-by: Erik Kieckhafer <ek@ato.la>
@kieckhafer kieckhafer dismissed aldeed’s stale review April 25, 2019 21:42

fixed issues, ready for another look

@kieckhafer kieckhafer removed the request for review from mikemurray April 25, 2019 21:42
Copy link
Contributor

@machikoyasuda machikoyasuda left a comment

Choose a reason for hiding this comment

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

1 small JSDoc change and otherwise good!!!

Signed-off-by: Erik Kieckhafer <ek@ato.la>
@kieckhafer kieckhafer dismissed machikoyasuda’s stale review April 25, 2019 23:18

Updated with jsdoc changes

@machikoyasuda machikoyasuda self-requested a review April 25, 2019 23:18
@kieckhafer
Copy link
Member Author

@machikoyasuda updated with changes, ready for another look

@machikoyasuda machikoyasuda changed the title ref: add home, order, orders, and account profule urls to shop object ref: add home, order, orders, and account profile urls to shop object Apr 25, 2019
Signed-off-by: Erik Kieckhafer <ek@ato.la>
@machikoyasuda machikoyasuda merged commit c11020d into develop Apr 25, 2019
@machikoyasuda machikoyasuda deleted the feat-kieckhafer-addStorefrontUrlsToShopSettings branch April 25, 2019 23:45
@jeffcorpuz jeffcorpuz mentioned this pull request Jul 2, 2019
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.

3 participants