Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #21

Merged
merged 158 commits into from
May 15, 2024
Merged

Dev #21

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
83d84bb
:construction_worker: CI. Workflow 파일 추가
junhaa Mar 31, 2024
46e0188
:construction_worker: CI. push test 용 추가
junhaa Mar 31, 2024
d73a036
:construction_worker: CI. Dockerfile 추가
junhaa Mar 31, 2024
5c28764
:construction_worker: CI. 테스트용 push 브렌치 변경
junhaa Mar 31, 2024
dde1cbd
:construction_worker: CI. build.gradle build 이름 변경
junhaa Mar 31, 2024
052d5ca
:construction_worker: CI. Dockerfile 변경
junhaa Mar 31, 2024
9c85cc7
:construction_worker: CI. 테스트 코드 제거
junhaa Mar 31, 2024
3a89ab9
👷CI. CI/CD 파이프라인 구축 #1
junhaa Mar 31, 2024
f369364
:sparkles: FEAT. 공통 응답 및 예외 핸들러 추가
junhaa Apr 8, 2024
ff1a3b4
:sparkles: FEAT. AmazonConfig 및 S3 Manager 기능 추가
junhaa Apr 8, 2024
0cb0c21
Merge pull request #7 from Fairy-Taless/feature/#5-s3
junhaa Apr 8, 2024
e8dfb78
:bug: FIX. log dependency 충돌 해결
junhaa Apr 10, 2024
2bab73e
:sparkles: FEAT. elevenLabs 요청 API 기능 구현
junhaa Apr 10, 2024
5d211fc
:white_check_mark: TEST. elevenLabs 요청 API 기능 테스트
junhaa Apr 10, 2024
3c48c6b
:sparkles: FEAT. User entity 추가
junhaa Apr 10, 2024
7b15b3d
:sparkles: FEAT. User 닉네임 중복 검증 기능 추가
junhaa Apr 10, 2024
73e87f2
:bug: FIX. SLF4J Provider 충돌 오류 해결
junhaa Apr 10, 2024
9de6fca
:sparkles: FEAT. User.java Entity 추가
junhaa Apr 10, 2024
0d8f77d
:sparkles: FEAT. User.java 요청, 응답 DTO 추가
junhaa Apr 10, 2024
d4ccf7c
:sparkles: FEAT. LOGGING 변경
junhaa Apr 10, 2024
e977d2e
:sparkles: FEAT. 사용자 추가 API 기능
junhaa Apr 10, 2024
71501ad
Merge pull request #9 from Fairy-Taless/feature/#8-user
junhaa Apr 10, 2024
13bbdac
:sparkles: FEAT. ElevenlabsManager.java 파일 변환 코드 변경 및 PostConstruct 추가
junhaa Apr 10, 2024
b4b2e8f
:sparkles: FEAT. EnableJpaAuditing 추가
junhaa Apr 10, 2024
c747169
:sparkles: FEAT. Entity 추가 및 매핑
junhaa Apr 10, 2024
f41ec3c
:sparkles: FEAT. Voice 요청 응답 DTO 추가
junhaa Apr 10, 2024
3589961
:sparkles: FEAT. Voice 생성 API 기능 구현
junhaa Apr 10, 2024
25ffc1b
Merge pull request #10 from Fairy-Taless/feature/#3-voice
junhaa Apr 10, 2024
3df9cd0
:sparkles: FEAT. 임시 파일 삭제 추가
junhaa May 1, 2024
c0239e5
:sparkles: FEAT. CustomCharacter Entity 추가
ghvfgfcht May 1, 2024
da14e14
:sparkles: FEAT. CustomCharacterRepository 추가
ghvfgfcht May 1, 2024
9050135
:sparkles: FEAT. FaceSwapRequestDto 추가
ghvfgfcht May 1, 2024
b832562
:sparkles: FEAT. FaceSwapResponseDto 추가
ghvfgfcht May 1, 2024
c687643
:sparkles: FEAT. FaceSwapRestController 추가
ghvfgfcht May 1, 2024
2c48b68
:sparkles: FEAT. OriginalCharacter Entity 추가
ghvfgfcht May 1, 2024
502225d
:sparkles: FEAT. OriginalCharacterRepository 추가
ghvfgfcht May 1, 2024
9087301
:sparkles: FEAT. OriginalStoryBook Entity 추가
ghvfgfcht May 1, 2024
94546ce
:sparkles: FEAT. PhotoUploadService Interface 추가
ghvfgfcht May 1, 2024
b9b2680
:sparkles: FEAT. PhotoUploadService 추가
ghvfgfcht May 1, 2024
57ce5fa
:sparkles: FEAT. Uuid Entity 추가
ghvfgfcht May 1, 2024
0562654
:sparkles: FEAT. UuidRepository 추가
ghvfgfcht May 1, 2024
65c3dd0
:art: CHORE. URL 오타수정
ghvfgfcht May 1, 2024
57915e9
:sparkles: FEAT. User.java Entity 추가
junhaa May 1, 2024
2552c5b
:sparkles: FEAT. Authority.java Entity 추가
junhaa May 1, 2024
c01c296
:sparkles: FEAT. Role.java 권한 역할 Enum 추가
junhaa May 1, 2024
ed1e594
:sparkles: FEAT. jwtService.java JWT 토큰 생성 및 검증 관련 서비스 추가
junhaa May 1, 2024
1692b6c
:sparkles: FEAT. CustomUsernamePwdAuthenticationFilter.java JWT 검증 및 …
junhaa May 1, 2024
51ccf3d
:sparkles: FEAT. JwtLoginSuccessHandler.java JWT 인증 성공 핸들러 추가
junhaa May 1, 2024
db3b076
:sparkles: FEAT. JwtLoginFailureHandler.java JWT 인증 실패 핸들러 추가
junhaa May 1, 2024
4bafcbf
:sparkles: FEAT. JwtAuthenticationFilter.java JWT 인증 필터 추가
junhaa May 1, 2024
006af79
:sparkles: FEAT. LoginService.java Custom 로그인 서비스 추가
junhaa May 1, 2024
2844e59
:sparkles: FEAT. WebConfig.java security, JWT 설정 파일 추가
junhaa May 1, 2024
e1dc5c7
:sparkles: FEAT. LoginUser.java 어노테이션 추가
junhaa May 1, 2024
da36e76
:sparkles: FEAT. WebConfig.java security, JWT 설정 파일 추가
junhaa May 1, 2024
8b8bbc1
:heavy_plus_sign: ADD. security, JWT dependency 추가
junhaa May 1, 2024
8851d65
:sparkles: FEAT. 검증 시 필요한 User 검색 기능 추가
junhaa May 1, 2024
bf17fcb
:sparkles: FEAT. User 검증 예외 추가
junhaa May 1, 2024
169e257
:sparkles: FEAT. User 생성 시 권한 부여 및 비밀번호 암호화 기능 추가
junhaa May 1, 2024
751cb6b
:sparkles: FEAT. 예외 관련 응답, 메세지 추가
junhaa May 1, 2024
f5adfd5
:sparkles: FEAT. Voice에서 User 연관 관계 추가
junhaa May 1, 2024
5cf2265
:sparkles: FEAT. 회원가입 요청 url 변경
junhaa May 1, 2024
9616060
:sparkles: FEAT. 사용자 음성 샘플 Entity 추가
junhaa May 1, 2024
31636c9
:sparkles: FEAT. Segment 동화 문장 Entity 추가
junhaa May 1, 2024
50500e0
:sparkles: FEAT. Fairytale 동화 Entity 추가
junhaa May 1, 2024
8bd6b76
:sparkles: FEAT. UserTTSSegment.java 사용자 음성 변환 Entity 추가
junhaa May 1, 2024
6ac781b
:sparkles: FEAT. VoiceType.java 문장 음성 타입 Enum 추가
junhaa May 1, 2024
97a912c
Merge pull request #11 from Fairy-Taless/feature/#8-user
junhaa May 1, 2024
2f80a5e
Merge branch 'dev' of https://github.com/Fairy-Taless/FairyTale-backe…
junhaa May 1, 2024
e5c836f
Update gradle.yml
junhaa May 1, 2024
a58b3c1
:sparkles: FEAT. VoiceType.java 문장 음성 종류 추가
junhaa May 1, 2024
b9aab00
:art: CHORE. Fairytale.java import 추가
junhaa May 1, 2024
43af553
:sparkles: FEAT. 음성 추가 요청 DTO 추가
junhaa May 1, 2024
083bc61
:sparkles: FEAT. 음성 추가 응답 DTO 추가
junhaa May 1, 2024
1a2dea4
:sparkles: FEAT. 음성 변환 관련 예외 추가
junhaa May 1, 2024
ab35bf9
:recycle: REFACTOR. S3 버킷 경로 및 파일 이름
junhaa May 1, 2024
19695f1
:sparkles: FEAT. MultiPartFile 변환 클래스 추가
junhaa May 1, 2024
1f5343b
:sparkles: FEAT. 음성 변환 서비스 로직 추가
junhaa May 2, 2024
b0a9034
:sparkles: FEAT. 음성 변환 요청 및 Segment Entity 변환 기능 추가
junhaa May 2, 2024
3e80ec3
:sparkles: FEAT. 음성 변환 요청 및 Segment Entity 변환 기능 추가
junhaa May 2, 2024
3778f97
:heavy_plus_sign: ADD. boot-test dependency 추가
junhaa May 2, 2024
88f2ff6
:sparkles: FEAT. 동화 추가 기능 API 요청 및 변환 기능 구현
junhaa May 2, 2024
f784973
:sparkles: FEAT. 동화 추가 기능 API 서비스 로직 구현
junhaa May 2, 2024
274ed4f
:sparkles: FEAT. Elevenlabs 음성 변환 키값 추가 및 키값 변환 기능 추가
junhaa May 2, 2024
b390c4f
:sparkles: FEAT. FairytaleQueryService.java 기본 패키지 구조 작성
junhaa May 2, 2024
3ed05d9
:art: CHORE. 관련 주석 추가
junhaa May 2, 2024
600da5a
:bug: FIX. cors 오류 수정
junhaa May 2, 2024
0d809df
:bug: FIX. cors 오류 수정
junhaa May 2, 2024
e49213a
:bug: FIX. cors 오류 수정
junhaa May 2, 2024
3f9a7d7
Merge pull request #13 from Fairy-Taless/fix/#12-cors
junhaa May 2, 2024
584788a
:bug: FIX. login 응답 오류 해결
May 2, 2024
60ae2b0
Merge pull request #14 from Fairy-Taless/fix/#12-cors
junhaa May 2, 2024
a6fa694
Update gradle.yml
junhaa May 1, 2024
76e6008
:bug: FIX. cors 오류 수정
junhaa May 2, 2024
0bb9e11
:bug: FIX. cors 오류 수정
junhaa May 2, 2024
53001dc
:bug: FIX. cors 오류 수정
junhaa May 2, 2024
8900cad
:bug: FIX. login 응답 오류 해결
May 2, 2024
32da08a
:art: CHORE. Segment.java 코드 포맷팅, 주석 추가
May 2, 2024
8919a56
:bug: FIX. 컨버터 오류 수정
May 2, 2024
ce4f726
Merge pull request #15 from Fairy-Taless/feature/#3-voice
junhaa May 2, 2024
213930a
:sparkles: FEAT. Photo upload 기능 구현
ghvfgfcht May 2, 2024
b3400a4
Merge branch 'dev' of https://github.com/Fairy-Taless/FairyTale-backe…
ghvfgfcht May 2, 2024
df74765
:art: CHORE. 코드 내 주석 추가
May 2, 2024
eeeca21
:art: CHORE. 코드 내 주석 추가
May 2, 2024
3935439
:sparkles: FEAT. FileConverter.java 파일 변환 예외 추가
May 2, 2024
89f6aea
:sparkles: FEAT. historyId 필드 제거 및 연관 관계 수정
May 2, 2024
476024f
:recycle: REFACTOR. 코드 리팩토링 및 코드 주석 추가
May 2, 2024
468c8f8
:bug: FIX. isMainCharacter boolean 변환 오류 해결
May 2, 2024
601e5e9
:art: CHORE. 응답 DTO 구조 수정
May 2, 2024
3548eed
:art: CHORE. 에러 응답 코드, 메세지 추가
May 2, 2024
55e7c93
:sparkles: FEAT. 페이지 번호 별 조회 추가
May 2, 2024
4c65afc
:sparkles: FEAT. 동화 내부 문장을 사용자 음성으로 변환하여 저장 및 조회 기능 구현
May 2, 2024
3eaf059
:recycle: REFACTOR. 문장 저장 서비스 리팩토링
May 2, 2024
a6ab095
:art: CHORE. 사용자 음성 조회 예외 추가
May 2, 2024
e8c82c8
Merge pull request #16 from Fairy-Taless/feature/#3-voice
junhaa May 2, 2024
9ca1724
CHORE. FaceSwapRestController uploadImg method 매개변수 이름 변경
ghvfgfcht May 3, 2024
42fdabb
Merge branch 'dev' of https://github.com/Fairy-Taless/FairyTale-backe…
ghvfgfcht May 3, 2024
afd47c2
:heavy_plus_sign: ADD. Face Swap API 사용에 필요한 의존성 추가
ghvfgfcht May 3, 2024
f595598
:art: RENAME. CustomCharacter 연관관계 변경 OriginalStoryBook -> Fairytale
ghvfgfcht May 3, 2024
67f87f3
:sparkles: FEAT. FaceDetectApiService 파일 추가
ghvfgfcht May 3, 2024
9afc46a
:sparkles: FEAT. FaceDetect API 요청 기능 FaceDetectApiServiceImpl 파일 추가
ghvfgfcht May 3, 2024
cd5f449
:sparkles: FEAT. FaceDetectConverter 클래스 추가
ghvfgfcht May 3, 2024
294019a
:art: ADD. @ToString 어노테이션 추가
ghvfgfcht May 3, 2024
2337d68
:sparkles: FEAT. FaceDetectResponseDto 추가
ghvfgfcht May 3, 2024
ffb76cf
:sparkles: FEAT. FaceSwapApiService 인터페이스 추가
ghvfgfcht May 3, 2024
093cf8a
:sparkles: FEAT. FaceSwapApiServiceImpl 클래스 추가
ghvfgfcht May 3, 2024
de298ac
:sparkles: FEAT. FaceSwapRequestDto 클래스 추가
ghvfgfcht May 3, 2024
e91a1bf
:sparkles: FEAT. FaceSwapResponseDto 클래스 추가
ghvfgfcht May 3, 2024
8555cac
:sparkles: FEAT. FaceDetectApi 테스트를 위한 메서드 test 추가
ghvfgfcht May 3, 2024
33676d9
:art: CHORE. OriginalStoryBook 파일 삭제 후 Fairytale 로 참조 수정
ghvfgfcht May 3, 2024
30ca62a
:sparkles: FEAT. PhotoUploadService savePhotos 메서드 매개변수 user 추가
ghvfgfcht May 3, 2024
ae75f31
:sparkles: FEAT. savePhotos 메서드 매개변수 user 추가
ghvfgfcht May 3, 2024
eb53801
Merge pull request #18 from Fairy-Taless/feature/#4-face
junhaa May 3, 2024
53a13a5
:sparkles: FEAT. Face Detect && Face Swap API 완성 야호
ghvfgfcht May 6, 2024
4285c6c
:twisted_rightwards_arrows: 충돌 해결
junhaa May 7, 2024
9804987
:sparkles: FEAT. Webhook 요청 응답 추가
junhaa May 7, 2024
eae75b0
:sparkles: FEAT. webhook 응답 복호화 기능 추가
junhaa May 7, 2024
393d46d
Merge pull request #20 from Fairy-Taless/feature/#4-face
junhaa May 7, 2024
04f35d8
:sparkles: FEAT. webhook 요청 보안 해제
junhaa May 7, 2024
21579c9
:sparkles: FEAT. webhook 요청 방식 변경
junhaa May 7, 2024
75eb8b1
:sparkles: FEAT. webhook 복호화 기능, 응답 추가
junhaa May 7, 2024
c147371
:sparkles: FEAT. webhook 요청 빈 응답으로 변경
junhaa May 7, 2024
0d8d588
:bug: FIX. AKOOL face-swap API 요청 오류 해결
junhaa May 7, 2024
0a6a497
:sparkles: FEAT. userID 사용자 검색 기능 구현
junhaa May 7, 2024
9894af6
:sparkles: FEAT. 사용자 이미지 업로드 및 Detect API 호출 기능 구현
junhaa May 7, 2024
1deafe1
:art: CHORE. Detect API 코드 구조 변경
junhaa May 7, 2024
6a1cbda
:sparkles: FEAT. S3 InputStream 저장 기능 구현
junhaa May 7, 2024
c92ce3a
:sparkles: FEAT. 테이블 연관 관계 매핑 및 컬럼 추가
junhaa May 7, 2024
c246d46
:sparkles: FEAT. Face Swap API 호출 관련 각종 메서드 추가
junhaa May 7, 2024
b921bde
:sparkles: FEAT. 요청, 응답 DTO 추가
junhaa May 7, 2024
84abea2
:art: CHORE. 에러 응답 메세지 추가
junhaa May 7, 2024
4b72ee6
:art: CHORE. S3 저장 경로 변경
junhaa May 7, 2024
e1e7ba8
:art: CHORE. final 선언 추가
junhaa May 7, 2024
edea02f
:art: CHORE. 트랜잭션 어노테이션 추가
junhaa May 7, 2024
d728969
:bug: FIX. url <-> id 반대로 입력되는 오류 수정
junhaa May 7, 2024
6aec712
:sparkles: FEAT. S3 InputStream 저장 시 확장자명 추가
junhaa May 7, 2024
99f57b5
:bug: FIX. S3 버킷 변환 오류 수정
junhaa May 7, 2024
851c8c0
:bug: FIX. S3 업로드 사진 일부만 저장되는 오류 수정
junhaa May 7, 2024
136fde3
:sparkles: FEAT. 동화 음성, 사진 데이터 조회 API 기능 구현
junhaa May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: FairyTale Dev CI/CD

on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
workflow_dispatch:


permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
# JDK 설정
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# gradle build 시간 향상
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

# application.yml 파일 생성
- name: make application.yml
run: |
mkdir -p src/main/resources
echo "$APPLICATION" > src/main/resources/application.yml
env:
APPLICATION: ${{ secrets.APPLICATION }}

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build -x test

- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t app .
docker tag app ${{ secrets.DOCKER_USERNAME }}/fairytale:latest
docker push ${{ secrets.DOCKER_USERNAME }}/fairytale:latest

- name: Deploy to dev
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
script: |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/fairytale:latest
sudo docker stop $(docker ps -a -q)
sudo docker run -d --log-driver=syslog -p 8080:8080 -e SPRING_PROFILES_ACTIVE= ${{ secrets.DOCKER_USERNAME }}/fairytale:latest
sudo docker rm $(docker ps --filter 'status=exited' -a -q)
sudo docker image prune -a -f

3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM openjdk:17
COPY ./build/libs/TBD-0.0.1-SNAPSHOT.jar fairytale.jar
ENTRYPOINT ["java", "-jar", "fairytale.jar"]
49 changes: 49 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ java {
sourceCompatibility = '17'
}

// build 이름 변경
jar{
archiveBaseName = 'fairytale'
version = '0.0.1-SNAPSHOT'
enabled = false
}

