-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2024-10-21 - feedback - external reviewer - server-side
- Loading branch information
Showing
7 changed files
with
63 additions
and
9 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
27 changes: 27 additions & 0 deletions
27
...ng/checkins/services/feedback_external_recipient/FeedbackExternalRecipientRepository.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,27 @@ | ||
package com.objectcomputing.checkins.services.feedback_external_recipient; | ||
|
||
import com.objectcomputing.checkins.services.feedback_request.FeedbackRequest; | ||
import io.micronaut.core.annotation.NonNull; | ||
import io.micronaut.core.annotation.Nullable; | ||
import io.micronaut.data.annotation.Query; | ||
import io.micronaut.data.annotation.TypeDef; | ||
import io.micronaut.data.jdbc.annotation.JdbcRepository; | ||
import io.micronaut.data.model.DataType; | ||
import io.micronaut.data.model.query.builder.sql.Dialect; | ||
import io.micronaut.data.repository.CrudRepository; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@JdbcRepository(dialect = Dialect.POSTGRES) | ||
public interface FeedbackExternalRecipientRepository extends CrudRepository<FeedbackExternalRecipient, UUID> { | ||
|
||
@Override | ||
<S extends FeedbackExternalRecipient> S save(@Valid @NotNull @NonNull S entity); | ||
@Override | ||
<S extends FeedbackExternalRecipient> S update(@NotNull @NonNull S entity); | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package com.objectcomputing.checkins.services.feedback_request; | ||
|
||
import com.objectcomputing.checkins.services.feedback_external_recipient.FeedbackExternalRecipient; | ||
import com.objectcomputing.checkins.services.feedback_external_recipient.FeedbackExternalRecipientServices; | ||
import com.objectcomputing.checkins.services.permissions.Permission; | ||
import com.objectcomputing.checkins.services.permissions.RequiredPermission; | ||
import io.micronaut.core.annotation.Nullable; | ||
|
@@ -35,9 +37,11 @@ | |
public class FeedbackRequestController { | ||
|
||
private final FeedbackRequestServices feedbackReqServices; | ||
private final FeedbackExternalRecipientServices feedbackExternalRecipientServices; | ||
|
||
public FeedbackRequestController(FeedbackRequestServices feedbackReqServices) { | ||
public FeedbackRequestController(FeedbackRequestServices feedbackReqServices, FeedbackExternalRecipientServices feedbackExternalRecipientServices) { | ||
this.feedbackReqServices = feedbackReqServices; | ||
this.feedbackExternalRecipientServices = feedbackExternalRecipientServices; | ||
} | ||
|
||
/** | ||
|
@@ -49,8 +53,22 @@ public FeedbackRequestController(FeedbackRequestServices feedbackReqServices) { | |
@RequiredPermission(Permission.CAN_CREATE_FEEDBACK_REQUEST) | ||
@Post | ||
public HttpResponse<FeedbackRequestResponseDTO> save(@Body @Valid @NotNull FeedbackRequestCreateDTO requestBody) { | ||
FeedbackRequest savedFeedbackRequest; | ||
FeedbackRequest feedbackRequest = fromDTO(requestBody); | ||
FeedbackRequest savedFeedbackRequest = feedbackReqServices.save(feedbackRequest); | ||
/* | ||
FeedbackExternalRecipient feedbackExternalRecipient = new FeedbackExternalRecipient(); | ||
feedbackExternalRecipient.setEmail("[email protected]"); | ||
feedbackExternalRecipient.setCompanyName("OCI"); | ||
feedbackExternalRecipient.setFirstName("None"); | ||
feedbackExternalRecipient.setLastName("None"); | ||
feedbackExternalRecipient = feedbackExternalRecipientServices.save(feedbackExternalRecipient); | ||
feedbackRequest.setExternalRecipientId(feedbackExternalRecipient.getId()); | ||
*/ | ||
try { | ||
savedFeedbackRequest = feedbackReqServices.save(feedbackRequest); | ||
} catch (Exception e) { | ||
throw e; | ||
} | ||
return HttpResponse.created(fromEntity(savedFeedbackRequest)) | ||
.headers(headers -> headers.location(URI.create("/feedback_request/" + savedFeedbackRequest.getId()))); | ||
} | ||
|
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