Package com.cyran.tp.server.api
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 Summary
Constructors Constructor Description BackendAPI()
-
Method Summary
Modifier and Type Method Description java.lang.String
addOrder(UserOrderRequest userRequest)
Sets id of order added to database, adds new order to firebase databasecom.fasterxml.jackson.databind.JsonNode
createOrder(OrderRequest orderRequest)
java.lang.String
createProduct(ProductRequest createProductRequest)
Product
getProduct(java.lang.String byName)
static double
getRandomIntegerBetweenRange(double min, double max)
java.lang.String
getTokenForPage(Page accessingPage)
User
getUser(java.lang.String name)
java.lang.String
registerUser(RegisterUserRequest userRequest)
Adding new user to firebase via process of user registrationvoid
savePage(Page accessingPage)
java.lang.String
updateProduct(ProductRequest updateProductRequest)
-
Constructor Details
-
BackendAPI
public BackendAPI()
-
-
Method Details
-
addOrder
public java.lang.String addOrder(UserOrderRequest userRequest) throws java.util.concurrent.ExecutionException, java.lang.InterruptedExceptionSets 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.InterruptedExceptionAdding 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
-