configurations {
compileOnly {
extendsFrom annotationProcessor
Expand All @@ -25,10 +32,52 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'

//logging
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
modules {
module("org.springframework.boot:spring-boot-starter-logging") {
replacedBy("org.springframework.boot:spring-boot-starter-log4j2")
}
}

// ElevenLabs API
implementation ('net.andrewcpu:elevenlabs-api:2.7.8')

// AWS
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'

compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

// Face Swap API
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'org.json:json:20200518'

// Face Swap API
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'org.json:json:20200518'

// Face Swap API
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'org.json:json:20200518'

// webhook
implementation 'javax.xml.bind:jaxb-api:2.3.1'

// Spring Security OAUTH 2.1
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.security:spring-security-oauth2-client'

// JWT token
implementation 'io.jsonwebtoken:jjwt:0.12.3'

compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
implementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/fairytale/tbd/FairytaleApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@SpringBootApplication
@EnableJpaAuditing
public class FairytaleApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package fairytale.tbd.domain.faceSwap.converter;

import java.time.LocalDateTime;

import fairytale.tbd.domain.faceSwap.entity.OriginalCharacter;
import fairytale.tbd.domain.faceSwap.web.dto.FaceResponseDTO;

public class FaceSwapConverter {

public static FaceResponseDTO.OriginalCharacterSaveResponseDTO toOriginalCharacterSaveResponseDTO(
OriginalCharacter originalCharacter) {
return FaceResponseDTO.OriginalCharacterSaveResponseDTO.builder()
.created_at(LocalDateTime.now())
.image_url(originalCharacter.getOriginalURL())
.original_character_id(originalCharacter.getOriginId())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package fairytale.tbd.domain.faceSwap.entity;

import fairytale.tbd.domain.fairytale.entity.Fairytale;
import fairytale.tbd.domain.user.entity.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.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "custom_character")
public class CustomCharacter {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "custom_character_id")
private Long customId;

@Column(name = "custom_character_image_url", nullable = false)
private String customURL;

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

@Column(name = "page_num", nullable = false)
private Long pageNum;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "fairytale_id")
private Fairytale fairytale;

public void setUser(User user) {
this.user = user;
}

public void setFairytale(Fairytale fairytale) {
this.fairytale = fairytale;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package fairytale.tbd.domain.faceSwap.entity;

import fairytale.tbd.global.entity.BaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "image_save_queue")
public class ImageSaveQueue extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "image_save_id")
private Long id;

@Column(name = "user_id", nullable = false)
private Long userId;

@Column(name = "image_url", nullable = false)
private String imageURL;

@Column(name = "page_num", nullable = false)
private Long pageNum;

@Column(name = "fairytale_id", nullable = false)
private Long fairytaleId;

@Column(name = "image_swap_request_id", nullable = false)
private String requestId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package fairytale.tbd.domain.faceSwap.entity;

import fairytale.tbd.domain.fairytale.entity.Fairytale;
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.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "original_character")
public class OriginalCharacter {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "original_character_id")
private Long originId;

