Skip to content

Feature/team1/Issue71/completeAzureUsersUserIdFunction #89

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

Conversation

theKunte
Copy link
Contributor

@theKunte theKunte commented Jan 29, 2021

Resolves Task/BUG :#71

To Test API function users/{userId}

Test this function on Azure:

image

This code completes the implementation of the Azure function for the previous PR #49 that is already merged into the dev branch

  • The following methods got implemented and Updated: GET/POST/PUT/PATCH/DELETE

  • Once this PR gets approved the function will be deployed automatically into the development branch

  • To test this feature locally make sure to have the following:

    • Azure function extension for VSCode
    • Pull the branch to your machine and make sure to be on the correct branch
    • Install the ODBC driver so you can connect to the database: For any issues with the ODBC driver checkout PR49 for additional documentation to fix ODBC driver
      -In local.settings.json at the root of the functions folder, enter in the values for the keys below in the following format: { "Values": { "KEY": "VALUE" } }
      ENV_DATABASE_NAME (name of the database)
      ENV_DATABASE_PASSWORD
      ENV_DATABASE_SERVER (this is the server location)
      ENV_DATABASE_USERNAME
  • You can click F5 or click run->Start Debugging in the functions folder to start it up

  • The GET request takes the userId and returns all a specific user by their Id.

  • The POST request is not allowed for this call.

  • The PUT request takes a JSON object { "firstName": "add your firstname", "lastName": "add your last name", "email": "[email protected]" } and will update the user firstName, lastName, email when you select a specific userId.

  • The DELETE request takes the userId and deletes the user from the database.
    -To test using JSON, copy the link provided by the debugger (the "/users/{userId}" ) into Postman, and use as usual for GET and PUT (info goes into the body), DELETE (userId). PUT and PATCH are not allowed

  • Error handling and Debug handling included in this feature

DATE ACTIVITY TIME
1/21 Review PR49 after class to get an idea of what I need to update 1 hr
1/23 More research of pyodbc Crud functionality 1.5 hr
1/24 encounter issue with running function locally 3 hr
1/24 Still figuring out what was going on with the issue 1 hr
1/24 Started working on functionality 1 hr
1/25 Setup all rest methods (get, post, put, delete) to work as expected 2 hr
1/26 Added error handling to post requests and added storage account to function app on azure 2 hr
1/28 Setup all rest methods (get, post, put, delete, patch) to work as expected 1 hr
1/28 wrote this PR which I will have to update again 1 hr
1/31 deployed all function to azure test work fine updated PR 1 hr

@theKunte theKunte added bug Something isn't working task New task, feature or request team1 Issues for Practicum Team 1 labels Jan 29, 2021
@theKunte theKunte added this to the Sprint 02 milestone Jan 29, 2021
@theKunte theKunte self-assigned this Jan 29, 2021
@theKunte theKunte added Work-in-Progress Pull Request not ready for review and removed Work-in-Progress Pull Request not ready for review labels Jan 29, 2021
Copy link
Contributor

@lbrown51 lbrown51 left a comment

Choose a reason for hiding this comment

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

A general comment is that we probably don't want any of the react code in this PR. Maybe you just need to update from upstream/development?

Copy link
Contributor

@jak-ashuraliev jak-ashuraliev left a comment

Choose a reason for hiding this comment

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

Since I cannot actually run the functions on my local machine, I can only make comments. Overall, good logging implementation!

@@ -23,30 +32,48 @@ def main(req: func.HttpRequest) -> func.HttpResponse:
id = req.route_params.get('userId')
if not id:
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure if this is necessary, because if there is no id, it basically triggers "/users" endpoint. if you test it without id you'll notice it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup! You are right. I removed this part since it is not necessary

Copy link
Contributor

@farhadbahrehmandhenry farhadbahrehmandhenry left a comment

Choose a reason for hiding this comment

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

I just noticed merging you branch will cause deleting the react app from NSC repo, we need to update you branch with NSC first.

@farhadbahrehmandhenry
Copy link
Contributor

tested, all the functionalities are working, good to merge.

@theKunte theKunte merged commit 1cd746c into North-Seattle-College:development Jan 30, 2021
@theKunte theKunte changed the title Feature/team1 issue71 complete azure users user id function Feature/team1/Issue71/completeAzureUsersUserIdFunction Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working task New task, feature or request team1 Issues for Practicum Team 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Complete the rest of CRUD functionality of API Users/{userId}
5 participants