Skip to content

Commit fa20e12

Browse files
authored
Merge pull request #70 from TAMULib/sprint6-b03633-feature_proposal-reject
Sprint6 b03633 Add Feature Proposal 'reject' path listener
2 parents 21c7238 + 3111fdf commit fa20e12

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/main/java/edu/tamu/app/controller/FeatureProposalController.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.springframework.web.bind.annotation.RequestMapping;
1212
import org.springframework.web.bind.annotation.RestController;
1313

14+
import edu.tamu.app.enums.FeatureProposalState;
1415
import edu.tamu.app.exception.UserNotFoundException;
1516
import edu.tamu.app.model.FeatureProposal;
1617
import edu.tamu.app.model.Idea;
@@ -78,4 +79,12 @@ public ApiResponse vote(@PathVariable Long id, @WeaverUser User voter) {
7879
return new ApiResponse(SUCCESS, featureProposalRepo.update(featureProposal));
7980
}
8081

82+
@RequestMapping("/{id}/reject")
83+
@PreAuthorize("hasRole('SERVICE_MANAGER')")
84+
public ApiResponse reject(@PathVariable Long id, @WeaverUser User voter) {
85+
FeatureProposal featureProposal = featureProposalRepo.findOne(id);
86+
featureProposal.setState(FeatureProposalState.REJECTED);
87+
return new ApiResponse(SUCCESS, featureProposalRepo.update(featureProposal));
88+
}
89+
8190
}

0 commit comments

Comments
 (0)