Skip to content

Commit

Permalink
✨ feat: User 엔티티 수정 (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunmin0317 committed Feb 28, 2024
1 parent 9c14325 commit 82a8196
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/main/java/com/smunity/petition/domain/account/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;
Expand All @@ -22,9 +21,10 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@EntityListeners(AuditingEntityListener.class)
@Table(name = "auth_user")
@Table(name = "accounts_user")
@Entity
public class User {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
Expand All @@ -39,9 +39,8 @@ public class User {
@Column(name = "email", nullable = false)
private String email;

@Column(name = "is_superuser", nullable = false)
@ColumnDefault("false")
private Boolean isSuperUser;
@Column(name = "name", nullable = false)
private String name;

@Column(name = "is_staff", nullable = false)
@ColumnDefault("false")
Expand All @@ -54,12 +53,19 @@ public class User {
@Column(name = "last_login")
private LocalDateTime lastLogin;

@Column(name = "date_joined")
@CreatedDate
private LocalDateTime dateJoined;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "year_id")
private Year year;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "department_id")
private Department department;

@OneToOne(mappedBy = "user", fetch = FetchType.LAZY)
private Profile profile;
@Column(name = "current_year")
private int currentYear;

@Column(name = "completed_semester")
private int completedSemesters;

@OneToMany(mappedBy = "user")
private List<Question> questions;
Expand All @@ -69,8 +75,4 @@ public class User {

@OneToMany(mappedBy = "user")
private List<Petition> petitions;

public void setProfile(Profile profile) {
this.profile = profile;
}
}

0 comments on commit 82a8196

Please sign in to comment.