77import org .springframework .beans .factory .annotation .Autowired ;
88import org .springframework .messaging .simp .SimpMessagingTemplate ;
99
10+ import edu .tamu .app .enums .IdeaState ;
1011import edu .tamu .app .exception .UserNotFoundException ;
1112import edu .tamu .app .model .FeatureProposal ;
1213import edu .tamu .app .model .Idea ;
@@ -38,7 +39,7 @@ public FeatureProposal create(FeatureProposal featureProposal, Credentials crede
3839 if (user .isPresent ()) {
3940 featureProposal .setAuthor (user .get ());
4041 featureProposal .getIdeas ().forEach (idea -> {
41- idea .setElevated ( true );
42+ idea .setState ( IdeaState . ELEVATED );
4243 idea = ideaRepo .save (idea );
4344 simpMessagingTemplate .convertAndSend ("/channel/ideas/update" , new ApiResponse (SUCCESS , idea ));
4445 });
@@ -51,7 +52,7 @@ public FeatureProposal create(FeatureProposal featureProposal, Credentials crede
5152
5253 @ Override
5354 public FeatureProposal create (Idea idea ) {
54- idea .setElevated ( true );
55+ idea .setState ( IdeaState . ELEVATED );
5556 idea = ideaRepo .save (idea );
5657 simpMessagingTemplate .convertAndSend ("/channel/ideas/update" , new ApiResponse (SUCCESS , idea ));
5758 FeatureProposal featureProposal = featureProposalRepo .save (new FeatureProposal (idea ));
@@ -62,7 +63,7 @@ public FeatureProposal create(Idea idea) {
6263 @ Override
6364 public FeatureProposal update (FeatureProposal featureProposal ) {
6465 featureProposal .getIdeas ().forEach (idea -> {
65- idea .setElevated ( true );
66+ idea .setState ( IdeaState . ELEVATED );
6667 idea = ideaRepo .save (idea );
6768 simpMessagingTemplate .convertAndSend ("/channel/ideas/update" , new ApiResponse (SUCCESS , idea ));
6869 });
@@ -74,7 +75,7 @@ public FeatureProposal update(FeatureProposal featureProposal) {
7475 @ Override
7576 public void delete (FeatureProposal featureProposal ) {
7677 featureProposal .getIdeas ().forEach (idea -> {
77- idea .setElevated ( false );
78+ idea .setState ( IdeaState . WAITING_ON_REVIEW );
7879 idea = ideaRepo .save (idea );
7980 simpMessagingTemplate .convertAndSend ("/channel/ideas/update" , new ApiResponse (SUCCESS , idea ));
8081 });
0 commit comments