Compare commits

...

2 Commits

3 changed files with 20 additions and 18 deletions

View File

@ -11,7 +11,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.example.demo.news.model.NewEntity;
import com.example.demo.news.service.NewService;
import com.example.demo.users.model.UserEntity;
import com.example.demo.users.service.UserService;
@SpringBootApplication

View File

@ -1,7 +1,9 @@
package com.example.demo.news.api;
import java.util.Date;
import java.util.List;
import com.example.demo.tage.model.TageEntity;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotBlank;
@ -17,9 +19,7 @@ public class NewDto {
@NotNull
@PastOrPresent
private Date date;
@NotBlank
@Size(min = 1, max = 30)
private String tage;
private List<TageEntity> tages;
@NotBlank
@Size(min = 1, max = 30)
private String text;
@ -49,12 +49,12 @@ public class NewDto {
this.date = date;
}
public String getTage() {
return tage;
public List<TageEntity> getTage() {
return tages;
}
public void setTage(String tage) {
this.tage = tage;
public void setTage(List<TageEntity> tages) {
this.tages = tages;
}
public String getText() {

View File

@ -1,25 +1,29 @@
package com.example.demo.news.model;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import com.example.demo.core.model.BaseEntity;
import com.example.demo.tage.model.TageEntity;
public class NewEntity extends BaseEntity {
private String title;
private Date date;
private String tage;
private List<TageEntity> tages;
private String text;
public NewEntity() {
super();
}
public NewEntity(Long id, String title, Date date, String tage, String text) {
public NewEntity(Long id, String title, Date date, List<TageEntity> tages, String text) {
super(id);
this.title = title;
this.date = date;
this.tage = tage;
this.tages = tages;
this.text = text;
}
@ -39,12 +43,12 @@ public class NewEntity extends BaseEntity {
this.date = date;
}
public String getTage() {
return tage;
public List<TageEntity> getTage() {
return tages;
}
public void setTage(String tage) {
this.tage = tage;
public void setTage(List<TageEntity> tages) {
this.tages = tages;
}
public String getText() {
@ -57,7 +61,7 @@ public class NewEntity extends BaseEntity {
@Override
public int hashCode() {
return Objects.hash(id, title, date, tage, text);
return Objects.hash(id, title, date, tages, text);
}
@Override
@ -70,8 +74,7 @@ public class NewEntity extends BaseEntity {
return Objects.equals(other.getId(), id)
&& Objects.equals(other.getTitle(), title)
&& Objects.equals(other.getDate(), date)
&& Objects.equals(other.getTage(), tage)
&& Objects.equals(other.getTage(), tages)
&& Objects.equals(other.getText(), text);
}
}