Giter VIP home page Giter VIP logo

washup-backend's Introduction

Washup Application

Backend for washup.io

Build

mvn clean package -DskipTests

Deploy

  1. Build the application jar using the build step.
  2. Go to: https://us-east-2.console.aws.amazon.com/elasticbeanstalk/home?region=us-east-2#/environment/dashboard?applicationName=washup-backend&environmentId=e-imrcjxpm3u
  3. Click Upload and Deploy
  4. Upload the jar from step 1. Use the latest git commit short hash on the build as the version.

Run

java -jar target/...jar

or

mvn spring-boot:run

Protos

Run mvn compile or mvn generate-sources after any changes to the proto to generate the java code.

Signup

curl -H "Content-Type: application/json" -X POST -d '{
  "first_name": "john",
  "last_name": "doe",
  "email": "[email protected]",
  "password": "password",
  "phone_number": "phone_number"
}' http://localhost:8080/api/v1/users/sign-up

Login

curl -i -H "Content-Type: application/json" -X POST -d '{
  "email": "[email protected]",
  "password": "password"
}' http://localhost:8080/api/v1/users/login

Order

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN_HERE" -X POST -d '{
  "order_type": 1, 
  "delivery_date": 1515900795000, 
  "pickup_date": 1515801600000, 
  "idempotence_token": "abc"
}' http://localhost:8080/api/v1/orders/place-order

User

###GetProfile

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN_HERE" -X GET  http://localhost:8080/api/v1/users/get-profile

###SetProfile

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN_HERE" -X POST -d '{
  "user": {"first_name": "jack", "last_name": "nelson", "phone_number": "1233322"}
  }' http://localhost:8080/api/v1/users/set-profile

Address

###GetAddress

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN_HERE" -X GET  http://localhost:8080/api/v1/users/get-address

###SetAddress

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN_HERE" -X POST -d '{
  "street_address": "143 ali st", 
  "apt": "40", 
  "postal_code": "", 
  "notes": "abc"
}' http://localhost:8080/api/v1/users/set-address

Preferences

###SetPreference

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN" -X POST -d '
{
  "preference": {
    "scented": true, 
    "fabric_softener": true, 
    "one_day_delivery": true, 
    "laundry_reminder": true
  }
}' http://localhost:8080/api/v1/users/set-preferences

###GetPreference

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN" -X GET http://localhost:8080/api/v1/users/get-preferences

Employees

###Register Employees java -jar target/...jar -register_employee [email protected] password=something first_name=john last_name=doe

###Login Employees curl -i -H "Content-Type: application/json" -X POST -d '{"email": "[email protected]", "password":"123"}' http://localhost:8080/_admin/login

###Get Orders curl -i -H "Content-Type: application/json" -H "Authorization: Bearer EMPLOYEE_AUTH_TOKEN" -X GET -d '{"start_date":1, "end_date":2, "order_type": "WASH_FOLD", "billed": true}' http://localhost:8080/_admin/orders/get-orders

Cards

###Set Card

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN" -X POST -d '{
  "stripeCardToken": "tok_ca"
}' http://localhost:8080/api/v1/users/set-card

###Get Card

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN" -X GET http://localhost:8080/api/v1/users/get-card

Pricing

###Get Postal Code Pricing

curl -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{
  "postal_code": "M5T1T4"
}' http://localhost:8080/api/v1/pricing/get-postal-code-pricing

###Get User Pricing

curl -i -H "Content-Type: application/json" -H "Authorization: Bearer AUTH_TOKEN" -H -X GET http://localhost:8080/api/v1/pricing/get-user-pricing

Seed Data

INSERT INTO pricing_buckets(bucket_name) VALUES ("TORONTO");
INSERT INTO item_pricings(item, price_cents, bucket_id) VALUES
  ("LAUNDERED_SHIRT", 395, 1),
  ("DRY_CLEAN_SHIRT", 425, 1),
  ("PER_POUND", 199, 1),
  ("DOUBLE_BLANKET", 3599, 1);
INSERT INTO postal_codes(postal_code, rule, bucket_id) VALUES ("M5", "STARTS_WITH", 1);

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.