@Column(name = "originl_character_image_url", nullable = false)
private String originalURL;

@Column(name = "page_num", nullable = false)
private Long pageNum;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "fairytale_id")
private Fairytale fairytale;

@Column(name = "original_character_image_opts", nullable = false)
private String opts;

// 연관 관계 편의 메서드

public void setFairytale(Fairytale fairytale) {
this.fairytale = fairytale;
}

}
18 changes: 18 additions & 0 deletions src/main/java/fairytale/tbd/domain/faceSwap/entity/Uuid.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package fairytale.tbd.domain.faceSwap.entity;

import jakarta.persistence.*;
import lombok.*;
@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PROTECTED)

public class Uuid {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long uuidId;

@Column(unique = true)
private String uuid;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package fairytale.tbd.domain.faceSwap.exception;

import fairytale.tbd.global.enums.statuscode.BaseCode;
import fairytale.tbd.global.exception.GeneralException;

public class FaceNotDetectException extends GeneralException {
public FaceNotDetectException(BaseCode errorStatus) {
super(errorStatus);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package fairytale.tbd.domain.faceSwap.exception;

import fairytale.tbd.global.enums.statuscode.BaseCode;
import fairytale.tbd.global.exception.GeneralException;

public class FaceSwapFailureException extends GeneralException {
public FaceSwapFailureException(BaseCode errorStatus) {
super(errorStatus);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package fairytale.tbd.domain.faceSwap.exception;

import fairytale.tbd.global.enums.statuscode.BaseCode;
import fairytale.tbd.global.exception.GeneralException;

public class UserFaceNotExistException extends GeneralException {
public UserFaceNotExistException(BaseCode errorStatus) {
super(errorStatus);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package fairytale.tbd.domain.faceSwap.repository;

import java.util.List;

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

import fairytale.tbd.domain.faceSwap.entity.CustomCharacter;

@Repository
public interface CustomCharacterRepository extends JpaRepository<CustomCharacter, Long> {
List<CustomCharacter> findByUserIdAndFairytaleId(Long userId, Long fairytaleId);
}
Loading
Loading