-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat database access repository (#15)
* feat: working repository connection * feat: Add Repository and Services * feat: Add findById Co-authored-by: Gio02092001 <[email protected]>
- Loading branch information
1 parent
bbf81bf
commit e6c7cef
Showing
17 changed files
with
256 additions
and
40 deletions.
There are no files selected for viewing
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
24 changes: 0 additions & 24 deletions
24
src/main/java/com/partycipate/Partycipate/model/SurveyRepositoryGio.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
src/main/java/com/partycipate/Partycipate/repository/AnswerPossibilityRepository.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.partycipate.Partycipate.repository; | ||
|
||
|
||
import com.partycipate.Partycipate.model.Survey; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface AnswerPossibilityRepository extends CrudRepository<Survey, Integer> { | ||
|
||
} | ||
|
12 changes: 12 additions & 0 deletions
12
src/main/java/com/partycipate/Partycipate/repository/AnswerRepository.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.partycipate.Partycipate.repository; | ||
|
||
|
||
import com.partycipate.Partycipate.model.Survey; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface AnswerRepository extends CrudRepository<Survey, Integer> { | ||
|
||
} | ||
|
12 changes: 12 additions & 0 deletions
12
src/main/java/com/partycipate/Partycipate/repository/ParticipantRepository.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.partycipate.Partycipate.repository; | ||
|
||
|
||
import com.partycipate.Partycipate.model.Survey; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface ParticipantRepository extends CrudRepository<Survey, Integer> { | ||
|
||
} | ||
|
13 changes: 13 additions & 0 deletions
13
src/main/java/com/partycipate/Partycipate/repository/SurveyElementRepository.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.partycipate.Partycipate.repository; | ||
|
||
|
||
import com.partycipate.Partycipate.model.Survey; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface SurveyElementRepository extends CrudRepository<Survey, Integer> { | ||
|
||
|
||
} | ||
|
16 changes: 16 additions & 0 deletions
16
src/main/java/com/partycipate/Partycipate/repository/SurveyRepository.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.partycipate.Partycipate.repository; | ||
|
||
|
||
import com.partycipate.Partycipate.model.Survey; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface SurveyRepository extends CrudRepository<Survey, Integer> { | ||
Survey findById(int id); | ||
//Survey findAllByUser_id(int id); | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
src/main/java/com/partycipate/Partycipate/repository/Survey_ParticipantRepository.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.partycipate.Partycipate.repository; | ||
|
||
|
||
import com.partycipate.Partycipate.model.Survey; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface Survey_ParticipantRepository extends CrudRepository<Survey, Integer> { | ||
|
||
} | ||
|
12 changes: 12 additions & 0 deletions
12
src/main/java/com/partycipate/Partycipate/repository/UserRepository.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.partycipate.Partycipate.repository; | ||
|
||
|
||
import com.partycipate.Partycipate.model.Survey; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface UserRepository extends CrudRepository<Survey, Integer> { | ||
|
||
} | ||
|
22 changes: 22 additions & 0 deletions
22
src/main/java/com/partycipate/Partycipate/service/AnswerPossibilityService.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.partycipate.Partycipate.service; | ||
|
||
import com.partycipate.Partycipate.dao.SurveyDao; | ||
import com.partycipate.Partycipate.repository.SurveyRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class AnswerPossibilityService { | ||
|
||
private final SurveyDao surveyDao; | ||
@Autowired | ||
private SurveyRepository surveyRepository; | ||
|
||
@Autowired | ||
public AnswerPossibilityService(@Qualifier("fakeDao") SurveyDao surveyDao) { | ||
this.surveyDao = surveyDao; | ||
} | ||
|
||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/partycipate/Partycipate/service/AnswerService.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.partycipate.Partycipate.service; | ||
|
||
import com.partycipate.Partycipate.dao.SurveyDao; | ||
import com.partycipate.Partycipate.repository.SurveyRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class AnswerService { | ||
|
||
private final SurveyDao surveyDao; | ||
@Autowired | ||
private SurveyRepository surveyRepository; | ||
|
||
@Autowired | ||
public AnswerService(@Qualifier("fakeDao") SurveyDao surveyDao) { | ||
this.surveyDao = surveyDao; | ||
} | ||
|
||
|
||
} |
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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/partycipate/Partycipate/service/ParticipantService.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.partycipate.Partycipate.service; | ||
|
||
import com.partycipate.Partycipate.dao.SurveyDao; | ||
import com.partycipate.Partycipate.repository.SurveyRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class ParticipantService { | ||
|
||
private final SurveyDao surveyDao; | ||
@Autowired | ||
private SurveyRepository surveyRepository; | ||
|
||
@Autowired | ||
public ParticipantService(@Qualifier("fakeDao") SurveyDao surveyDao) { | ||
this.surveyDao = surveyDao; | ||
} | ||
|
||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/partycipate/Partycipate/service/SurveyElementService.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.partycipate.Partycipate.service; | ||
|
||
import com.partycipate.Partycipate.dao.SurveyDao; | ||
import com.partycipate.Partycipate.repository.SurveyRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class SurveyElementService { | ||
|
||
private final SurveyDao surveyDao; | ||
@Autowired | ||
private SurveyRepository surveyRepository; | ||
|
||
@Autowired | ||
public SurveyElementService(@Qualifier("fakeDao") SurveyDao surveyDao) { | ||
this.surveyDao = surveyDao; | ||
} | ||
|
||
|
||
} |
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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/partycipate/Partycipate/service/Survey_ParticipantService.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.partycipate.Partycipate.service; | ||
|
||
import com.partycipate.Partycipate.dao.SurveyDao; | ||
import com.partycipate.Partycipate.repository.SurveyRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class Survey_ParticipantService { | ||
|
||
private final SurveyDao surveyDao; | ||
@Autowired | ||
private SurveyRepository surveyRepository; | ||
|
||
@Autowired | ||
public Survey_ParticipantService(@Qualifier("fakeDao") SurveyDao surveyDao) { | ||
this.surveyDao = surveyDao; | ||
} | ||
|
||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/partycipate/Partycipate/service/UserService.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.partycipate.Partycipate.service; | ||
|
||
import com.partycipate.Partycipate.dao.SurveyDao; | ||
import com.partycipate.Partycipate.model.Survey; | ||
import com.partycipate.Partycipate.repository.SurveyRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Service | ||
public class UserService { | ||
|
||
private final SurveyDao surveyDao; | ||
@Autowired | ||
private SurveyRepository surveyRepository; | ||
|
||
@Autowired | ||
public UserService(@Qualifier("fakeDao") SurveyDao surveyDao) { | ||
this.surveyDao = surveyDao; | ||
} | ||
|
||
|
||
} |