Giter Site home page Giter Site logo

kaizen-profile-api's Introduction

Kaizen Profile API

Java 17 Spring Boot 3 MySQL

Kaizen Profile API is a microservice for managing KaizenLAN user profiles and associated widget row information. This project's purpose is to provide a simple API to integrate with this data. The core application is developed in Java, utilizing the Spring Boot framework. The application uses Spring Data JPA to interact with a MySQL database.

Requirements to Run

This section assumes the user is familiar with installing Java 17 and running Maven-based Java applications. It also assumes knowledge of installing and configuring a MySQL database server.

MySQL Configuration

Configure the setup_database.sql file by including which database are using.

USE <replace_with_your_database_name>;

Then, run the script in a MySQL terminal.

Create or Validate MySQL properties

Create the file in the directory ${user.home}/Documents/narlock/secrets/mysql.properties if it does not exist, and include your MySQL credentials so that this API can read them from this properties file.

lmysql.username=<replace_with_your_mysql_username>
lmysql.password=<replace_with_your_mysql_password>

Run the application

  • Using Java 17: After building the application, navigate to the directory of the jar in a terminal and use java -jar kaizen-profile-api.jar to run the application.
  • Using Maven: In a terminal, use mvn spring-boot:run to run the application.

Relational Database Schema

Relational Database Schema

API Specification

Create a profile

Creates a Profile and Health entry for a Kaizen Profile.

POST /profile
Content-Type: application/json

{
    "username": "narlock",
    "birthDate": "2000-02-02",
    "imageUrl": null,
    "xp": 0,
    "numRows": 1,
    "pin": 1234,
    "height": 723,
    "weight": 175,
    "goalWeight": 155,
    "goalWater": 128
}

Response

HTTP/1.1 201 Created

{
    "profile": {
        "id": 12,
        "username": "narlock",
        "birthDate": "2000-02-02",
        "imageUrl": null,
        "xp": 0,
        "numRows": 1,
        "pin": "1234"
    },
    "health": {
        "profileId": 12,
        "height": 723.0,
        "weight": 175.0,
        "goalWeight": 155.0,
        "goalWater": 128.0
    },
    "rowInfoList": null
}

Update a profile

Updates a Profile and Health entry for a Kaizen Profile.

PUT /profile
Content-Type: application/json

{
    "profileId": 12,
    "username": "narlock",
    "birthDate": "2000-02-02",
    "imageUrl": null,
    "xp": 0,
    "numRows": 1,
    "pin": 1234,
    "height": 723,
    "weight": 175,
    "goalWeight": 155,
    "goalWater": 128
}

Response

HTTP/1.1 200 OK

{
    "profile": {
        "id": 12,
        "username": "narlock",
        "birthDate": "2000-02-02",
        "imageUrl": null,
        "xp": 0,
        "numRows": 1,
        "pin": "1234"
    },
    "health": {
        "profileId": 12,
        "height": 723.0,
        "weight": 175.0,
        "goalWeight": 155.0,
        "goalWater": 128.0
    },
    "rowInfoList": null
}

Delete a profile

Deletes an existing profile.

DELETE /profile/{id}

Response

HTTP/1.1 204 No Content

Retrieve a profile

Retrieves a profile by its ID.

GET /profile/{id}
Content-Type: application/json

Response

HTTP/1.1 200 OK

{
    "profile": {
        "id": 12,
        "username": "narlock",
        "birthDate": "2000-02-02",
        "imageUrl": null,
        "xp": 0,
        "numRows": 1,
        "pin": "1234"
    },
    "health": {
        "profileId": 12,
        "height": 723.0,
        "weight": 175.0,
        "goalWeight": 155.0,
        "goalWater": 128.0
    },
    "rowInfoList": []
}

Save row information

Saves row information for a given profile ID.

POST /profile/{id}/rowInfo
Content-Type: application/json

{
    "rowIndex": 1,
    "widgets": "checklist,weight,profile"
}

Response

HTTP/1.1 200 OK

[
    {
        "profileId": 12,
        "rowIndex": 1,
        "widgets": "checklist,weight,profile"
    }
]

Update row information

Updates row information for a given profile ID.

PUT /profile/{id}/rowInfo
Content-Type: application/json

{
    "rowIndex": 1,
    "widgets": "checklist,profile,weight"
}

Response

HTTP/1.1 200 OK

[
    {
        "profileId": 12,
        "rowIndex": 1,
        "widgets": "checklist,profile,weight"
    }
]

Delete row information

Deletes row information for a given profile ID and row index.

DELETE /profile/{id}/rowInfo/{index}

Response

HTTP/1.1 204 No Content

Testing

Note

This section is currently in progress!

kaizen-profile-api's People

Contributors

narlock 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.