[6e7b472] | 1 | package com.wediscussmovies.project.model;
|
---|
| 2 |
|
---|
| 3 | import javax.persistence.*;
|
---|
| 4 | import java.util.List;
|
---|
| 5 |
|
---|
| 6 | @Entity(name="users")
|
---|
| 7 | public class User {
|
---|
| 8 | @Id
|
---|
| 9 | @GeneratedValue
|
---|
| 10 | @Column(name="user_id", nullable = false)
|
---|
| 11 | private int user_id;
|
---|
| 12 |
|
---|
| 13 | @Column(name="username", length=50, nullable=false, unique=false)
|
---|
| 14 | private String username;
|
---|
| 15 |
|
---|
| 16 | @Column(name="name", length=50, nullable=false, unique=false)
|
---|
| 17 | private String name;
|
---|
| 18 |
|
---|
| 19 | @Column(name="surname", length=50, nullable=false, unique=false)
|
---|
| 20 | private String surname;
|
---|
| 21 |
|
---|
| 22 | @Column(name="email", length=50, nullable=false, unique=false)
|
---|
| 23 | private String email;
|
---|
| 24 |
|
---|
| 25 | @Column(name="password", length=100, nullable=false, unique=true)
|
---|
| 26 | private String password;
|
---|
| 27 |
|
---|
| 28 | //TODO("RATES_MOVIE")
|
---|
| 29 | @ManyToMany(mappedBy = "movie_likes")
|
---|
| 30 | private List<Movie> likes_movie;
|
---|
| 31 |
|
---|
| 32 | @ManyToMany(mappedBy = "user_genres")
|
---|
| 33 | private List<Genre> likes_genres;
|
---|
| 34 |
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | /*
|
---|
| 39 | create table users(
|
---|
| 40 | user_id serial primary key,
|
---|
| 41 | username varchar(50) not null unique,
|
---|
| 42 | name varchar(50) not null,
|
---|
| 43 | surname varchar(50) not null,
|
---|
| 44 | email varchar(100) not null unique,
|
---|
| 45 | password varchar(30) not null,
|
---|
| 46 | constraint ck_password check(length(password) >= 9)
|
---|
| 47 | );
|
---|
| 48 | */ |
---|