Skip to content

Commit 1d2ae20

Browse files
Merge pull request #11 from GabrielTorelo/feat/gameDTOs
feat/gameDTOs#002 - OK
2 parents 586a410 + 7bba446 commit 1d2ae20

3 files changed

Lines changed: 141 additions & 0 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package com.gabriel_torelo.game_list.dto;
2+
3+
import org.springframework.beans.BeanUtils;
4+
import com.gabriel_torelo.game_list.entities.Game;
5+
6+
public class GameLongDTO {
7+
private Long id;
8+
private String title;
9+
private Integer year;
10+
private String gender;
11+
private String platforms;
12+
private Double score;
13+
private String imgUrl;
14+
private String longDescription;
15+
16+
public GameLongDTO() {
17+
}
18+
19+
public GameLongDTO(Game entity) {
20+
BeanUtils.copyProperties(entity, this);
21+
}
22+
23+
public Long getId() {
24+
return id;
25+
}
26+
27+
public void setId(Long id) {
28+
this.id = id;
29+
}
30+
31+
public String getTitle() {
32+
return title;
33+
}
34+
35+
public void setTitle(String title) {
36+
this.title = title;
37+
}
38+
39+
public Integer getYear() {
40+
return year;
41+
}
42+
43+
public void setYear(Integer year) {
44+
this.year = year;
45+
}
46+
47+
public String getGender() {
48+
return gender;
49+
}
50+
51+
public void setGender(String gender) {
52+
this.gender = gender;
53+
}
54+
55+
public String getPlatforms() {
56+
return platforms;
57+
}
58+
59+
public void setPlatforms(String platforms) {
60+
this.platforms = platforms;
61+
}
62+
63+
public Double getScore() {
64+
return score;
65+
}
66+
67+
public void setScore(Double score) {
68+
this.score = score;
69+
}
70+
71+
public String getImgUrl() {
72+
return imgUrl;
73+
}
74+
75+
public void setImgUrl(String imgUrl) {
76+
this.imgUrl = imgUrl;
77+
}
78+
79+
public String getLongDescription() {
80+
return longDescription;
81+
}
82+
83+
public void setLongDescription(String longDescription) {
84+
this.longDescription = longDescription;
85+
}
86+
}

src/main/java/com/gabriel_torelo/game_list/dto/GameMinDTO.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,20 @@ public Double getScore() {
3333
public String getImgUrl() {
3434
return imgUrl;
3535
}
36+
37+
public void setId(Long id) {
38+
this.id = id;
39+
}
40+
41+
public void setTitle(String title) {
42+
this.title = title;
43+
}
44+
45+
public void setScore(Double score) {
46+
this.score = score;
47+
}
48+
49+
public void setImgUrl(String imgUrl) {
50+
this.imgUrl = imgUrl;
51+
}
3652
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.gabriel_torelo.game_list.dto;
2+
3+
import com.gabriel_torelo.game_list.entities.Game;
4+
5+
public class GameShortDTO {
6+
private GameMinDTO gameMinDTO = new GameMinDTO();
7+
private String shortDescription;
8+
9+
public GameShortDTO() {
10+
}
11+
12+
public GameShortDTO(Game entity) {
13+
gameMinDTO.setId(entity.getId());
14+
gameMinDTO.setTitle(entity.getTitle());
15+
gameMinDTO.setScore(entity.getScore());
16+
gameMinDTO.setImgUrl(entity.getImgUrl());
17+
shortDescription = entity.getShortDescription();
18+
}
19+
20+
public Long getId() {
21+
return gameMinDTO.getId();
22+
}
23+
24+
public String getTitle() {
25+
return gameMinDTO.getTitle();
26+
}
27+
28+
public Double getScore() {
29+
return gameMinDTO.getScore();
30+
}
31+
32+
public String getImgUrl() {
33+
return gameMinDTO.getImgUrl();
34+
}
35+
36+
public String getShortDescription() {
37+
return shortDescription;
38+
}
39+
}

0 commit comments

Comments
 (0)