Skip to content
Snippets Groups Projects
Commit cabd504f authored by Seb Barnard's avatar Seb Barnard :speech_balloon:
Browse files

Added some javadocs to explain code function

parent 0e3a9bdd
No related branches found
No related tags found
5 merge requests!56tags will be saved to userFavTags table (needs user ID of current logged in user),!39Develop,!33Develop,!32Branch Update,!31Merging almost finished product, needs sessions to be complete for testing
......@@ -10,6 +10,10 @@ public class UserFavouriteDeleter {
@Autowired
JdbcTemplate jdbc;
/**
* Takes a userfavourite DTO and removes it from the database.
* @param usfDTO
*/
public void delete(UserFavouriteDTO usfDTO){
String query = "DELETE FROM User_Shop_Links WHERE (Shop_Id = " +
......
......@@ -10,6 +10,10 @@ public class UserFavouriteSaver {
@Autowired
JdbcTemplate jdbc;
/**
* Takes a user dto and saves it to the DB with jdbc
* @param urfDTO UserfavouriteDTO
*/
public void save(UserFavouriteDTO urfDTO){
String query = "INSERT INTO User_Shop_Links (Shop_Id, User_Id) VALUES ("+ urfDTO.getShopId() +
......
......@@ -14,6 +14,12 @@ public class UserFavouriteToggle {
@Autowired
JdbcTemplate jdbc;
/**
* Checks whether the user has already favourited a shop
* @param urfDTO, Userfavourite DTO
* @return Boolean, true if it's already favourited false if not.
* @throws Exception
*/
public boolean alreadyInDb(UserFavouriteDTO urfDTO) throws Exception{
String query = "SELECT s.User_Shop_Link_Id FROM User_Shop_Links s WHERE (Shop_Id = " +
......
......@@ -19,6 +19,12 @@ public class BusinessFavouriter {
deleteFavourite = ufd;
}
/**
*
* @param Submitted form, contains a UserID and ShopID
* @return ERROR or OK depending on whether it any errors are thrown.
*/
@PostMapping("/favouriteBusiness")
public String favouriteBusiness(UserFavouriteForm uff){
UserFavouriteDTO ufDTO = new UserFavouriteDTO(uff);
......
function favouriteBusiness(e,shopId){
if(e.classList.contains("active")){
e.classList.remove("active")
}else{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment