-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from 2024-ITEC0401/develop
9번 이슈까지 작업한 내용 main 브랜치로 병합
- Loading branch information
Showing
39 changed files
with
1,087 additions
and
34 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
28 changes: 28 additions & 0 deletions
28
backend/src/main/java/com/itec0401/backend/config/SecurityConfig.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,28 @@ | ||
package com.itec0401.backend.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
import org.springframework.security.web.SecurityFilterChain; | ||
|
||
@Configuration | ||
@EnableWebSecurity | ||
public class SecurityConfig { | ||
|
||
@Bean | ||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { | ||
http | ||
.csrf((csrf) -> csrf.disable()) | ||
.cors((c) -> c.disable()) | ||
.headers((headers) -> headers.disable()); | ||
return http.build(); | ||
} | ||
|
||
@Bean | ||
public PasswordEncoder passwordEncoder(){ | ||
return new BCryptPasswordEncoder(); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
backend/src/main/java/com/itec0401/backend/domain/clothing/entity/Clothing.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,43 @@ | ||
package com.itec0401.backend.domain.clothing.entity; | ||
|
||
import com.itec0401.backend.domain.clothing.entity.type.weatherType; | ||
import com.itec0401.backend.domain.coordinationclothing.entity.CoordinationClothing; | ||
import com.itec0401.backend.domain.user.entity.User; | ||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class Clothing { | ||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "clothing_id") | ||
private Long id; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private weatherType weather; | ||
|
||
// 다른 특징들을 enum 화 할건지 테이블 만들어서 쓸 건지 결정 해야함! | ||
private String category; | ||
|
||
private String subCategory; | ||
|
||
private String textile; | ||
|
||
private String pattern; | ||
|
||
private String baseColor; | ||
|
||
private String pointColor; | ||
|
||
@OneToMany(mappedBy = "clothing") | ||
private List<CoordinationClothing> coordinationClothingList; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/com/itec0401/backend/domain/clothing/entity/type/weatherType.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,5 @@ | ||
package com.itec0401.backend.domain.clothing.entity.type; | ||
|
||
public enum weatherType { | ||
SPRING, SUMMER, AUTUMN, WINTER | ||
} |
29 changes: 29 additions & 0 deletions
29
backend/src/main/java/com/itec0401/backend/domain/color/entity/Color.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,29 @@ | ||
package com.itec0401.backend.domain.color.entity; | ||
|
||
import com.itec0401.backend.domain.usercolor.entity.UserColor; | ||
import com.itec0401.backend.global.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class Color extends BaseEntity { | ||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "color_id") | ||
private Long id; | ||
|
||
private String color; | ||
|
||
@OneToMany(mappedBy = "color") | ||
private List<UserColor> userColors; | ||
|
||
@Builder | ||
public Color(String color) { | ||
this.color = color; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
backend/src/main/java/com/itec0401/backend/domain/color/repository/ColorRepository.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,10 @@ | ||
package com.itec0401.backend.domain.color.repository; | ||
|
||
import com.itec0401.backend.domain.color.entity.Color; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface ColorRepository extends JpaRepository<Color, Long> { | ||
Optional<Color> findByColor(String color); | ||
} |
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/com/itec0401/backend/domain/color/service/ColorService.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,13 @@ | ||
package com.itec0401.backend.domain.color.service; | ||
|
||
import com.itec0401.backend.domain.color.entity.Color; | ||
import com.itec0401.backend.domain.color.repository.ColorRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.Optional; | ||
|
||
|
||
public interface ColorService { | ||
Optional<Color> findColorByName(String color); | ||
} |
22 changes: 22 additions & 0 deletions
22
backend/src/main/java/com/itec0401/backend/domain/color/service/ColorServiceImpl.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,22 @@ | ||
package com.itec0401.backend.domain.color.service; | ||
|
||
import com.itec0401.backend.domain.color.entity.Color; | ||
import com.itec0401.backend.domain.color.repository.ColorRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.Optional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ColorServiceImpl implements ColorService { | ||
private final ColorRepository colorRepository; | ||
|
||
// Color 이름으로 color 객체 찾기 | ||
@Override | ||
public Optional<Color> findColorByName(String color) { | ||
return colorRepository.findByColor(color); | ||
} | ||
|
||
// Color 초기 값 생성은 관리자가 DB에 직접 넣기! | ||
} |
31 changes: 31 additions & 0 deletions
31
backend/src/main/java/com/itec0401/backend/domain/coordination/entity/Coordination.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,31 @@ | ||
package com.itec0401.backend.domain.coordination.entity; | ||
|
||
import com.itec0401.backend.domain.coordinationclothing.entity.CoordinationClothing; | ||
import com.itec0401.backend.domain.user.entity.User; | ||
import com.itec0401.backend.global.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class Coordination extends BaseEntity { | ||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "coordination_id") | ||
private Long id; | ||
|
||
private Boolean liked; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
|
||
@OneToMany(mappedBy = "coordination") | ||
private List<CoordinationClothing> coordinationClothingList; | ||
|
||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...in/java/com/itec0401/backend/domain/coordinationclothing/entity/CoordinationClothing.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,23 @@ | ||
package com.itec0401.backend.domain.coordinationclothing.entity; | ||
|
||
import com.itec0401.backend.domain.clothing.entity.Clothing; | ||
import com.itec0401.backend.domain.coordination.entity.Coordination; | ||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class CoordinationClothing { | ||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "clothing_id") | ||
private Clothing clothing; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "coordination_id") | ||
private Coordination coordination; | ||
} |
29 changes: 29 additions & 0 deletions
29
backend/src/main/java/com/itec0401/backend/domain/style/entity/Style.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,29 @@ | ||
package com.itec0401.backend.domain.style.entity; | ||
|
||
import com.itec0401.backend.domain.userstyle.entity.UserStyle; | ||
import com.itec0401.backend.global.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
public class Style extends BaseEntity { | ||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "style_id") | ||
private Long id; | ||
|
||
private String style; | ||
|
||
@OneToMany(mappedBy = "style") | ||
private List<UserStyle> userStyles; | ||
|
||
@Builder | ||
public Style(String style){ | ||
this.style = style; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
backend/src/main/java/com/itec0401/backend/domain/style/repository/StyleRepository.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,10 @@ | ||
package com.itec0401.backend.domain.style.repository; | ||
|
||
import com.itec0401.backend.domain.style.entity.Style; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface StyleRepository extends JpaRepository<Style, Long> { | ||
Optional<Style> findByStyle(String style); | ||
} |
9 changes: 9 additions & 0 deletions
9
backend/src/main/java/com/itec0401/backend/domain/style/service/StyleService.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,9 @@ | ||
package com.itec0401.backend.domain.style.service; | ||
|
||
import com.itec0401.backend.domain.style.entity.Style; | ||
import java.util.Optional; | ||
|
||
|
||
public interface StyleService { | ||
Optional<Style> findStyleByName(String style); | ||
} |
22 changes: 22 additions & 0 deletions
22
backend/src/main/java/com/itec0401/backend/domain/style/service/StyleServiceImpl.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,22 @@ | ||
package com.itec0401.backend.domain.style.service; | ||
|
||
import com.itec0401.backend.domain.style.entity.Style; | ||
import com.itec0401.backend.domain.style.repository.StyleRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.Optional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class StyleServiceImpl implements StyleService { | ||
private final StyleRepository styleRepository; | ||
|
||
// Style 이름으로 style 객체 찾기 | ||
@Override | ||
public Optional<Style> findStyleByName(String style) { | ||
return styleRepository.findByStyle(style); | ||
} | ||
|
||
// Style 초기 값 생성은 관리자가 DB에 직접 넣기! | ||
} |
Oops, something went wrong.