1 | package edu.ucsb.cs156.happiercows.entities; | |
2 | ||
3 | import com.fasterxml.jackson.annotation.JsonIgnore; | |
4 | import com.fasterxml.jackson.annotation.JsonInclude; | |
5 | import lombok.*; | |
6 | ||
7 | import javax.persistence.EmbeddedId; | |
8 | import javax.persistence.Entity; | |
9 | import javax.persistence.ManyToOne; | |
10 | import javax.persistence.MapsId; | |
11 | ||
12 | @Data | |
13 | @AllArgsConstructor | |
14 | @NoArgsConstructor(access = AccessLevel.PROTECTED) | |
15 | @Builder | |
16 | @Entity(name = "user_commons") | |
17 | public class UserCommons { | |
18 | @EmbeddedId | |
19 | @JsonIgnore | |
20 | @Builder.Default | |
21 | private UserCommonsKey id = new UserCommonsKey(); | |
22 | ||
23 | @MapsId("userId") | |
24 | @ManyToOne | |
25 | @JsonIgnore | |
26 | private User user; | |
27 | ||
28 | @MapsId("commonsId") | |
29 | @ManyToOne | |
30 | @JsonIgnore | |
31 | private Commons commons; | |
32 | ||
33 | private String username; | |
34 | ||
35 | private double totalWealth; | |
36 | ||
37 | private int numOfCows; | |
38 | ||
39 | private double cowHealth; | |
40 | ||
41 | private int cowsBought; | |
42 | ||
43 | private int cowsSold; | |
44 | ||
45 | private int cowDeaths; | |
46 | ||
47 | // userID and commonsId are used by the frontend | |
48 | @JsonInclude | |
49 | public long getUserId() { | |
50 |
1
1. getUserId : replaced long return with 0 for edu/ucsb/cs156/happiercows/entities/UserCommons::getUserId → KILLED |
return user.getId(); |
51 | } | |
52 | ||
53 | @JsonInclude | |
54 | public long getCommonsId() { | |
55 |
1
1. getCommonsId : replaced long return with 0 for edu/ucsb/cs156/happiercows/entities/UserCommons::getCommonsId → KILLED |
return commons.getId(); |
56 | } | |
57 | ||
58 | public void setId(UserCommonsKey id) { | |
59 | this.id = id; | |
60 | } | |
61 | | |
62 | public UserCommonsKey getId() { | |
63 |
1
1. getId : replaced return value with null for edu/ucsb/cs156/happiercows/entities/UserCommons::getId → KILLED |
return this.id; |
64 | } | |
65 | } | |
Mutations | ||
50 |
1.1 |
|
55 |
1.1 |
|
63 |
1.1 |