Skip to content

melissacela/micro-fund-be-a

 
 

Repository files navigation

Microfund

Kate McGee Shanon Fritz Sam Kester Anthony Navarro

Introduction

Microfund API is built using Java Spring. It provides endpoints for the front-end client to read various data sets contained in the application's data.

Documentation Video

https://youtu.be/I_OjgwKNQdI

Database layout

Microfund is currently using this database layout.

Image of Microfund Database Layout

Notes provided to us in the initial project scaffold

  • The join table userroles is explicitly created. This allows us to add additional columns to the join table
  • Since we are creating the join table ourselves, the Many to Many relationship that formed the join table is now two Many to One relationships
  • All tables now have audit fields

Thus the new table layout is as follows

  • User is the driving table.
  • Users have a Many-To-Many relationship with Organizations.
  • Useremails have a Many-To-One relationship with User. Each User has many user email combinations. Each user email combination has only one User.
  • Roles have a Many-To-Many relationship with Users.

End Notes

This is the Database layout that was provided to us in the intial project scaffold

Image of Database Layout

Using the provided seed data, expand each endpoint below to see the output it generates.

Base API - https://microfund-b.herokuapp.com/users/all
[
    {
        "userid": 7,
        "username": "[email protected]",
        "address": null,
        "phone": null,
        "imageUrl": null,
        "description": null,
        "useremails": [],
        "roles": [
            {
                "role": {
                    "roleid": 1,
                    "name": "ADMIN"
                }
            }
        ],
        "organizations": [
            {
                "orgid": 4,
                "name": "Organization 1",
                "address": "456 greenville drive, longtucky, ark 80067",
                "phone": "567-890-2234",
                "applications": [
                    {
                        "appid": 9,
                        "name": "Org 1",
                        "address": "123 somewhere drive",
                        "phone": "923-567-8965",
                        "reason": "i want to help my community",
                        "status": "not reviewed",
                        "user": {
                            "userid": 8,
                            "username": "[email protected]",
                            "address": null,
                            "phone": null,
                            "imageUrl": null,
                            "description": null,
                            "useremails": [],
                            "roles": [
                                {
                                    "role": {
                                        "roleid": 2,
                                        "name": "USER"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        ],
        "applications": []
    }
]
https://microfund-b.herokuapp.com/users/user/8
{
    "userid": 8,
    "username": "[email protected]",
    "address": null,
    "phone": null,
    "imageUrl": null,
    "description": null,
    "useremails": [],
    "roles": [
        {
            "role": {
                "roleid": 2,
                "name": "USER"
            }
        }
    ],
    "organizations": [
        {
            "orgid": 5,
            "name": "Organization 2",
            "address": "4 takona lane, nashville, tn 12546",
            "phone": "333-222-1111",
            "applications": [
                {
                    "appid": 10,
                    "name": "Org 2",
                    "address": "124 rainbow lane",
                    "phone": "444-111-3333",
                    "reason": "i have a great idea i need help with",
                    "status": "not reviewed",
                    "user": {
                        "userid": 8,
                        "username": "[email protected]",
                        "address": null,
                        "phone": null,
                        "imageUrl": null,
                        "description": null,
                        "useremails": [],
                        "roles": [
                            {
                                "role": {
                                    "roleid": 2,
                                    "name": "USER"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "applications": [
        {
            "appid": 9,
            "name": "Org 1",
            "address": "123 somewhere drive",
            "phone": "923-567-8965",
            "reason": "i want to help my community",
            "status": "not reviewed",
            "organization": {
                "orgid": 4,
                "name": "Organization 1",
                "address": "456 greenville drive, longtucky, ark 80067",
                "phone": "567-890-2234"
            }
        },
        {
            "appid": 10,
            "name": "Org 2",
            "address": "124 rainbow lane",
            "phone": "444-111-3333",
            "reason": "i have a great idea i need help with",
            "status": "not reviewed",
            "organization": {
                "orgid": 5,
                "name": "Organization 2",
                "address": "4 takona lane, nashville, tn 12546",
                "phone": "333-222-1111"
            }
        }
    ]
}
https://microfund-b.herokuapp.com/users/user/name/[email protected]
{
    "userid": 8,
    "username": "[email protected]",
    "address": null,
    "phone": null,
    "imageUrl": null,
    "description": null,
    "useremails": [],
    "roles": [
        {
            "role": {
                "roleid": 2,
                "name": "USER"
            }
        }
    ],
    "organizations": [
        {
            "orgid": 5,
            "name": "Organization 2",
            "address": "4 takona lane, nashville, tn 12546",
            "phone": "333-222-1111",
            "applications": [
                {
                    "appid": 10,
                    "name": "Org 2",
                    "address": "124 rainbow lane",
                    "phone": "444-111-3333",
                    "reason": "i have a great idea i need help with",
                    "status": "not reviewed",
                    "user": {
                        "userid": 8,
                        "username": "[email protected]",
                        "address": null,
                        "phone": null,
                        "imageUrl": null,
                        "description": null,
                        "useremails": [],
                        "roles": [
                            {
                                "role": {
                                    "roleid": 2,
                                    "name": "USER"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "applications": [
        {
            "appid": 9,
            "name": "Org 1",
            "address": "123 somewhere drive",
            "phone": "923-567-8965",
            "reason": "i want to help my community",
            "status": "not reviewed",
            "organization": {
                "orgid": 4,
                "name": "Organization 1",
                "address": "456 greenville drive, longtucky, ark 80067",
                "phone": "567-890-2234"
            }
        },
        {
            "appid": 10,
            "name": "Org 2",
            "address": "124 rainbow lane",
            "phone": "444-111-3333",
            "reason": "i have a great idea i need help with",
            "status": "not reviewed",
            "organization": {
                "orgid": 5,
                "name": "Organization 2",
                "address": "4 takona lane, nashville, tn 12546",
                "phone": "333-222-1111"
            }
        }
    ]
}
https://microfund-b.herokuapp.com/users/user/name/like/cool
[
    {
        "userid": 8,
        "username": "[email protected]",
        "address": null,
        "phone": null,
        "imageUrl": null,
        "description": null,
        "useremails": [],
        "roles": [
            {
                "role": {
                    "roleid": 2,
                    "name": "USER"
                }
            }
        ],
        "organizations": [
            {
                "orgid": 5,
                "name": "Organization 2",
                "address": "4 takona lane, nashville, tn 12546",
                "phone": "333-222-1111",
                "applications": [
                    {
                        "appid": 10,
                        "name": "Org 2",
                        "address": "124 rainbow lane",
                        "phone": "444-111-3333",
                        "reason": "i have a great idea i need help with",
                        "status": "not reviewed",
                        "user": {
                            "userid": 8,
                            "username": "[email protected]",
                            "address": null,
                            "phone": null,
                            "imageUrl": null,
                            "description": null,
                            "useremails": [],
                            "roles": [
                                {
                                    "role": {
                                        "roleid": 2,
                                        "name": "USER"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        ],
        "applications": [
            {
                "appid": 9,
                "name": "Org 1",
                "address": "123 somewhere drive",
                "phone": "923-567-8965",
                "reason": "i want to help my community",
                "status": "not reviewed",
                "organization": {
                    "orgid": 4,
                    "name": "Organization 1",
                    "address": "456 greenville drive, longtucky, ark 80067",
                    "phone": "567-890-2234"
                }
            },
            {
                "appid": 10,
                "name": "Org 2",
                "address": "124 rainbow lane",
                "phone": "444-111-3333",
                "reason": "i have a great idea i need help with",
                "status": "not reviewed",
                "organization": {
                    "orgid": 5,
                    "name": "Organization 2",
                    "address": "4 takona lane, nashville, tn 12546",
                    "phone": "333-222-1111"
                }
            }
        ]
    },
    {
        "userid": 11,
        "username": "[email protected]",
        "address": null,
        "phone": null,
        "imageUrl": null,
        "description": null,
        "useremails": [],
        "roles": [
            {
                "role": {
                    "roleid": 3,
                    "name": "PARTNER"
                }
            }
        ],
        "organizations": [
            {
                "orgid": 6,
                "name": "Organization 3",
                "address": "678 snowyhille crossing, boulder, c0 80053",
                "phone": "888-999-1111",
                "applications": [
                    {
                        "appid": 12,
                        "name": "Org 3",
                        "address": "534 abbey road",
                        "phone": "000-345-9807",
                        "reason": "i would love to be a part of this",
                        "status": "not reviewed",
                        "user": {
                            "userid": 11,
                            "username": "[email protected]",
                            "address": null,
                            "phone": null,
                            "imageUrl": null,
                            "description": null,
                            "useremails": [],
                            "roles": [
                                {
                                    "role": {
                                        "roleid": 3,
                                        "name": "PARTNER"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        ],
        "applications": [
            {
                "appid": 12,
                "name": "Org 3",
                "address": "534 abbey road",
                "phone": "000-345-9807",
                "reason": "i would love to be a part of this",
                "status": "not reviewed",
                "organization": {
                    "orgid": 6,
                    "name": "Organization 3",
                    "address": "678 snowyhille crossing, boulder, c0 80053",
                    "phone": "888-999-1111"
                }
            }
        ]
    }
]
https://microfund-b.herokuapp.com/users/getuserinfo
{
    "userid": 8,
    "username": "[email protected]",
    "address": null,
    "phone": null,
    "imageUrl": null,
    "description": null,
    "useremails": [],
    "roles": [
        {
            "role": {
                "roleid": 2,
                "name": "USER"
            }
        }
    ],
    "organizations": [
        {
            "orgid": 5,
            "name": "Organization 2",
            "address": "4 takona lane, nashville, tn 12546",
            "phone": "333-222-1111",
            "applications": [
                {
                    "appid": 10,
                    "name": "Org 2",
                    "address": "124 rainbow lane",
                    "phone": "444-111-3333",
                    "reason": "i have a great idea i need help with",
                    "status": "not reviewed",
                    "user": {
                        "userid": 8,
                        "username": "[email protected]",
                        "address": null,
                        "phone": null,
                        "imageUrl": null,
                        "description": null,
                        "useremails": [],
                        "roles": [
                            {
                                "role": {
                                    "roleid": 2,
                                    "name": "USER"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "applications": [
        {
            "appid": 9,
            "name": "Org 1",
            "address": "123 somewhere drive",
            "phone": "923-567-8965",
            "reason": "i want to help my community",
            "status": "not reviewed",
            "organization": {
                "orgid": 4,
                "name": "Organization 1",
                "address": "456 greenville drive, longtucky, ark 80067",
                "phone": "567-890-2234"
            }
        },
        {
            "appid": 10,
            "name": "Org 2",
            "address": "124 rainbow lane",
            "phone": "444-111-3333",
            "reason": "i have a great idea i need help with",
            "status": "not reviewed",
            "organization": {
                "orgid": 5,
                "name": "Organization 2",
                "address": "4 takona lane, nashville, tn 12546",
                "phone": "333-222-1111"
            }
        }
    ]
}
https://microfund-b.herokuapp.com/users/user/8/apps
[
    {
        "appid": 9,
        "name": "Org 1",
        "address": "123 somewhere drive",
        "phone": "923-567-8965",
        "reason": "i want to help my community",
        "status": "not reviewed",
        "organization": {
            "orgid": 4,
            "name": "Organization 1",
            "address": "456 greenville drive, longtucky, ark 80067",
            "phone": "567-890-2234"
        },
        "user": {
            "userid": 8,
            "username": "[email protected]",
            "address": null,
            "phone": null,
            "imageUrl": null,
            "description": null,
            "useremails": [],
            "roles": [
                {
                    "role": {
                        "roleid": 2,
                        "name": "USER"
                    }
                }
            ]
        }
    },
    {
        "appid": 10,
        "name": "Org 2",
        "address": "124 rainbow lane",
        "phone": "444-111-3333",
        "reason": "i have a great idea i need help with",
        "status": "not reviewed",
        "organization": {
            "orgid": 5,
            "name": "Organization 2",
            "address": "4 takona lane, nashville, tn 12546",
            "phone": "333-222-1111"
        },
        "user": {
            "userid": 8,
            "username": "[email protected]",
            "address": null,
            "phone": null,
            "imageUrl": null,
            "description": null,
            "useremails": [],
            "roles": [
                {
                    "role": {
                        "roleid": 2,
                        "name": "USER"
                    }
                }
            ]
        }
    }
]
Currently, the way Okta is setup and implemented, it would not allow the creation of new users from the front-end.
POST https://microfund-b.herokuapp.com/users/user

DATA

{
    "username":"NEWUSER"
}

OUTPUT

Status CREATED
PUT https://microfund-b.herokuapp.com/users/user/8

DATA

{
    "userid": 8,
    "username": "[email protected]",
    "address": "123 Here We Are Drive, School, Texas 95678",
    "phone": null,
    "imageUrl": null,
    "description": null,
    "useremails": [],
    "roles": [
        {
            "role": {
                "roleid": 2,
                "name": "USER"
            }
        }
    ],
    "organizations": [
        {
            "orgid": 5,
            "name": "Organization 2",
            "address": "4 takona lane, nashville, tn 12546",
            "phone": "333-222-1111",
            "applications": [
                {
                    "appid": 10,
                    "name": "Org 2",
                    "address": "124 rainbow lane",
                    "phone": "444-111-3333",
                    "reason": "i have a great idea i need help with",
                    "status": "not reviewed",
                    "user": {
                        "userid": 8,
                        "username": "[email protected]",
                        "address": null,
                        "phone": null,
                        "imageUrl": null,
                        "description": null,
                        "useremails": [],
                        "roles": [
                            {
                                "role": {
                                    "roleid": 2,
                                    "name": "USER"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "applications": [
        {
            "appid": 9,
            "name": "Org 1",
            "address": "123 somewhere drive",
            "phone": "923-567-8965",
            "reason": "i want to help my community",
            "status": "not reviewed",
            "organization": {
                "orgid": 4,
                "name": "Organization 1",
                "address": "456 greenville drive, longtucky, ark 80067",
                "phone": "567-890-2234"
            }
        },
        {
            "appid": 10,
            "name": "Org 2",
            "address": "124 rainbow lane",
            "phone": "444-111-3333",
            "reason": "i have a great idea i need help with",
            "status": "not reviewed",
            "organization": {
                "orgid": 5,
                "name": "Organization 2",
                "address": "4 takona lane, nashville, tn 12546",
                "phone": "333-222-1111"
            }
        }
    ]
}

OUTPUT

Status OK
PATCH https://microfund-b.herokuapp.com/users/user/8

DATA

 {"phone": "333-200-1112"}

OUTPUT

Status OK
DELETE https://microfund-b.herokuapp.com/users/user/8
No Body Data

Status OK

https://microfund-b.herokuapp.com/apps/all
[
    {
        "appid": 9,
        "name": "Org 1",
        "address": "123 somewhere drive",
        "phone": "923-567-8965",
        "reason": "i want to help my community",
        "status": "not reviewed",
        "organization": {
            "orgid": 4,
            "name": "Organization 1",
            "address": "456 greenville drive, longtucky, ark 80067",
            "phone": "567-890-2234"
        },
        "user": {
            "userid": 8,
            "username": "[email protected]",
            "address": null,
            "phone": null,
            "imageUrl": null,
            "description": null,
            "useremails": [],
            "roles": [
                {
                    "role": {
                        "roleid": 2,
                        "name": "USER"
                    }
                }
            ]
        }
    },
    {
        "appid": 10,
        "name": "Org 2",
        "address": "124 rainbow lane",
        "phone": "444-111-3333",
        "reason": "i have a great idea i need help with",
        "status": "not reviewed",
        "organization": {
            "orgid": 5,
            "name": "Organization 2",
            "address": "4 takona lane, nashville, tn 12546",
            "phone": "333-222-1111"
        },
        "user": {
            "userid": 8,
            "username": "[email protected]",
            "address": null,
            "phone": null,
            "imageUrl": null,
            "description": null,
            "useremails": [],
            "roles": [
                {
                    "role": {
                        "roleid": 2,
                        "name": "USER"
                    }
                }
            ]
        }
    },
    {
        "appid": 12,
        "name": "Org 3",
        "address": "534 abbey road",
        "phone": "000-345-9807",
        "reason": "i would love to be a part of this",
        "status": "not reviewed",
        "organization": {
            "orgid": 6,
            "name": "Organization 3",
            "address": "678 snowyhille crossing, boulder, c0 80053",
            "phone": "888-999-1111"
        },
        "user": {
            "userid": 11,
            "username": "[email protected]",
            "address": null,
            "phone": null,
            "imageUrl": null,
            "description": null,
            "useremails": [],
            "roles": [
                {
                    "role": {
                        "roleid": 3,
                        "name": "PARTNER"
                    }
                }
            ]
        }
    }
]
https://microfund-b.herokuapp.com/apps/app/9
POST https://microfund-b.herokuapp.com/app/new

DATA

{
"name": "New Micro-entrepenuer",
"address": "543 Loveland Drive, Lindy, Texas 6789",
"phone": "777-444-2222",
"reason": "I've always wanted to start my own business",
"status": "new",
"organization": {
                "orgid": 5,
                "name": "Organization 2",
                "address": "4 takona lane, nashville, tn 12546",
                "phone": "333-222-1111"
                },
"user":{
           "userid": 8,
           "username": "[email protected]",
           "address": "123 Here We Are Drive, School, Texas 95678",
           "phone": null,
           "imageUrl": null,
           "description": null,
           "useremails": [],
           "roles": [
               {
                   "role": {
                       "roleid": 2,
                       "name": "USER"
                   }
               }
           ]
         }
}

OUTPUT

Status CREATED
PATCH https://microfund-b.herokuapp.com/apps/app/9/status

DATA

{"status": "approved"}

OUTPUT

Status OK
PATCH https://microfund-b.herokuapp.com/apps/app/9

DATA

{"phone": "444-000-2222"}

OUTPUT

Status OK

https://microfund-b.herokuapp.com/orgs/all
https://microfund-b.herokuapp.com/orgs/org/9/users
https://microfund-b.herokuapp.com/orgs/org/9
https://microfund-b.herokuapp.com/orgs/org/9/apps
POST https://microfund-b.herokuapp.com/orgs/org

DATA

OUTPUT

Status OK
PATCH https://microfund-b.herokuapp.com/orgs/org/9

DATA

OUTPUT

Status OK
DELETE https://microfund-b.herokuapp.com/orgs/org/8
No Body Data

Status OK

These endpoints were provided with the project scaffold. They have not been tested, altered or implemented in the front-end client at this time though the JSON input/output for each has changed/will need to change due to a change in the data models. Therefore, we are noting the endpoints but not the JSON object sent or returned because these will have changed/will need to change slightly. If you wish to implement any of these, we believe it would be fairly easy to do.
http://localhost:2019/roles/roles
[
    {
        "roleid": 1,
        "name": "ADMIN",
        "users": [
            {
                "user": {
                    "userid": 4,
                    "username": "admin",
                    "primaryemail": "[email protected]",
                    "useremails": [
                        {
                            "useremailid": 5,
                            "useremail": "[email protected]"
                        },
                        {
                            "useremailid": 6,
                            "useremail": "[email protected]"
                        }
                    ]
                }
            }
        ]
    },
    {
        "roleid": 2,
        "name": "USER",
        "users": [
            {
                "user": {
                    "userid": 14,
                    "username": "misskitty",
                    "primaryemail": "[email protected]",
                    "useremails": [
                        {
                            "useremailid": 15,
                            "useremail": "[email protected]"
                        }
                    ]
                }
            },
            {
                "user": {
                    "userid": 13,
                    "username": "puttat",
                    "primaryemail": "[email protected]",
                    "useremails": []
                }
            },
            {
                "user": {
                    "userid": 11,
                    "username": "barnbarn",
                    "primaryemail": "[email protected]",
                    "useremails": [
                        {
                            "useremailid": 12,
                            "useremail": "[email protected]"
                        }
                    ]
                }
            },
            {
                "user": {
                    "userid": 7,
                    "username": "cinnamon",
                    "primaryemail": "[email protected]",
                    "useremails": [
                        {
                            "useremailid": 9,
                            "useremail": "[email protected]"
                        },
                        {
                            "useremailid": 10,
                            "useremail": "[email protected]"
                        }
                    ]
                }
            },
            {
                "user": {
                    "userid": 4,
                    "username": "admin",
                    "primaryemail": "[email protected]",
                    "useremails": [
                        {
                            "useremailid": 5,
                            "useremail": "[email protected]"
                        },
                        {
                            "useremailid": 6,
                            "useremail": "[email protected]"
                        }
                    ]
                }
            }
        ]
    },
    {
        "roleid": 3,
        "name": "DATA",
        "users": [
            {
                "user": {
                    "userid": 4,
                    "username": "admin",
                    "primaryemail": "[email protected]",
                    "useremails": [
                        {
                            "useremailid": 5,
                            "useremail": "[email protected]"
                        },
                        {
                            "useremailid": 6,
                            "useremail": "[email protected]"
                        }
                    ]
                }
            },
            {
                "user": {
                    "userid": 7,
                    "username": "cinnamon",
                    "primaryemail": "[email protected]",
                    "useremails": [
                        {
                            "useremailid": 9,
                            "useremail": "[email protected]"
                        },
                        {
                            "useremailid": 10,
                            "useremail": "[email protected]"
                        }
                    ]
                }
            }
        ]
    }
]
http://localhost:2019/roles/role/3
{
    "roleid": 3,
    "name": "DATA",
    "users": [
        {
            "user": {
                "userid": 4,
                "username": "admin",
                "primaryemail": "[email protected]",
                "useremails": [
                    {
                        "useremailid": 5,
                        "useremail": "[email protected]"
                    },
                    {
                        "useremailid": 6,
                        "useremail": "[email protected]"
                    }
                ]
            }
        },
        {
            "user": {
                "userid": 7,
                "username": "cinnamon",
                "primaryemail": "[email protected]",
                "useremails": [
                    {
                        "useremailid": 9,
                        "useremail": "[email protected]"
                    },
                    {
                        "useremailid": 10,
                        "useremail": "[email protected]"
                    }
                ]
            }
        }
    ]
}
http://localhost:2019/roles/role/name/data
{
    "roleid": 3,
    "name": "DATA",
    "users": [
        {
            "user": {
                "userid": 4,
                "username": "admin",
                "primaryemail": "[email protected]",
                "useremails": [
                    {
                        "useremailid": 5,
                        "useremail": "[email protected]"
                    },
                    {
                        "useremailid": 6,
                        "useremail": "[email protected]"
                    }
                ]
            }
        },
        {
            "user": {
                "userid": 7,
                "username": "cinnamon",
                "primaryemail": "[email protected]",
                "useremails": [
                    {
                        "useremailid": 9,
                        "useremail": "[email protected]"
                    },
                    {
                        "useremailid": 10,
                        "useremail": "[email protected]"
                    }
                ]
            }
        }
    ]
}
POST http://localhost:2019/roles/role

DATA

{
    "name" : "ANewRole"
}

OUTPUT

Status CREATED

Location Header: http://localhost:2019/roles/role/16
http://localhost:2019/roles/role/name/anewrole
{
    "roleid": 16,
    "name": "ANEWROLE",
    "users": []
}
PUT http://localhost:2019/roles/role/16

DATA

{
    "name" : "ANewRole"
}

OUTPUT

Status OK

These endpoints were provided with the project scaffold. They have not been tested, altered or implemented in the front-end client at this time though the JSON input/output for each has changed/will need to change due to a change in the data models. Therefore, we are noting the endpoints but not the JSON object sent or returned because these will have changed/will need to change slightly. If you wish to implement any of these, we believe it would be fairly easy to do.
http://localhost:2019/useremails/useremails
http://localhost:2019/useremails/useremail/8
DELETE http://localhost:2019/useremails/useremail/8
No Body Data

Status OK
PUT http://localhost:2019/useremails/useremail/9/email/[email protected]

DATA

OUTPUT

Status OK
http://localhost:2019/useremails/useremail/9
POST http://localhost:2019/useremails/user/14/email/[email protected]

OUTPUT

Status CREATED

Location Header: http://localhost:2019/useremails/useremail/15
http://localhost:2019/useremails/useremail/15

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 80.9%
  • Java 15.8%
  • CSS 1.7%
  • JavaScript 1.6%