Update role
This commit is contained in:
parent
9191e6bf16
commit
d4f61438eb
@ -35,8 +35,8 @@ public record UserDTO(
|
||||
.fullName(user.getFullName())
|
||||
.email(user.getMail())
|
||||
.phoneNumber(user.getNumberPhone())
|
||||
.createdAt(user.getCreateAt())
|
||||
.updatedAt(user.getUpdateAt())
|
||||
.createdAt(user.getCreatedAt())
|
||||
.updatedAt(user.getUpdatedAt())
|
||||
.authorities(user.getRoles().stream().map(Role::getAuthority).toList())
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import lombok.Setter;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
|
||||
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@ -22,9 +23,6 @@ public class Role implements GrantedAuthority {
|
||||
private Integer id;
|
||||
@Column(name = "name", nullable = false)
|
||||
private String name;
|
||||
|
||||
@Override
|
||||
public String getAuthority() {
|
||||
return name;
|
||||
}
|
||||
@Column(name = "authority", nullable = false)
|
||||
private String authority;
|
||||
}
|
||||
|
||||
@ -36,10 +36,10 @@ public class User implements UserDetails {
|
||||
private String mail;
|
||||
@Column(name = "number_phone", nullable = false, unique = true)
|
||||
private String numberPhone;
|
||||
@Column(name = "create_at", nullable = false)
|
||||
private ZonedDateTime createAt;
|
||||
@Column(name = "update_at")
|
||||
private ZonedDateTime updateAt;
|
||||
@Column(name = "created_at", nullable = false)
|
||||
private ZonedDateTime createdAt;
|
||||
@Column(name = "updated_at")
|
||||
private ZonedDateTime updatedAt;
|
||||
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinTable(name = "user_role",schema = "vkr",
|
||||
joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"),
|
||||
|
||||
@ -8,7 +8,7 @@ spring:
|
||||
out-of-order: true
|
||||
web:
|
||||
resources:
|
||||
static-locations: file://${user.dir}/web/dist/
|
||||
static-locations: file:///${user.dir}/web/dist/
|
||||
chain:
|
||||
cache: false
|
||||
compressed: false
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
create table vkr.role
|
||||
(
|
||||
id integer primary key generated by default as identity,
|
||||
name text not null unique
|
||||
name text not null unique,
|
||||
authority text not null unique
|
||||
)
|
||||
|
||||
@ -6,7 +6,7 @@ create table vkr.user
|
||||
full_name text not null,
|
||||
mail text not null unique,
|
||||
number_phone text not null unique,
|
||||
create_at timestamp(6) with time zone not null,
|
||||
update_at timestamp(6) with time zone
|
||||
created_at timestamp(6) with time zone not null,
|
||||
updated_at timestamp(6) with time zone
|
||||
|
||||
)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
INSERT INTO vkr.user (login, password, full_name, mail, number_phone, create_at, update_at)
|
||||
INSERT INTO vkr.user (login, password, full_name, mail, number_phone, created_at, updated_at)
|
||||
VALUES ('akulenko_mikhail', 'password123', 'Акуленко Михаил Вячеславович', 'akulenko.mikhail@example.com',
|
||||
'+79110000001', NOW(), NOW()),
|
||||
('borovikov_artem', 'password123', 'Боровиков Артём Викторович', 'borovikov.artem@example.com', '+79110000002',
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
INSERT INTO vkr.role (name)
|
||||
VALUES('Руководитель'),('Куратор'),('Студент');
|
||||
INSERT INTO vkr.role (name,authority)
|
||||
VALUES('Руководитель','ROLE_DIRECTOR'),('Куратор','ROLE_TUTOR'),('Студент','ROLE_STUDENT');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user