Skip to content

Commit

Permalink
Merge pull request #4 from Leets-Official/feat/#2/도메인-생성
Browse files Browse the repository at this point in the history
[feat] #2 도메인 생성
  • Loading branch information
yechan-kim authored Sep 29, 2024
2 parents 9281b01 + e6b5c9d commit fc9abd4
Show file tree
Hide file tree
Showing 26 changed files with 582 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: featrue
name: feature
about: Suggest an idea for this project
title: '[feat] #[issue number] [issue name]'
labels: ''
Expand Down
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ext {
dependencies {
// Spring
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
Expand All @@ -46,8 +45,8 @@ dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

// Mysql
runtimeOnly 'com.mysql:mysql-connector-j'
// MariaDB
implementation 'org.mariadb.jdbc:mariadb-java-client'

// JWT
implementation 'io.jsonwebtoken:jjwt-api:0.12.6'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.leets.xcellentbe.domain.chatroom.domain;

import java.util.UUID;

import com.leets.xcellentbe.domain.shared.BaseTimeEntity;

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

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

@Id
@GeneratedValue(strategy = GenerationType.UUID)
private UUID ChatroomId;

@Column(length = 50)
private String lastParticipantName;

@Column
private String lastMessage;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.leets.xcellentbe.domain.chatroom.domain.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import lombok.RequiredArgsConstructor;

@RestController
@RequestMapping("/chatroom")
@RequiredArgsConstructor
public class ChatroomController {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.leets.xcellentbe.domain.chatroom.domain.repository;

import java.util.UUID;

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

import com.leets.xcellentbe.domain.chatroom.domain.Chatroom;

public interface ChatroomRepository extends JpaRepository<Chatroom, UUID> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.leets.xcellentbe.domain.comment.domain;

import java.util.UUID;

import com.leets.xcellentbe.domain.post.domain.Post;
import com.leets.xcellentbe.domain.shared.BaseTimeEntity;
import com.leets.xcellentbe.domain.shared.DeletedStatus;
import com.leets.xcellentbe.domain.user.domain.User;

import jakarta.persistence.Column;
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.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

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

@Id
@GeneratedValue(strategy = GenerationType.UUID)
private UUID CommentId;

@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "writer_id")
private User writer;

@Column(length = 50)
private String content;

@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id")
private Post post;

@NotNull
@Column
private DeletedStatus deletedStatus;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.leets.xcellentbe.domain.comment.domain.repository;

import java.util.UUID;

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

import com.leets.xcellentbe.domain.comment.domain.Comment;

public interface CommentRepository extends JpaRepository<Comment, UUID> {
}
49 changes: 49 additions & 0 deletions src/main/java/com/leets/xcellentbe/domain/dm/domain/DM.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.leets.xcellentbe.domain.dm.domain;

import java.util.UUID;

import com.leets.xcellentbe.domain.chatroom.domain.Chatroom;
import com.leets.xcellentbe.domain.shared.BaseTimeEntity;
import com.leets.xcellentbe.domain.shared.DeletedStatus;
import com.leets.xcellentbe.domain.user.domain.User;

import jakarta.persistence.Column;
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.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

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

@Id
@GeneratedValue(strategy = GenerationType.UUID)
private UUID DMId;

@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "chatroom_id")
private Chatroom chatRoom;

@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "participant_id")
private User participant;

@NotNull
@Column
private String message;

@NotNull
@Column
private DeletedStatus deletedStatus;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.leets.xcellentbe.domain.dm.domain.repository;

import java.util.UUID;

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

import com.leets.xcellentbe.domain.dm.domain.DM;

public interface DMRepository extends JpaRepository<DM, UUID> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.leets.xcellentbe.domain.follow.domain;

import com.leets.xcellentbe.domain.user.domain.User;

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.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Follow {

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

@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "following_id")
private User following;

@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "follower_id")
private User follower;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.leets.xcellentbe.domain.follow.domain.repository;

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

import com.leets.xcellentbe.domain.follow.domain.Follow;

public interface FollowRepository extends JpaRepository<Follow, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.leets.xcellentbe.domain.hashtag.domain;

import java.util.UUID;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Hashtag {

@Id
@Column(name = "hashtag_id")
@GeneratedValue(strategy = GenerationType.UUID)
private UUID HashtagId;

@NotNull
@Column(length = 30)
private String content;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.leets.xcellentbe.domain.hashtag.domain.repository;

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

import com.leets.xcellentbe.domain.hashtag.domain.Hashtag;

public interface HashtagRepository extends JpaRepository<Hashtag, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.leets.xcellentbe.domain.post.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import lombok.RequiredArgsConstructor;

@RestController
@RequestMapping("/post")
@RequiredArgsConstructor
public class PostController {
}
57 changes: 57 additions & 0 deletions src/main/java/com/leets/xcellentbe/domain/post/domain/Post.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.leets.xcellentbe.domain.post.domain;

import java.util.List;
import java.util.UUID;

import com.leets.xcellentbe.domain.hashtag.domain.Hashtag;
import com.leets.xcellentbe.domain.shared.DeletedStatus;
import com.leets.xcellentbe.domain.user.domain.User;

import jakarta.persistence.Column;
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.OneToMany;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Post {

@Id
@GeneratedValue(strategy = GenerationType.UUID)
private UUID PostId;

@NotNull
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "writer_id")
private User writer;

@NotNull
@Column
private String content;

@NotNull
@Column
private DeletedStatus deletedStatus;

@NotNull
@Column
private Boolean isPinned;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "repost_id")
private Post rePost;

@OneToMany(fetch = FetchType.LAZY)
@JoinColumn(name = "hashtag_id")
private List<Hashtag> hashtags;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.leets.xcellentbe.domain.post.domain.repository;

import java.util.UUID;

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

import com.leets.xcellentbe.domain.post.domain.Post;

public interface PostRepository extends JpaRepository<Post, UUID> {
}
Loading

0 comments on commit fc9abd4

Please sign in to comment.