65 lines
1.7 KiB
Java
Executable File
65 lines
1.7 KiB
Java
Executable File
package com.plannaplan.responses.models;
|
|
|
|
import com.plannaplan.entities.Commision;
|
|
|
|
import io.swagger.annotations.ApiModel;
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
|
/**
|
|
* Commision api response
|
|
*/
|
|
@ApiModel(description = "Response shows information about commision.", value = "CommisionResponse")
|
|
public class CommisionResponse {
|
|
@ApiModelProperty(value = "ID created by database")
|
|
private Long id;
|
|
|
|
@ApiModelProperty(value = "ID of user that commision belongs to")
|
|
private UserResponse owner;
|
|
|
|
@ApiModelProperty(value = "ID of user that created commision")
|
|
private UserResponse commiter;
|
|
|
|
@ApiModelProperty(value = "Timestamp where the user commit the commision")
|
|
private String commisionDate;
|
|
|
|
/**
|
|
* @param commision commision to map to api response
|
|
*/
|
|
public CommisionResponse(Commision commision) {
|
|
this.id = commision.getId();
|
|
this.commisionDate = commision.getCommisionDate().toString();
|
|
this.owner = commision.getCommisionOwner() != null ? new UserResponse(commision.getCommisionOwner()) : null;
|
|
this.commiter = commision.getCommisionCommiter() != null ? new UserResponse(commision.getCommisionCommiter())
|
|
: null;
|
|
}
|
|
|
|
/**
|
|
* @return get Commiter user as api response
|
|
*/
|
|
public UserResponse getCommiter() {
|
|
return commiter;
|
|
}
|
|
|
|
/**
|
|
* @return get Owner user as api response
|
|
*/
|
|
public UserResponse getOwner() {
|
|
return owner;
|
|
}
|
|
|
|
/**
|
|
* @return when commision was created string formated
|
|
*/
|
|
public String getCommisionDate() {
|
|
return commisionDate;
|
|
}
|
|
|
|
/**
|
|
* @return db id
|
|
*/
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
}
|