-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[feat] 여행후기 관련 엔티티 & 예외 구현
- Loading branch information
Showing
24 changed files
with
536 additions
and
29 deletions.
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
14 changes: 14 additions & 0 deletions
14
...main/java/com/haejwo/tripcometrue/domain/member/exception/UserInvalidAccessException.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.haejwo.tripcometrue.domain.member.exception; | ||
|
||
|
||
import com.haejwo.tripcometrue.global.exception.ApplicationException; | ||
import com.haejwo.tripcometrue.global.exception.ErrorCode; | ||
|
||
public class UserInvalidAccessException extends ApplicationException { | ||
|
||
private static final ErrorCode ERROR_CODE = ErrorCode.USER_INVALID_ACCESS; | ||
|
||
public UserInvalidAccessException() { | ||
super(ERROR_CODE); | ||
} | ||
} |
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
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
36 changes: 36 additions & 0 deletions
36
...java/com/haejwo/tripcometrue/domain/triprecord/controller/TripRecordControllerAdvice.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,36 @@ | ||
package com.haejwo.tripcometrue.domain.triprecord.controller; | ||
|
||
import com.haejwo.tripcometrue.domain.triprecord.exception.ExpenseRangeTypeNotFoundException; | ||
import com.haejwo.tripcometrue.domain.triprecord.exception.TripRecordNotFoundException; | ||
import com.haejwo.tripcometrue.global.util.ResponseDTO; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@RestControllerAdvice | ||
public class TripRecordControllerAdvice { | ||
|
||
@ExceptionHandler(TripRecordNotFoundException.class) | ||
public ResponseEntity<ResponseDTO<Void>> tripRecordNotFoundException( | ||
TripRecordNotFoundException e | ||
) { | ||
HttpStatus status = e.getErrorCode().getHttpStatus(); | ||
|
||
return ResponseEntity | ||
.status(status) | ||
.body(ResponseDTO.errorWithMessage(status, e.getMessage())); | ||
} | ||
|
||
@ExceptionHandler(ExpenseRangeTypeNotFoundException.class) | ||
public ResponseEntity<ResponseDTO<Void>> expenseRangeTypeNotFoundException( | ||
ExpenseRangeTypeNotFoundException e | ||
) { | ||
HttpStatus status = e.getErrorCode().getHttpStatus(); | ||
|
||
return ResponseEntity | ||
.status(status) | ||
.body(ResponseDTO.errorWithMessage(status, e.getMessage())); | ||
} | ||
|
||
} |
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
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
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
51 changes: 51 additions & 0 deletions
51
src/main/java/com/haejwo/tripcometrue/domain/triprecord/entity/TripRecordImage.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,51 @@ | ||
package com.haejwo.tripcometrue.domain.triprecord.entity; | ||
|
||
import com.haejwo.tripcometrue.domain.triprecord.entity.type.ExternalLinkTagType; | ||
import com.haejwo.tripcometrue.domain.triprecord.entity.type.TripRecordImageType; | ||
import com.haejwo.tripcometrue.global.entity.BaseTimeEntity; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
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 lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class TripRecordImage extends BaseTimeEntity { | ||
|
||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "trip_record_image_id") | ||
private Long id; | ||
|
||
private TripRecordImageType imageType; | ||
private String imageUrl; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private ExternalLinkTagType tagType; | ||
private String tagUrl; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "trip_record_id") | ||
private TripRecord tripRecord; | ||
|
||
@Builder | ||
public TripRecordImage(Long id, TripRecordImageType imageType, String imageUrl, | ||
ExternalLinkTagType tagType, String tagUrl, TripRecord tripRecord) { | ||
this.id = id; | ||
this.imageType = imageType; | ||
this.imageUrl = imageUrl; | ||
this.tagType = tagType; | ||
this.tagUrl = tagUrl; | ||
this.tripRecord = tripRecord; | ||
} | ||
} |
Oops, something went wrong.