maj du script avec des roles pour les users
This commit is contained in:
parent
c3dd337c7d
commit
9fa9630e5d
@ -103,7 +103,8 @@ public class AuthorController {
|
||||
throw new AlreadyExistsException("Author already exists");
|
||||
}
|
||||
author.setPassword(passwordEncoder.encode(author.getPassword()));
|
||||
return new ResponseEntity<>(authorRepository.save(author.setRole("USER")).setPassword(""), HttpStatus.CREATED);
|
||||
return new ResponseEntity<>(authorRepository.save(author.setRole("READER")).setPassword(""), HttpStatus.CREATED);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value = "/me", produces = "application/json")
|
||||
|
@ -1,6 +1,9 @@
|
||||
drop table if exists publication;
|
||||
drop table if exists post;
|
||||
drop table if exists author;
|
||||
drop type if exists author_role;
|
||||
|
||||
create type author_role as enum ('READER', 'WRITER', 'ADMIN');
|
||||
|
||||
create table author
|
||||
(
|
||||
@ -8,7 +11,7 @@ create table author
|
||||
name varchar(255) unique not null,
|
||||
password text not null,
|
||||
profile_picture bytea,
|
||||
role varchar(50) default 'USER' not null
|
||||
role author_role default 'READER' not null
|
||||
);
|
||||
|
||||
create table post
|
||||
|
Loading…
Reference in New Issue
Block a user