-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feature/BE-591-backend-handle-image-upload
- Loading branch information
Showing
42 changed files
with
840 additions
and
578 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
33 changes: 33 additions & 0 deletions
33
resq/backend/resq/src/main/java/com/groupa1/resq/controller/FeedbackController.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,33 @@ | ||
package com.groupa1.resq.controller; | ||
|
||
import com.groupa1.resq.request.CreateFeedbackRequest; | ||
import com.groupa1.resq.service.FeedbackService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/feedback") | ||
public class FeedbackController { | ||
|
||
@Autowired | ||
private FeedbackService feedbackService; | ||
|
||
@PreAuthorize("hasRole('RESPONDER')") | ||
@PostMapping("/giveFeedback") | ||
public ResponseEntity<Object> giveFeedback(CreateFeedbackRequest feedback) { | ||
return feedbackService.giveFeedback(feedback); | ||
} | ||
|
||
|
||
@PreAuthorize("hasRole('RESPONDER')") | ||
@PostMapping("/deleteFeedback") | ||
public ResponseEntity<String> deleteFeedback(@RequestParam Long feedbackId) { | ||
return feedbackService.deleteFeedback(feedbackId); | ||
} | ||
|
||
} |
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
28 changes: 28 additions & 0 deletions
28
resq/backend/resq/src/main/java/com/groupa1/resq/converter/ActionConverter.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.groupa1.resq.converter; | ||
|
||
import com.groupa1.resq.dto.ActionDto; | ||
import com.groupa1.resq.entity.Action; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class ActionConverter { | ||
|
||
public ActionDto convertToDto(Action action){ | ||
ActionDto actionDto = new ActionDto(); | ||
actionDto.setId(action.getId()); | ||
actionDto.setTaskId(action.getTask().getId()); | ||
if (action.getVerifier() != null) { | ||
actionDto.setVerifierId(action.getVerifier().getId()); | ||
} | ||
actionDto.setDescription(action.getDescription()); | ||
actionDto.setCompleted(action.isCompleted()); | ||
actionDto.setStartLatitude(action.getStartLatitude()); | ||
actionDto.setStartLongitude(action.getStartLongitude()); | ||
actionDto.setEndLatitude(action.getEndLatitude()); | ||
actionDto.setEndLongitude(action.getEndLongitude()); | ||
actionDto.setDueDate(action.getDueDate()); | ||
actionDto.setCreatedDate(action.getCreatedAt()); | ||
return actionDto; | ||
|
||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
resq/backend/resq/src/main/java/com/groupa1/resq/converter/FeedbackConverter.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,19 @@ | ||
package com.groupa1.resq.converter; | ||
|
||
import com.groupa1.resq.dto.FeedbackDto; | ||
import com.groupa1.resq.entity.Feedback; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class FeedbackConverter { | ||
|
||
public FeedbackDto convertToDto(Feedback feedback){ | ||
FeedbackDto feedbackDto = new FeedbackDto(); | ||
feedbackDto.setId(feedback.getId()); | ||
feedbackDto.setTaskId(feedback.getTask().getId()); | ||
feedbackDto.setUserId(feedback.getCreator().getId()); | ||
feedbackDto.setMessage(feedback.getMessage()); | ||
feedbackDto.setCreatedDate(feedback.getCreatedAt()); | ||
return feedbackDto; | ||
} | ||
} |
Oops, something went wrong.