File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
server/src/main/java/com/studybuddies/server/web/mapper Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -72,12 +72,16 @@ public String userEntityToUUIDString(UserEntity userEntity) {
7272
7373 @ Named ("assignExistingModule" )
7474 public String assignExistingModule (String module ) {
75- var foundModule = moduleCrudService .get ();
75+ var foundModules = moduleCrudService .get ();
7676
77- if (!moduleValidationService .exists (module ) || foundModule .isEmpty ()) {
77+ if (!moduleValidationService .exists (module ) || foundModules .isEmpty ()) {
7878 throw new ModuleNotFoundException ("" );
7979 }
80- return foundModule .get (0 ).getName ().toUpperCase ();
80+ var foundModule = foundModules .stream ()
81+ .filter (m -> m .getName ().equalsIgnoreCase (module ))
82+ .findFirst ()
83+ .orElseThrow (() -> new ModuleNotFoundException ("" ));
84+ return foundModule .getName ().toUpperCase ();
8185 }
8286
8387 private Repeat stringToRepeat (String repeatString ) {
You can’t perform that action at this time.
0 commit comments