-
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.
- Loading branch information
Showing
67 changed files
with
1,575 additions
and
304 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
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
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,34 @@ | ||
package db.domain.store; | ||
|
||
import db.domain.store.enums.StoreLocation; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import java.time.LocalDateTime; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Table(name = "goods_ledger") | ||
@Builder | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class GoodsLedgerEntity { | ||
|
||
@Id | ||
private Long goodsId; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(length = 50,columnDefinition = "VARCHAR(50)") | ||
private StoreLocation location; | ||
|
||
@Column(nullable = false) | ||
private LocalDateTime storedDate; | ||
|
||
} |
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 db.domain.store; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface GoodsLedgerRepository extends JpaRepository<GoodsLedgerEntity,Long> { | ||
|
||
} |
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,19 @@ | ||
package db.domain.store.enums; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public enum StoreLocation { | ||
|
||
S1( "서울"), | ||
S2( "부산"), | ||
S3("대구"), | ||
S4( "대전"), | ||
S5( "목포"), | ||
; | ||
|
||
private final String location; | ||
|
||
} |
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
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
20 changes: 0 additions & 20 deletions
20
db/src/main/java/db/domain/usedgoodsorder/enums/UsedGoodsOrderStatus.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
delivery/src/main/java/delivery/common/exception/ImageExceptionHandler.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,33 @@ | ||
package delivery.common.exception; | ||
|
||
import delivery.common.error.ImageErrorCode; | ||
import delivery.common.exception.image.ImageNotFoundException; | ||
import delivery.common.exception.image.ImageStorageException; | ||
import global.api.Api; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@Slf4j | ||
@RestControllerAdvice | ||
@Order(value = Integer.MIN_VALUE) | ||
public class ImageExceptionHandler { | ||
|
||
@ExceptionHandler(value = ImageStorageException.class) | ||
public ResponseEntity<Api<Object>> imageException(ImageStorageException e) { | ||
log.info("", e); | ||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) | ||
.body(Api.ERROR(ImageErrorCode.IMAGE_STORAGE_ERROR)); | ||
} | ||
|
||
@ExceptionHandler(value = ImageNotFoundException.class) | ||
public ResponseEntity<Api<Object>> imageException(ImageNotFoundException e) { | ||
log.info("", e); | ||
return ResponseEntity.status(HttpStatus.NOT_FOUND) | ||
.body(Api.ERROR(ImageErrorCode.IMAGE_NOT_FOUND)); | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
delivery/src/main/java/delivery/common/exception/image/ApiExceptionIfs.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,11 @@ | ||
package delivery.common.exception.image; | ||
|
||
import global.errorcode.ErrorCodeIfs; | ||
|
||
public interface ApiExceptionIfs { | ||
|
||
ErrorCodeIfs getErrorCodeIfs(); | ||
|
||
String getDescription(); | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
delivery/src/main/java/delivery/common/exception/image/ImageNotFoundException.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,38 @@ | ||
package delivery.common.exception.image; | ||
|
||
import global.errorcode.ErrorCodeIfs; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
||
@Getter | ||
@ResponseStatus(HttpStatus.NOT_FOUND) | ||
public class ImageNotFoundException extends RuntimeException implements ApiExceptionIfs { | ||
|
||
private final ErrorCodeIfs errorCodeIfs; | ||
private final String description; | ||
|
||
public ImageNotFoundException(ErrorCodeIfs errorCodeIfs) { | ||
super(errorCodeIfs.getDescription()); | ||
this.errorCodeIfs = errorCodeIfs; | ||
this.description = errorCodeIfs.getDescription(); | ||
} | ||
|
||
public ImageNotFoundException(ErrorCodeIfs errorCodeIfs, String errorDescription) { | ||
this.errorCodeIfs = errorCodeIfs; | ||
this.description = errorDescription; | ||
} | ||
|
||
public ImageNotFoundException(ErrorCodeIfs errorCodeIfs, Throwable throwable) { | ||
super(throwable); | ||
this.errorCodeIfs = errorCodeIfs; | ||
this.description = errorCodeIfs.getDescription(); | ||
} | ||
|
||
public ImageNotFoundException(ErrorCodeIfs errorCodeIfs, Throwable throwable, | ||
String errorDescription) { | ||
super(throwable); | ||
this.errorCodeIfs = errorCodeIfs; | ||
this.description = errorDescription; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
delivery/src/main/java/delivery/common/exception/image/ImageStorageException.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 delivery.common.exception.image; | ||
|
||
import global.errorcode.ErrorCodeIfs; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ImageStorageException extends RuntimeException implements ApiExceptionIfs { | ||
|
||
private final ErrorCodeIfs errorCodeIfs; | ||
private final String description; | ||
|
||
public ImageStorageException(ErrorCodeIfs errorCodeIfs) { | ||
super(errorCodeIfs.getDescription()); | ||
this.errorCodeIfs = errorCodeIfs; | ||
this.description = errorCodeIfs.getDescription(); | ||
} | ||
|
||
public ImageStorageException(ErrorCodeIfs errorCodeIfs, String errorDescription) { | ||
this.errorCodeIfs = errorCodeIfs; | ||
this.description = errorDescription; | ||
} | ||
|
||
public ImageStorageException(ErrorCodeIfs errorCodeIfs, Throwable throwable) { | ||
super(throwable); | ||
this.errorCodeIfs = errorCodeIfs; | ||
this.description = errorCodeIfs.getDescription(); | ||
} | ||
|
||
public ImageStorageException(ErrorCodeIfs errorCodeIfs, Throwable throwable, | ||
String errorDescription) { | ||
super(throwable); | ||
this.errorCodeIfs = errorCodeIfs; | ||
this.description = errorDescription; | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
delivery/src/main/java/delivery/domain/image/converter/ImageConverter.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
20 changes: 20 additions & 0 deletions
20
delivery/src/main/java/delivery/domain/image/service/ImageMappingService.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,20 @@ | ||
package delivery.domain.image.service; | ||
|
||
import db.domain.imagemapping.ImageMappingEntity; | ||
import db.domain.imagemapping.ImageMappingRepository; | ||
import delivery.common.error.ImageErrorCode; | ||
import delivery.common.exception.image.ImageNotFoundException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ImageMappingService { | ||
|
||
private final ImageMappingRepository imageMappingRepository; | ||
|
||
public ImageMappingEntity getImageMappingBy(Long imageMappingId) { | ||
return imageMappingRepository.findById(imageMappingId) | ||
.orElseThrow(() -> new ImageNotFoundException(ImageErrorCode.IMAGE_NOT_FOUND)); | ||
} | ||
} |
Oops, something went wrong.