Skip to content

Commit

Permalink
[ADD] Mument, MumentTag Entity 및 Controller, Service 인터페이스와 구현부 추가 #4
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchaeeun3447 committed Jun 3, 2023
1 parent 1a8089c commit 41c7405
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mument.mument.core.mument.controller;

import com.mument.mument.core.mument.service.MumentService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mument")
@AllArgsConstructor
public class MumentController {

private final MumentService mumentService;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.mument.mument.core.mument.domain;

import com.mument.mument.core.common.domain.BaseDate;
import com.mument.mument.core.user.domain.User;
import com.mument.mument.core.music.domain.Music;
import lombok.Getter;

import javax.persistence.*;
import java.time.LocalDateTime;

@Entity
@Getter
public class Mument extends BaseDate {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private User user;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "music_id", nullable = false)
private Music music;

@Column(length = 1000)
private String content;

@Column(nullable = false, name = "is_first")
private boolean is_first;

@Column(nullable = false)
private int likeCount;

@Column(nullable = false, name = "is_deleted")
private boolean is_deleted;

@Column(nullable = false, name = "is_private")
private boolean is_private;

private LocalDateTime updatedAt;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mument.mument.core.mument.domain;

import com.mument.mument.core.common.domain.BaseDate;
import lombok.Getter;

import javax.persistence.*;
import java.time.LocalDateTime;

@Entity
@Getter
public class MumentTag extends BaseDate {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "mument_id", nullable = false)
private Mument mument;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "tag_id", nullable = false)
private Tag tag;

@Column(nullable = false, name = "is_deleted")
private boolean is_deleted;

private LocalDateTime updatedAt;
}
19 changes: 19 additions & 0 deletions mument/src/main/java/com/mument/mument/core/mument/domain/Tag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.mument.mument.core.mument.domain;

import lombok.Getter;

import javax.persistence.*;

@Entity
@Getter
public class Tag {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(nullable = false)
private int tagSort;

@Column(length = 20)
private String content;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.mument.mument.core.mument.service;

public interface MumentService {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.mument.mument.core.mument.service;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@RequiredArgsConstructor
@Slf4j
@Service
public class MumentServiceImpl implements MumentService {
}

0 comments on commit 41c7405

Please sign in to comment.