Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
65846d8
Merge pull request #72 from TeamLearningFlow/develop
LJYeon12 Feb 2, 2025
81c5362
Merge pull request #78 from TeamLearningFlow/develop
LJYeon12 Feb 4, 2025
e8c8805
Merge pull request #81 from TeamLearningFlow/develop
LJYeon12 Feb 4, 2025
b55bda5
Merge pull request #83 from TeamLearningFlow/develop
LJYeon12 Feb 4, 2025
7c084b1
Merge pull request #85 from TeamLearningFlow/develop
LJYeon12 Feb 5, 2025
83d77fb
Merge pull request #87 from TeamLearningFlow/develop
LJYeon12 Feb 5, 2025
7dac4c9
Merge pull request #89 from TeamLearningFlow/develop
LJYeon12 Feb 5, 2025
7773dbe
Merge pull request #91 from TeamLearningFlow/develop
LJYeon12 Feb 5, 2025
354acb0
Merge pull request #93 from TeamLearningFlow/develop
LJYeon12 Feb 5, 2025
1da07c1
Merge pull request #95 from TeamLearningFlow/develop
LJYeon12 Feb 5, 2025
422f75b
Merge pull request #97 from TeamLearningFlow/develop
LJYeon12 Feb 5, 2025
2faea53
Merge pull request #98 from TeamLearningFlow/develop
jimin-fundamental Feb 6, 2025
5eda64a
Merge pull request #99 from TeamLearningFlow/develop
jimin-fundamental Feb 6, 2025
cc36441
Revert "[hotfix] driver:docker 설정 추가해서 moby/buildkit 다운로드 막음"
jimin-fundamental Feb 6, 2025
41dbe16
Merge pull request #100 from TeamLearningFlow/revert-99-develop
jimin-fundamental Feb 6, 2025
ca6f042
CorsConfig, SecurityConfig 링크 추가
JungJaehoon0430 Feb 6, 2025
d58eec5
Merge pull request #103 from TeamLearningFlow/feat/102/editCors
JaehoonJung0430 Feb 6, 2025
1396488
Merge pull request #104 from TeamLearningFlow/develop
JaehoonJung0430 Feb 6, 2025
8191b0c
Config 수정
JungJaehoon0430 Feb 7, 2025
42373bb
Merge pull request #106 from TeamLearningFlow/feat/102/editCors
JaehoonJung0430 Feb 7, 2025
38e9dcc
Merge branch 'deploy' into develop
JaehoonJung0430 Feb 7, 2025
4b85961
Merge pull request #107 from TeamLearningFlow/develop
JaehoonJung0430 Feb 7, 2025
f7aadd9
Merge pull request #105 from TeamLearningFlow/feat/101/swaggerUpdate
MODUGGAGI Feb 7, 2025
2000e2d
수정 완료
LJYeon12 Feb 7, 2025
58f4ce6
Merge pull request #109 from TeamLearningFlow/feat/108/yml과-oauth2log…
LJYeon12 Feb 7, 2025
b72debf
Merge pull request #110 from TeamLearningFlow/develop
LJYeon12 Feb 7, 2025
a99c315
[hotfix] application.yml 수정에 따른 app.url 안바뀐 부분 수정
jimin-fundamental Feb 8, 2025
e87776c
Merge pull request #111 from TeamLearningFlow/develop
jimin-fundamental Feb 8, 2025
de8ba2a
수강 상태 저장 완료, home localdate 직렬화
LJYeon12 Feb 8, 2025
22e8a88
Merge pull request #113 from TeamLearningFlow/112-feat-usercollection…
LJYeon12 Feb 8, 2025
5a0cad4
Merge pull request #114 from TeamLearningFlow/develop
LJYeon12 Feb 8, 2025
80154cf
feat : 오류 수정 및 필요없는 import
MODUGGAGI Feb 9, 2025
bbfa70d
Merge pull request #116 from TeamLearningFlow/feat/115/searhFix
MODUGGAGI Feb 9, 2025
3e1639a
Merge pull request #117 from TeamLearningFlow/develop
MODUGGAGI Feb 9, 2025
e8c5edd
feat : 구글 로그인 할 때 이름은 따로 사용자에게 추가 입력 받게끔 변경
MODUGGAGI Feb 9, 2025
f6cda14
Merge pull request #119 from TeamLearningFlow/feat/118/googleLoginFix
MODUGGAGI Feb 9, 2025
a239ed8
Merge pull request #120 from TeamLearningFlow/develop
MODUGGAGI Feb 9, 2025
baeeeda
feat : 커서 기반 페이징 사용 시, 다음 페이지로 넘어가기 위해서 lastId가 아닌 page를 인자로 전달받게끔 수정
MODUGGAGI Feb 10, 2025
c7c8964
Merge pull request #122 from TeamLearningFlow/feat/121/searchPaging
MODUGGAGI Feb 10, 2025
b4445a7
Merge pull request #123 from TeamLearningFlow/develop
MODUGGAGI Feb 10, 2025
383142a
feat : 구글 로그인 수정
MODUGGAGI Feb 10, 2025
248f7fa
Merge pull request #125 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 10, 2025
5c215b0
Merge pull request #126 from TeamLearningFlow/develop
MODUGGAGI Feb 10, 2025
212c386
feat : 구글 로그인 수정
MODUGGAGI Feb 10, 2025
4cedb51
Merge pull request #127 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 10, 2025
21b990d
Merge pull request #128 from TeamLearningFlow/develop
MODUGGAGI Feb 10, 2025
bc195bf
feat : 구글 로그인 수정
MODUGGAGI Feb 10, 2025
a95fc5f
Merge pull request #129 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 10, 2025
c59efa6
Merge pull request #130 from TeamLearningFlow/develop
MODUGGAGI Feb 10, 2025
8e07833
feat : 구글 로그인 수정
MODUGGAGI Feb 10, 2025
4a50423
Merge pull request #131 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 10, 2025
3925d48
Merge pull request #132 from TeamLearningFlow/develop
MODUGGAGI Feb 10, 2025
58674dd
feat : 구글 로그인 수정
MODUGGAGI Feb 10, 2025
ec8cc2c
Merge pull request #133 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 10, 2025
d9b854d
Merge pull request #134 from TeamLearningFlow/develop
MODUGGAGI Feb 10, 2025
4f9a8b2
feat : 구글 로그인 수정
MODUGGAGI Feb 11, 2025
fc7a726
Merge pull request #135 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 11, 2025
83413a2
Merge pull request #136 from TeamLearningFlow/develop
MODUGGAGI Feb 11, 2025
ba9a59d
feat : 구글 로그인 수정
MODUGGAGI Feb 12, 2025
5da87dd
Merge pull request #137 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 12, 2025
01895f6
Merge pull request #138 from TeamLearningFlow/develop
MODUGGAGI Feb 12, 2025
416fe07
youtube ad 제거
LJYeon12 Feb 12, 2025
2b67aa2
Merge pull request #140 from TeamLearningFlow/feat/139/youtube-광고-제거
LJYeon12 Feb 12, 2025
008fc2a
Merge pull request #141 from TeamLearningFlow/develop
LJYeon12 Feb 12, 2025
af7b918
feat : CollectionDTO에 imageUrl 추가
MODUGGAGI Feb 13, 2025
492498f
Merge pull request #142 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 13, 2025
5751166
Merge pull request #143 from TeamLearningFlow/develop
MODUGGAGI Feb 13, 2025
314618d
유튜브 광고 수정
LJYeon12 Feb 13, 2025
775e656
Merge pull request #144 from TeamLearningFlow/feat/139/youtube-광고-제거
LJYeon12 Feb 13, 2025
a26fb73
Merge pull request #145 from TeamLearningFlow/develop
LJYeon12 Feb 13, 2025
2aab6a1
feat : 쿼리 스트링에 들어가던 token 이라는 이름을 각 경우에 맞는 이름으로 수정
MODUGGAGI Feb 13, 2025
14b5f61
Merge pull request #146 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 13, 2025
e02eb05
Merge pull request #147 from TeamLearningFlow/develop
MODUGGAGI Feb 13, 2025
92c38ef
feat : 비밀번호 재설정 API는 loginController에서 UserRestController로 이동
MODUGGAGI Feb 13, 2025
8adb0d1
[feat] banner img url 생성 완료
jimin-fundamental Feb 13, 2025
d93fccf
Merge branch 'develop' of https://github.com/TeamLearningFlow/Learnin…
jimin-fundamental Feb 13, 2025
dba928a
Merge pull request #149 from TeamLearningFlow/develop
jimin-fundamental Feb 13, 2025
661c5c5
feat : 이메일 재설정 API 추가
MODUGGAGI Feb 13, 2025
2b64541
Merge pull request #150 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 13, 2025
dee7403
Merge pull request #151 from TeamLearningFlow/develop
MODUGGAGI Feb 13, 2025
169d358
feat : 구글 로그인 해결 시도...
MODUGGAGI Feb 13, 2025
c27b450
Merge pull request #152 from TeamLearningFlow/feat/124/googleRedirect
MODUGGAGI Feb 13, 2025
85f41a2
Merge pull request #153 from TeamLearningFlow/develop
MODUGGAGI Feb 13, 2025
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
3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
driver: docker

