GithubHelp home page GithubHelp logo

shelbydiamond / sprint-challenge--rdbms-and-api-intros-java-todos Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bloominstituteoftechnology/sprint-challenge--rdbms-and-api-intros-java-todos

0.0 1.0 0.0 55 KB

License: MIT License

Java 100.00%

sprint-challenge--rdbms-and-api-intros-java-todos's Introduction

java-todos

A student that completes this project shows that they can

  • perform CRUD operations on an RDBMS using JPA and Hibernate.
  • implement a data seeding class using JPA and Hibernate
  • use JPA and Hibernate to perform advanced query operations on a RDBMS.
  • add relationships between tables.
  • implement Spring Security and OAuth2. to provide authentication for a project.

Specifically

  • Seed Data
  • CRUD Operations
  • H2 Connections
  • Authentication

Introduction

This is a basic todo database scheme with users and a todo list.

Instructions

Create a REST api service to store and read data from H2 database.

  • seeddata.java is a sample script that can be modified to populate the database
  • note that all new todos default to completed = false;

The table layouts are as follows:

  • All tables should have audit fields / columns - createby createddate modifiedby modifieddate

  • TODO

    • todoid primary key, not null long
    • description string, not null
    • datestarted datetime
    • completed boolean
    • userid foreign key (one user to many todos) not null
  • USERS

    • userid primary key, not null long
    • username string, not null unique
    • password string, not null
  • ROLES

    • roleid primary key, not null long
    • rolename string not null unique
  • USERROLES

    • roleid foreign key to role
    • userid foreign key to user

Expose the following end points

  • GET /users/mine - return the user and todo based off of the authenticated user. You can only look up your own. It is okay if this also lists the users roles and authorities.
  • POST /users - adds a user. Can only be done by an admin.
{
    "username": "cinnamon",
    "password": "password",
    "userRoles": [
        {
            "role": {
                "roleid": 2
            }
        }
    ],
    "todos": [
        {
            "description": "Eat Carrots",
            "datestarted": "2019-08-16T01:44:18.089+0000"
        },
        {
            "description": "Bang on cage until everyone is awake",
            "datestarted": "2019-08-16T01:44:18.089+0000"
        }
    ]
}
  • POST /users/todo/{userid} - adds a todo to the assigned user. Can be done by any user. You can add this todo
{
    "description": "Have Fun",
    "datestarted": "2019-01-01T01:00"
}
  • PUT /todos/todoid/{todoid} - updates a todo based on todoid. Can be done by any user. Note: null boolean is not a thing - it is false, so just set compeleted to whatever comes across in the RequestBody.
{
    "completed": true
}
  • DELETE /users/userid/{userid} - Deletes a user based off of their userid and deletes all their associated todos. Can only be done by an admin.

  • hint - think about taking the project https://github.com/LambdaSchool/java-oauth2.git and modifying it to fit this application

Stretch goals

  • Update the end points below:

    • POST /users/todo/{userid} - adds a todo to the assigned user. Can only be done by the authenticated user. A user can only modify their own data.

    • PUT /todos/todoid/{todoid} - updates a todo based on todoid. Can only be done by the authenticated user. A user can only modify their own data.

sprint-challenge--rdbms-and-api-intros-java-todos's People

Contributors

jrmmba8314 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.