Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:TG-WinG/tech-blog into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
wwingyou committed Nov 27, 2024
2 parents 45ad6ce + d37bb48 commit 45d2209
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/kr/tgwing/tech/project/domain/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
@DynamicInsert
@NoArgsConstructor
@Table(name= "project")
public class Project extends BaseEntity {
public class
Project extends BaseEntity {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="project_id")
private Long id;
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/kr/tgwing/tech/project/dto/ProjectBriefDTO.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package kr.tgwing.tech.project.dto;

import kr.tgwing.tech.project.domain.Image;
import kr.tgwing.tech.project.domain.Project;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.util.Optional;

@Data
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand All @@ -33,13 +35,20 @@ public ProjectBriefDTO(Long id, String title, LocalDate start, LocalDate end, St
}

public static ProjectBriefDTO of(Project project) {
String imgUrl;
Optional<Image> first = project.getImageUrls().stream().findFirst();
if (first.isEmpty()) {
imgUrl = null;
} else {
imgUrl = first.get().getImageUrl();
}
return ProjectBriefDTO.builder()
.id(project.getId())
.title(project.getTitle())
.start(project.getStartDate())
.end(project.getEndDate())
.description(project.getDescription())
.thumbnail(project.getImageUrls().stream().findFirst().get().getImageUrl())
.thumbnail(imgUrl)
.devStatus(project.getDevStatus())
.devType(project.getDevType())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
// .hasRole("ADMIN")
.requestMatchers("/**")
.permitAll()
.anyRequest().authenticated())
.anyRequest().authenticated()
)
.addFilterBefore(new JwtFilter(jwtUtil), LoginFilter.class)
.addFilterAt(new LoginFilter(authenticationManager(authenticationConfiguration), jwtUtil, tempUserRepository),
UsernamePasswordAuthenticationFilter.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected void successfulAuthentication(HttpServletRequest request,
HttpServletResponse response,
FilterChain chain,
Authentication authentication) throws IOException {
//UserDetailsS
//UserDetailsS
CustomUserDetails customUserDetails = (CustomUserDetails) authentication.getPrincipal();

String username = customUserDetails.getUsername();
Expand Down

0 comments on commit 45d2209

Please sign in to comment.