This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 392044a6 authored by Michael Breu's avatar Michael Breu :speech_balloon:
Browse files

Intermediate commit: Renaming userIdId et al.

parent 07c56655
2 merge requests!188Merging Peer Reviewing et. al to Master,!164211 peer reviewing functionality
Showing
with 35 additions and 35 deletions
......@@ -100,7 +100,7 @@ public class MailService {
@Scheduled(cron = "0 0 5 * * ?")
public void sendInfoMails() {
for(User u: userRepository.findAll()) {
// TODO
}
}
......
......@@ -82,7 +82,7 @@ public class UserWatchListService {
}
if(!mustExist)
return Optional.empty();
final boolean isAccessible = watchListO.get().getUserIdLogin().equals(currentPrincipal.get().getUsername());
final boolean isAccessible = watchListO.get().getUserLogin().equals(currentPrincipal.get().getUsername());
if(!isAccessible) {
log.warn("watchlist {} does not belong to current user", watchListO.get().getName());
throw new IllegalAccessError("watchlist does not belong to current User");
......
......@@ -24,9 +24,9 @@ public class UserWatchListDTO implements Serializable {
private CheckFrequency checkFrequency;
private Long userIdId;
private Long userId;
private String userIdLogin;
private String userLogin;
public Long getId() {
return id;
......@@ -52,20 +52,20 @@ public class UserWatchListDTO implements Serializable {
this.checkFrequency = checkFrequency;
}
public Long getUserIdId() {
return userIdId;
public Long getUserId() {
return userId;
}
public void setUserIdId(Long userId) {
this.userIdId = userId;
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserIdLogin() {
return userIdLogin;
public String getUserLogin() {
return userLogin;
}
public void setUserIdLogin(String userLogin) {
this.userIdLogin = userLogin;
public void setUserLogin(String userLogin) {
this.userLogin = userLogin;
}
@Override
......@@ -92,8 +92,8 @@ public class UserWatchListDTO implements Serializable {
"id=" + getId() +
", name='" + getName() + "'" +
", checkFrequency='" + getCheckFrequency() + "'" +
", userIdId=" + getUserIdId() +
", userIdLogin='" + getUserIdLogin() + "'" +
", userIdId=" + getUserId() +
", userIdLogin='" + getUserLogin() + "'" +
"}";
}
}
......@@ -12,11 +12,11 @@ import org.mapstruct.*;
@Mapper(componentModel = "spring", uses = {UserMapper.class})
public interface UserWatchListMapper extends EntityMapper<UserWatchListDTO, UserWatchList> {
@Mapping(source = "userId.id", target = "userIdId")
@Mapping(source = "user.login", target = "userIdLogin")
@Mapping(source = "user.id", target = "userId")
@Mapping(source = "user.login", target = "userLogin")
UserWatchListDTO toDto(UserWatchList userWatchList);
@Mapping(source = "userIdId", target = "userId")
@Mapping(source = "userId", target = "user")
UserWatchList toEntity(UserWatchListDTO userWatchListDTO);
default UserWatchList fromId(Long id) {
......
......@@ -95,14 +95,14 @@ public class UserWatchListResource {
log.debug("unknown user cannot create watchlist {}", userWatchListDTO.getName());
return ResponseEntity.badRequest().build();
}
if(userWatchListDTO.getUserIdId() == null) {
if(userWatchListDTO.getUserId() == null) {
Optional<at.ac.uibk.gitsearch.domain.User> u = userService.getUserWithAuthoritiesByLogin(SecurityUtils.getCurrentUserLogin().get());
if(u.isEmpty()) {
log.debug(" user not found, cannot create watchlist {}", userWatchListDTO.getName());
return ResponseEntity.badRequest().build();
}
userWatchListDTO.setUserIdId(u.get().getId());
userWatchListDTO.setUserIdLogin(u.get().getLastName());
userWatchListDTO.setUserId(u.get().getId());
userWatchListDTO.setUserLogin(u.get().getLastName());
}
if (userWatchListDTO.getId() != null) {
throw new BadRequestAlertException("A new userWatchList cannot already have an ID", ENTITY_NAME, "idexists");
......@@ -137,8 +137,8 @@ public class UserWatchListResource {
log.warn("Cannot create a watchlist {} for unknown user", springUser.getUsername());
throw new BadRequestAlertException("Cannot create a watchlist for unknown user", ENTITY_NAME, "unknownUser");
}
userWatchListDTO.setUserIdLogin(springUser.getUsername());
userWatchListDTO.setUserIdId(userWithAuthoritiesByLogin.get().getId());
userWatchListDTO.setUserLogin(springUser.getUsername());
userWatchListDTO.setUserId(userWithAuthoritiesByLogin.get().getId());
UserWatchListDTO result = userWatchListService.save(userWatchListDTO);
return ResponseEntity.created(new URI("/api/user-watch-lists/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, ENTITY_NAME, result.getId().toString()))
......
......@@ -24,7 +24,7 @@ export class UserWatchListUpdateComponent implements OnInit {
editForm = this.fb.group({
id: [],
name: [null, [Validators.required, Validators.minLength(1)]],
userIdId: [null],
userId: [null],
checkFrequency: CheckFrequency.NEVER
});
......@@ -47,7 +47,7 @@ export class UserWatchListUpdateComponent implements OnInit {
this.editForm.patchValue({
id: userWatchList.id,
name: userWatchList.name,
userIdId: userWatchList.userIdId,
userId: userWatchList.userId,
checkFrequency: userWatchList.checkFrequency,
});
}
......@@ -71,7 +71,7 @@ export class UserWatchListUpdateComponent implements OnInit {
...new UserWatchList(),
id: this.editForm.get(['id'])!.value,
name: this.editForm.get(['name'])!.value,
userIdId: this.editForm.get(['userIdId'])!.value,
userId: this.editForm.get(['userId'])!.value,
checkFrequency: this.editForm.get(['checkFrequency'])!.value,
};
}
......
......@@ -18,7 +18,7 @@
</dd>
<dt><span jhiTranslate="gitsearchApp.userWatchList.userId">User Id</span></dt>
<dd>
{{ userWatchList.userIdLogin }}
{{ userWatchList.userLogin }}
</dd>
</dl>
......
......@@ -22,7 +22,7 @@ export class UserWatchListUpdateComponent implements OnInit {
id: [],
name: [null, [Validators.required, Validators.minLength(1)]],
checkFrequency: [null, [Validators.required]],
userIdId: [null, Validators.required],
userId: [null, Validators.required],
});
constructor(
......@@ -45,7 +45,7 @@ export class UserWatchListUpdateComponent implements OnInit {
id: userWatchList.id,
name: userWatchList.name,
checkFrequency: userWatchList.checkFrequency,
userIdId: userWatchList.userIdId,
userId: userWatchList.userId,
});
}
......@@ -69,7 +69,7 @@ export class UserWatchListUpdateComponent implements OnInit {
id: this.editForm.get(['id'])!.value,
name: this.editForm.get(['name'])!.value,
checkFrequency: this.editForm.get(['checkFrequency'])!.value,
userIdId: this.editForm.get(['userIdId'])!.value,
userId: this.editForm.get(['userId'])!.value,
};
}
......
......@@ -4,8 +4,8 @@ export interface IUserWatchList {
id?: number;
name?: string;
checkFrequency?: CheckFrequency;
userIdLogin?: string;
userIdId?: number;
userLogin?: string;
userId?: number;
}
export class UserWatchList implements IUserWatchList {
......@@ -13,8 +13,8 @@ export class UserWatchList implements IUserWatchList {
public id?: number,
public name?: string,
public checkFrequency?: CheckFrequency,
public userIdLogin?: string,
public userIdId?: number
public userLogin?: string,
public userId?: number
) {}
}
......
......@@ -58,8 +58,8 @@ export class WatchlistManager implements OnInit, OnDestroy {
const userWatchlist: IUserWatchList = {
name: this.translate.instant('gitsearchApp.userWatchList.defaultName'),
userIdLogin: this.account!.login,
userIdId: 1, // unused, replaced by correct userId by create service
userLogin: this.account!.login,
userId: 1, // unused, replaced by correct userId by create service
checkFrequency: CheckFrequency.NEVER,
};
this.watchListService.createForCurrentUser(userWatchlist).subscribe(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment