GithubHelp home page GithubHelp logo

admin's Introduction

BAUS Admin

A RESTful application that’s used by frontend user interface to retrieve/update data stored in the database. It is built using Java, and Postgres.

Building

  • Install Java SDK 9
  • Install Maven
  • Run mvn package

Running locally

mvn spring-boot:run

Frameworks used

Security

With exception to token request endpoint, /api/token, all other requests require have to a valid JWT token in Authorization header. Access for individual endpoints is configured at https://github.com/bausit/admin/blob/main/src/main/java/org/bausit/admin/configs/SecurityConfig.java

Request tokens

curl --location --request POST 'http://localhost:9090/api/token' \ --header 'Content-Type: application/json' \ --data-raw '{ "username": "[email protected]", "password": "password" }'

Token response

{ "token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkYW5ueUBtYWlsLmNvbSIsImlhdCI6MTYwOTY0MDgzNCwiZXhwIjoxNjA5NjU4ODM0fQ.DDhy5CCLH8hxqxgHPOr15Pygro4aTKzA7dBThZmmQeIU3Bg7nsT-PWFw7qrmYBkqVAY74HYClaiGHdj-iHXGoQ", "type": "Bearer", "id": 13, "username": "[email protected]", "email": "[email protected]", "roles": [ "admin" ] }

Request with token

curl http://localhost8080/json/skills \ -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkYW5ueUBtYWlsLmNvbSIsImlhdCI6MTYwOTY0MDgzNCwiZXhwIjoxNjA5NjU4ODM0fQ.DDhy5CCLH8hxqxgHPOr15Pygro4aTKzA7dBThZmmQeIU3Bg7nsT-PWFw7qrmYBkqVAY74HYClaiGHdj-iHXGoQ'

Using endpoints exposed by Spring Data Rest

List objects

curl http://localhost8080/json/skills

Creating a new object

curl --location --request POST 'http://localhost:8080/json/skills' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "test", "description": "test" }'

Overwrite objects

curl --location --request PUT 'http://localhost:8080/json/skills/15' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "test2", "description": "test", "id": 15 }'

Partial update object

curl --location --request PATCH 'http://localhost:8080/json/skills/16' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "test3" }'

Deleting objects

curl --location --request DELETE 'http://localhost:8080/json/skills/15'

Update object relationship

Add a skill to members

curl --location --request POST 'http://localhost:8080/json/members/7/skills' \ --header 'Content-Type: text/uri-list' \ --data-raw '1'

Overwrite member skills

curl --location --request PUT 'http://localhost:8080/json/members/7/skills' \ --header 'Content-Type: text/uri-list' \ --data-raw '16'

Remove a skill from members

curl --location --request DELETE 'http://localhost:8080/json/members/7/skills/1'

creating a function

curl --location --request POST 'http://localhost:9090/json/teams' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "Main Shrine", "description": "" }'

assign function to an activity

curl --location --request PUT 'http://localhost:9090/json/teams/3/activity' \ --header 'Content-Type: text/uri-list' \ --data-raw '5'

assign leader to a function

curl --location --request PUT 'http://localhost:9090/json/teams/3/leader' \ --header 'Content-Type: text/uri-list' \ --data-raw '12'

admin's People

Contributors

dannyjiangmlb avatar longjk369 avatar dannyjiang001 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.