Class BackendAPI

java.lang.Object
com.cyran.tp.server.api.BackendAPI

@Service
public class BackendAPI
extends java.lang.Object
Class serving firebase database
Author:
Peter Spusta
  • Constructor Details

  • Method Details

    • addOrder

      public java.lang.String addOrder​(UserOrderRequest userRequest) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
      Sets id of order added to database, adds new order to firebase database
      Parameters:
      userRequest - - user order request
      Returns:
      updated string - returns information that order is added to database
      Throws:
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • registerUser

      public java.lang.String registerUser​(RegisterUserRequest userRequest) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
      Adding new user to firebase via process of user registration
      Parameters:
      userRequest - - user request
      Returns:
      information string - returns information if new user is succeffuly added to database
      Throws:
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • savePage

      public void savePage​(Page accessingPage) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
      Throws:
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • getTokenForPage

      public java.lang.String getTokenForPage​(Page accessingPage) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
      Throws:
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • getRandomIntegerBetweenRange

      public static double getRandomIntegerBetweenRange​(double min, double max)
    • createOrder

      public com.fasterxml.jackson.databind.JsonNode createOrder​(OrderRequest orderRequest) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
      Throws:
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • getUser

      public User getUser​(java.lang.String name) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
      Throws:
      java.lang.InterruptedException
      java.util.concurrent.ExecutionException
    • getProduct

      public Product getProduct​(java.lang.String byName) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
      Throws:
      java.lang.InterruptedException
      java.util.concurrent.ExecutionException
    • createProduct

      public java.lang.String createProduct​(ProductRequest createProductRequest) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
      Throws:
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • updateProduct

      public java.lang.String updateProduct​(ProductRequest updateProductRequest) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
      Throws:
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException