-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
favorites services and ralational integration added
- Loading branch information
Showing
8 changed files
with
335 additions
and
260 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
import React from "react"; | ||
import axios from "axios"; | ||
|
||
const FAVORITES_API_BASE_URL = "http://localhost:8080/api/v1/favorites"; | ||
const FAVORITES_BASE_API_URL = "http://localhost:8080/api/v1/favorites"; | ||
|
||
const FAVORITES_API_LIST_URL = "http://localhost:8080/api/v1/favorites"; | ||
class FavoritesServices { | ||
createFavorite(favorites) { | ||
return axios.post(FAVORITES_BASE_API_URL, favorites); | ||
} | ||
|
||
getFavorites() { | ||
return axios.get(FAVORITES_BASE_API_URL); | ||
} | ||
|
||
getFavoritesByUserId(id) { | ||
return axios.get(FAVORITES_BASE_API_URL + "/" + "user" + "/" + id); | ||
} | ||
|
||
class FavoritesService { | ||
|
||
|
||
addToFavorites(favorites) { | ||
return axios.post(FAVORITES_API_BASE_URL, favorites); | ||
} | ||
|
||
getFavorites() { | ||
return axios.get(FAVORITES_API_LIST_URL); | ||
} | ||
deleteFavorites(id) { | ||
return axios.delete(FAVORITES_BASE_API_URL + "/" + id); | ||
} | ||
} | ||
|
||
export default new FavoritesService(); | ||
export default new FavoritesServices(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...otBackEnd/demo/src/main/java/com/nationalParkApp/demo/Repository/FavoritesRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
package com.nationalParkApp.demo.Repository; | ||
|
||
import com.nationalParkApp.demo.Model.Favorites; | ||
import com.nationalParkApp.demo.Model.User; | ||
import com.nationalParkApp.demo.entity.FavoritesEntity; | ||
import jakarta.persistence.TypedQuery; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface FavoritesRepository extends JpaRepository<FavoritesEntity, Long> { | ||
|
||
public List<FavoritesEntity> findByParkCode(String parkCode); | ||
|
||
public List<FavoritesEntity> findByUserId(Long id); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters