Giter Club home page Giter Club logo

promotions-api's Introduction

Promotions API

Project

This project it's a web API to make CRUD operations about Supermarket scenario;

Overview

This repository contains the solution implemented by the DM111 discipline from the Pos Graduation course Mobile and Cloud Development by Inatel.

During the classes was implemented a web service to deal with a minimal structure of supermarket, i.e. The CRUD operations for Products, Users (Client and Admin), Shopping Lists. But now this API has CRUD operation for Promotions and others manipulations;

To make these exposed APIs secure it was implemented an Authentication API as well using JWT token.

In addition to the auth API an Interceptor was created and all the endpoints that required the authorization was added behind this interceptor. It means, only authenticated users could access the resources and in some scenarios only authenticated and authorized users were able to perform some operations.

Integrations

The current project does have the integrations with: Firebase DB, Firebase Cloud Message, Pub Sub.

Firebase

In order to reduce the cost and also reduce the risk of reach the Free tier limit of U$ 300 provided by the Google Cloud I have decided to use Firebase as our main database solution. That decision helped us to reduce the number of resources required to be deployed and simplify our deployment letting us move our focus on the code itself.

Remember

You have to generate the service accounts from your Firebase project and paste into the right place, i.e.the folder src/main/resources

The following entities are stored on the Firebase:

User

{
  "email": "[email protected]",
  "id": "uuid",
  "name": "name",
  "password": "encrypted",
  "role": "ADMIN|CLIENT"
}

Products

{
  "id": "uuid",
  "name": "name",
  "amount": 0,
  "brand": "brand",
  "price": 5.99,
  "unit": "kg|lt|ml"
}

Supermarket list

{
  "id": "uuid",
  "name": "name",
  "products": [
    "product_id1",
    "product_id2"
  ]
}

Promotion

{
  "id": "uuid",
  "name": "name",
  "starting": "starting_date",
  "expiration": "expiration_date",
  "products": [
    {
      "productId": "product_id",
      "discount": 15
    }
  ]
}

How to set up

In order to prepare the machine to either run or change the project follow the instructions detailed at DM111 setup instructions

How to deploy to GAE

To deploy the code to GAE (Google App Engine), it is necessary first initialize the gcloud environment, please run the following command:

gcloud init

During the execution of this command, it will be necessary to authenticate at the Google Cloud account. After the initialization has been completed the deployment will be straightforward you only need to execute the following command.

gcloud app deploy --version 1 dm111/app.yaml

Some data/confirmation will be requested via terminal at the end of this step and as result of the deploy the link to access the service via API will be there.

Deploy multiple services at once

To deploy both services simultaneously, please run the following command:

gcloud app deploy --version 1 dm111/app.yaml dm111-promo/app.yaml

promotions-api's People

Contributors

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