Skip to content

Commit

Permalink
merge: 기업 및 기업 계정 엔티티 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
yh0921k authored Sep 21, 2023
2 parents 1d0ca7b + e1b7a6b commit 602039f
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/main/java/io/devlabs/keytree/domains/company/domain/Admin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.devlabs.keytree.domains.company.domain;

import io.devlabs.keytree.commons.jpa.BaseTimeEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.hibernate.annotations.Comment;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Getter
@Builder
public class Admin extends BaseTimeEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Comment("관리자 아이디")
private Long id;

@Column
@NotNull
@Comment("이름")
private String name;

@Column
@NotNull
@Comment("이메일")
private String email;

@Column
@NotNull
@Comment("비밀번호")
private String password;

@Column
@NotNull
@Enumerated(EnumType.STRING)
@Comment("관리자 권한")
private UserRole userRole;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.devlabs.keytree.domains.company.domain;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface AdminRepository extends JpaRepository<Admin, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.devlabs.keytree.domains.company.domain;

import io.devlabs.keytree.commons.jpa.BaseTimeEntity;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.hibernate.annotations.Comment;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Getter
@Builder
public class Company extends BaseTimeEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Comment("기업 아이디")
private Long id;

@Column
@NotNull
@Comment("기업 이름")
private String name;

@Column
@NotNull
@Comment("기업 연락처")
private String phone;

@Column
@Comment("기업 주소")
private String address;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.devlabs.keytree.domains.company.domain;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface CompanyRepository extends JpaRepository<Company, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.devlabs.keytree.domains.company.domain;

public enum UserRole {
MASTER("MASTER"),
ADMIN("ADMIN"),
USER("USER");

private final String name;

UserRole(String name) {
this.name = name;
}

public String getName() {
return name;
}
}

0 comments on commit 602039f

Please sign in to comment.