Code Monkey home page Code Monkey logo

presenceqr-server-api's Introduction

TODO

  • Add validation to models and post controllers request bodies
  • Improve relation between model and database
  • Replace save request response with created (201)

Used Technologies

Install development environment

  1. Install all the tools mentioned at Used Technologies section
  2. Create Database Schema :
#Create Database
cd ./src/main/resources/database/create/
sudo chmod a+x ./createDB.sh
./createDB.sh
cd -

#Populate Database
cd ./src/main/resources/database/populate/
sudo chmod a+x ./populateDB.sh
./populateDB.sh
cd - 
  1. Deploy the Smart Contract
cd ./src/main/resources/truffle
truffle compile
truffle migrate
cd -
  1. Download all dependencies
mvn clean install
  1. Run
cd ./target/
java -jar ./*.jar

Database Schema

AD_USER

                                   Table "presenceqr.ad_user"
     Column      |            Type             | Collation | Nullable |         Default         
-----------------+-----------------------------+-----------+----------+-------------------------
 ad_user_uid     | character varying(40)       |           | not null | 
 isactif         | boolean                     |           | not null | true
 created         | timestamp without time zone |           | not null | now()
 updated         | timestamp without time zone |           | not null | now()
 email           | character varying(255)      |           | not null | 
 password        | character varying(512)      |           | not null | 
 password_backup | character varying(255)      |           |          | NULL::character varying
 first_name      | character varying(60)       |           |          | 
 last_name       | character varying(60)       |           |          | 
 gender          | character varying(1)        |           |          | 
 birthday        | timestamp without time zone |           |          | 
 address         | character varying(255)      |           |          | 
 ad_role_id      | bigint                      |           | not null | 
Indexes:
    "ad_user_pkey" PRIMARY KEY, btree (ad_user_uid)
    "ad_user_email_key" UNIQUE CONSTRAINT, btree (email)
Check constraints:
    "sys_gender" CHECK (gender::bpchar = ANY (ARRAY['M'::bpchar, 'F'::bpchar]))
Foreign-key constraints:
    "fk_user_role" FOREIGN KEY (ad_role_id) REFERENCES ad_role(ad_role_id)

AD_ROLE

                                           Table "presenceqr.ad_role"
   Column    |            Type             | Collation | Nullable |                   Default                   
-------------+-----------------------------+-----------+----------+---------------------------------------------
 ad_role_id  | bigint                      |           | not null | nextval('ad_role_ad_role_id_seq'::regclass)
 isactif     | boolean                     |           | not null | true
 created     | timestamp without time zone |           | not null | now()
 updated     | timestamp without time zone |           | not null | now()
 name        | character varying(50)       |           | not null | 
 value       | character varying(50)       |           | not null | 
 description | character varying(255)      |           |          | 
Indexes:
    "ad_role_pkey" PRIMARY KEY, btree (ad_role_id)
    "ad_role_value_key" UNIQUE CONSTRAINT, btree (value)
Referenced by:
    TABLE "ad_user" CONSTRAINT "fk_user_role" FOREIGN KEY (ad_role_id) REFERENCES ad_role(ad_role_id)

M_COURSE

                        Table "presenceqr.m_course"
   Column    |            Type             | Collation | Nullable | Default 
-------------+-----------------------------+-----------+----------+---------
 m_course_id | bigint                      |           | not null | 
 isactif     | boolean                     |           | not null | true
 created     | timestamp without time zone |           | not null | now()
 updated     | timestamp without time zone |           | not null | now()
 name        | character varying(255)      |           | not null | 
Indexes:
    "m_course_pkey" PRIMARY KEY, btree (m_course_id)

More

Generate a smart contract wrapper model

To generate model class from solidity smart contract:

cd ./src/main/resources/truffle
web3j generate truffle --truffle-json=build/contracts/Transaction.json --outputDir ../../java/ --package=com.youcefmegoura.presenceqr.model
cd -

Generated data

All database dummy data are generated via https://www.mockaroo.com/

presenceqr-server-api's People

Contributors

youcefmegoura avatar

Watchers

James Cloos avatar  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.