Skip to content

Commit

Permalink
Merge pull request #48 from OmokNoonE/feature/post
Browse files Browse the repository at this point in the history
[PR] 게시물 기능 개발 수정 1차
  • Loading branch information
ms1011 authored Apr 12, 2024
2 parents dee3de3 + 148ccba commit 63808b2
Show file tree
Hide file tree
Showing 25 changed files with 351 additions and 531 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.omoknoone.onionhotsayyo;

import org.modelmapper.ModelMapper;
import org.modelmapper.config.Configuration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
Expand All @@ -15,9 +16,15 @@ public static void main(String[] args) {

@Bean
public ModelMapper modelMapper() {
return new ModelMapper();
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration()
.setFieldAccessLevel(Configuration.AccessLevel.PRIVATE)
.setFieldMatchingEnabled(true);
return modelMapper;
}

@Bean
public BCryptPasswordEncoder bCryptPasswordEncoder(){ return new BCryptPasswordEncoder();}
}


This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public class GlobalExceptionHandler {
public ResponseEntity<String> handlePostNotFoundException(PostNotFoundException ex) {
logger.error("게시물을 찾을 수 없음: {}", ex.getMessage());
return ResponseEntity
.status(HttpStatus.NOT_FOUND).body("요청하신 게시물을 찾을 수 없습니다(유감).");
.status(HttpStatus.NOT_FOUND).body("요청하신 게시물을 찾을 수 없네요(ㅇㅅㅇ).");
}

@ExceptionHandler(Exception.class)
public ResponseEntity<String> handleGeneralException(Exception ex) {
logger.error("에러 발생: {}", ex.getMessage());
return ResponseEntity
.status(HttpStatus.INTERNAL_SERVER_ERROR).body("서버 내부에서 예상치 못한 에러가 발생했습니다(ㅠ.ㅠ).");
.status(HttpStatus.INTERNAL_SERVER_ERROR).body("저런ㅋ 서버 내부에서 예상치 못한 에러가 발생했네요(ㅠ.ㅠ).");
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.omoknoone.onionhotsayyo.post.command.aggregate;
package org.omoknoone.onionhotsayyo.post.aggregate;

import jakarta.persistence.*;
import lombok.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.omoknoone.onionhotsayyo.post.command.aggregate;
package org.omoknoone.onionhotsayyo.post.aggregate;

import jakarta.persistence.*;
import lombok.*;
Expand All @@ -13,5 +13,5 @@ public class Language {

@Id
@Column(name = "language")
private String language;
private String language = "KO";
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.omoknoone.onionhotsayyo.post.command.aggregate;
package org.omoknoone.onionhotsayyo.post.aggregate;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
package org.omoknoone.onionhotsayyo.post.command.aggregate;
package org.omoknoone.onionhotsayyo.post.aggregate;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.*;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import java.time.LocalDateTime;

@Entity
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@ToString
@Entity
@Table(name = "post")
public class Post {

Expand Down Expand Up @@ -50,16 +47,19 @@ public class Post {
private boolean isDeleted = false; // 초기 삭제 상태는 false 삭제 되지 않음으로 설정

@JoinColumn(name = "category_id")
private String categoryId;
private Integer categoryId;

@JoinColumn(name = "member_id")
private String memberId;
private String memberId = "member1";

@Column(name = "image")
private String image;

@JoinColumn(name = "language")
private String language = "KO"; // 초기 상태 한국어로 설정

@JoinColumn(name = "location_id")
private String location;
private String locationId;

// 조회수 증가
public void increaseHits() {
Expand All @@ -70,8 +70,4 @@ public void increaseHits() {
public void markAsDeleted() {
this.isDeleted = true;
}

public Post() {
}

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 63808b2

Please sign in to comment.