-
Notifications
You must be signed in to change notification settings - Fork 1
/
Fight.java
79 lines (63 loc) · 1.71 KB
/
Fight.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package io.quarkus.sample.superheroes.fight;
import java.time.Instant;
import java.util.Objects;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import io.quarkus.mongodb.panache.common.MongoEntity;
import io.quarkus.mongodb.panache.reactive.ReactivePanacheMongoEntity;
/**
* Mongo entity class for a Fight. Re-used in the API layer
*/
@MongoEntity(collection = "Fights")
@Schema(description = "Each fight has a winner and a loser")
public class Fight extends ReactivePanacheMongoEntity {
@NotNull
public Instant fightDate;
@NotEmpty
public String winnerName;
@NotNull
public Integer winnerLevel;
@NotEmpty
public String winnerPicture;
@NotEmpty
public String loserName;
@NotNull
public Integer loserLevel;
@NotEmpty
public String loserPicture;
@NotEmpty
public String winnerTeam;
@NotEmpty
public String loserTeam;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Fight fight = (Fight) o;
return this.id == fight.id;
}
@Override
public int hashCode() {
return Objects.hash(this.id);
}
@Override
public String toString() {
return "Fight{" +
"fightDate=" + this.fightDate +
", id=" + this.id +
", winnerName='" + this.winnerName + '\'' +
", winnerLevel=" + this.winnerLevel +
", winnerPicture='" + this.winnerPicture + '\'' +
", loserName='" + this.loserName + '\'' +
", loserLevel=" + this.loserLevel +
", loserPicture='" + this.loserPicture + '\'' +
", winnerTeam='" + this.winnerTeam + '\'' +
", loserTeam='" + this.loserTeam + '\'' +
'}';
}
}