-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from HongDam-org/meeting
[ADD] Group Controller + Service + Repository + Entity 설계 완료
- Loading branch information
Showing
8 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
backend/src/main/java/com/twtw/backend/domain/group/controller/GroupController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.twtw.backend.domain.group.controller; | ||
|
||
import com.twtw.backend.domain.group.service.GroupService; | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/group") | ||
public class GroupController { | ||
private final GroupService groupService; | ||
|
||
public GroupController(GroupService groupService) { | ||
this.groupService = groupService; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/com/twtw/backend/domain/group/entity/Group.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.twtw.backend.domain.group.entity; | ||
|
||
import jakarta.persistence.*; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Group { | ||
@Id | ||
@GeneratedValue(generator = "uuid2") | ||
@Column(name = "id", columnDefinition = "BINARY(16)") | ||
private UUID id; | ||
|
||
private String name; | ||
private String groupImage; | ||
|
||
@OneToMany(mappedBy = "group") | ||
private List<GroupMember> groupMembers = new ArrayList<>(); | ||
} |
29 changes: 29 additions & 0 deletions
29
backend/src/main/java/com/twtw/backend/domain/group/entity/GroupMember.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.twtw.backend.domain.group.entity; | ||
|
||
import com.twtw.backend.domain.member.entity.Member; | ||
|
||
import jakarta.persistence.*; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.UUID; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class GroupMember { | ||
@Id | ||
@GeneratedValue(generator = "uuid2") | ||
@Column(name = "id", columnDefinition = "BINARY(16)") | ||
private UUID id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "group_id") | ||
private Group group; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
} |
9 changes: 9 additions & 0 deletions
9
backend/src/main/java/com/twtw/backend/domain/group/repository/GroupMemberRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.twtw.backend.domain.group.repository; | ||
|
||
import com.twtw.backend.domain.group.entity.GroupMember; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.UUID; | ||
|
||
public interface GroupMemberRepository extends JpaRepository<GroupMember, UUID> {} |
9 changes: 9 additions & 0 deletions
9
backend/src/main/java/com/twtw/backend/domain/group/repository/GroupRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.twtw.backend.domain.group.repository; | ||
|
||
import com.twtw.backend.domain.group.entity.Group; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.UUID; | ||
|
||
public interface GroupRepository extends JpaRepository<Group, UUID> {} |
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/com/twtw/backend/domain/group/service/GroupService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.twtw.backend.domain.group.service; | ||
|
||
import com.twtw.backend.domain.group.repository.GroupRepository; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class GroupService { | ||
private final GroupRepository groupRepository; | ||
|
||
public GroupService(GroupRepository groupRepository) { | ||
this.groupRepository = groupRepository; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters