почти работает
This commit is contained in:
parent
57a412b0d7
commit
4cc4300a14
@ -1,5 +1,5 @@
|
||||
package com.example.demo.core.config;
|
||||
|
||||
public class Constants {
|
||||
public static final String API_URL = "/api";
|
||||
public static final String API_URL = "/api/2";
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addCorsMappings(@NonNull CorsRegistry registry) {
|
||||
registry.addMapping("lab2/**")
|
||||
registry.addMapping("/**")
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE");
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,7 @@ package com.example.demo.users.api;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Past;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -17,9 +15,6 @@ public class UserDTO {
|
||||
@NotNull
|
||||
@Min(4)
|
||||
private String password;
|
||||
@NotNull
|
||||
@Past
|
||||
private Date dateCreate;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
@ -27,11 +22,6 @@ public class UserDTO {
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Date getDateCreate() {
|
||||
return dateCreate;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package com.example.demo.users.model;
|
||||
|
||||
import com.example.demo.core.model.BaseEntity;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserEntity extends BaseEntity {
|
||||
@ -13,11 +15,13 @@ public class UserEntity extends BaseEntity {
|
||||
super();
|
||||
}
|
||||
|
||||
public UserEntity(Long id, String name, String password, Date dateCreate){
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yy");
|
||||
|
||||
public UserEntity(Long id, String name, String password, String dateCreate) throws ParseException {
|
||||
super(id);
|
||||
this.name = name;
|
||||
this.password = password;
|
||||
this.dateCreate = dateCreate;
|
||||
this.dateCreate = new Date();
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
@ -36,8 +40,8 @@ public class UserEntity extends BaseEntity {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Date getDateCreate(){
|
||||
return dateCreate;
|
||||
public String getDateCreate(){
|
||||
return formatter.format(dateCreate);
|
||||
}
|
||||
|
||||
public void setDateCreate(Date dateCreate){
|
||||
|
Loading…
Reference in New Issue
Block a user