# Build and push Docker image
- name: Build and push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.PathInits;


/**
Expand All @@ -17,6 +18,8 @@ public class QEmailVerificationToken extends EntityPathBase<EmailVerificationTok

private static final long serialVersionUID = -1162432526L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QEmailVerificationToken emailVerificationToken = new QEmailVerificationToken("emailVerificationToken");

public final QBaseEntity _super = new QBaseEntity(this);
Expand All @@ -35,18 +38,29 @@ public class QEmailVerificationToken extends EntityPathBase<EmailVerificationTok
//inherited
public final DateTimePath<java.time.LocalDateTime> updatedAt = _super.updatedAt;

public final QUser user;

public final BooleanPath verified = createBoolean("verified");

public QEmailVerificationToken(String variable) {
super(EmailVerificationToken.class, forVariable(variable));
this(EmailVerificationToken.class, forVariable(variable), INITS);
}

public QEmailVerificationToken(Path<? extends EmailVerificationToken> path) {
super(path.getType(), path.getMetadata());
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}

public QEmailVerificationToken(PathMetadata metadata) {
super(EmailVerificationToken.class, metadata);
this(metadata, PathInits.getFor(metadata, INITS));
}

public QEmailVerificationToken(PathMetadata metadata, PathInits inits) {
this(EmailVerificationToken.class, metadata, inits);
}

public QEmailVerificationToken(Class<? extends EmailVerificationToken> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.user = inits.isInitialized("user") ? new QUser(forProperty("user")) : null;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public class QUser extends EntityPathBase<User> {

public final QBaseEntity _super = new QBaseEntity(this);

public final StringPath bannerImgUrl = createString("bannerImgUrl");

public final ListPath<Long, NumberPath<Long>> bookmarkedCollectionIds = this.<Long, NumberPath<Long>>createList("bookmarkedCollectionIds", Long.class, NumberPath.class, PathInits.DIRECT2);

//inherited
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class QUserEpisodeProgress extends EntityPathBase<UserEpisodeProgress> {

public final NumberPath<Integer> episodeNumber = createNumber("episodeNumber", Integer.class);

public final BooleanPath isComplete = createBoolean("isComplete");

public final EnumPath<learningFlow.learningFlow_BE.domain.enums.ResourceType> resourceType = createEnum("resourceType", learningFlow.learningFlow_BE.domain.enums.ResourceType.class);

public final NumberPath<Integer> totalProgress = createNumber("totalProgress", Integer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,24 @@ public enum ErrorStatus implements BaseErrorCode {


// 멤버 관려 에러
EMAIL_ALREADY_EXISTS(HttpStatus.BAD_REQUEST,"EMAIL4001" ,"이미 동일한 이메일로 생성된 계정이 존재합니다."),
EMAIL_VERIFICATION_IN_PROGRESS(HttpStatus.BAD_REQUEST, "EMAIL4002", "이미 진행 중인 이메일 인증이 있습니다. 이메일을 확인해주세요."),
EMAIL_CHANGE_SAME_AS_CURRENT(HttpStatus.BAD_REQUEST, "EMAIL4004", "기존과 동일한 이메일로는 변경하실 수 없습니다."),
GOOGLE_USER_CANNOT_CHANGE_EMAIL(HttpStatus.BAD_REQUEST,"EMAIL4005","구글 로그인 유저는 이메일 변경을 하실 수 없습니다."),
EMAIL_CODE_INVALID(HttpStatus.BAD_REQUEST, "EMAIL4006", "유효하지 않은 이메일 인증 코드입니다."),
EMAIL_CODE_EXPIRED(HttpStatus.BAD_REQUEST,"EMAIL4007","만료된 이메일 인증 코드입니다. 이메일 인증을 다시 요청해주세요."),

USER_NOT_FOUND(HttpStatus.BAD_REQUEST, "USER4001", "사용자를 찾을 수 없습니다."),
NICKNAME_NOT_EXIST(HttpStatus.BAD_REQUEST, "USER4002", "닉네임은 필수 입니다."),

// 비밀번호 관련 에러 추가
INVALID_PASSWORD(HttpStatus.BAD_REQUEST, "PASSWORD4001", "유효하지 않은 비밀번호입니다."),
PASSWORD_CURRENT_MISMATCH(HttpStatus.BAD_REQUEST, "PASSWORD4002", "현재 비밀번호가 일치하지 않습니다."),
PASSWORD_SAME_AS_CURRENT(HttpStatus.BAD_REQUEST, "PASSWORD4003", "새 비밀번호는 현재 비밀번호와 달라야 합니다."),
PASSWORD_RESET_CODE_INVALID(HttpStatus.BAD_REQUEST, "PASSWORD4004", "유효하지 않은 비밀번호 재설정 코드입니다."),
PASSWORD_RESET_CODE_EXPIRED(HttpStatus.BAD_REQUEST, "PASSWORD4005", "만료된 비밀번호 재설정 코드입니다. 비밀번호 재설정을 다시 요청해주세요."),


//Resources 관련 에어
RESOURCES_NOT_FOUND(HttpStatus.NOT_FOUND,"RESOURCE4001","강의 에피소드를 찾을 수 없습니다."),
QUANTITY_IS_NULL(HttpStatus.BAD_REQUEST, "RESOURCE4002", "분량이 존재하지 않습니다"),
Expand All @@ -41,10 +56,6 @@ public enum ErrorStatus implements BaseErrorCode {
// 예시,,,
ARTICLE_NOT_FOUND(HttpStatus.NOT_FOUND, "ARTICLE4001", "게시글이 없습니다."),


EMAIL_ALREADY_EXISTS(HttpStatus.BAD_REQUEST,"EMAIL4001" ,"이미 동일한 이메일로 생성된 계정이 존재합니다."),
INVALID_PASSWORD(HttpStatus.BAD_REQUEST, "PASSWORD4001", "유효하지 않은 비밀번호입니다."),

//이미지
IMAGE_FORMAT_BADREQUEST(HttpStatus.BAD_REQUEST,"COMMON400","이미지 파일만 업로드할 수 있습니다."),
IMAGE_UPLOAD_FAILED(HttpStatus.INTERNAL_SERVER_ERROR, "COMMON5001", "이미지 업로드에 실패했습니다. 다시 시도해주세요."),
Expand Down
26 changes: 22 additions & 4 deletions src/main/java/learningFlow/learningFlow_BE/config/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
package learningFlow.learningFlow_BE.config;

//Spring Security까지 CORS 적용 목적
Expand All @@ -7,6 +8,7 @@
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

import java.util.Arrays;
import java.util.List;

@Configuration
Expand All @@ -16,12 +18,28 @@ public class CorsConfig {
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();

config.setAllowedOrigins(Arrays.asList(
"http://localhost:3000",
"http://localhost:8081",
"http://onboarding.p-e.kr:8080",
"http://54.180.118.227",
"https://accounts.google.com"
));

config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
config.setAllowedHeaders(Arrays.asList("*"));
config.setAllowCredentials(true);
config.setAllowedOrigins(List.of("http://localhost:3000", "http://localhost:8081")); // ✅ Swagger 포함
config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
config.setAllowedHeaders(List.of("*"));
config.setMaxAge(3600L);
config.setExposedHeaders(Arrays.asList(
"Authorization",
"Refresh-Token",
"Access-Control-Allow-Origin",
"Access-Control-Allow-Credentials"
));
config.setMaxAge(86400L);

source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
}
*/
13 changes: 11 additions & 2 deletions src/main/java/learningFlow/learningFlow_BE/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
package learningFlow.learningFlow_BE.config;

