backend/restservice/src/main/java/com/plannaplan/responses/models/UserResponse.java

57 lines
1.1 KiB
Java
Raw Normal View History

2020-10-19 12:13:02 +02:00
package com.plannaplan.responses.models;
import com.plannaplan.entities.User;
import io.swagger.annotations.ApiModel;
2021-01-15 17:45:29 +01:00
/**
* Model for api response for user serach results.
*/
@ApiModel(description = "Response shows information about user.", value = "UserResponse")
public class UserResponse {
2020-10-19 12:13:02 +02:00
private Long id;
private String name;
private String surname;
private String email;
2021-01-15 17:45:29 +01:00
/**
* @param user entity to be mapped to api response
*/
public UserResponse(User user) {
2020-10-19 12:13:02 +02:00
this.id = user.getId();
2020-12-18 17:43:03 +01:00
this.name = user.getName() != null ? user.getName() : "";
this.surname = user.getSurname() != null ? user.getSurname() : "";
2020-10-19 12:13:02 +02:00
this.email = user.getEmail();
}
2021-01-15 17:45:29 +01:00
/**
* @return user email
*/
2020-10-19 12:13:02 +02:00
public String getEmail() {
return email;
}
2021-01-15 17:45:29 +01:00
/**
* @return user surname
*/
2020-10-19 12:13:02 +02:00
public String getSurname() {
return surname;
}
2021-01-15 17:45:29 +01:00
/**
* @return user name
*/
2020-10-19 12:13:02 +02:00
public String getName() {
return name;
}
2021-01-15 17:45:29 +01:00
/**
* @return db id
*/
2020-10-19 12:13:02 +02:00
public Long getId() {
return id;
}
}