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

feat(api): add user endpoints #137

Merged
merged 10 commits into from
Nov 28, 2023
Merged

feat(api): add user endpoints #137

merged 10 commits into from
Nov 28, 2023

Conversation

nganphan123
Copy link
Contributor

@nganphan123 nganphan123 commented Nov 20, 2023

Welcome to PrivacyPal! 👋

Fixes: #85
Depends on #129

Description of the change:

Add user data endpoints for fetch and update data from postgres

GET /api/users?id=1
Response:
{
    "result": {
        "data": [
            {
                "id": 1,
                "username": "jane",
                "email": "jdoe@gmail.com",
                "firstname": "jane",
                "lastname": "doe"
            }
        ]
    }
}
GET /api/users
Response:
{
    "result": {
        "data": [
            {
                "id": 1,
                "username": "jane",
                "email": "jdoe@gmail.com",
                "firstname": "jane",
                "lastname": "doe"
            },
            {
                "id": 2,
                "username": "john",
                "email": "jhdoe@gmail.com",
                "firstname": "john",
                "lastname": "doe"
            }
        ]
    }
}
PUT /api/users?id=1
Request:
{
    "firstname": "john",
    "username": "john",
    "email": "jhdoe@gmail.com",
    "lastname": "doe"
}
Response:
{
    "id": 2,
    "username": "john",
    "email": "jhdoe@gmail.com",
    "firstname": "john",
    "lastname": "doe"
}

How to test

  1. Run postgres and add some mock data
  2. Disable middleware redirect
  3. Test each endpoint with Postman or other softwares
  4. Test if the apis handle error cases

@nganphan123 nganphan123 self-assigned this Nov 20, 2023
@nganphan123 nganphan123 added feat New feature or request area/back-end Back-end work labels Nov 20, 2023
@github-actions github-actions bot added the dependent Depending on other work label Nov 20, 2023
@tthvo tthvo added the need-documentation Product documentation required label Nov 21, 2023
@tthvo tthvo added this to the Term 1 Week 12 milestone Nov 24, 2023
@github-actions github-actions bot removed the dependent Depending on other work label Nov 25, 2023
Copy link

This PR/issue depends on:

Copy link
Contributor

@MyStackOverflows MyStackOverflows left a comment

Choose a reason for hiding this comment

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

this all looks good to me, wondering why it's still 'blocked' by #129? i thought #129 was merged

@tthvo
Copy link
Contributor

tthvo commented Nov 27, 2023

this all looks good to me, wondering why it's still 'blocked' by #129? i thought #129 was merged

This PR needs rebasing before the block can be removed. @nganphan123 rebase pls.

@tthvo tthvo merged commit 5672c77 into develop Nov 28, 2023
8 checks passed
@tthvo tthvo deleted the gh-85-add-user-api branch November 28, 2023 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/back-end Back-end work feat New feature or request need-documentation Product documentation required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants