diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 38b4106..bf5e6f7 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -5,10 +5,7 @@ - - - \ No newline at end of file diff --git a/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/AddressController.java b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/AddressController.java new file mode 100644 index 0000000..9e2e903 --- /dev/null +++ b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/AddressController.java @@ -0,0 +1,192 @@ +package com.upgrad.FoodOrderingApp.api.controller; + +import com.upgrad.FoodOrderingApp.api.model.*; +import com.upgrad.FoodOrderingApp.service.businness.AddressServiceImpl; +import com.upgrad.FoodOrderingApp.service.businness.CustomerServiceImpl; +import com.upgrad.FoodOrderingApp.service.entity.AddressEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerAddressEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; +import com.upgrad.FoodOrderingApp.service.exception.AddressNotFoundException; +import com.upgrad.FoodOrderingApp.service.exception.AuthorizationFailedException; +import com.upgrad.FoodOrderingApp.service.exception.SaveAddressException; +import com.upgrad.FoodOrderingApp.service.exception.UpdateCustomerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +@RestController//returns the object and object data is directly written into HTTP response as JSON +@CrossOrigin//for resolving the CORS issue when integrating the frontend and the backend +@RequestMapping("/")//to tell where the mapping in the db has to go +public class AddressController { + + @Autowired//control over where and how autowiring should be done in the code .Can be on constructors, variables class and its objects + private CustomerServiceImpl customerServiceImpl; + + @Autowired + private AddressServiceImpl addressServiceImpl; + + + //saveAddress endpoint definition of POST type + @RequestMapping(path = "/address",method = RequestMethod.POST,produces= MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + public ResponseEntitysaveAddress(@RequestBody SaveAddressRequest saveAddressRequest, @RequestHeader("accessToken") final String accessToken) throws AuthorizationFailedException, SaveAddressException,AddressNotFoundException, UpdateCustomerException { + try{ + //if any of the input fields is empty then this exception is thrown + if(saveAddressRequest.getStateUuid().isEmpty() || saveAddressRequest.getPincode().isEmpty()|| saveAddressRequest.getFlatBuildingName().isEmpty() || saveAddressRequest.getLocality().isEmpty() || saveAddressRequest.getCity().isEmpty()) + { + throw new SaveAddressException("SAR-001", "No field can be empty"); + } + // Getting the CustomerEntity object using the accessToken. + CustomerEntity customerEntity=customerServiceImpl.getCustomer(accessToken); + if(customerEntity==null)//if the accessToken is not in db + { + throw new AuthorizationFailedException("ATHR-001", "Customer is not Logged in."); + } + if(!customerServiceImpl.isUserLoggedIn(accessToken)) + { + //if the accessToken states that the customer has already logged out + throw new AuthorizationFailedException("ATHR-002", "Customer is logged out. Log in again to access this endpoint."); + } + if(customerServiceImpl.checkExpiryOfToken(accessToken)) + { + //if the customer has not logged out but the max time limit to stay logged in has exceeded. + throw new AuthorizationFailedException("ATHR-002", "Customer is logged out. Log in again to access this endpoint."); + } + AddressEntity addressEntity=new AddressEntity();// Creating an empty AddressEntity object. + //setting the values in the AddressEntity in the address table + addressEntity.setUuid(UUID.randomUUID().toString());//this generates UUID in the db table + addressEntity.setFlatBuilNumber(saveAddressRequest.getFlatBuildingName());//setting the flat,building value in the table + addressEntity.setLocality(saveAddressRequest.getLocality());//setting the locality + addressEntity.setCity(saveAddressRequest.getCity());//setting the city in the table + addressEntity.setPincode(saveAddressRequest.getPincode());//setting the pincode according to the constraints + String stateUuid=saveAddressRequest.getStateUuid();//the stateUuid is taken from the State table + addressServiceImpl.saveAddress(addressEntity,stateUuid,customerEntity);//the logic of the saveAddress + //if all conditions are met and no issues found then save the data in the table + SaveAddressResponse response=new SaveAddressResponse().id(addressEntity.getUuid()).status("ADDRESS SUCCESSFULLY REGISTERED"); + return new ResponseEntity(response, HttpStatus.CREATED); + } + catch (AuthorizationFailedException e)//if there exists exception in the table + { + //throw the exception + SaveAddressResponse errorResponse=new SaveAddressResponse().id(e.getCode()).status(e.getErrorMessage()); + return new ResponseEntity(errorResponse,HttpStatus.BAD_REQUEST); + } + catch (SaveAddressException e) + { + SaveAddressResponse errorResponse=new SaveAddressResponse().id(e.getCode()).status(e.getErrorMessage()); + return new ResponseEntity(errorResponse,HttpStatus.BAD_REQUEST); + } + catch (AddressNotFoundException e) + { + SaveAddressResponse errorResponse=new SaveAddressResponse().id(e.getCode()).status(e.getErrorMessage()); + return new ResponseEntity(errorResponse,HttpStatus.BAD_REQUEST); + } + + } + + //getAddress From the db table endpoint definition which is of GET type + @RequestMapping(method = RequestMethod.GET,value = "/address/customer",produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public ResponseEntity getAllAddress(@RequestHeader("accessToken") String accessToken){ + try { + CustomerEntity customerEntity=customerServiceImpl.getCustomer(accessToken); + + if(customerEntity==null) + { + //if the accessToken doesnt exist in the db table + throw new AuthorizationFailedException("ATHR-001", "Customer is not Logged in."); + } + if(!customerServiceImpl.isUserLoggedIn(accessToken)) + { + //if the accessToken states that the customer has already logged out + throw new AuthorizationFailedException("ATHR-002", "Customer is logged out. Log in again to access this endpoint."); + } + if(customerServiceImpl.checkExpiryOfToken(accessToken)) + { + //if the customer has not logged out but the max time limit to stay logged in has exceeded. + throw new AuthorizationFailedException("ATHR-002", "Customer is logged out. Log in again to access this endpoint."); + } + //getting the object list of AddressEntity + List addressEntityList=addressServiceImpl.getAllAddresses(customerEntity); + List newAddressEntityList=new ArrayList<>();//empty AddressList + + // Creating an AddressListState object. + for(AddressEntity addressEntity:addressEntityList){ + AddressListState addressListState=new AddressListState().id(UUID.fromString(addressEntity.getUuid())).stateName(addressServiceImpl.getStateNameByStateId(addressEntity.getId())); + // Creating an AddressList object. + AddressList addressList=new AddressList().id(UUID.fromString(addressEntity.getUuid())).flatBuildingName(addressEntity.getFlatBuilNumber()).locality(addressEntity.getLocality()).city(addressEntity.getCity()).state(addressListState).pincode(addressEntity.getPincode()); + newAddressEntityList.add(addressList);//adding AddressList object to the list. + } + AddressListResponse addressListResponse=new AddressListResponse().addresses(newAddressEntityList); + return new ResponseEntity(addressListResponse,HttpStatus.OK); + } + catch (AuthorizationFailedException e) + { + ErrorResponse response=new ErrorResponse().code(e.getCode()).message(e.getErrorMessage()); + return new ResponseEntity(response,HttpStatus.BAD_REQUEST); + } + } + + //deleteAddress endpoint definition with DELETE type method + @RequestMapping(value = "/address/{address_id}",method=RequestMethod.DELETE,produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public ResponseEntity deleteAddress(@PathVariable("address_id")final String addressUuid,@RequestHeader("accessToken")final String accessToken) + { + try { + boolean check=false;//creating a flag to check the values + CustomerEntity customerEntity=customerServiceImpl.getCustomer(accessToken); + if(customerEntity == null) { + //if the accessToken doesnt exist in the db table + throw new AuthorizationFailedException("ATHR-001", "Customer is not Logged in."); + } + if(!customerServiceImpl.isUserLoggedIn(accessToken)) { + //if the accessToken states that the customer has already logged out + throw new AuthorizationFailedException("ATHR-002", "Customer is logged out. Log in again to access this endpoint."); + } + if(customerServiceImpl.checkExpiryOfToken(accessToken)) { + //if the customer has not logged out but the max time limit to stay logged in has exceeded. + throw new AuthorizationFailedException("ATHR-002", "Customer is logged out. Log in again to access this endpoint."); + } + for(AddressEntity address : customerEntity.getAddress()){ + if(address.getUuid().equalsIgnoreCase(addressUuid)) + check = true; + } + //if(addressUuid.length()==0)//required hai + if(addressUuid.isEmpty()) + { + throw new AddressNotFoundException("ANF-005", "Address id can not be empty"); + } + AddressEntity addressEntity=addressServiceImpl.searchByUuid(addressUuid); + CustomerAddressEntity customerAddressEntity=addressServiceImpl.searchByAddressId(addressEntity.getId()); + + //if(customerAddressEntity.getCustomerId()!=customerEntity.getId())//nhi chl rhi + if(!check) + { + //if the customer id of the table doesnt match with the id of the accessToken customer then this exception is thrown + throw new AuthorizationFailedException("ATHR-004", "You are not authorized to view/update/delete any one else's address."); + } + if(addressEntity == null)//nhi chl rhi + { + throw new AddressNotFoundException("ANF-003", "No address by this id"); + } + addressServiceImpl.deleteAddress(addressEntity,customerAddressEntity);// Getting the AddressEntity object using the addressUuid. + DeleteAddressResponse response=new DeleteAddressResponse().id(UUID.fromString(addressEntity.getUuid())).status("ADDRESS DELETED SUCCESSFULLY"); + return new ResponseEntity(response,HttpStatus.OK); + + } catch (AuthorizationFailedException e) { + //if some constraints are not followed exception is thrown which is caught by catch block + ErrorResponse errorResponse=new ErrorResponse().code(e.getCode()).message(e.getErrorMessage()); + return new ResponseEntity(errorResponse,HttpStatus.BAD_REQUEST); + } + catch (AddressNotFoundException e) { + ErrorResponse errorResponse=new ErrorResponse().code(e.getCode()).message(e.getErrorMessage()); + return new ResponseEntity(errorResponse,HttpStatus.BAD_REQUEST); + } + + } + +} + diff --git a/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/CategoryController.java b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/CategoryController.java new file mode 100644 index 0000000..cafa988 --- /dev/null +++ b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/CategoryController.java @@ -0,0 +1,86 @@ +package com.upgrad.FoodOrderingApp.api.controller; + +import com.upgrad.FoodOrderingApp.api.model.*; +import com.upgrad.FoodOrderingApp.api.model.CategoriesListResponse; +import com.upgrad.FoodOrderingApp.api.model.CategoryListResponse; +import com.upgrad.FoodOrderingApp.api.model.ItemList; +import com.upgrad.FoodOrderingApp.service.businness.CategoryItemServiceImpl; +import com.upgrad.FoodOrderingApp.service.businness.CategoryServiceImpl; +import com.upgrad.FoodOrderingApp.service.businness.ItemServiceImpl; +import com.upgrad.FoodOrderingApp.service.entity.CategoryEntity; +import com.upgrad.FoodOrderingApp.service.entity.CategoryItemEntity; +import com.upgrad.FoodOrderingApp.service.entity.ItemEntity; +import com.upgrad.FoodOrderingApp.service.exception.CategoryNotFoundException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +@RestController +@CrossOrigin +@RequestMapping("/") +public class CategoryController { + + @Autowired + private CategoryServiceImpl categoryServiceImpl; + + @Autowired + private CategoryItemServiceImpl categoryItemServiceImpl; + + @Autowired + private ItemServiceImpl itemServiceImpl; + + //getAllCategory endpoint definition + @RequestMapping(value = "/category",method = RequestMethod.GET)//produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + public ResponseEntity getAllCategories() + { + + ListcategoryList=categoryServiceImpl.getAllCategories(); + List list = new ArrayList<>(); + for(CategoryEntity categoryEntity:categoryList) + { + CategoryListResponse categoryListResponse=new CategoryListResponse().id(UUID.fromString(categoryEntity.getUuid())).categoryName(categoryEntity.getCategoryName()); + list.add(categoryListResponse); + } + CategoriesListResponse response = new CategoriesListResponse().categories(list); + return new ResponseEntity (response, HttpStatus.FOUND); + //return new ResponseEntity (response, HttpStatus.OK); + } + + @RequestMapping(value = "/category/{category_id}", method = RequestMethod.GET)//,produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + public ResponseEntity getCategoryById(@PathVariable("category_id") final String categoryUuid) throws CategoryNotFoundException { + + try { + CategoryEntity categoryEntity = categoryServiceImpl.getCategoryUsingUuid(categoryUuid); + Listlist=categoryItemServiceImpl.getItemsUsingCategoryId(categoryEntity.getId()); + List itemList=new ArrayList<>(); + for(CategoryItemEntity categoryItemEntity:list) + { + ItemEntity itemEntity=itemServiceImpl.getItemUsingId(categoryItemEntity.getItemId()); + ItemList itemList1=new ItemList().id(UUID.fromString(itemEntity.getUuid())).itemName(itemEntity.getItemName()).price(itemEntity.getPrice()); + if(itemEntity.getType().equals("0")) + { + itemList1.setItemType(ItemList.ItemTypeEnum.VEG); + } + else if(itemEntity.getType().equals("1")) + { + itemList1.setItemType(ItemList.ItemTypeEnum.NON_VEG); + } + itemList.add(itemList1); + } + CategoryDetailsResponse response = new CategoryDetailsResponse().id( UUID.fromString(categoryEntity.getUuid())).categoryName(categoryEntity.getCategoryName()).itemList(itemList ); + return new ResponseEntity (response, HttpStatus.FOUND); + } + catch (CategoryNotFoundException e) + { + ErrorResponse response=new ErrorResponse().code(e.getCode()).message(e.getErrorMessage()); + return new ResponseEntity(response,HttpStatus.NOT_FOUND); + } + } + +} diff --git a/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/CustomerController.java b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/CustomerController.java new file mode 100644 index 0000000..66ecd23 --- /dev/null +++ b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/CustomerController.java @@ -0,0 +1,141 @@ +package com.upgrad.FoodOrderingApp.api.controller; + +import com.upgrad.FoodOrderingApp.api.model.*; +import com.upgrad.FoodOrderingApp.service.businness.CustomerService; +import com.upgrad.FoodOrderingApp.service.businness.CustomerServiceImpl; +import com.upgrad.FoodOrderingApp.service.dao.CustomerDao; +import com.upgrad.FoodOrderingApp.service.entity.CustomerAuthEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; +import com.upgrad.FoodOrderingApp.service.exception.AuthenticationFailedException; +import com.upgrad.FoodOrderingApp.service.exception.AuthorizationFailedException; +import com.upgrad.FoodOrderingApp.service.exception.SignUpRestrictedException; +import com.upgrad.FoodOrderingApp.service.exception.UpdateCustomerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.naming.AuthenticationException; +import java.awt.*; +import java.util.ArrayList; +import java.util.Base64; +import java.util.List; +import java.util.UUID; + +@RestController//returns the object and object data is directly written into HTTP response as JSON +@CrossOrigin//for the future use if we want t0 link the frontend to the backend and to avoid the CORS issue +@RequestMapping("/")//to tell where the mapping in the db has to go +public class CustomerController { + + @Autowired//control over where and how autowiring should be done in the code .Can be on constructors, variables class and its objects + private CustomerService customerService; + + @Autowired + private CustomerDao customerDao; + + @Autowired + private CustomerServiceImpl customerServiceImpl; + + //this is the signup endpoint function definition which is of POST type + @RequestMapping(method= RequestMethod.POST,path = "/customer/signup", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)//api takes the input as Json format and output as Json format + public ResponseEntity signUp(final SignupCustomerRequest signupCustomerRequest) throws SignUpRestrictedException{ + + final CustomerEntity customerEntity=new CustomerEntity();//which is going to be saved in db yeh sb store hoga db mei. + customerEntity.setUuid(UUID.randomUUID().toString());//this generates random uuid automatically .the intellij has the function + customerEntity.setFirstName(signupCustomerRequest.getFirstName());//to set the firstname in the db + customerEntity.setLastName(signupCustomerRequest.getLastName());//set the lastname in the db + customerEntity.setContactNumber(signupCustomerRequest.getContactNumber());//set the contact number + customerEntity.setEmailAddress(signupCustomerRequest.getEmailAddress());//set the email id + customerEntity.setPassword(signupCustomerRequest.getPassword());//set the password + customerEntity.setSalt("1234");//salt is for password cryptography and security reasons. + + try { + final CustomerEntity responseCustomer = customerService.saveCustomer(customerEntity, signupCustomerRequest.getFirstName(), signupCustomerRequest.getLastName(), signupCustomerRequest.getContactNumber(), signupCustomerRequest.getEmailAddress(), signupCustomerRequest.getPassword());//if everything is f9 then this will bring some output response + SignupCustomerResponse signupCustomerResponse = new SignupCustomerResponse(); + signupCustomerResponse.setId(responseCustomer.getUuid()); + signupCustomerResponse.setStatus("CUSTOMER SUCCESSFULLY REGISTERED");//if no issues then customer is stored in db and this msg displayed + return new ResponseEntity(signupCustomerResponse,HttpStatus.CREATED); + //return new ResponseEntity(signupCustomerResponse, HttpStatus.OK); + } + catch(SignUpRestrictedException e) { + SignupCustomerResponse signupCustomerResponse=new SignupCustomerResponse().id(e.getCode()).status(e.getErrorMessage()); + return new ResponseEntity(signupCustomerResponse,HttpStatus.BAD_REQUEST);//if issue the exception is thrown and the return is from the exception classes + } + } + + + //login endpoint functionality defined having method of post typ + @RequestMapping(method = RequestMethod.POST,path="/customer/login",produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + public ResponseEntitylogin(@RequestHeader("authorization")final String authorization)throws AuthenticationFailedException { +//the String authorization has the contactnumber:password which is encoded in base64 format which is then passed along + byte[] decodedBytes = Base64.getDecoder().decode(authorization);//.split("Basic ")[1]);//splits the bearer + String decodedString = new String(decodedBytes); + if (!decodedString.contains(":"))//if the encrypted form doesnt have : then tht means the inout string/value is wrong + throw new AuthenticationFailedException("ATH-003", "Incorrect format of decoded customer name and password"); + try { + String decodeArr[] = decodedString.split(":");//splits contact number and password as in betwee the 2=string of them is : + final CustomerAuthEntity customerAuthEntity = customerServiceImpl.verifyAuthenticate(decodeArr[0], decodeArr[1]);//passing the contactnumber and password as array 0 and array 1 + CustomerEntity customerEntity=customerServiceImpl.searchById(customerAuthEntity.getCustomerId()); + //CustomerEntity customerEntity = customerAuthEntity.getCustomer();//return customer according to the query + if (customerEntity == null) { + //if the returned customerEntity is null ie returns nulll then thsi exception with the error message is thrown + throw new AuthenticationFailedException("ATH-002", "Invalid Credentials"); + } + LoginResponse loginResponse = new LoginResponse().firstName(customerEntity.getFirstName()).lastName(customerEntity.getLastName()).contactNumber(customerEntity.getContactNumber()).emailAddress(customerEntity.getEmailAddress()).id(customerEntity.getUuid()) + .message("LOGGED IN SUCCESSFULLY"); // if all validations verified then customer login successfully + HttpHeaders headers = new HttpHeaders(); + headers.add("access-token", customerAuthEntity.getAccessToken()); + /* List header = new ArrayList<>(); + header.add("access-token"); + headers.setAccessControlExposeHeaders(header); + headers.add("access-token", customerAuthEntity.getAccessToken());*/ + return new ResponseEntity(loginResponse, headers, HttpStatus.OK);// if everything is verified then it return response and HTTPstatus.OK + } catch (AuthenticationFailedException e) { + LoginResponse loginresponse = new LoginResponse().id(e.getCode()).message(e.getErrorMessage()); + return new ResponseEntity(loginresponse, HttpStatus.UNAUTHORIZED); + } + } + + //this is logout endpoint method definition whch is of post type and throws AuthorizationFailed exception + @RequestMapping(method = RequestMethod.POST, path = "/customer/logout", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)//,consumes=MediaType.APPLICATION_JSON_UTF8_VALUE) + public ResponseEntity logout(@RequestHeader("accessToken") final String accessToken) throws AuthorizationFailedException{ + try { + //String[] aToken = accessToken.split("Bearer ");//splits the accesstoken which we got during the login and then checks the condtitions + CustomerAuthEntity customerAuthEntity = customerServiceImpl.logout(accessToken);//method logout is called which holds the business logic + // if every validation fullfill then the we send this message to customer + LogoutResponse response = new LogoutResponse().id(customerAuthEntity.getUuid()).message("LOGGED OUT SUCCESSFULLY"); + return new ResponseEntity(response, HttpStatus.OK); + } + catch(AuthorizationFailedException e)//if above validations conditions dont hold true then exception is raised which is caught in this block + { + LogoutResponse logoutResponse=new LogoutResponse().id(e.getCode()).message(e.getErrorMessage()); + return new ResponseEntity(logoutResponse,HttpStatus.BAD_REQUEST); + } + } + + //this is the change password endpoint which is of put type + @RequestMapping(path = "/customer/password",method = RequestMethod.PUT)//,produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + public ResponseEntityupdateCustomerPassword(UpdatePasswordRequest updatePasswordRequest, @RequestHeader("accessToken")final String accessToken) throws UpdateCustomerException ,AuthorizationFailedException{ + try{ + //String bToken[]=bearerAuthorization.split("Bearer");//this split the access token which we get when we log in + CustomerEntity customerEntity = customerServiceImpl.getCustomer(accessToken);//this method is to bring the customer from the customer_Auth table having the same accessToken + CustomerEntity customerEntityNew = customerServiceImpl.updateCustomerPassword(updatePasswordRequest.getOldPassword(),updatePasswordRequest.getNewPassword(),customerEntity); + //final CustomerEntity customerEntity=customerService.updateCustomerPassword(bToken[1],oldPassword,newPassword);//the method which holds the logic in service class + UpdatePasswordResponse updatePasswordResponse=new UpdatePasswordResponse().id(customerEntity.getUuid()).status("CUSTOMER PASSWORD UPDATED SUCCESSFULLY"); + return new ResponseEntity(updatePasswordResponse,HttpStatus.OK);//if all hold true then this works with the above output + } + catch (AuthorizationFailedException e) + { + UpdatePasswordResponse response=new UpdatePasswordResponse().id(e.getCode()).status(e.getErrorMessage()); + return new ResponseEntity(response,HttpStatus.BAD_REQUEST); + } + catch (UpdateCustomerException e1)//if the password validations are not true then the updateCustomerException is thrown which is caught by this + { + UpdatePasswordResponse response=new UpdatePasswordResponse().id(e1.getCode()).status(e1.getErrorMessage());//this returns the error code with the error message + return new ResponseEntity(response,HttpStatus.BAD_REQUEST); + } + + } +} diff --git a/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/RestaurantController.java b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/RestaurantController.java new file mode 100644 index 0000000..6402957 --- /dev/null +++ b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/controller/RestaurantController.java @@ -0,0 +1,156 @@ +package com.upgrad.FoodOrderingApp.api.controller; + +import com.upgrad.FoodOrderingApp.api.model.*; +import com.upgrad.FoodOrderingApp.service.businness.*; +import com.upgrad.FoodOrderingApp.service.entity.*; +import com.upgrad.FoodOrderingApp.service.exception.CategoryNotFoundException; +import com.upgrad.FoodOrderingApp.service.exception.RestaurantNotFoundException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; +import java.util.*; + +@RestController// used tp create Restful web services using spring mvc. +@CrossOrigin//for the future use if we want t0 link the frontend to the backend and to avoid the CORS issue +public class RestaurantController { + + @Autowired //control over where and how autowiring should be done with the code. can be on constructors, variable class and its objects + private RestaurantServiceImpl restaurantServiceImpl; + + @Autowired + private AddressServiceImpl addressServiceImpl; + + @Autowired + private StateServiceImpl stateServiceImpl; + + @Autowired + private RestaurantCategoryServiceImpl restaurantCategoryServiceImpl; + + @Autowired + private CategoryServiceImpl categoryServiceImpl; + + @Autowired + private CategoryItemServiceImpl categoryItemServiceImpl; + + @Autowired + private ItemServiceImpl itemServiceImpl; + + //getRestaurantByName endpoint function definition and Request Method type is GET + @RequestMapping(value = "/restaurant/name/{restaurant_name}" , method = RequestMethod.GET) + public ResponseEntity getRestaurantByName(@PathVariable(value="restaurant_name") final String restaurantName) + { + try + { + List restaurantEntityList = restaurantServiceImpl.getRestaurantUsingName(restaurantName); //list type of Restaurant entity defined in serviceEntity + List restaurantListList = new ArrayList<>(); // list which is type of Restaurant List defined in api.model + + String category = new String(); // category type of String + List categories = new ArrayList<>(); // categories list type of string + for (RestaurantEntity restaurantEntity :restaurantEntityList) + { + long restaurantId = restaurantEntity.getId();//fetching the restaurantId from the RestaurantEntity + List restaurantCategoryEntityList = restaurantCategoryServiceImpl.getCategoryByRestaurantId(restaurantId); + for(RestaurantCategoryEntity restaurantCategoryEntity : restaurantCategoryEntityList) + { + + CategoryEntity categoryEntity = categoryServiceImpl.getCategoryUsingId(restaurantCategoryEntity.getCategoryId()); + categories.add(categoryEntity.getCategoryName()); //add category in list of categories + } + + Collections.sort(categories); // sort all the categories + category = categories.toString().substring(1,categories.toString().length()-1); + + AddressEntity addressEntity = addressServiceImpl.getAddressById(restaurantEntity.getAddressId());// fetch address using getAddressById and Store in addressEntity + StateEntity stateEntity =stateServiceImpl.getStateById(addressEntity.getStateId()); // fetch state using getStateById and store in stateEntity + + RestaurantDetailsResponseAddressState restaurantDetailsResponseAddressState = new RestaurantDetailsResponseAddressState().id(UUID.fromString(stateEntity.getUuid())).stateName(stateEntity.getStateName()); //getting id(stateId) , stateName + + // getting id, city , flatBuildNUmber, locality, pincode, state + RestaurantDetailsResponseAddress restaurantDetailsResponseAddress = new RestaurantDetailsResponseAddress().id(UUID.fromString(addressEntity.getUuid())).city(addressEntity.getCity()).flatBuildingName(addressEntity.getFlatBuilNumber()).locality(addressEntity.getLocality()).pincode(addressEntity.getPincode()).state(restaurantDetailsResponseAddressState); + + //getting id, restaurantName,photoUrl,customerRating , averagePrice,numberCustomerRated , address , Categories + RestaurantList restaurantList = new RestaurantList().id(UUID.fromString(restaurantEntity.getUuid())).restaurantName(restaurantEntity.getRestaurantName()).photoURL(restaurantEntity.getPhotoUrl()).customerRating(new BigDecimal(restaurantEntity.getCustomerRating())).averagePrice(restaurantEntity.getAveragePriceForTwo()).numberCustomersRated(restaurantEntity.getNumberOfCustomersRated()).address(restaurantDetailsResponseAddress).categories(category); + + restaurantListList.add(restaurantList); // add restaurantlist in List of Restaurant for final result + } + + RestaurantListResponse restaurantListResponse = new RestaurantListResponse().restaurants(restaurantListList); // object of restaurantList Response and pass list of restaurant + return new ResponseEntity(restaurantListResponse, HttpStatus.OK);// return the list of response to the customer + } + catch (RestaurantNotFoundException exc)//if the constraints are not taken care of or validations not followed then exception is thrown which is caught by the catch block + { + ErrorResponse response = new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()); + return new ResponseEntity(response,HttpStatus.NOT_FOUND); + } + } + // this is getRestaurantById endpoint of RequestMethod of type GET + @RequestMapping(value = "/api/restaurant/{restaurant_id}", method = RequestMethod.GET) + public ResponseEntity getRestaurantById(@PathVariable(value ="restaurant_id") final String restaurantId) + { + try { + + RestaurantEntity restaurantEntity = restaurantServiceImpl.getRestaurantUsingUuid(restaurantId);// get RestaurantUsingId and store in object of RestaurantEntity + List restaurantCategoryEntityList = restaurantCategoryServiceImpl.getCategoryByRestaurantId(restaurantEntity.getId());// list of RestaurantCategoryEntity and find category type by using getCategoryBYRestaurantId + List categories= new ArrayList<>();//list of CategoryEntity type + for(RestaurantCategoryEntity restaurantCategoryEntity : restaurantCategoryEntityList) + { + CategoryEntity categoryEntity = categoryServiceImpl.getCategoryUsingId(restaurantCategoryEntity.getCategoryId()); + categories.add(categoryEntity); + } + List categoryListList = new ArrayList<>(); // list type of categoryList defined in api.model + for(CategoryEntity category : categories) + { + List list = categoryItemServiceImpl.getItemsUsingCategoryId(category.getId()); // list type of categoryItem entity and add items in list using getItemsUsingCategoryId + List itemListList = new ArrayList<>(); + + for(CategoryItemEntity categoryItemEntity :list) + { + + ItemEntity itemEntity = itemServiceImpl.getItemUsingId(categoryItemEntity.getItemId()); //create object of ItemEntity and store items using getItemsById + ItemList itemList =new ItemList().id(UUID.fromString(itemEntity.getUuid())).itemName(itemEntity.getItemName()).price(itemEntity.getPrice()); // getting the id, itemName, price + + if(itemEntity.getType().equals("0")) // if itemType value is 0 + { + itemList.setItemType(ItemList.ItemTypeEnum.VEG); // set Item Type is VEG + } + else if(itemEntity.getType().equals("1")) // if item value is 1 + { + itemList.setItemType(ItemList.ItemTypeEnum.NON_VEG); //set item Type is NONVEG + } + itemListList.add(itemList); // add itemList in list + } + CategoryList categoryList= new CategoryList(); + categoryList.id(UUID.fromString(category.getUuid())).categoryName(category.getCategoryName()).itemList(itemListList);//getting categoryUuid,categoryName, itemList + + categoryListList.add(categoryList); // add in categoryList + } + //sort category using Collections.sort and comparator + Collections.sort(categoryListList, new Comparator() + { + @Override + public int compare(CategoryList o1, CategoryList o2) + { + return o1.getCategoryName().compareTo(o2.getCategoryName()); + } + }); + AddressEntity addressEntity = addressServiceImpl.getAddressById(restaurantEntity.getAddressId());// object of restaurantEntity and getAddressById function + StateEntity stateEntity =stateServiceImpl.getStateById(addressEntity.getStateId()); + RestaurantDetailsResponseAddressState restaurantDetailsResponseAddressState = new RestaurantDetailsResponseAddressState().id(UUID.fromString(stateEntity.getUuid())).stateName(stateEntity.getStateName()); //getting id, stateId, stateName + RestaurantDetailsResponseAddress restaurantDetailsResponseAddress = new RestaurantDetailsResponseAddress().id(UUID.fromString(addressEntity.getUuid())).flatBuildingName(addressEntity.getFlatBuilNumber()).locality(addressEntity.getLocality()).city(addressEntity.getCity()).pincode(addressEntity.getPincode()).state(restaurantDetailsResponseAddressState);//getting id, flatBuildNumber, pincode, locality , city, state + + // getting id, restaurantName, photoUrl, customerRating , average price, average price for two, number of customerRated + RestaurantDetailsResponse restaurantDetailsResponse = new RestaurantDetailsResponse().id(UUID.fromString(restaurantEntity.getUuid())).restaurantName(restaurantEntity.getRestaurantName()).photoURL(restaurantEntity.getPhotoUrl()).customerRating(new BigDecimal(restaurantEntity.getCustomerRating())).averagePrice(restaurantEntity.getAveragePriceForTwo()).numberCustomersRated(restaurantEntity.getNumberOfCustomersRated()).address(restaurantDetailsResponseAddress).categories(categoryListList); + return new ResponseEntity(restaurantDetailsResponse,HttpStatus.FOUND);// return the Response of restaurant and HttpStatus.FOUND + } + catch(RestaurantNotFoundException e)//if the validations are not followed or the constraints are not properly handled then an exception is thrown which is caught by the catch block + { + ErrorResponse response =new ErrorResponse().code(e.getCode()).message(e.getErrorMessage()); + return new ResponseEntity(response,HttpStatus.NOT_FOUND); + } + } + + +} diff --git a/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/exception/RestExceptionHandler.java b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/exception/RestExceptionHandler.java new file mode 100644 index 0000000..73778ae --- /dev/null +++ b/FoodOrderingApp-api/src/main/java/com/upgrad/FoodOrderingApp/api/exception/RestExceptionHandler.java @@ -0,0 +1,65 @@ +package com.upgrad.FoodOrderingApp.api.exception; + +import com.upgrad.FoodOrderingApp.api.model.ErrorResponse; +import com.upgrad.FoodOrderingApp.service.exception.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.context.request.WebRequest; + +@ControllerAdvice +public class RestExceptionHandler { + + @ExceptionHandler(SignUpRestrictedException.class) + public ResponseEntitysignUpRestrictedException(SignUpRestrictedException exc, WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()), HttpStatus.NOT_FOUND); + } + + @ExceptionHandler(AuthenticationFailedException.class) + public ResponseEntityauthenticationFailedException(AuthenticationFailedException exc,WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()),HttpStatus.UNAUTHORIZED); + } + + @ExceptionHandler(UpdateCustomerException.class) + public ResponseEntityupdateCustomerException(UpdateCustomerException exc,WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()),HttpStatus.UNAUTHORIZED); + } + + @ExceptionHandler(CategoryNotFoundException.class) + public ResponseEntityupdateCustomerException(CategoryNotFoundException exc,WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()),HttpStatus.UNAUTHORIZED); + } + + @ExceptionHandler(AddressNotFoundException.class) + public ResponseEntityaddressNotFoundException(AddressNotFoundException exc,WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()),HttpStatus.NOT_FOUND); + } + + @ExceptionHandler(AuthorizationFailedException.class) + public ResponseEntityauthorizationFailedException(AuthorizationFailedException exc,WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()),HttpStatus.NOT_FOUND); + } + + @ExceptionHandler(CustomerNotFoundException.class) + public ResponseEntitycustomerNotFoundException(CategoryNotFoundException exc,WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()),HttpStatus.NOT_FOUND); + } + + @ExceptionHandler(ItemNotFoundException.class) + public ResponseEntityitemNotFoundException(ItemNotFoundException exc,WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()),HttpStatus.NOT_FOUND); + } + + @ExceptionHandler(RestaurantNotFoundException.class) + public ResponseEntityrestaurantNotFoundException(RestaurantNotFoundException exc,WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()),HttpStatus.NOT_FOUND); + } + + @ExceptionHandler(SaveAddressException.class) + public ResponseEntitysaveAddressException(SaveAddressException exc,WebRequest request){ + return new ResponseEntity(new ErrorResponse().code(exc.getCode()).message(exc.getErrorMessage()),HttpStatus.NOT_FOUND); + } + + +} diff --git a/FoodOrderingApp-api/src/main/resources/application.properties b/FoodOrderingApp-api/src/main/resources/application.properties new file mode 100644 index 0000000..65f96cf --- /dev/null +++ b/FoodOrderingApp-api/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port= 8080 \ No newline at end of file diff --git a/FoodOrderingApp-api/src/main/resources/application.yaml b/FoodOrderingApp-api/src/main/resources/application.yaml index 2f2674b..2f23aad 100644 --- a/FoodOrderingApp-api/src/main/resources/application.yaml +++ b/FoodOrderingApp-api/src/main/resources/application.yaml @@ -13,7 +13,7 @@ spring: driverClassName: org.postgresql.Driver url: jdbc:postgresql://localhost:5432/restaurantdb username: postgres - password: password + password: abhishek jpa: properties: diff --git a/FoodOrderingApp-api/target/FoodOrderingApp-api-1.0-SNAPSHOT.jar b/FoodOrderingApp-api/target/FoodOrderingApp-api-1.0-SNAPSHOT.jar index 17ce937..3de6b0d 100644 Binary files a/FoodOrderingApp-api/target/FoodOrderingApp-api-1.0-SNAPSHOT.jar and b/FoodOrderingApp-api/target/FoodOrderingApp-api-1.0-SNAPSHOT.jar differ diff --git a/FoodOrderingApp-api/target/classes/.swagger-codegen-ignore b/FoodOrderingApp-api/target/classes/.swagger-codegen-ignore new file mode 100644 index 0000000..c5fa491 --- /dev/null +++ b/FoodOrderingApp-api/target/classes/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/FoodOrderingApp-api/target/classes/.swagger-codegen/VERSION b/FoodOrderingApp-api/target/classes/.swagger-codegen/VERSION new file mode 100644 index 0000000..a625450 --- /dev/null +++ b/FoodOrderingApp-api/target/classes/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.1 \ No newline at end of file diff --git a/FoodOrderingApp-api/target/classes/META-INF/FoodOrderingApp-api.kotlin_module b/FoodOrderingApp-api/target/classes/META-INF/FoodOrderingApp-api.kotlin_module new file mode 100644 index 0000000..a49347a Binary files /dev/null and b/FoodOrderingApp-api/target/classes/META-INF/FoodOrderingApp-api.kotlin_module differ diff --git a/FoodOrderingApp-api/target/classes/README.md b/FoodOrderingApp-api/target/classes/README.md new file mode 100644 index 0000000..a2e8a9f --- /dev/null +++ b/FoodOrderingApp-api/target/classes/README.md @@ -0,0 +1,18 @@ +# Swagger generated server + +Spring Boot Server + + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. +By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core), you can easily generate a server stub. +This is an example of building a swagger-enabled server in Java using the SpringBoot framework. + +The underlying library integrating swagger to SpringBoot is [springfox](https://github.com/springfox/springfox) + +Start your server as an simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/ + +Change default port value in application.properties \ No newline at end of file diff --git a/FoodOrderingApp-api/target/classes/application.properties b/FoodOrderingApp-api/target/classes/application.properties new file mode 100644 index 0000000..65f96cf --- /dev/null +++ b/FoodOrderingApp-api/target/classes/application.properties @@ -0,0 +1 @@ +server.port= 8080 \ No newline at end of file diff --git a/FoodOrderingApp-api/target/classes/application.yaml b/FoodOrderingApp-api/target/classes/application.yaml index 2f2674b..2f23aad 100644 --- a/FoodOrderingApp-api/target/classes/application.yaml +++ b/FoodOrderingApp-api/target/classes/application.yaml @@ -13,7 +13,7 @@ spring: driverClassName: org.postgresql.Driver url: jdbc:postgresql://localhost:5432/restaurantdb username: postgres - password: password + password: abhishek jpa: properties: diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/AddressController.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/AddressController.class new file mode 100644 index 0000000..2b12473 Binary files /dev/null and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/AddressController.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/CategoryController.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/CategoryController.class new file mode 100644 index 0000000..83d72e8 Binary files /dev/null and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/CategoryController.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/CustomerController.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/CustomerController.class new file mode 100644 index 0000000..39a18b4 Binary files /dev/null and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/CustomerController.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/RestaurantController$1.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/RestaurantController$1.class new file mode 100644 index 0000000..4c9e9c5 Binary files /dev/null and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/RestaurantController$1.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/RestaurantController.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/RestaurantController.class new file mode 100644 index 0000000..357c03e Binary files /dev/null and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/controller/RestaurantController.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/exception/RestExceptionHandler.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/exception/RestExceptionHandler.class new file mode 100644 index 0000000..98d3a76 Binary files /dev/null and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/exception/RestExceptionHandler.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/AddressList.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/AddressList.class index ce4f348..db15bc2 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/AddressList.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/AddressList.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/AddressListState.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/AddressListState.class index 543cbcd..b00b096 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/AddressListState.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/AddressListState.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryDetailsResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryDetailsResponse.class index 0b4f78a..2a9434c 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryDetailsResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryDetailsResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryList.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryList.class index d4a168a..772591c 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryList.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryList.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryListResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryListResponse.class index 8912ef4..268b174 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryListResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/CategoryListResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/DeleteAddressResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/DeleteAddressResponse.class index 85d31a1..c7571ee 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/DeleteAddressResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/DeleteAddressResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/ErrorResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/ErrorResponse.class index ca0614d..00e3d2e 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/ErrorResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/ErrorResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/ItemList.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/ItemList.class index 93b0740..b6eaceb 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/ItemList.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/ItemList.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/LoginResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/LoginResponse.class index 62b28c6..0f3ef52 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/LoginResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/LoginResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/LogoutResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/LogoutResponse.class index 3616176..19c1277 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/LogoutResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/LogoutResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponse.class index 98b8e45..57ed445 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddress.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddress.class index 493755d..e76fc4a 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddress.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddress.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddressState.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddressState.class index 8f64f15..6f6345b 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddressState.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddressState.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantList.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantList.class index 9f58b3a..8e99cee 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantList.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/RestaurantList.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SaveAddressRequest.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SaveAddressRequest.class index ad58929..1209ff2 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SaveAddressRequest.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SaveAddressRequest.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SaveAddressResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SaveAddressResponse.class index d0941f0..3518a31 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SaveAddressResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SaveAddressResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SignupCustomerRequest.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SignupCustomerRequest.class index d7034f1..c1f8d9b 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SignupCustomerRequest.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SignupCustomerRequest.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SignupCustomerResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SignupCustomerResponse.class index 303436d..605bbcc 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SignupCustomerResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/SignupCustomerResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordRequest.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordRequest.class index c0523f8..b7e8cc4 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordRequest.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordRequest.class differ diff --git a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordResponse.class b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordResponse.class index 52c09f3..e701db6 100644 Binary files a/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordResponse.class and b/FoodOrderingApp-api/target/classes/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordResponse.class differ diff --git a/FoodOrderingApp-api/target/classes/io/swagger/api/ApiResponseMessage.class b/FoodOrderingApp-api/target/classes/io/swagger/api/ApiResponseMessage.class index 35f0433..65c12f0 100644 Binary files a/FoodOrderingApp-api/target/classes/io/swagger/api/ApiResponseMessage.class and b/FoodOrderingApp-api/target/classes/io/swagger/api/ApiResponseMessage.class differ diff --git a/FoodOrderingApp-api/target/classes/pom.xml b/FoodOrderingApp-api/target/classes/pom.xml new file mode 100644 index 0000000..8830596 --- /dev/null +++ b/FoodOrderingApp-api/target/classes/pom.xml @@ -0,0 +1,66 @@ + + 4.0.0 + io.swagger + swagger-spring + jar + swagger-spring + 1.0.0 + + 1.8 + ${java.version} + ${java.version} + 2.7.0 + + + org.springframework.boot + spring-boot-starter-parent + 1.5.9.RELEASE + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + javax.validation + validation-api + + + diff --git a/FoodOrderingApp-api/target/classes/src/main/resources/application.properties b/FoodOrderingApp-api/target/classes/src/main/resources/application.properties new file mode 100644 index 0000000..94aed44 --- /dev/null +++ b/FoodOrderingApp-api/target/classes/src/main/resources/application.properties @@ -0,0 +1,5 @@ +springfox.documentation.swagger.v2.path=/api-docs +server.contextPath=/api +server.port=8080 +spring.jackson.date-format=io.swagger.RFC3339DateFormat +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressList.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressList.java index 73e063e..1964c64 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressList.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressList.java @@ -15,7 +15,7 @@ * AddressList */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.040+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.125+05:30") public class AddressList { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressListResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressListResponse.java index 4d2b9e4..96f76f8 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressListResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressListResponse.java @@ -16,7 +16,7 @@ * AddressListResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.040+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.125+05:30") public class AddressListResponse { @JsonProperty("addresses") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressListState.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressListState.java index dfb31ae..5e985f1 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressListState.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/AddressListState.java @@ -14,7 +14,7 @@ * AddressListState */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.040+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.125+05:30") public class AddressListState { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoriesListResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoriesListResponse.java index 692f08a..fd4ffd8 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoriesListResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoriesListResponse.java @@ -16,7 +16,7 @@ * CategoriesListResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") public class CategoriesListResponse { @JsonProperty("categories") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryDetailsResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryDetailsResponse.java index d804263..e55841e 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryDetailsResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryDetailsResponse.java @@ -17,7 +17,7 @@ * CategoryDetailsResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") public class CategoryDetailsResponse { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryList.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryList.java index 36f505d..ba4d7f3 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryList.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryList.java @@ -17,7 +17,7 @@ * CategoryList */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:46.406+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:25.583+05:30") public class CategoryList { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryListResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryListResponse.java index a6cd42d..63fb14a 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryListResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/CategoryListResponse.java @@ -14,7 +14,7 @@ * CategoryListResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") public class CategoryListResponse { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/DeleteAddressResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/DeleteAddressResponse.java index 289515f..8d822e4 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/DeleteAddressResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/DeleteAddressResponse.java @@ -14,7 +14,7 @@ * DeleteAddressResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.040+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.125+05:30") public class DeleteAddressResponse { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/ErrorResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/ErrorResponse.java index 938d127..2bb41e2 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/ErrorResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/ErrorResponse.java @@ -13,7 +13,7 @@ * ErrorResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") public class ErrorResponse { @JsonProperty("code") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/ItemList.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/ItemList.java index 8882bc6..e006d60 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/ItemList.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/ItemList.java @@ -15,7 +15,7 @@ * ItemList */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") public class ItemList { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/LoginResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/LoginResponse.java index 79c0948..9b3a022 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/LoginResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/LoginResponse.java @@ -13,7 +13,7 @@ * LoginResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:44.861+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:24.911+05:30") public class LoginResponse { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/LogoutResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/LogoutResponse.java index 60ccf88..ef5cbfc 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/LogoutResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/LogoutResponse.java @@ -13,7 +13,7 @@ * LogoutResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:44.861+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:24.911+05:30") public class LogoutResponse { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponse.java index 68bb75d..6ab9045 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponse.java @@ -20,7 +20,7 @@ */ @ApiModel(description = "Restaurant details") @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:46.406+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:25.583+05:30") public class RestaurantDetailsResponse { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddress.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddress.java index 5e5f899..9520a5c 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddress.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddress.java @@ -15,7 +15,7 @@ * RestaurantDetailsResponseAddress */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:46.406+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:25.583+05:30") public class RestaurantDetailsResponseAddress { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddressState.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddressState.java index 55669ca..0112756 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddressState.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantDetailsResponseAddressState.java @@ -14,7 +14,7 @@ * RestaurantDetailsResponseAddressState */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:46.406+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:25.583+05:30") public class RestaurantDetailsResponseAddressState { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantList.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantList.java index 77a4945..21214b8 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantList.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantList.java @@ -16,7 +16,7 @@ * RestaurantList */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:46.406+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:25.583+05:30") public class RestaurantList { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantListResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantListResponse.java index e808aed..addf8b4 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantListResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/RestaurantListResponse.java @@ -16,7 +16,7 @@ * RestaurantListResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:46.406+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:25.583+05:30") public class RestaurantListResponse { @JsonProperty("restaurants") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SaveAddressRequest.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SaveAddressRequest.java index aa03713..d034bff 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SaveAddressRequest.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SaveAddressRequest.java @@ -13,7 +13,7 @@ * SaveAddressRequest */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.040+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.125+05:30") public class SaveAddressRequest { @JsonProperty("flat_building_name") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SaveAddressResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SaveAddressResponse.java index 26489db..ed7d9ec 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SaveAddressResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SaveAddressResponse.java @@ -13,7 +13,7 @@ * SaveAddressResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.040+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.125+05:30") public class SaveAddressResponse { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SignupCustomerRequest.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SignupCustomerRequest.java index cbb4a1d..347df03 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SignupCustomerRequest.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SignupCustomerRequest.java @@ -13,7 +13,7 @@ * SignupCustomerRequest */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:44.861+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:24.911+05:30") public class SignupCustomerRequest { @JsonProperty("first_name") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SignupCustomerResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SignupCustomerResponse.java index 116bdd6..e1d8236 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SignupCustomerResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/SignupCustomerResponse.java @@ -13,7 +13,7 @@ * SignupCustomerResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:44.861+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:24.911+05:30") public class SignupCustomerResponse { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordRequest.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordRequest.java index 300fd9e..a2eebb8 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordRequest.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordRequest.java @@ -13,7 +13,7 @@ * UpdatePasswordRequest */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:44.861+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:24.911+05:30") public class UpdatePasswordRequest { @JsonProperty("old_password") diff --git a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordResponse.java b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordResponse.java index d10f150..82fabc1 100644 --- a/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordResponse.java +++ b/FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/UpdatePasswordResponse.java @@ -13,7 +13,7 @@ * UpdatePasswordResponse */ @Validated -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:44.861+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:24.911+05:30") public class UpdatePasswordResponse { @JsonProperty("id") diff --git a/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiException.java b/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiException.java index c266a73..bdcc762 100644 --- a/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiException.java +++ b/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") public class ApiException extends Exception{ private int code; diff --git a/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiOriginFilter.java b/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiOriginFilter.java index 7114c9f..b9b0b8a 100644 --- a/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiOriginFilter.java +++ b/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") public class ApiOriginFilter implements javax.servlet.Filter { @Override diff --git a/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiResponseMessage.java b/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiResponseMessage.java index a069da7..cf88ea6 100644 --- a/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiResponseMessage.java +++ b/FoodOrderingApp-api/target/generated-sources/io/swagger/api/ApiResponseMessage.java @@ -2,7 +2,7 @@ import javax.xml.bind.annotation.XmlTransient; -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") @javax.xml.bind.annotation.XmlRootElement public class ApiResponseMessage { diff --git a/FoodOrderingApp-api/target/generated-sources/io/swagger/api/NotFoundException.java b/FoodOrderingApp-api/target/generated-sources/io/swagger/api/NotFoundException.java index 34ef324..98a0889 100644 --- a/FoodOrderingApp-api/target/generated-sources/io/swagger/api/NotFoundException.java +++ b/FoodOrderingApp-api/target/generated-sources/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") public class NotFoundException extends ApiException { private int code; diff --git a/FoodOrderingApp-api/target/generated-sources/io/swagger/configuration/SwaggerDocumentationConfig.java b/FoodOrderingApp-api/target/generated-sources/io/swagger/configuration/SwaggerDocumentationConfig.java index ec71e8c..5f445fa 100644 --- a/FoodOrderingApp-api/target/generated-sources/io/swagger/configuration/SwaggerDocumentationConfig.java +++ b/FoodOrderingApp-api/target/generated-sources/io/swagger/configuration/SwaggerDocumentationConfig.java @@ -10,7 +10,7 @@ import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; -@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-21T16:13:47.677+05:30") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-04-23T20:02:26.570+05:30") @Configuration public class SwaggerDocumentationConfig { diff --git a/FoodOrderingApp-api/target/maven-archiver/pom.properties b/FoodOrderingApp-api/target/maven-archiver/pom.properties index e4de0a3..8d3bd2c 100644 --- a/FoodOrderingApp-api/target/maven-archiver/pom.properties +++ b/FoodOrderingApp-api/target/maven-archiver/pom.properties @@ -1,4 +1,4 @@ #Created by Apache Maven 3.6.3 +version=1.0-SNAPSHOT groupId=FoodOrderingApp-Backend artifactId=FoodOrderingApp-api -version=1.0-SNAPSHOT diff --git a/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 1a3fbb3..3d0191b 100644 --- a/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -5,6 +5,7 @@ com\upgrad\FoodOrderingApp\api\model\DeleteAddressResponse.class io\swagger\configuration\HomeController.class com\upgrad\FoodOrderingApp\api\model\ItemList$ItemTypeEnum.class com\upgrad\FoodOrderingApp\api\model\UpdatePasswordRequest.class +com\upgrad\FoodOrderingApp\api\controller\AddressController.class io\swagger\api\ApiResponseMessage.class com\upgrad\FoodOrderingApp\api\model\RestaurantDetailsResponseAddress.class com\upgrad\FoodOrderingApp\api\model\CategoryDetailsResponse.class @@ -33,3 +34,4 @@ com\upgrad\FoodOrderingApp\api\model\CategoryList.class com\upgrad\FoodOrderingApp\api\model\CategoryListResponse.class com\upgrad\FoodOrderingApp\api\model\UpdatePasswordResponse.class com\upgrad\FoodOrderingApp\api\model\AddressListState.class +com\upgrad\FoodOrderingApp\api\controller\CustomerController.class diff --git a/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index e1b2ca8..80aa796 100644 --- a/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,33 +1,35 @@ -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\LoginResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\src\main\java\com\upgrad\FoodOrderingApp\api\FoodOrderingAppApiApplication.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\AddressListState.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\UpdatePasswordResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\SignupCustomerRequest.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\DeleteAddressResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\SaveAddressResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\io\swagger\configuration\SwaggerDocumentationConfig.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\io\swagger\RFC3339DateFormat.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\CategoryListResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\SaveAddressRequest.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantDetailsResponseAddress.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\io\swagger\Swagger2SpringBoot.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantDetailsResponseAddressState.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\io\swagger\api\ApiResponseMessage.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\LogoutResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\io\swagger\configuration\HomeController.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantListResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\AddressList.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\UpdatePasswordRequest.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantDetailsResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\io\swagger\api\ApiOriginFilter.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\CategoriesListResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\ItemList.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantList.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\CategoryDetailsResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\CategoryList.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\io\swagger\api\ApiException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\io\swagger\api\NotFoundException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\SignupCustomerResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\AddressListResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\ErrorResponse.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-api\src\main\java\com\upgrad\FoodOrderingApp\api\config\SwaggerConfiguration.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantList.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantDetailsResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\DeleteAddressResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\CategoryList.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\LogoutResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\src\main\java\com\upgrad\FoodOrderingApp\api\FoodOrderingAppApiApplication.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\CategoryListResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\LoginResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\io\swagger\api\NotFoundException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\io\swagger\RFC3339DateFormat.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\UpdatePasswordResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\io\swagger\api\ApiException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\src\main\java\com\upgrad\FoodOrderingApp\api\config\SwaggerConfiguration.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\io\swagger\Swagger2SpringBoot.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\AddressListState.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\CategoriesListResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\SignupCustomerResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\io\swagger\configuration\HomeController.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantDetailsResponseAddressState.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantListResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\SaveAddressRequest.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\AddressList.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\SaveAddressResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\UpdatePasswordRequest.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\io\swagger\configuration\SwaggerDocumentationConfig.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\src\main\java\com\upgrad\FoodOrderingApp\api\controller\CustomerController.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\AddressListResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\io\swagger\api\ApiOriginFilter.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\RestaurantDetailsResponseAddress.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\src\main\java\com\upgrad\FoodOrderingApp\api\controller\AddressController.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\ItemList.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\io\swagger\api\ApiResponseMessage.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\CategoryDetailsResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\ErrorResponse.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-api\target\generated-sources\.\com\upgrad\FoodOrderingApp\api\model\SignupCustomerRequest.java diff --git a/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/FoodOrderingApp-api/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst deleted file mode 100644 index e69de29..0000000 diff --git a/FoodOrderingApp-db/src/main/resources/config/localhost.properties b/FoodOrderingApp-db/src/main/resources/config/localhost.properties index 5c0b5c7..9c00d68 100644 --- a/FoodOrderingApp-db/src/main/resources/config/localhost.properties +++ b/FoodOrderingApp-db/src/main/resources/config/localhost.properties @@ -2,5 +2,5 @@ server.port=5432 server.host=localhost database.name=restaurantdb database.username=postgres -database.password=root +database.password=abhishek diff --git a/FoodOrderingApp-db/target/FoodOrderingApp-db.jar b/FoodOrderingApp-db/target/FoodOrderingApp-db.jar index accabae..2f4bc0d 100644 Binary files a/FoodOrderingApp-db/target/FoodOrderingApp-db.jar and b/FoodOrderingApp-db/target/FoodOrderingApp-db.jar differ diff --git a/FoodOrderingApp-db/target/classes/config/localhost.properties b/FoodOrderingApp-db/target/classes/config/localhost.properties index 5c0b5c7..9c00d68 100644 --- a/FoodOrderingApp-db/target/classes/config/localhost.properties +++ b/FoodOrderingApp-db/target/classes/config/localhost.properties @@ -2,5 +2,5 @@ server.port=5432 server.host=localhost database.name=restaurantdb database.username=postgres -database.password=root +database.password=abhishek diff --git a/FoodOrderingApp-db/target/maven-archiver/pom.properties b/FoodOrderingApp-db/target/maven-archiver/pom.properties index 7d95f6d..6a6ece1 100644 --- a/FoodOrderingApp-db/target/maven-archiver/pom.properties +++ b/FoodOrderingApp-db/target/maven-archiver/pom.properties @@ -1,4 +1,4 @@ #Created by Apache Maven 3.6.3 +version=1.0-SNAPSHOT groupId=FoodOrderingApp-Backend artifactId=FoodOrderingApp-db -version=1.0-SNAPSHOT diff --git a/FoodOrderingApp-db/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/FoodOrderingApp-db/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index e69de29..0000000 diff --git a/FoodOrderingApp-db/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/FoodOrderingApp-db/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst deleted file mode 100644 index e69de29..0000000 diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/AddressService.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/AddressService.java new file mode 100644 index 0000000..0557539 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/AddressService.java @@ -0,0 +1,22 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.entity.AddressEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerAddressEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; +import com.upgrad.FoodOrderingApp.service.entity.StateEntity; +import com.upgrad.FoodOrderingApp.service.exception.AddressNotFoundException; +import com.upgrad.FoodOrderingApp.service.exception.SaveAddressException; + +import java.util.List; + +public interface AddressService { + + AddressEntity saveAddress(AddressEntity addressEntity, final String stateUuid, final CustomerEntity customerEntity) throws SaveAddressException, AddressNotFoundException; + AddressEntity deleteAddress(AddressEntity addressEntity, CustomerAddressEntity customerAddressEntity); + //StateEntity getStateIdByUuid(final String stateUuid) throws AddressNotFoundException ; + List getAllAddresses(final CustomerEntity customerEntity); + //String getStateNameByStateId(final long stateId); + //AddressEntity searchByUuid(final String addressUuid); + //CustomerAddressEntity searchByAddressId(final long addressId); + //AddressEntity getAddressById(final Long addressId); +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/AddressServiceImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/AddressServiceImpl.java new file mode 100644 index 0000000..cbeb9c3 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/AddressServiceImpl.java @@ -0,0 +1,161 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.dao.AddressDao; +import com.upgrad.FoodOrderingApp.service.dao.AddressDaoImpl; +import com.upgrad.FoodOrderingApp.service.dao.CustomerAddressDaoImpl; +import com.upgrad.FoodOrderingApp.service.entity.AddressEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerAddressEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; +import com.upgrad.FoodOrderingApp.service.entity.StateEntity; +import com.upgrad.FoodOrderingApp.service.exception.AddressNotFoundException; +import com.upgrad.FoodOrderingApp.service.exception.SaveAddressException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service//classes that provide some business functionality.It is to mark the class as a service provider +public class AddressServiceImpl implements AddressService{ + + @Autowired + private AddressDao addressDao; + + @Autowired + private AddressDaoImpl addressDaoImpl; + + @Autowired + private CustomerAddressDaoImpl customerAddressDaoImpl; + + //saveAddress implementation and the business logic + @Override + @Transactional(propagation = Propagation.REQUIRED) + public AddressEntity saveAddress(AddressEntity addressEntity, String stateUuid, CustomerEntity customerEntity) throws SaveAddressException, AddressNotFoundException { + + //if(checkFieldIsEmpty(addressEntity,stateUuid)){ + //if(checkFieldIsEmpty(addressEntity, stateUuid)) { + if(addressEntity.getFlatBuilNumber().length()==0||addressEntity.getCity().length()==0||addressEntity.getLocality().length()==0||addressEntity.getPincode().length()==0||stateUuid.length()==0) + {//if one of the fields is empty then this exception is thrown + throw new SaveAddressException("SAR-001", "No field can be empty"); + } + else if(!checkIfPincode(addressEntity)) + { + //if the pincode doesnt match with the constraints given + throw new SaveAddressException("SAR-002","Invalid pincode"); + } + else + { + StateEntity stateEntity=getStateIdByUuid(stateUuid);//getting the stateuuid from the state table + if(stateEntity==null)//if no such stateUuid exists then this particular exception is thrown + { + throw new AddressNotFoundException("ANF-002", "No state by this id"); + } + addressEntity.setStateId(stateEntity.getId()); + addressEntity=addressDao.saveAddress(addressEntity); + + CustomerAddressEntity customerAddressEntity=new CustomerAddressEntity();//creating the object + customerAddressEntity.setCustomerId(customerEntity.getId()); + customerAddressEntity.setAddressId(addressEntity.getId()); + //CustomerAddressDaoImpl.saveCustomerAddress(customerAddressEntity); + customerAddressDaoImpl.saveCustomerAddress(customerAddressEntity); + return addressEntity; + } + } + //function to check if the input field is filled or empty + public boolean checkFieldIsEmpty(final AddressEntity addressEntity,final String stateUuid) + { + /* if(addressEntity.getFlatBuilNumber().length() == 0 || addressEntity.getLocality().length() == 0 || addressEntity.getCity().length() == 0 || addressEntity.getPincode().length()==0||stateUuid.length()==0) + { + return true; + } + else + return false;*/ + + //the constraint was that when saving the addresses in the table no field should be empty + if (addressEntity.getFlatBuilNumber().isEmpty() || addressEntity.getLocality().isEmpty() || addressEntity.getCity().isEmpty() || addressEntity.getPincode().isEmpty() || addressEntity.getUuid().isEmpty()){ + //if(addressEntity.getFlatBuilNumber().length() == 0 || addressEntity.getLocality().length() == 0 ||addressEntity.getCity().length() == 0 || addressEntity.getPincode().length() == 0 || stateUuid.length() == 0) { + return true; + } else { + return false; + } + } + //function to check if the pincode constraint is handled or not + public boolean checkIfPincode(final AddressEntity addressEntity) + { + //the pincode should be of numbers and should be of length 6 only. + /* String pattern="^[0-9]{6}$"; + if(addressEntity.getPincode().matches(pattern)) + { + return true; + } + else + { + return false; + }*/ + final String pin=addressEntity.getPincode(); + try + { + long no=Long.parseLong(pin); + if(pin.length()!=6) + return false; + else + return true; + } + catch (NumberFormatException e) + { + return false; + } + } + + //this is the business logic of deleting the address of the specified accessToken customer along with his/her valid addressId + @Override + @Transactional(propagation = Propagation.REQUIRED) + @Modifying + public AddressEntity deleteAddress(AddressEntity addressEntity, CustomerAddressEntity customerAddressEntity) { + customerAddressDaoImpl.deleteCustomerAddress(customerAddressEntity); + return addressDao.deleteAddress(addressEntity); + } + + //this method returns the state according to the StateUuid + @Transactional(propagation = Propagation.REQUIRED) + public StateEntity getStateIdByUuid(String stateUuid) throws AddressNotFoundException { + return addressDaoImpl.getStateIdByUuid(stateUuid); + } + + //this is the method logic for returning all the addresses of the accessToken specified in the inout field + @Override + @Transactional(propagation = Propagation.REQUIRED) + public List getAllAddresses(CustomerEntity customerEntity) { + return addressDao.getAllAddresses(customerEntity); + } + + + //this returns from the AddressDao the states from it stateId + @Transactional(propagation = Propagation.REQUIRED) + public String getStateNameByStateId(long stateId) { + return addressDao.getStateNameByStateId(stateId); + } + + + //this method returns the addressUuid made + @Transactional(propagation = Propagation.REQUIRED) + public AddressEntity searchByUuid(String addressUuid) { + return addressDao.searchByUuid(addressUuid); + } + + + //this method searches for the addresses using the addressID + @Transactional(propagation = Propagation.REQUIRED) + public CustomerAddressEntity searchByAddressId(long addressId) { + return customerAddressDaoImpl.searchByAddressId(addressId); + } + + + //this method returns address by addressId + @Transactional(propagation = Propagation.REQUIRED) + public AddressEntity getAddressById(Long addressId) { + return addressDao.getAddressById(addressId); + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CategoryItemServiceImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CategoryItemServiceImpl.java new file mode 100644 index 0000000..1ce344b --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CategoryItemServiceImpl.java @@ -0,0 +1,25 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.dao.CategoryItemDaoImpl; +import com.upgrad.FoodOrderingApp.service.entity.CategoryItemEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +public class CategoryItemServiceImpl { + + @Autowired + private CategoryItemDaoImpl categoryItemDaoImpl; + + + //@Transactional(propagation = Propagation.REQUIRED) + @Transactional + public List getItemsUsingCategoryId(final long categoryId){ + return categoryItemDaoImpl.getItemsUsingCategoryId(categoryId); + } + +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CategoryServiceImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CategoryServiceImpl.java new file mode 100644 index 0000000..fe7610c --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CategoryServiceImpl.java @@ -0,0 +1,47 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.dao.CategoryDaoImpl; +import com.upgrad.FoodOrderingApp.service.entity.CategoryEntity; +import com.upgrad.FoodOrderingApp.service.exception.CategoryNotFoundException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +public class CategoryServiceImpl { + + @Autowired + private CategoryDaoImpl categoryDaoImpl; + + @Transactional + public CategoryEntity getCategoryUsingId(final Long categoryId) + { + return categoryDaoImpl.getCategoryUsingId(categoryId); + } + + @Transactional + public CategoryEntity getCategoryUsingUuid(final String categoryUuid) throws CategoryNotFoundException{ + + if(categoryUuid.length()==0) + { + throw new CategoryNotFoundException("CNF-001", "Category id field should not be empty"); + } + CategoryEntity categoryEntity=categoryDaoImpl.getCategoryUsingUuid(categoryUuid); + if(categoryEntity==null) + { + throw new CategoryNotFoundException("CNF-002", "No category by this id"); + } + return categoryEntity; + } + + //@Transactional(propagation = Propagation.REQUIRED) + @Transactional + public List getAllCategories() + { + + return categoryDaoImpl.getAllCategories(); + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CustomerService.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CustomerService.java new file mode 100644 index 0000000..a9d7151 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CustomerService.java @@ -0,0 +1,23 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.entity.CustomerAuthEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; +import com.upgrad.FoodOrderingApp.service.exception.AuthenticationFailedException; +import com.upgrad.FoodOrderingApp.service.exception.AuthorizationFailedException; +import com.upgrad.FoodOrderingApp.service.exception.SignUpRestrictedException; +import com.upgrad.FoodOrderingApp.service.exception.UpdateCustomerException; + +public interface CustomerService { + + CustomerEntity saveCustomer(CustomerEntity customerEntity,String firstName,String lastName,String password,String email,String contactNumber) throws SignUpRestrictedException; + boolean checkIfFieldIsEmpty(final CustomerEntity customerEntity);//signup method validator function + boolean checkEmailPattern(final CustomerEntity customerEntity);//signup method validator function + boolean checkContactNumber(final CustomerEntity customerEntity);//signup method validator function + boolean checkPassword(final CustomerEntity customerEntity);//signup method validator function + CustomerAuthEntity verifyAuthenticate(String contactNumber,String password)throws AuthenticationFailedException;//login method + CustomerEntity getCustomer(final String accessToken) throws AuthorizationFailedException;//login method validator + //CustomerAuthEntity authorization(String access_token) throws AuthorizationFailedException;//logout method + CustomerAuthEntity logout(final String accesstoken)throws AuthorizationFailedException;//logout + //public CustomerEntity getCustomer (final String accessToken) throws AuthorizationFailedException; + CustomerEntity updateCustomerPassword(String oldPassword,String newPassword,CustomerEntity customerEntity)throws UpdateCustomerException; +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CustomerServiceImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CustomerServiceImpl.java new file mode 100644 index 0000000..538d4ff --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/CustomerServiceImpl.java @@ -0,0 +1,389 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.dao.CustomerAuthEntityDao; +import com.upgrad.FoodOrderingApp.service.dao.CustomerAuthEntityDaoImpl; +import com.upgrad.FoodOrderingApp.service.dao.CustomerDao; +import com.upgrad.FoodOrderingApp.service.dao.CustomerDaoImpl; +import com.upgrad.FoodOrderingApp.service.entity.CustomerAuthEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; +import com.upgrad.FoodOrderingApp.service.exception.AuthenticationFailedException; +import com.upgrad.FoodOrderingApp.service.exception.AuthorizationFailedException; +import com.upgrad.FoodOrderingApp.service.exception.SignUpRestrictedException; +import com.upgrad.FoodOrderingApp.service.exception.UpdateCustomerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.time.ZonedDateTime; +import java.util.Base64; +import java.util.UUID; +import java.util.regex.Pattern; + +@Service//classes that provide some business functionality.It is to mark the class as a service provider +public class CustomerServiceImpl implements CustomerService { + + @Autowired + private CustomerDao customerDao;//the dao is Data object model which links from model to controller to view.. + + @Autowired + private CustomerDaoImpl customerDaoImpl; + + @Autowired + private CustomerAuthEntityDaoImpl customerAuthEntityDaoImpl; + + @Autowired + private PasswordCryptographyProvider passwordCryptographyProvider;//for encryption of password we already have in intellij + + //signup implementation and validation function + @Override + @Transactional(propagation = Propagation.REQUIRED)//means of telling your code when it executes that it must have a Transaction. + public CustomerEntity saveCustomer(CustomerEntity customerEntity, String firstname, String lastname, String password, String email, String contactNumber) throws SignUpRestrictedException { + //handle all the validations here if all validations are ok then save in db using Dao + //if the customer exists in the db using the customer column which is also a primary key + CustomerEntity object = customerDao.getCustomerByContactNumber(customerEntity.getContactNumber());//gets the value from CustomerDaoImpl + if (object != null)//this means that there exists in db a customer with the same mobile number so this particular exception thrown + throw new SignUpRestrictedException("SGR-001", "This contact number is already registered! Try other contact number"); + //if (checkIfFieldIsEmpty(customerEntity)) + if(firstname == null || email == null || contactNumber == null ||password == null)//to check whether the fields of all these are empty or not + throw new SignUpRestrictedException("SGR-005", "Except last name all fields should be filled"); + if (!checkEmailPattern(customerEntity))//if the email id is not in the correct format then the exception is thrown + throw new SignUpRestrictedException("SGR-002", "Invalid email-id format!"); + if(!checkContactNumber(customerEntity))//if the contact number is not in correct format then this exception is thrown + throw new SignUpRestrictedException("SGR-003","Invalid contact number!"); + if(!checkPassword(customerEntity))//if password is of wrong format which is explained in the checkPassword method then the particular exception is thrown + throw new SignUpRestrictedException("SGR-004","Weak password!"); + else { + //if there is no such exception and all above conditions are satisfactory then encrypt the password for its safety and security purpos + String[] encryptPassoword = passwordCryptographyProvider.encrypt(customerEntity.getPassword());//this is provided by springboot/hibernate to encrpyt the password + customerEntity.setSalt(encryptPassoword[0]);//setting the salt + customerEntity.setPassword(encryptPassoword[1]);//encrypt password + //salt is an extra layer for better security purpose.an extra layer for defense against hacking + return customerDao.saveCustomer(customerEntity);//data wiill be saved in db now + } + } + @Override + public boolean checkIfFieldIsEmpty(final CustomerEntity customerEntity) + {//this method checks whether the input fields are empty or not if they are empty then the returns true where it is called and exception is thrown + if (customerEntity.getFirstName().length() == 0 || customerEntity.getLastName().length() == 0 || customerEntity.getContactNumber().length() == 0 || customerEntity.getEmailAddress().length() == 0 || customerEntity.getPassword().length() == 0) + return true; + else + return false; + } + + @Override + public boolean checkEmailPattern(final CustomerEntity customerEntity) { + //this method checks that the email pattern is correct according to the constraints specified or not + /* String emailExpression = "^[a-zA-Z0-9_+&*-]+(?:\\." + "[a-zA-Z0-9_+&*-]+)*@" + "(?:[a-zA-Z0-9-]+\\.)+[a-z" + "A-Z]{2,7}$"; + Pattern pattern = Pattern.compile(emailExpression); + if (pattern.matcher(emailExpression).matches()) + return true; + else + return false;*/ + final String email = customerEntity.getEmailAddress(); + return email.contains("@") && email.contains(".") && !email.contains(" ");//it checks whether the email string has @,. and it doesnt have space in it + } + + @Override + public boolean checkContactNumber(CustomerEntity customerEntity) { + //constraint specified is that the contactNumber should be of digits only and it should be of length 10 only and if the constraints are not followed it should throw an exception + String expression = "^[0-9]{10}$";//to check whether the contact number is of 0-9 numbers only and size is 10 + String contact = customerEntity.getContactNumber(); + if( contact.matches(expression)){ + return true; + } + else + return false; + //int number = Integer.parseInt(contact); + //if length of number is less than 10 then return true + /*try { + if (contact.length() != 10) + return false; + else + return true; + } catch (NumberFormatException e) { + return false; + }*/ + } + + @Override + public boolean checkPassword(CustomerEntity customerEntity) { + //the password constraints specified are tht shouldn't be less than 8 characters of length + //it should have atleast 1 uppercase and lowercase alphabet each, shuld have atleast 1 number adn should have atleast 1 special character. + String pass=customerEntity.getPassword(); + if(pass.length()<8||!pass.matches("(?=.*[0-9]).*")||!pass.matches("(?=.*[A-Z]).*")||!pass.matches("(?=.*[~!@#$%^&*()_-]).*")) + return false; + else + return true; + } + + //-----> login logic implementation + @Override + @Transactional(propagation =Propagation.REQUIRED) + public CustomerAuthEntity verifyAuthenticate(String contactNumber, String password) throws AuthenticationFailedException { + //boolean checkData=false; + CustomerEntity customerEntity=customerDaoImpl.getCustomerByContactNumber(contactNumber);//Using customerDaoImpl to find the user based on contact number + if(customerEntity==null)// if contact number provided by customer is not exist in database + throw new AuthenticationFailedException("ATH-001", "This contact number has not been registered!"); + else{ + //verifyauthenticate the user and encrypt the password received from the Customer with the salt added as well + final String encryptedPassword = PasswordCryptographyProvider.encrypt(password, customerEntity.getSalt());//for pssword encryption checker + + if (encryptedPassword.equals(customerEntity.getPassword())) + { + //customer has been authenticated and verified .Now create a JWT token + JwtTokenProvider jwtTokenProvider = new JwtTokenProvider(encryptedPassword); + CustomerAuthEntity customerAuthEntity = new CustomerAuthEntity();//store data and token in db using CustomerAuthEntity + + /*customerAuthEntity = customerDaoImpl.getCustomerAuthEntityTokenByUUID(customerEntity.getUuid()); + if (customerAuthEntity != null) { + checkData = true; + } else { + customerAuthEntity = new CustomerAuthEntity(); + }*/ + + //setting values in the customer_auth table + customerAuthEntity.setUuid(UUID.randomUUID().toString());//set the uuid randomly generated in customer_ath table + customerAuthEntity.setCustomerId(customerEntity.getId());//set the customerid which is the primary key of customer table "id" + final ZonedDateTime now = ZonedDateTime.now();//finding the current login time of customer + final ZonedDateTime expiresAt = now.plusHours(8);//automatic logout time or the time the customer/user can remain logged in + customerAuthEntity.setLoginAt(now);//login time is set in the column at the time of login of customer + customerAuthEntity.setExpiresAt(expiresAt);//setting the max login or the expirytime in db + + //customerAuthEntity.setAccessToken(jwtTokenProvider.generateToken(customerEntity.getUuid(), now, expiresAt)); + String accessToken = jwtTokenProvider.generateToken(customerEntity.getUuid(), now, expiresAt); + customerAuthEntity.setAccessToken(accessToken);//setting the accessToken in the customer_Auth table + customerAuthEntity.setLogoutAt(null); + + // if already uuid so new token generate for existing previous will merge else another user with new token + /* if (checkData) + customerDaoImpl.createAuthToken(customerAuthEntity); + else + customerDaoImpl.updateLoginInfo(customerAuthEntity);*/ + + customerAuthEntityDaoImpl.create(customerAuthEntity);// Persist the CustomerAuthEntity generated, in the database + customerDaoImpl.updateUser(customerEntity);//updating the user/customer value in customer,customer_auth table + return customerAuthEntity;// Return the CustomerAuthEntity generated + + /*customerAuthEntity.setLoginAt(ZonedDateTime.now()); + customerAuthEntity.setExpiresAt(expiresAt); + customerAuthEntity.setAccessToken(jwtTokenProvider.generateToken(customerEntity.getUuid(), now, expiresAt)); + return customerAuthEntity;*/ + + } else { + // if the password does not match with the existing password present in database + throw new AuthenticationFailedException("ATH-002", "Invalid Credentials"); + } + }} + + @Transactional + public CustomerEntity getCustomerByContactNumber(final String contactNumber) { + //runs the method according to the sql queries and returns the value/result of the query + return customerDaoImpl.getCustomerByContactNumber(contactNumber); + } + + @Transactional + public CustomerEntity searchByUuid(final String uuid) { + //runs the method according to the sql queries and returns the value/result of the query + return customerDaoImpl.searchByUuid(uuid); + } + + @Transactional + public CustomerEntity searchById(final long id) { + //runs the method according to the sql queries and returns the value/result of the query + return customerDaoImpl.searchById(id); + } + + + /*//function called in customer controller to check valid format and it returns boolean value + public static boolean validAuthFormat(String authorization) + { + String regexStr = "^[0-9]{10}$"; + byte[] decode = Base64.getDecoder().decode(authorization.split("Basic ")[1]); + String decodedText = new String(decode); + String[] decodedArray = decodedText.split(":"); + String basic = authorization.split("Basic")[1]; + if(contactNumberVerified(decodedArray[0]) && passwordVerified(decodedArray[1]) ){ + return true;} + else {return false;} + } + + // function called in validAuthFormat to verify contact number or ATH-003 + public static boolean contactNumberVerified(String cno) + { + String str= "^[0-9]{10}$"; + if(cno.matches(str)) + return true; + else + return false; + } + // function called in validAuthFormat to verifyPassword + public static boolean passwordVerified(String password) + { + if(password.length()<8 || !password.matches("(?=.*[0-9]).*")|| !password.matches("(?=.*[A-Z]).*")|| !password.matches("(?=.*[~!@#$%^&*()_-]).*")) + return false; + + return true; + } + //-------------->Logout + //checks whether customer has loggedout based on access token + /*@Transactional(propagation = Propagation.REQUIRED) + public CustomerAuthEntity logout(final String access_token) throws AuthorizationFailedException { + CustomerAuthEntity customerAuthEntity = customerDaoImpl.getAuthTokenByAccessToken(access_token); + if (customerAuthEntity == null) { + //if access token provided by the customer not exist in database + throw new AuthorizationFailedException("ATHR-001", "Customer is not Logged in."); + } + else if(customerAuthEntity!=null&&customerAuthEntity.getLoginAt()!=null){ + //if (customerAuthEntity.getLogoutAt() != null) { + throw new AuthorizationFailedException("ATHR-002", "Customer is logged out. Log in again to access this endpoint."); + } + else if (customerAuthEntity!=null && ZonedDateTime.now().isAfter(customerAuthEntity.getExpiresAt())) { + throw new AuthorizationFailedException("ATHR-003", "Your session is expired. Log in again to access this endpoint."); + } + else + { + final ZonedDateTime now=ZonedDateTime.now(); + customerAuthEntity.setLogoutAt(now); + return customerAuthEntity; + } + }*/ + + + //logout implementation and validation + @Transactional(propagation = Propagation.REQUIRED) + public CustomerAuthEntity logout(final String accessToken)throws AuthorizationFailedException + { + //returns the customer with that particular accessToken from the db + CustomerAuthEntity customerAuthEntity = customerAuthEntityDaoImpl.getAuthTokenByAccessToken(accessToken); + if(customerAuthEntity == null) + { + //if access token provided by the customer not exist in database + throw new AuthorizationFailedException("ATHR-001","Customer is not logged in."); + } + if(!isUserLoggedIn(accessToken)) //if the method returns false ie. there is no customer in the db with the accessToken anymore + { + throw new AuthorizationFailedException("ATHR-002", "Customer is logged out. Log in again to access this endpoint."); + } + + if(checkExpiryOfToken(accessToken))//if the expiry time or the max login time has exceeded even though the customer was loggedin he/she gets automatically loggedout + { + throw new AuthorizationFailedException("ATHR-002", "Customer is logged out. Log in again to access this endpoint."); + } + + ZonedDateTime now = ZonedDateTime.now();//getting the current time + long difference = customerAuthEntity.getExpiresAt().compareTo(now);//finding the difference of maxlogin time and current time + if(customerAuthEntity.getLogoutAt() != null)//if the logout is not null + { + throw new AuthorizationFailedException("AUTH-002", "Customer is logged out. Log in again to access this endpoint."); + } + else if (difference < 0) + { + //if the difference is in negative ie. current time-maxLogin or expiry that means the login session has expired and customer is automatically logged out + throw new AuthorizationFailedException("AUTH-003", "Your session is expired. Log in again to access this endpoint."); + } + else + { + customerAuthEntity.setLogoutAt(now);//changiing the logout time + customerAuthEntityDaoImpl.updateCustomer(customerAuthEntity);//changing the values in table + } + return customerAuthEntity; + } + // this function is used to verify the token of customer + @Transactional + public boolean checkExpiryOfToken(final String accessToken) { + CustomerAuthEntity customerAuthEntity = customerAuthEntityDaoImpl.getAuthTokenByAccessToken(accessToken); + if(customerAuthEntity == null) { + return true; + } + ZonedDateTime now = ZonedDateTime.now(); + long diff = customerAuthEntity.getExpiresAt().compareTo(now); + if(diff < 0) + return true; + else + return false; + } + + @Transactional + public boolean isUserLoggedIn(final String accessToken) { + //checking of the customer is still logged in or not + CustomerAuthEntity customerAuthEntity = customerAuthEntityDaoImpl.getAuthTokenByAccessToken(accessToken); + if(customerAuthEntity == null) + return false; + + ZonedDateTime logoutAt = customerAuthEntity.getLogoutAt(); + ZonedDateTime loginAt = customerAuthEntity.getLoginAt(); + if(logoutAt == null) + return true; + + long diff = loginAt.compareTo(logoutAt); + if(diff > 0) + return true; + else + return false; + } + + @Transactional + public CustomerEntity getCustomer (final String accessToken) throws AuthorizationFailedException { + final CustomerAuthEntity customerAuthEntity = customerAuthEntityDaoImpl.getAuthTokenByAccessToken(accessToken); + if(customerAuthEntity == null) { + //if the access token is null ie the customerAuthEntity is null means there is no customer logged in of that particular accessToken + throw new AuthorizationFailedException("ATHR-001", "Customer is not Logged in."); + } + ZonedDateTime now = ZonedDateTime.now(); + long difference = customerAuthEntity.getExpiresAt().compareTo(now); + CustomerEntity customerEntity = customerDaoImpl.searchById(customerAuthEntity.getCustomerId()); + return customerEntity; + } + + + //password updatation method implementation + @Override + @Transactional(propagation = Propagation.REQUIRED) + public CustomerEntity updateCustomerPassword(final String oldPassword,final String newPassword,final CustomerEntity customerEntity)throws UpdateCustomerException { + /*CustomerAuthEntity customerAuthEntity=customerDaoImpl.getAuthTokenByAccessToken(accessToken);//rturns the daoimpl function on the query + CustomerEntity customerEntity=customerAuthEntity.getCustomer();//returns the customer + final String decryptedPassword = passwordCryptographyProvider.encrypt(oldPassword,customerAuthEntity.getCustomer().getSalt());*///to encrypt the password and return the old pasword along with the salt + CustomerEntity customerAuthEntity1=new CustomerEntity(); + final String oldPasswordString=passwordCryptographyProvider.encrypt(oldPassword, customerEntity.getSalt()); + final String newPasswordString=passwordCryptographyProvider.encrypt(oldPassword, customerEntity.getSalt()); + if( oldPassword.length()==0 || newPassword.length()==0 )//if password whether old or new is empty then this exception is thrown + { + throw new UpdateCustomerException("UCR-003", "No field should be empty"); + } + customerAuthEntity1.setPassword(newPassword);//set the new password + /* if(customerAuthEntity==null) + { + //if no customer is in the login state + throw new AuthorizationFailedException("ATHR-001","Customer is not Logged in."); + } + else if(customerAuthEntity!=null&&customerAuthEntity.getLogoutAt()!=null){ + //if the customer has already logged out before + throw new AuthorizationFailedException("ATHR-002","Customer is logged out. Log in again to access this endpoint."); + } + else if(customerAuthEntity!=null && ZonedDateTime.now().isAfter(customerAuthEntity.getExpiresAt())){ + //if his access token time has expired or the time for the person to remain loggedin has exceeded + throw new AuthorizationFailedException("ATHR-003", "Your session is expired. Log in again to access this endpoint."); + }*/ + if(!checkPassword(customerAuthEntity1)){ + //if the new password doesnt match the constraints + throw new UpdateCustomerException("UCR-001","Weak password!"); + } + if(!customerEntity.getPassword().matches(oldPasswordString)) + { + //if the old password stored in db doesnt match with the password u input then this exception is thrown + throw new UpdateCustomerException("UCR-004","Incorrect old password!"); + } + customerEntity.setPassword(newPasswordString);//set the password as new password + customerDaoImpl.updateUser(customerEntity);//make changes into the db + return customerEntity; + /* else + { + //if above all validations constraints are verified and there is no issue then we encrypt the new password along with the salt + String encrpted[]=passwordCryptographyProvider.encrypt(newPassword); + customerEntity.setSalt(encrpted[0]); + customerEntity.setPassword(encrpted[1]); + customerDaoImpl.updateCustomer(customerEntity); + return customerAuthEntity.getCustomer();}*/ + } +} \ No newline at end of file diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/ItemService.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/ItemService.java new file mode 100644 index 0000000..5a57f11 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/ItemService.java @@ -0,0 +1,7 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.entity.ItemEntity; + +public interface ItemService { + public ItemEntity getItemUsingId(final long itemId); +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/ItemServiceImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/ItemServiceImpl.java new file mode 100644 index 0000000..a50c5fb --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/ItemServiceImpl.java @@ -0,0 +1,23 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.dao.ItemDaoImpl; +import com.upgrad.FoodOrderingApp.service.entity.ItemEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class ItemServiceImpl implements ItemService{ + + @Autowired + private ItemDaoImpl itemDaoImpl; + + @Override + //@Transactional(propagation = Propagation.REQUIRED) + @Transactional + public ItemEntity getItemUsingId(final long itemId){ + + return itemDaoImpl.getItemUsingId(itemId); + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryService.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryService.java new file mode 100644 index 0000000..e938a9a --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryService.java @@ -0,0 +1,12 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.entity.RestaurantCategoryEntity; + +import java.util.List; + +public interface RestaurantCategoryService { + + public List getCategoryByRestaurantId(final long rId); + + public List getRestaurantByCategoryId(final long cid); +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryServiceImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryServiceImpl.java new file mode 100644 index 0000000..9098f49 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryServiceImpl.java @@ -0,0 +1,29 @@ +package com.upgrad.FoodOrderingApp.service.businness; + + +import com.upgrad.FoodOrderingApp.service.dao.RestaurantCategoryDaoImpl; +import com.upgrad.FoodOrderingApp.service.entity.RestaurantCategoryEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service// defines that class provides some business fuctionality, used to mark class as a service provider +public class RestaurantCategoryServiceImpl implements RestaurantCategoryService{ + + @Autowired //control where and how autowiring should be done in the code , it can be constructors , variable class etc + private RestaurantCategoryDaoImpl restaurantCategoryDao; + + @Transactional// ask your code that this function executes must have a transaction + public List getCategoryByRestaurantId(final long rId) + { + return restaurantCategoryDao.getCategoriesByRestaurantId(rId); // return value of category using restaurantId + } + + @Transactional + public List getRestaurantByCategoryId(final long cid) + { + return restaurantCategoryDao.getRestaurantByCategoryId(cid); // return restaurant using categoryId + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantService.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantService.java new file mode 100644 index 0000000..2f09db5 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantService.java @@ -0,0 +1,15 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.entity.RestaurantEntity; +import com.upgrad.FoodOrderingApp.service.exception.RestaurantNotFoundException; + +import java.util.List; + +public interface RestaurantService { + + public List getRestaurantUsingName(final String rName) throws RestaurantNotFoundException; + + public RestaurantEntity getRestaurantUsingId(final long rId); + + public RestaurantEntity getRestaurantUsingUuid(final String rUuid) throws RestaurantNotFoundException; +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantServiceImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantServiceImpl.java new file mode 100644 index 0000000..c1e927d --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/RestaurantServiceImpl.java @@ -0,0 +1,54 @@ +package com.upgrad.FoodOrderingApp.service.businness; + + +import com.upgrad.FoodOrderingApp.service.dao.RestaurantDaoImpl; +import com.upgrad.FoodOrderingApp.service.entity.RestaurantEntity; +import com.upgrad.FoodOrderingApp.service.exception.RestaurantNotFoundException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service // class that provide some business functionality , used to mark class as a service provider +public class RestaurantServiceImpl implements RestaurantService { + + @Autowired + private RestaurantDaoImpl restaurantDaoImpl; + + + //function getRestaurantByName and return list type of RestaurantEntity + @Transactional// means of telling your code when it executes that it must have a Transaction. + public List getRestaurantUsingName(final String rName) throws RestaurantNotFoundException + { + if (rName.length()==0) // if length of restaurant name is 0 then throw exception + { + throw new RestaurantNotFoundException("RNF-003","Restaurant name field should not be empty"); + } + else + { + //if it validates then provide value using function defined in restaurantDao + return restaurantDaoImpl.getRestaurantUsingName(rName); + } + } + + @Transactional + public RestaurantEntity getRestaurantUsingId(final long rId) + { + return restaurantDaoImpl.getRestaurantUsingId(rId); // return value using getRestaurantUsingId defined in restaurantDao + } + + @Transactional + public RestaurantEntity getRestaurantUsingUuid(final String rUuid) throws RestaurantNotFoundException + { + if(rUuid.length()==0) // if length of restaurantUuid is 0 then throw exception + { + throw new RestaurantNotFoundException("RNF-002","Restaurant id field should not be empty"); + } + RestaurantEntity restaurantEntity =restaurantDaoImpl.getRestaurantByUuid(rUuid); // object of RestaurantEntity + if (restaurantEntity== null) // if value of restaurantEntity is null then throw exception + throw new RestaurantNotFoundException("RNF-001","No restaurant by this id"); + + return restaurantEntity; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/StateService.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/StateService.java new file mode 100644 index 0000000..5b2fca5 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/StateService.java @@ -0,0 +1,7 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.entity.StateEntity; + +public interface StateService { + StateEntity getStateById(final Long stateId); +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/StateServiceImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/StateServiceImpl.java new file mode 100644 index 0000000..f829574 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/businness/StateServiceImpl.java @@ -0,0 +1,24 @@ +package com.upgrad.FoodOrderingApp.service.businness; + +import com.upgrad.FoodOrderingApp.service.dao.StateDaoImpl; +import com.upgrad.FoodOrderingApp.service.entity.StateEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +@Service//classes that provide some business functionality.It is to mark the class as a service provider +public class StateServiceImpl implements StateService{ + + @Autowired + private StateDaoImpl stateDao; + + //return the stateId according to the stateId passed + @Override + //@Transactional(propagation = Propagation.REQUIRED) + @Transactional + public StateEntity getStateById(Long stateId) + { + return stateDao.getStateById(stateId); + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/AddressDao.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/AddressDao.java new file mode 100644 index 0000000..b074520 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/AddressDao.java @@ -0,0 +1,18 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.AddressEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; +import com.upgrad.FoodOrderingApp.service.entity.StateEntity; + +import java.util.List; + +public interface AddressDao { + AddressEntity saveAddress(AddressEntity addressEntity); + //StateEntity getStateIdByUuid(final String stateUuid); + List getAllAddresses(final CustomerEntity customerEntity); + String getStateNameByStateId(final long stateId); + AddressEntity deleteAddress(AddressEntity addressEntity); + AddressEntity searchByUuid(final String addressUuid); + AddressEntity getAddressById(final Long addressId); + +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/AddressDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/AddressDaoImpl.java new file mode 100644 index 0000000..fc546b2 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/AddressDaoImpl.java @@ -0,0 +1,165 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.AddressEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerAddressEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; +import com.upgrad.FoodOrderingApp.service.entity.StateEntity; +import org.springframework.stereotype.Repository; + +import javax.persistence.*; +import java.util.ArrayList; +import java.util.List; + +@Repository//indicate that the class provides the mechanism for storage, retrieval, search, update and delete operation on objects. +public class AddressDaoImpl implements AddressDao{ + + @PersistenceUnit//set of entities such that for any persistent identity there is a unique entity instance. + private EntityManagerFactory entityManagerFactory; + + @Override + public AddressEntity saveAddress(AddressEntity addressEntity) { + EntityManager entityManager=entityManagerFactory.createEntityManager(); + EntityTransaction transaction=entityManager.getTransaction(); + try + { + transaction.begin(); + entityManager.persist(addressEntity); + transaction.commit(); + } + catch (Exception e) + { + transaction.rollback(); + return null; + } + AddressEntity addressEntity1=searchByUuid(addressEntity.getUuid()); + addressEntity.setId(addressEntity1.getId()); + entityManager.close(); + return addressEntity; + } + + //@Override + public StateEntity getStateIdByUuid(String stateUuid) { + /* EntityManager entityManager = entityManagerFactory.createEntityManager(); + TypedQuery query = entityManager. + createQuery("select u from StateEntity u where u.uuid = :uuid", StateEntity.class); + List list = query.setParameter("uuid", stateUuid).getResultList(); + entityManager.close(); + if(list.size() == 0) + return null; + else + return list.get(0);*/ + EntityManager entityManager = entityManagerFactory.createEntityManager(); + //the query is written which searches for the required in the database + TypedQuery query = entityManager.createQuery("select s from StateEntity s where s.uuid = :uuid", StateEntity.class); + List list = query.setParameter("uuid", stateUuid).getResultList(); + entityManager.close(); + if(list.size() == 0) + return null; + else + return list.get(0); + } + + @Override//this method retruns all the address oof the particular accessToken's customer from the table + public List getAllAddresses(CustomerEntity customerEntity) { + /*EntityManager entityManager = entityManagerFactory.createEntityManager(); + TypedQuery query = entityManager.createQuery("select c from CustomerAddressEntity c where c.customerId = :customerId", CustomerAddressEntity.class); + query.setParameter("customerId", customerEntity.getId()); + List customerAddressEntityList = query.getResultList(); + List list = new ArrayList<>(); + for(CustomerAddressEntity customerAddressEntity : customerAddressEntityList) { + TypedQuery query2 = entityManager.createQuery("select u from AddressEntity u where u.id = :id", AddressEntity.class); + query2.setParameter("id", customerAddressEntity.getAddressId()); + AddressEntity addressEntity = query2.getSingleResult(); + list.add(addressEntity); + } + entityManager.close(); + return list;*/ + EntityManager entityManager = entityManagerFactory.createEntityManager(); + //the query is written which searches for the required in the database + TypedQuery query = entityManager + .createQuery("select c from CustomerAddressEntity c where c.customerId = :customerId", CustomerAddressEntity.class); + query.setParameter("customerId", customerEntity.getId()); + List customerAddressEntityList = query.getResultList(); + List list = new ArrayList<>(); + for(CustomerAddressEntity customerAddressEntity : customerAddressEntityList) { + TypedQuery query2 = entityManager + .createQuery("select a From AddressEntity a where a.id = :id", AddressEntity.class); + query2.setParameter("id", customerAddressEntity.getAddressId()); + AddressEntity addressEntity = query2.getSingleResult(); + list.add(addressEntity); + } + entityManager.close(); + return list; + } + + @Override + public String getStateNameByStateId(long stateId) { + EntityManager entityManager = entityManagerFactory.createEntityManager(); + //the query is written which searches for the required in the database + TypedQuery query = entityManager. + createQuery("select u from StateEntity u where u.id = :id", StateEntity.class); + List list = query.setParameter("id", stateId).getResultList(); + + entityManager.close(); + + if(list.size() == 0) + return null; + else + return list.get(0).getStateName(); + } + + @Override + public AddressEntity deleteAddress(AddressEntity addressEntity) { + EntityManager entityManager = entityManagerFactory.createEntityManager(); + EntityTransaction transaction = entityManager.getTransaction(); + + try { + transaction.begin(); + AddressEntity searched = entityManager.find(AddressEntity.class, addressEntity.getId()); + entityManager.remove(searched); + transaction.commit(); + } + catch (Exception e) + { + transaction.rollback(); + return null; + } + entityManager.close(); + return addressEntity; + } + + @Override + public AddressEntity searchByUuid(String addressUuid) { + EntityManager entityManager=entityManagerFactory.createEntityManager(); + //the query is written which searches for the required in the database + TypedQuery query = entityManager.createQuery("select u from AddressEntity u where u.uuid = :uuid", AddressEntity.class); + List list = query.setParameter("uuid", addressUuid).getResultList(); + entityManager.close(); + if(list.size() == 0) + return null; + else + return list.get(0); + } + + @Override + public AddressEntity getAddressById(Long addressId) { + EntityManager entityManager = entityManagerFactory.createEntityManager(); + List list = new ArrayList<>(); + + try { + //the query is written which searches for the required in the database + TypedQuery query = entityManager.createQuery("Select u from AddressEntity u where u.id = :addressId", AddressEntity.class); + query.setParameter("addressId", addressId); + list = query.getResultList(); + + } catch (Exception e) { + return null; + } + + entityManager.close(); + if(list.size() == 0) + return null; + else + return list.get(0); + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CategoryDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CategoryDaoImpl.java new file mode 100644 index 0000000..cc79067 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CategoryDaoImpl.java @@ -0,0 +1,81 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.CategoryEntity; +import org.springframework.stereotype.Repository; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; +import javax.persistence.TypedQuery; +import java.util.ArrayList; +import java.util.List; + +@Repository +public class CategoryDaoImpl { + + @PersistenceUnit + private EntityManagerFactory entityManagerFactory; + + public CategoryEntity getCategoryUsingId(final Long categoryId) + { + EntityManager entityManager=entityManagerFactory.createEntityManager(); + Listlist=new ArrayList<>(); + try + { + TypedQuery query = entityManager.createQuery("select c from CategoryEntity c where c.id = :categoryId", CategoryEntity.class); + query.setParameter("categoryId", categoryId); + list = query.getResultList(); + } + catch (Exception e) + { + System.out.println(e); + return null; + } + entityManager.close(); + if(list.size() == 0) + return null; + else + return list.get(0); + } + + public CategoryEntity getCategoryUsingUuid(final String categoryUuid){ + EntityManager entityManager=entityManagerFactory.createEntityManager(); + Listlist=new ArrayList<>(); + try + { + TypedQuery query = entityManager.createQuery("select c from CategoryEntity c where c.uuid = :categoryUuid", CategoryEntity.class); + query.setParameter("categoryUuid", categoryUuid); + list = query.getResultList(); + } + catch (Exception e) + { + System.out.println(e); + return null; + } + entityManager.close(); + if(list.size()==0) + return null; + else + return list.get(0); + } + + public List getAllCategories(){ + EntityManager entityManager=entityManagerFactory.createEntityManager(); + Listlist=new ArrayList<>(); + try + { + TypedQuery query = entityManager.createQuery("SELECT c FROM CategoryEntity c ORDER BY c.categoryName", CategoryEntity.class); + list = query.getResultList(); + } + catch (Exception e) + { + System.out.println(e); + return null; + } + entityManager.close(); + /*if(list.size()==0) + return null; + else*/ + return list; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CategoryItemDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CategoryItemDaoImpl.java new file mode 100644 index 0000000..7357a06 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CategoryItemDaoImpl.java @@ -0,0 +1,39 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.CategoryItemEntity; +import org.springframework.stereotype.Repository; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; +import javax.persistence.TypedQuery; +import java.util.ArrayList; +import java.util.List; + +@Repository +public class CategoryItemDaoImpl { + + @PersistenceUnit + private EntityManagerFactory entityManagerFactory; + + public List getItemsUsingCategoryId(final long categoryId) + { + EntityManager entityManager=entityManagerFactory.createEntityManager(); + Listlist=new ArrayList<>(); + try + { + TypedQuery query = entityManager.createQuery("SELECT c FROM CategoryItemEntity c WHERE c.categoryId = :categoryId", CategoryItemEntity.class); + query.setParameter("categoryId", categoryId); + list = query.getResultList(); + + } catch (Exception e) { + System.out.println(e); + return null; + } + entityManager.close(); + /* if(list.size()==0) + return null; + else*/ + return list; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerAddressDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerAddressDaoImpl.java new file mode 100644 index 0000000..b1a58d3 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerAddressDaoImpl.java @@ -0,0 +1,65 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.CustomerAddressEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import javax.persistence.*; +import java.util.List; + +@Repository +public class CustomerAddressDaoImpl { + + @Autowired + private EntityManagerFactory entityManagerFactory; + + @PersistenceContext + private EntityManager entityManager; + + public CustomerAddressEntity searchByAddressId(long addressId) { + EntityManager entityManager = entityManagerFactory.createEntityManager(); + + TypedQuery query = entityManager.createQuery("select c from CustomerAddressEntity c where c.addressId = :addressId", CustomerAddressEntity.class); + List list = query.setParameter("addressId", addressId).getResultList(); + if(list.size() == 0) + return null; + else + return list.get(0); + } + + + public CustomerAddressEntity saveCustomerAddress(CustomerAddressEntity customerAddressEntity) { + EntityManager entityManager = entityManagerFactory.createEntityManager(); + EntityTransaction tx = entityManager.getTransaction(); + + try { + + tx.begin(); + entityManager.persist(customerAddressEntity); + tx.commit(); + + } catch (Exception e) { + tx.rollback(); + return null; + } + return customerAddressEntity; + } + + public CustomerAddressEntity deleteCustomerAddress(CustomerAddressEntity customerAddressEntity) { + EntityManager entityManager = entityManagerFactory.createEntityManager(); + EntityTransaction tx = entityManager.getTransaction(); + + try { + + tx.begin(); + entityManager.remove(customerAddressEntity); + tx.commit(); + } + catch (Exception e) + { + tx.rollback(); + return null; + } + return customerAddressEntity; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDao.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDao.java new file mode 100644 index 0000000..a11041b --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDao.java @@ -0,0 +1,9 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.CustomerAuthEntity; + +public interface CustomerAuthEntityDao { + CustomerAuthEntity create(final CustomerAuthEntity customerAuthEntity); + CustomerAuthEntity updateCustomer(final CustomerAuthEntity customerAuthEntity); + CustomerAuthEntity getAuthTokenByAccessToken(final String accessToken); +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDaoImpl.java new file mode 100644 index 0000000..5a02b02 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDaoImpl.java @@ -0,0 +1,71 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.CustomerAuthEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import javax.persistence.*; +import java.util.List; + +@Repository +public class CustomerAuthEntityDaoImpl implements CustomerAuthEntityDao{ + + @Autowired + private EntityManagerFactory entityManagerFactory; + + @PersistenceContext + private EntityManager entityManager; + + @Override + public CustomerAuthEntity create(CustomerAuthEntity customerAuthEntity) { + EntityManager entityManager = entityManagerFactory.createEntityManager(); + EntityTransaction tx = entityManager.getTransaction(); + try { + tx.begin(); + entityManager.persist(customerAuthEntity); + tx.commit(); + } catch (Exception e) { + tx.rollback(); + System.out.println(e); + return null; + } + return customerAuthEntity; + } + + @Override + public CustomerAuthEntity updateCustomer(CustomerAuthEntity customerAuthEntity) { + EntityManager entityManager = entityManagerFactory.createEntityManager(); + EntityTransaction tx = entityManager.getTransaction(); + + try { + + tx.begin(); + entityManager.merge(customerAuthEntity); + tx.commit(); + System.out.println("customerAuthEntity updated with UUID : " + customerAuthEntity.getUuid()); + + } catch (Exception e) { + tx.rollback(); + System.out.println(e); + return null; + } + return customerAuthEntity; + } + + @Override + public CustomerAuthEntity getAuthTokenByAccessToken(String accessToken) { + EntityManager entityManager = entityManagerFactory.createEntityManager(); + TypedQuery query = entityManager.createQuery("select c from CustomerAuthEntity c where c.accessToken = :accessToken", CustomerAuthEntity.class); + List list = query.setParameter("accessToken", accessToken).getResultList(); + if(list.size() == 0) + return null; + else + return list.get(0); + }/** + try { + return entityManager.createNamedQuery("customerAuthByAccesstoken", CustomerAuthEntity.class).setParameter("accessToken", accessToken).getSingleResult(); + } catch (NoResultException nre) { + return null; + } }*/ + +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerDao.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerDao.java new file mode 100644 index 0000000..69334ea --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerDao.java @@ -0,0 +1,16 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.CustomerAuthEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; + +public interface CustomerDao { + //logic how customer is saved in db + CustomerEntity saveCustomer(CustomerEntity customerEntity); + //CustomerEntity getCustomer(CustomerEntity customerEntity); + CustomerEntity getCustomerByContactNumber(String contactNumber); + //fetch the contactnumber se customer.if exist + //CustomerEntity getCustomer(String contactNumber); + //boolean getCustomer(boolean b); + //CustomerAuthEntity getAuthTokenByAccessToken(String access_token); + +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerDaoImpl.java new file mode 100644 index 0000000..a52d4f2 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/CustomerDaoImpl.java @@ -0,0 +1,141 @@ +package com.upgrad.FoodOrderingApp.service.dao; + + +import com.upgrad.FoodOrderingApp.service.entity.CustomerAuthEntity; +import com.upgrad.FoodOrderingApp.service.entity.CustomerEntity; +import org.springframework.stereotype.Repository; + +import javax.persistence.*; +import java.util.List; + +@Repository//indicate that the class provides the mechanism for storage, retrieval, search, update and delete operation on objects. +public class CustomerDaoImpl implements CustomerDao{ + + @PersistenceContext//set of entities such that for any persistent identity there is a unique entity instance. + private EntityManager entityManager; + + @Override//the method in the interface is implemented here and overridden + public CustomerEntity saveCustomer(CustomerEntity customerEntity) //this method is for signup which will save users/customers int eh db + { + entityManager.persist(customerEntity); + return customerEntity; + } + + public CustomerEntity getCustomerByContactNumber(final String contactNumber) //to check whether there already exists a customer in the db having the same contactnumber + {/* + try { + return entityManager.createNamedQuery("customerByContactNumber", CustomerEntity.class).setParameter("contactNumber", contactNumber).getSingleResult(); + } catch (NoResultException nre) { + return null; + }*/ + + //the query is written which searches for the required in the database + TypedQuery query = entityManager.createQuery("SELECT c from CustomerEntity c where c.contactNumber = :contactNumber", + CustomerEntity.class); + + List list = query.setParameter("contactNumber", contactNumber).getResultList(); + if(list.size() == 0) + return null; + else + return list.get(0); + } + + public CustomerEntity searchById(final long id) { + + TypedQuery query = entityManager.createQuery("SELECT c from CustomerEntity c where c.id = :id", + CustomerEntity.class); + + List list = query.setParameter("id", id).getResultList(); + if(list.size() == 0) + return null; + else + return list.get(0); + + } + + public CustomerAuthEntity createAuthToken(CustomerAuthEntity customerAuthEntity) + { + this.entityManager.persist(customerAuthEntity); + return customerAuthEntity; + } + public CustomerAuthEntity updateCustomer(final CustomerAuthEntity customerAuthEntity) + { + EntityTransaction entityTransaction=entityManager.getTransaction(); + try + { + entityTransaction.begin(); + entityManager.merge(customerAuthEntity); + entityTransaction.commit(); + //System.out.println("customerAuthEntity updated with UUID: "+customerAuthEntity.getUuid()); + } + catch (Exception e) + { + entityTransaction.rollback(); + return null; + } + return customerAuthEntity; + } + public void updateUser(final CustomerEntity customerEntity) { + try { + entityManager.merge(customerEntity); + + } catch (Exception e) { + System.out.println(e); + } + } + + + /*public CustomerAuthEntity getAuthTokenByAccessToken(final String accessToken) { + try { + return entityManager.createNamedQuery("customerAuthByAccesstoken", CustomerAuthEntity.class).setParameter("accessToken", accessToken).getSingleResult(); + } catch (NoResultException nre) { + return null; + } + }*/ + public CustomerAuthEntity updateLoginInfo(final CustomerAuthEntity userAuthEntity) { + try { + entityManager.persist(userAuthEntity); + return userAuthEntity; + } catch (NoResultException nre) { + return null; + } + } + + public CustomerAuthEntity getCustomerAuthEntityTokenByUUID(final String uuid) { + /*try { + return entityManager.createNamedQuery("userAuthTokenByUUID", CustomerAuthEntity.class).setParameter("uuid", UUID).getSingleResult(); + } catch (NoResultException nre) { + return null; + }*/ + TypedQuery query = entityManager.createQuery("SELECT c from CustomerEntity c where c.uuid = :uuid",CustomerEntity.class); + + List list = query.setParameter("uuid", uuid).getResultList(); + if(list.size() == 0) + return null; + try { + return entityManager.createNamedQuery("userAuthTokenByUUID", CustomerAuthEntity.class).setParameter("uuid", uuid).getSingleResult(); + } catch (NoResultException nre) { + return null;} + + } + + public CustomerAuthEntity updateUserLogOut(final CustomerAuthEntity customerAuthEntity) { + try { + return entityManager.merge(customerAuthEntity); + } catch (NoResultException nre) { + return null; + } + } + public CustomerEntity searchByUuid(final String uuid) { + + TypedQuery query = entityManager.createQuery("SELECT c from CustomerEntity c where c.uuid = :uuid",CustomerEntity.class); + + List list = query.setParameter("uuid", uuid).getResultList(); + if(list.size() == 0) + return null; + else + return list.get(0); + } + + +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/ItemDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/ItemDaoImpl.java new file mode 100644 index 0000000..337b7e0 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/ItemDaoImpl.java @@ -0,0 +1,41 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.ItemEntity; +import org.springframework.stereotype.Repository; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; +import javax.persistence.TypedQuery; +import java.util.ArrayList; +import java.util.List; + +@Repository +public class ItemDaoImpl { + + @PersistenceUnit + private EntityManagerFactory entityManagerFactory; + + public ItemEntity getItemUsingId(final long itemId) + { + EntityManager entityManager=entityManagerFactory.createEntityManager(); + Listlist=new ArrayList<>(); + try + { + TypedQuery query = entityManager.createQuery("select i from ItemEntity i where i.id = :itemId", ItemEntity.class); + query.setParameter("itemId", itemId); + list = query.getResultList(); + } + catch (Exception e) + { + System.out.println(e); + return null; + } + entityManager.close(); + if(list.size()==0) + return null; + else + return list.get(0); + } + +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDao.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDao.java new file mode 100644 index 0000000..b99423a --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDao.java @@ -0,0 +1,12 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.RestaurantCategoryEntity; + +import java.util.List; + +public interface RestaurantCategoryDao { + + public List getCategoriesByRestaurantId(final long retaurantId); + + public List getRestaurantByCategoryId(final long categoryId); +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDaoImpl.java new file mode 100644 index 0000000..b5788d7 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDaoImpl.java @@ -0,0 +1,56 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.RestaurantCategoryEntity; +import org.springframework.stereotype.Repository; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.TypedQuery; +import java.util.ArrayList; +import java.util.List; + +@Repository // indicates that the class provide mechanism for storage , retreival , search and delete operation on objects +public class RestaurantCategoryDaoImpl implements RestaurantCategoryDao{ + + @PersistenceContext // set of entity such that for any persistent identity there is unique identity instance + private EntityManager entityManager; + + + // function to get the categories using restaurant id + public List getCategoriesByRestaurantId(final long retaurantId) + { + // list of type RestaurantCategoryEntity + List restaurantCategoryEntityList = new ArrayList<>(); + try + { + // query written for our requirement using database + TypedQuery query= entityManager.createQuery(" SELECT r FROM RestaurantCategoryEntity r WHERE r.restaurantId =:restaurantId",RestaurantCategoryEntity.class); + query.setParameter("restaurantId",retaurantId); + restaurantCategoryEntityList = query.getResultList(); + } + catch (Exception e) + { + return null; + } + entityManager.close(); // closes an entity manager to release its persistence context and other resources + return restaurantCategoryEntityList; + } + + //function to getRestaurantBy the categoryId + public List getRestaurantByCategoryId(final long categoryId) + { + List restaurantCategoryEntityList = new ArrayList<>(); + try + { + TypedQuery query = entityManager.createQuery("SELECT r FROM RestaurantCategoryEntity r WHERE r.categoryId = :categoryId",RestaurantCategoryEntity.class); + query.setParameter("categoryId",categoryId); + restaurantCategoryEntityList = query.getResultList(); + } + catch (Exception ex) + { + return null; + } + entityManager.close(); + return restaurantCategoryEntityList; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantDao.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantDao.java new file mode 100644 index 0000000..d3a7769 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantDao.java @@ -0,0 +1,14 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.RestaurantEntity; + +import java.util.List; + +public interface RestaurantDao { + + public RestaurantEntity getRestaurantUsingId(final long restaurantId); + + public List getRestaurantUsingName(final String restaurantName); + + public RestaurantEntity getRestaurantByUuid(final String restaurantUuid); +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantDaoImpl.java new file mode 100644 index 0000000..afdf5ae --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/RestaurantDaoImpl.java @@ -0,0 +1,82 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.RestaurantEntity; +import org.springframework.stereotype.Repository; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.TypedQuery; +import java.util.ArrayList; +import java.util.List; + +@Repository +public class RestaurantDaoImpl implements RestaurantDao { + + @PersistenceContext //set of entities such that for any persistent identity there is a unique entity instance. + private EntityManager entityManager; + + // function to get Restaurant using the id + public RestaurantEntity getRestaurantUsingId(final long restaurantId) + { + // list of type RestaurantEntity + List restaurantEntityList = new ArrayList<>(); + try + { + // query which used to complete requirement using database + TypedQuery query =entityManager.createQuery("SELECT r from RestaurantEntity WHERE r.id := restaurantId ORDER BY r.restaurantName",RestaurantEntity.class); + query.setParameter("restaurantId",restaurantId); + restaurantEntityList = query.getResultList(); + } + catch (Exception ex) + { + return null; + } + entityManager.close();//closes an entity manager to release its persistence context and other resources + if(restaurantEntityList.size()==0) + return null; + else + return restaurantEntityList.get(0); + } + + // function to get the restaurant using name + public List getRestaurantUsingName(final String restaurantName) + { + // list of type restaurantEntity + List restaurantEntityList= new ArrayList<>(); + String str= "%"+restaurantName.toLowerCase()+"%"; // it converts the restaurant name to lower case + try + { + TypedQuery query = entityManager.createQuery("SELECT r FROM RestaurantEntity r WHERE LOWER(r.restaurantName) LIKE :str ORDER BY r.restaurantName",RestaurantEntity.class); + query.setParameter("str",str); + restaurantEntityList = query.getResultList(); + } + catch (Exception e) + { + return null; + } + entityManager.close(); + return restaurantEntityList; // return the list of restaurantEntity + } + + // function to get the name of restaurant by using Uuid + public RestaurantEntity getRestaurantByUuid(final String restaurantUuid) + { + // list of type restaurant Entity + List restaurantEntityList = new ArrayList<>(); + try + { + TypedQuery query = entityManager.createQuery("SELECT r from RestaurantEntity r WHERE r.uuid =:restaurantUuid",RestaurantEntity.class); + query.setParameter("restaurantUuid",restaurantUuid); + restaurantEntityList = query.getResultList(); + } + catch (Exception x) + { + return null; + } + entityManager.close(); + if(restaurantEntityList.size()==0) + return null; + else + return restaurantEntityList.get(0); + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/StateDao.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/StateDao.java new file mode 100644 index 0000000..0a22040 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/StateDao.java @@ -0,0 +1,8 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.StateEntity; + +public interface StateDao { + StateEntity getStateById(final Long stateId); + +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/StateDaoImpl.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/StateDaoImpl.java new file mode 100644 index 0000000..c5bec9f --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/dao/StateDaoImpl.java @@ -0,0 +1,37 @@ +package com.upgrad.FoodOrderingApp.service.dao; + +import com.upgrad.FoodOrderingApp.service.entity.StateEntity; +import org.springframework.stereotype.Repository; + +import javax.persistence.*; +import java.util.ArrayList; +import java.util.List; + +@Repository//indicate that the class provides the mechanism for storage, retrieval, search, update and delete operation on objects. +public class StateDaoImpl implements StateDao{ + + @PersistenceUnit//set of entities such that for any persistent identity there is a unique entity instance. + private EntityManagerFactory entityManagerFactory; + + @Override + public StateEntity getStateById(Long stateId) { + EntityManager entityManager=entityManagerFactory.createEntityManager(); + Listlist=new ArrayList<>(); + try + { + //the query is written which searches for the required in the database + TypedQueryquery=entityManager.createQuery("select u from StateEntity u where u.id=:stateId",StateEntity.class); + query.setParameter("stateId",stateId); + list=query.getResultList(); + } + catch (Exception exception) + { + return null; + } + entityManager.close(); + if(list.size()==0) + return null; + else + return list.get(0); + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/AddressEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/AddressEntity.java new file mode 100644 index 0000000..e440f7f --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/AddressEntity.java @@ -0,0 +1,116 @@ +package com.upgrad.FoodOrderingApp.service.entity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + + +/*@NamedQueries({ + @NamedQuery(name = "deleteAddressById", query = "delete from AddressEntity a where a.uuid=:addressuuid"), + @NamedQuery(name = "getAddressById", query = "select a from AddressEntity a where a.uuid=:addressuuid") + + @NamedQuery(name = "getAllAddress", query = "select b from CustomerAddressEntity a inner join a.address b where " + + "a.customer = :customer order by b.id desc"), + @NamedQuery(name = "getAddressByUUID", query = "select b from CustomerAddressEntity a inner join a.address b where " + + "b.uuid = :uuid") +})*/ +@Entity +@Table(name = "address") +public class AddressEntity implements Serializable { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "uuid", nullable = false) + private String uuid; + + @Column(name = "flat_buil_number", nullable = false) + private String flatBuilNumber; + + @Column(name = "locality",nullable = false) + private String locality; + + @Column(name = "city",nullable = false) + private String city; + + @Column(name = "pincode",nullable = false) + private String pincode; + + @Column(name = "state_id",nullable = false) + private long stateId; + + //constructor + public AddressEntity() {} + + public AddressEntity(long id, String uuid, String flatBuilNumber, String locality, String city, String pincode, long stateId) { + this.id = id; + this.uuid = uuid; + this.flatBuilNumber = flatBuilNumber; + this.locality = locality; + this.city = city; + this.pincode = pincode; + this.stateId = stateId; + } + + + + + //getter and setters + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getFlatBuilNumber() { + return flatBuilNumber; + } + + public void setFlatBuilNumber(String flatBuilNumber) { + this.flatBuilNumber = flatBuilNumber; + } + + public String getLocality() { + return locality; + } + + public void setLocality(String locality) { + this.locality = locality; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getPincode() { + return pincode; + } + + public void setPincode(String pincode) { + this.pincode = pincode; + } + + public long getStateId() { + return stateId; + } + + public void setStateId(long stateId) { + this.stateId = stateId; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CategoryEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CategoryEntity.java new file mode 100644 index 0000000..44e1e24 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CategoryEntity.java @@ -0,0 +1,55 @@ +package com.upgrad.FoodOrderingApp.service.entity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +@Entity +@Table(name = "CATEGORY") +public class CategoryEntity { + + @Id + @Column(name = "ID") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "UUID") + @NotNull + private String uuid; + + @Column(name = "CATEGORY_NAME") + private String categoryName; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + @Override + public String toString() { + return "CategoryEntity{" + + "id=" + id + + ", uuid='" + uuid + '\'' + + ", categoryName='" + categoryName + '\'' + + '}'; + } + +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CategoryItemEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CategoryItemEntity.java new file mode 100644 index 0000000..c000539 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CategoryItemEntity.java @@ -0,0 +1,61 @@ +package com.upgrad.FoodOrderingApp.service.entity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/* +@NamedQueries({ + @NamedQuery( name = "customerItemByCategoryId", query = "select ci from CategoryItemEntity ci where ci.categoryId = :categoryId") +}) +*/ +@Entity +@Table(name = "category_item") +public class CategoryItemEntity implements Serializable { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "item_id") + @NotNull + private long itemId; + + @Column(name = "category_id") + @NotNull + private long categoryId; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public long getItemId() { + return itemId; + } + + public void setItemId(long itemId) { + this.itemId = itemId; + } + + public long getCategoryId() { + return categoryId; + } + + public void setCategoryId(long categoryId) { + this.categoryId = categoryId; + } + + @Override + public String toString() { + return "CategoryItemEntity{" + + "id=" + id + + ", itemId=" + itemId + + ", categoryId=" + categoryId + + '}'; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CustomerAddressEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CustomerAddressEntity.java new file mode 100644 index 0000000..d5bdea3 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CustomerAddressEntity.java @@ -0,0 +1,54 @@ +package com.upgrad.FoodOrderingApp.service.entity; + + +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + + + +/*@NamedQuery(name = "userByAddress", query = "select a from CustomerAddressEntity a inner join a.address b where " + +"b.uuid = :uuid")*/ +@Entity +@Table(name = "customer_address") +public class CustomerAddressEntity implements Serializable { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "customer_id",nullable = false) + private long customerId; + + @Column(name = "address_id",nullable = false) + private long addressId; + + //getter and setter methods of the variables + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public long getCustomerId() { + return customerId; + } + + public void setCustomerId(long customerId) { + this.customerId = customerId; + } + + public long getAddressId() { + return addressId; + } + + public void setAddressId(long addressId) { + this.addressId = addressId; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CustomerAuthEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CustomerAuthEntity.java new file mode 100644 index 0000000..3471f50 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CustomerAuthEntity.java @@ -0,0 +1,122 @@ +package com.upgrad.FoodOrderingApp.service.entity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.time.ZonedDateTime; + + +/*@NamedQueries({ + // @NamedQuery(name = "searchByUuid", query = "select c from CustomerAuthEntity c where c.uuid = :uuid"), + @NamedQuery(name = "customerAuthByAccesstoken", query = "select c from CustomerAuthEntity c where c.accessToken = :accessToken") +})*/ +@Entity +@Table(name = "customer_auth") +public class CustomerAuthEntity implements Serializable { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "UUID", nullable = false) + private String uuid; + + /* @ManyToOne + @JoinColumn(name = "customer_id") + private CustomerEntity customer;*/ + + @Column(name = "customer_id") + @NotNull + private long customerId; + + @Column(name = "access_token",length = 500, nullable = false) + private String accessToken; + + @Column(name = "EXPIRES_AT", nullable = false) + private ZonedDateTime expiresAt; + + @Column(name = "login_at", nullable = false) + private ZonedDateTime loginAt; + + @Column(name = "logout_at") + private ZonedDateTime logoutAt; + + /* public CustomerAuthEntity() {} + */ + + /* public CustomerAuthEntity(String uuid, CustomerEntity customer, String accessToken,ZonedDateTime expiresAt,ZonedDateTime loginAt, ZonedDateTime logoutAt) { + this.uuid = uuid; + this.customer = customer; + this.accessToken = accessToken; + this.expiresAt = expiresAt; + this.loginAt = loginAt; + this.logoutAt = logoutAt; + }*/ + + public long getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /* public CustomerEntity getCustomer() { + return customer; + } + + + public void setCustomer(CustomerEntity customer) { + this.customer = customer; + } +*/ + + public long getCustomerId() { + return customerId; + } + + public void setCustomerId(long customerId) { + this.customerId = customerId; + } + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public ZonedDateTime getExpiresAt() { + return expiresAt; + } + + public void setExpiresAt(ZonedDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public ZonedDateTime getLoginAt() { + return loginAt; + } + + public void setLoginAt(ZonedDateTime loginAt) { + this.loginAt = loginAt; + } + + public ZonedDateTime getLogoutAt() { + return logoutAt; + } + + public void setLogoutAt(ZonedDateTime logoutAt) { + this.logoutAt = logoutAt; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CustomerEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CustomerEntity.java new file mode 100644 index 0000000..bb98e69 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/CustomerEntity.java @@ -0,0 +1,141 @@ +package com.upgrad.FoodOrderingApp.service.entity; + +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/*@Entity//specifies that the class is an entity and is mapped to a database table +@Table(name="CUSTOMER")//tells us in which table in the database we have to go +@NamedQueries( + { + //statically defined query with a predefined unchangeable query string. + @NamedQuery(name = "customerByContactNumber", query = "select u from CustomerEntity u where u.contactNumber =:contactNumber"), + @NamedQuery(name = "searchById",query = "Select c from CustomerEntity c where c.id = :id"), + @NamedQuery(name = "UserQueryByPassword",query = "select c from CustomerEntity c where c.contactNumber=:contactNumber and c.password=:password") + } +)*/ +@Entity +@Table(name = "CUSTOMER") +public class CustomerEntity implements Serializable { + + @Id//member field below is the primary key of current entity. + @Column(name = "id")//the name of the column of the table + @GeneratedValue(strategy = GenerationType.IDENTITY)//configure the way of increment of the specified column(field)/how the primary key should be generated + private long id; + + @Column(name="uuid",nullable = false) + private String uuid; + + @Column(name = "firstname",nullable = false) + private String firstName; + + @Column(name = "lastname",nullable = false) + private String lastName; + + @Column(name = "email",nullable = false) + private String emailAddress; + + @Column(name = "password",nullable = false) + private String password; + + @Column(name = "contact_number",nullable = false) + private String contactNumber; + + @Column(name = "salt",nullable = false) + private String salt; + + //constructor + public CustomerEntity(){ + + } + //getter setter of all the variables + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getContactNumber() { + return contactNumber; + } + + public void setContactNumber(String contactNumber) { + this.contactNumber = contactNumber; + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(this).hashCode(); + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + } + + @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) + private List address = new ArrayList(); + + public List getAddress() { + return address; + } + + public void setAddress(List address) { + this.address = address; + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/ItemEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/ItemEntity.java new file mode 100644 index 0000000..ac310ba --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/ItemEntity.java @@ -0,0 +1,97 @@ +package com.upgrad.FoodOrderingApp.service.entity; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + + +/* +@NamedQueries({ + @NamedQuery(name = "getAllItems", query = "select i from ItemEntity i") +}) +*/ +@Entity +@Table(name = "item") +public class ItemEntity implements Serializable { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "uuid") + @NotNull + private String uuid; + + @Column(name = "item_name") + @NotNull + private String ItemName; + + @Column(name = "price") + @NotNull + private int price; + + @Column(name = "type") + @NotNull + private String type; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getItemName() { + return ItemName; + } + + public void setItemName(String itemName) { + ItemName = itemName; + } + + public int getPrice() { + return price; + } + + public void setPrice(int price) { + this.price = price; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object obj) { + return new EqualsBuilder().append(this, obj).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(this).hashCode(); + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + } +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantCategoryEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantCategoryEntity.java new file mode 100644 index 0000000..48733b1 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantCategoryEntity.java @@ -0,0 +1,55 @@ +package com.upgrad.FoodOrderingApp.service.entity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +@Entity +@Table(name = "RESTAURANT_CATEGORY") +public class RestaurantCategoryEntity { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "restaurant_id") + @NotNull + private long restaurantId; + + @Column(name = "category_id") + @NotNull + private long categoryId; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public long getRestaurantId() { + return restaurantId; + } + + public void setRestaurantId(long restaurantId) { + this.restaurantId = restaurantId; + } + + public long getCategoryId() { + return categoryId; + } + + public void setCategoryId(long categoryId) { + this.categoryId = categoryId; + } + + @Override + public String toString() { + return "RestaurantCategoryEntity{" + + "id=" + id + + ", restaurantId=" + restaurantId + + ", categoryId=" + categoryId + + '}'; + } +} \ No newline at end of file diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantEntity.java new file mode 100644 index 0000000..46690c0 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantEntity.java @@ -0,0 +1,108 @@ +package com.upgrad.FoodOrderingApp.service.entity; + + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +@Entity +@Table(name ="RESTAURANT") +public class RestaurantEntity { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "uuid") + @NotNull + private String uuid; + + @Column(name = "restaurant_name") + @NotNull + private String restaurantName; + + @Column(name = "photo_url") + private String photoUrl; + + @Column(name = "customer_rating") + @NotNull + private float customerRating; + + @Column(name = "average_price_for_two") + @NotNull + private int averagePriceForTwo; + + @Column(name = "number_of_customers_rated") + @NotNull + private int numberOfCustomersRated; + + @Column(name = "address_id") + @NotNull + private long addressId; + + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getRestaurantName() { + return restaurantName; + } + + public void setRestaurantName(String restaurantName) { + this.restaurantName = restaurantName; + } + + public String getPhotoUrl() { + return photoUrl; + } + + public void setPhotoUrl(String photoUrl) { + this.photoUrl = photoUrl; + } + + public float getCustomerRating() { + return customerRating; + } + + public void setCustomerRating(float customerRating) { + this.customerRating = customerRating; + } + + public int getAveragePriceForTwo() { + return averagePriceForTwo; + } + + public void setAveragePriceForTwo(int averagePriceForTwo) { + this.averagePriceForTwo = averagePriceForTwo; + } + + public int getNumberOfCustomersRated() { + return numberOfCustomersRated; + } + + public void setNumberOfCustomersRated(int numberOfCustomersRated) { + this.numberOfCustomersRated = numberOfCustomersRated; + } + + public long getAddressId() { + return addressId; + } + + public void setAddressId(long addressId) { + this.addressId = addressId; + } + +} diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantItemEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantItemEntity.java new file mode 100644 index 0000000..8ba38a5 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/RestaurantItemEntity.java @@ -0,0 +1,35 @@ +package com.upgrad.FoodOrderingApp.service.entity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +@Entity +@Table(name = "RESTAURANT_ITEM") +public class RestaurantItemEntity { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "restaurant_id") + @NotNull + private int restaurantId; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public int getRestaurantId() { + return restaurantId; + } + + public void setRestaurantId(int restaurantId) { + this.restaurantId = restaurantId; + } +} + diff --git a/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/StateEntity.java b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/StateEntity.java new file mode 100644 index 0000000..4bad581 --- /dev/null +++ b/FoodOrderingApp-service/src/main/java/com/upgrad/FoodOrderingApp/service/entity/StateEntity.java @@ -0,0 +1,61 @@ +package com.upgrad.FoodOrderingApp.service.entity; + +import javax.persistence.*; +import java.io.Serializable; + + +/*@NamedQueries({ + + @NamedQuery(name = "getStateByUUID", query = "select s from StateEntity s where s.uuid =:uuid"), + @NamedQuery(name = "getAllStates", query = "select s from StateEntity s") +})*/ +@Entity +@Table(name = "state") +public class StateEntity implements Serializable { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + @Column(name = "uuid", nullable = false) + private String uuid; + + @Column(name = "state_name", nullable = false) + private String stateName; + + + //constructor + public StateEntity() { + } + + public StateEntity(long id, String uuid, String stateName) { + this.id = id; + this.uuid = uuid; + this.stateName = stateName; + } + //getter and setter functions + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getStateName() { + return stateName; + } + + public void setStateName(String stateName) { + this.stateName = stateName; + } +} diff --git a/FoodOrderingApp-service/target/FoodOrderingApp-service-1.0-SNAPSHOT.jar b/FoodOrderingApp-service/target/FoodOrderingApp-service-1.0-SNAPSHOT.jar index 5ec73dc..688fa38 100644 Binary files a/FoodOrderingApp-service/target/FoodOrderingApp-service-1.0-SNAPSHOT.jar and b/FoodOrderingApp-service/target/FoodOrderingApp-service-1.0-SNAPSHOT.jar differ diff --git a/FoodOrderingApp-service/target/classes/META-INF/FoodOrderingApp-service.kotlin_module b/FoodOrderingApp-service/target/classes/META-INF/FoodOrderingApp-service.kotlin_module new file mode 100644 index 0000000..a49347a Binary files /dev/null and b/FoodOrderingApp-service/target/classes/META-INF/FoodOrderingApp-service.kotlin_module differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/AddressService.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/AddressService.class new file mode 100644 index 0000000..e7f221b Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/AddressService.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/AddressServiceImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/AddressServiceImpl.class new file mode 100644 index 0000000..5f95c8d Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/AddressServiceImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CategoryItemServiceImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CategoryItemServiceImpl.class new file mode 100644 index 0000000..96c8b95 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CategoryItemServiceImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CategoryServiceImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CategoryServiceImpl.class new file mode 100644 index 0000000..f4af741 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CategoryServiceImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CustomerService.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CustomerService.class new file mode 100644 index 0000000..8b53c06 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CustomerService.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CustomerServiceImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CustomerServiceImpl.class new file mode 100644 index 0000000..f2ca41a Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/CustomerServiceImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/ItemService.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/ItemService.class new file mode 100644 index 0000000..81e1c64 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/ItemService.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/ItemServiceImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/ItemServiceImpl.class new file mode 100644 index 0000000..766edc5 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/ItemServiceImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/JwtTokenProvider.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/JwtTokenProvider.class index fb93475..0a585e7 100644 Binary files a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/JwtTokenProvider.class and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/JwtTokenProvider.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryService.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryService.class new file mode 100644 index 0000000..0bc7d55 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryService.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryServiceImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryServiceImpl.class new file mode 100644 index 0000000..f0ba642 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantCategoryServiceImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantService.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantService.class new file mode 100644 index 0000000..3af3b74 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantService.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantServiceImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantServiceImpl.class new file mode 100644 index 0000000..7cb7d14 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/RestaurantServiceImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/StateService.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/StateService.class new file mode 100644 index 0000000..d40b047 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/StateService.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/StateServiceImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/StateServiceImpl.class new file mode 100644 index 0000000..836084c Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/businness/StateServiceImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/AddressDao.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/AddressDao.class new file mode 100644 index 0000000..787bd38 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/AddressDao.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/AddressDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/AddressDaoImpl.class new file mode 100644 index 0000000..5cfed1b Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/AddressDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CategoryDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CategoryDaoImpl.class new file mode 100644 index 0000000..40fd0e9 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CategoryDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CategoryItemDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CategoryItemDaoImpl.class new file mode 100644 index 0000000..7e6df77 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CategoryItemDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerAddressDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerAddressDaoImpl.class new file mode 100644 index 0000000..07314a2 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerAddressDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDao.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDao.class new file mode 100644 index 0000000..a6c735d Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDao.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDaoImpl.class new file mode 100644 index 0000000..9006d76 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerAuthEntityDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerDao.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerDao.class new file mode 100644 index 0000000..2664145 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerDao.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerDaoImpl.class new file mode 100644 index 0000000..c2eb4da Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/CustomerDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/ItemDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/ItemDaoImpl.class new file mode 100644 index 0000000..e309450 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/ItemDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDao.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDao.class new file mode 100644 index 0000000..0586d0a Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDao.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDaoImpl.class new file mode 100644 index 0000000..d8ddd15 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantCategoryDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantDao.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantDao.class new file mode 100644 index 0000000..753b698 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantDao.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantDaoImpl.class new file mode 100644 index 0000000..682aeaf Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/RestaurantDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/StateDao.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/StateDao.class new file mode 100644 index 0000000..fef7853 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/StateDao.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/StateDaoImpl.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/StateDaoImpl.class new file mode 100644 index 0000000..4b450f0 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/dao/StateDaoImpl.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/AddressEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/AddressEntity.class new file mode 100644 index 0000000..d395040 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/AddressEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CategoryEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CategoryEntity.class new file mode 100644 index 0000000..0013fdb Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CategoryEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CategoryItemEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CategoryItemEntity.class new file mode 100644 index 0000000..298b422 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CategoryItemEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CustomerAddressEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CustomerAddressEntity.class new file mode 100644 index 0000000..9ec45c5 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CustomerAddressEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CustomerAuthEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CustomerAuthEntity.class new file mode 100644 index 0000000..a718e64 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CustomerAuthEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CustomerEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CustomerEntity.class new file mode 100644 index 0000000..8154c4f Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/CustomerEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/ItemEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/ItemEntity.class new file mode 100644 index 0000000..71fe7fc Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/ItemEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/RestaurantCategoryEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/RestaurantCategoryEntity.class new file mode 100644 index 0000000..129c539 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/RestaurantCategoryEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/RestaurantEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/RestaurantEntity.class new file mode 100644 index 0000000..4a2da2e Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/RestaurantEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/RestaurantItemEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/RestaurantItemEntity.class new file mode 100644 index 0000000..a2f33d8 Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/RestaurantItemEntity.class differ diff --git a/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/StateEntity.class b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/StateEntity.class new file mode 100644 index 0000000..de85e3b Binary files /dev/null and b/FoodOrderingApp-service/target/classes/com/upgrad/FoodOrderingApp/service/entity/StateEntity.class differ diff --git a/FoodOrderingApp-service/target/maven-archiver/pom.properties b/FoodOrderingApp-service/target/maven-archiver/pom.properties index a6f5d8f..5f7326f 100644 --- a/FoodOrderingApp-service/target/maven-archiver/pom.properties +++ b/FoodOrderingApp-service/target/maven-archiver/pom.properties @@ -1,4 +1,4 @@ #Created by Apache Maven 3.6.3 +version=1.0-SNAPSHOT groupId=FoodOrderingApp-Backend artifactId=FoodOrderingApp-service -version=1.0-SNAPSHOT diff --git a/FoodOrderingApp-service/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/FoodOrderingApp-service/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index eb7c2a0..8e07cdf 100644 --- a/FoodOrderingApp-service/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/FoodOrderingApp-service/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,17 +1,30 @@ -com\upgrad\FoodOrderingApp\service\exception\CustomerNotFoundException.class +com\upgrad\FoodOrderingApp\service\businness\CustomerServiceImpl.class com\upgrad\FoodOrderingApp\service\exception\ItemNotFoundException.class com\upgrad\FoodOrderingApp\service\exception\AuthenticationFailedException.class -com\upgrad\FoodOrderingApp\service\businness\JwtTokenProvider.class +com\upgrad\FoodOrderingApp\service\entity\AddressEntity.class +com\upgrad\FoodOrderingApp\service\dao\CustomerDao.class com\upgrad\FoodOrderingApp\service\businness\PasswordCryptographyProvider.class +com\upgrad\FoodOrderingApp\service\dao\AddressDao.class +com\upgrad\FoodOrderingApp\service\dao\AddressDaoImpl.class +com\upgrad\FoodOrderingApp\service\entity\CustomerEntity.class +com\upgrad\FoodOrderingApp\service\exception\UpdateCustomerException.class +com\upgrad\FoodOrderingApp\service\exception\SignUpRestrictedException.class +com\upgrad\FoodOrderingApp\service\exception\SaveAddressException.class +com\upgrad\FoodOrderingApp\service\dao\CustomerDaoImpl.class +com\upgrad\FoodOrderingApp\service\exception\AuthorizationFailedException.class +com\upgrad\FoodOrderingApp\service\businness\AddressServiceImpl.class +com\upgrad\FoodOrderingApp\service\exception\CategoryNotFoundException.class +com\upgrad\FoodOrderingApp\service\entity\StateEntity.class +com\upgrad\FoodOrderingApp\service\exception\CustomerNotFoundException.class +com\upgrad\FoodOrderingApp\service\businness\AddressService.class +com\upgrad\FoodOrderingApp\service\entity\CustomerAddressEntity.class +com\upgrad\FoodOrderingApp\service\businness\JwtTokenProvider.class com\upgrad\FoodOrderingApp\service\common\ErrorCode.class com\upgrad\FoodOrderingApp\service\ServiceConfiguration.class com\upgrad\FoodOrderingApp\service\common\GenericErrorCode.class com\upgrad\FoodOrderingApp\service\exception\RestaurantNotFoundException.class com\upgrad\FoodOrderingApp\service\common\ItemType.class -com\upgrad\FoodOrderingApp\service\exception\UpdateCustomerException.class -com\upgrad\FoodOrderingApp\service\exception\SignUpRestrictedException.class -com\upgrad\FoodOrderingApp\service\exception\SaveAddressException.class -com\upgrad\FoodOrderingApp\service\exception\AuthorizationFailedException.class +com\upgrad\FoodOrderingApp\service\businness\CustomerService.class com\upgrad\FoodOrderingApp\service\exception\AddressNotFoundException.class com\upgrad\FoodOrderingApp\service\common\UnexpectedException.class -com\upgrad\FoodOrderingApp\service\exception\CategoryNotFoundException.class +com\upgrad\FoodOrderingApp\service\entity\CustomerAuthEntity.class diff --git a/FoodOrderingApp-service/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/FoodOrderingApp-service/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 011df30..18f9d41 100644 --- a/FoodOrderingApp-service/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/FoodOrderingApp-service/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,17 +1,30 @@ -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\businness\JwtTokenProvider.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\ServiceConfiguration.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\SaveAddressException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\common\ErrorCode.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\common\GenericErrorCode.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\AuthorizationFailedException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\AuthenticationFailedException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\SignUpRestrictedException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\common\ItemType.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\CustomerNotFoundException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\ItemNotFoundException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\CategoryNotFoundException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\businness\PasswordCryptographyProvider.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\UpdateCustomerException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\RestaurantNotFoundException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\common\UnexpectedException.java -G:\SEM 6\Backend\FoodOrderingAppBackend -College-STUB\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\AddressNotFoundException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\entity\CustomerEntity.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\UpdateCustomerException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\businness\CustomerServiceImpl.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\AuthenticationFailedException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\common\UnexpectedException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\businness\JwtTokenProvider.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\ServiceConfiguration.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\dao\AddressDaoImpl.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\common\GenericErrorCode.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\CustomerNotFoundException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\SignUpRestrictedException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\common\ErrorCode.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\entity\CustomerAddressEntity.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\entity\CustomerAuthEntity.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\entity\AddressEntity.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\SaveAddressException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\entity\StateEntity.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\businness\CustomerService.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\businness\PasswordCryptographyProvider.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\ItemNotFoundException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\businness\AddressServiceImpl.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\CategoryNotFoundException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\businness\AddressService.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\AuthorizationFailedException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\dao\CustomerDao.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\AddressNotFoundException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\exception\RestaurantNotFoundException.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\dao\CustomerDaoImpl.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\common\ItemType.java +K:\ZomatoApp\FoodOrderApp\FoodOrderingApp-service\src\main\java\com\upgrad\FoodOrderingApp\service\dao\AddressDao.java