import org.springframework.context.annotation.Configuration;
Expand All @@ -10,11 +11,19 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:3000", "http://localhost:8080", "http://onboarding.p-e.kr:8080", "http://54.180.118.227")
// .allowedOrigins("http://localhost:3000") // 프론트엔드 주소
.allowedOriginPatterns("*") // 개발 중일 때만 사용
// 또는 특정 출처만 허용
.allowedOrigins(
"http://localhost:3000",
"http://localhost:8081",
"http://onboarding.p-e.kr:8080",
"http://54.180.118.227",
"https://accounts.google.com"
)
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
.allowedHeaders("*")
.allowCredentials(true)
.maxAge(86400L);
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,16 @@ public SecurityFilterChain filterChain(HttpSecurity http, JwtAuthenticationFilte
"/search/**",
"/",
"/collections/{collectionId:[\\d]+}",
"/image/upload" //이미지 업로드는 허용
"/image/upload", //이미지 업로드는 허용
"/favicon.ico",
"/register",
"/register/complete",
"/login",
"/login/google",
"/oauth2/**",
"/login/oauth2/**",
"/user/change-email"
).permitAll()
.requestMatchers(
"/register", "/register/complete", "/login", "/login/google", "/oauth2/**").permitAll()
.requestMatchers("/admin/**").hasRole("ADMIN")
.requestMatchers("/user/**", "/resources/**", "/collections/{collectionId:[\\d]+}/likes", "/logout/**").authenticated()
.anyRequest().permitAll()
Expand All @@ -72,7 +78,6 @@ public SecurityFilterChain filterChain(HttpSecurity http, JwtAuthenticationFilte
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
.exceptionHandling(exception ->
exception.authenticationEntryPoint(authenticationEntryPoint));

return http.build();
}

