Skip to content

Commit

Permalink
Merge pull request #2 from local-mood/feat/1-domain
Browse files Browse the repository at this point in the history
Feat: 도메인 초기 설정
  • Loading branch information
gmkim20713 authored Dec 12, 2023
2 parents 37e34dd + 4f05bf3 commit 7b93931
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/main/java/com/ceos/vote/domain/dev_part/entity/DevPart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ceos.vote.domain.dev_part.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "dev_part")
public class DevPart {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private String name;
private String description;
private Integer voteCnt;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.ceos.vote.domain.dev_part.repository;

import com.ceos.vote.domain.dev_part.entity.DevPart;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface DevPartRepository extends JpaRepository<DevPart, Long> {
}
59 changes: 59 additions & 0 deletions src/main/java/com/ceos/vote/domain/member/entity/Member.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.ceos.vote.domain.member.entity;

import com.ceos.vote.domain.dev_part.entity.DevPart;
import com.ceos.vote.domain.team.entity.Team;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "member")
public class Member {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private String username;
private String userid;
private String email;
private String password;

private Boolean voteFlagMember;
private Boolean voteFlagTeam;

private Integer voteCnt;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "team_id")
private Team team;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dev_part_id")
private DevPart devPart;

@Builder
public Member(Long id, String username, String userId, String email, String password, Boolean voteFlagMember, Boolean voteFlagTeam, Integer voteCnt, Team team, DevPart devPart) {
this.id = id;
this.username = username;
this.userid = userId;
this.email = email;
this.password = password;
this.voteFlagMember = voteFlagMember;
this.voteFlagTeam = voteFlagTeam;
this.voteCnt = voteCnt;
this.team = team;
this.devPart = devPart;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.ceos.vote.domain.member.repository;

import com.ceos.vote.domain.member.entity.Member;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface MemberRepository extends JpaRepository<Member, Long> {
}
24 changes: 24 additions & 0 deletions src/main/java/com/ceos/vote/domain/team/entity/Team.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.ceos.vote.domain.team.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "team")
public class Team {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private String name;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.ceos.vote.domain.team.repository;

import com.ceos.vote.domain.team.entity.Team;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface TeamRepository extends JpaRepository<Team, Long> {
}

0 comments on commit 7b93931

Please sign in to comment.