Expand All @@ -89,10 +94,37 @@ public PasswordEncoder passwordEncoder() {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(List.of("http://localhost:3000")); // 프론트엔드 주소

configuration.setAllowedOrigins(Arrays.asList(
"http://localhost:3000",
"http://localhost:8081",
"http://onboarding.p-e.kr:8080",
"http://54.180.118.227",
"https://accounts.google.com"
));

configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
configuration.setAllowedHeaders(List.of("*"));
configuration.setAllowedHeaders(Arrays.asList(
"Authorization",
"Refresh-Token",
"Access-Control-Allow-Origin",
"Access-Control-Allow-Credentials",
"Content-Type",
"Accept",
"Origin",
"X-Requested-With"
));
configuration.setAllowCredentials(true);
configuration.setExposedHeaders(Arrays.asList(
"Authorization",
"Refresh-Token",
"Access-Control-Allow-Origin",
"Access-Control-Allow-Credentials",
"Content-Type",
"Accept",
"Origin",
"X-Requested-With"
));
configuration.setMaxAge(86400L);

UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public static SearchRequestDTO.SearchConditionDTO toSearchConditionDTO(

public static CollectionResponseDTO.SearchResultDTO toSearchResultDTO(
List<Collection> collections,
Long lastId,
boolean hasNext,
int totalPages,
int currentPage,
User currentUser,
Map<Long, CollectionResponseDTO.CollectionLearningInfo> learningInfoMap
Map<Long, CollectionResponseDTO.CollectionLearningInfo> learningInfoMap,
int totalCount
) {
List<CollectionResponseDTO.CollectionPreviewDTO> list = collections.stream()
.map(collection -> toCollectionPreviewDTO(
Expand All @@ -63,10 +63,10 @@ public static CollectionResponseDTO.SearchResultDTO toSearchResultDTO(

return CollectionResponseDTO.SearchResultDTO.builder()
.searchResults(list)
.lastId(lastId)
.hasNext(hasNext)
.currentPage(currentPage)
.totalPages(totalPages)
.totalCount(totalCount)
.build();
}

Expand All @@ -82,6 +82,7 @@ public static CollectionResponseDTO.CollectionPreviewDTO toCollectionPreviewDTO(

return CollectionResponseDTO.CollectionPreviewDTO.builder()
.collectionId(collection.getId())
.imageUrl(collection.getCollectionImgUrl())
.interestField(collection.getInterestField())
.title(collection.getTitle())
.creator(collection.getCreator())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import learningFlow.learningFlow_BE.domain.*;
import learningFlow.learningFlow_BE.domain.Collection;
import learningFlow.learningFlow_BE.web.dto.collection.CollectionResponseDTO;
import learningFlow.learningFlow_BE.web.dto.resource.ResourceRequestDTO;
import learningFlow.learningFlow_BE.web.dto.resource.ResourceResponseDTO;
import learningFlow.learningFlow_BE.domain.CollectionEpisode;
import learningFlow.learningFlow_BE.domain.UserCollection;
import learningFlow.learningFlow_BE.web.dto.home.HomeResponseDTO;
import java.util.*;

public class ResourceConverter {
Expand All @@ -23,10 +21,15 @@ public static ResourceResponseDTO.ResourceUrlDTO watchEpisode(Collection collect
.urlTitle(resource.getTitle())
.progress(userProgress.getCurrentProgress())
.memoContents(memoContents)
.episodeInformationList(episodeInformationList(collection))
.episodeInformationList(episodeInformationList(collection,userProgress))
.build();
}
public static ResourceResponseDTO.ResourceBlogUrlDTO watchBlogEpisode(Collection collection, UserEpisodeProgress userProgress, String pageResource, String resourceTitle, Optional<Memo> memo){
public static ResourceResponseDTO.ResourceBlogUrlDTO watchBlogEpisode(
Collection collection,
UserEpisodeProgress userProgress,
String pageResource,
String resourceTitle,
Optional<Memo> memo){
String memoContents = "작성하신 글의 첫 줄은 노트의 제목이 됩니다, 최대 2,000자까지 입력하실 수 있어요";
if (memo.isPresent())
memoContents = memo.get().getContents();
Expand All @@ -38,17 +41,20 @@ public static ResourceResponseDTO.ResourceBlogUrlDTO watchBlogEpisode(Collection
.urlTitle(resourceTitle)
.progress(userProgress.getCurrentProgress())
.memoContents(memoContents)
.episodeInformationList(episodeInformationList(collection))
.episodeInformationList(episodeInformationList(collection, userProgress))
.build();
}

public static List<ResourceResponseDTO.episodeInformation> episodeInformationList(Collection collection) {
public static List<ResourceResponseDTO.episodeInformation> episodeInformationList(
Collection collection, UserEpisodeProgress userEpisodeProgress
) {
List<ResourceResponseDTO.episodeInformation> episodeInformationList = new ArrayList<>();

for (CollectionEpisode episode : collection.getEpisodes()) {
episodeInformationList.add(new ResourceResponseDTO.episodeInformation(
episode.getEpisodeNumber(),
episode.getResource().getTitle()
episode.getResource().getTitle(),
userEpisodeProgress.getIsComplete()
));
}
episodeInformationList.sort(Comparator.comparingInt(ResourceResponseDTO.episodeInformation::getEpisodeNumber));
Expand All @@ -62,6 +68,12 @@ public static ResourceResponseDTO.ProgressResponseDTO toSaveProgressResponse(Res
.build();
}

public static ResourceResponseDTO.changeEpisodeIsCompleteDTO toChangeEpisodeIsCompleteDTO(Boolean isComplete){
return ResourceResponseDTO.changeEpisodeIsCompleteDTO.builder()
.isComplete(isComplete)
.build();
}

public static ResourceResponseDTO.SearchResultResourceDTO convertToResourceDTO(CollectionEpisode episode) {
return ResourceResponseDTO.SearchResultResourceDTO.builder()
.resourceId(episode.getId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static UserResponseDTO.UserLoginResponseDTO toUserLoginResponseDTO(User u
.name(user.getName())
.role(user.getRole())
.socialType(user.getSocialType())
.profileImgUrl(user.getProfileImgUrl())
.build();
}

Expand All @@ -30,6 +31,7 @@ public static UserInfoDTO convertToUserInfoDTO(User user) {
.interestFields(user.getInterestFields())
.preferType(user.getPreferType())
.profileImgUrl(user.getProfileImgUrl())
.bannerImgUrl(user.getBannerImgUrl())
.build();
}

Expand All @@ -53,6 +55,7 @@ private static UserResponseDTO.UserPreviewDTO convertToUserPreviewDTO(User user)
.email(user.getEmail())
.job(user.getJob().getDescription())
.profileImgUrl(user.getProfileImgUrl())
.bannerImgUrl(user.getBannerImgUrl())
.build();
}
}
Loading