-
Notifications
You must be signed in to change notification settings - Fork 4
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 #33 from yooonwodyd/weekly
- Loading branch information
Showing
33 changed files
with
792 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.helpmeCookies.global.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
|
||
@Configuration | ||
@EnableJpaAuditing | ||
public class JpaConfig { | ||
} |
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
59 changes: 59 additions & 0 deletions
59
src/main/java/com/helpmeCookies/user/controller/ArtistController.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,59 @@ | ||
package com.helpmeCookies.user.controller; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.helpmeCookies.global.jwt.JwtProvider; | ||
import com.helpmeCookies.global.jwt.JwtUser; | ||
import com.helpmeCookies.user.dto.request.BusinessArtistReq; | ||
import com.helpmeCookies.user.dto.request.StudentArtistReq; | ||
import com.helpmeCookies.user.dto.response.BusinessArtistRes; | ||
import com.helpmeCookies.user.dto.response.StudentArtistRes; | ||
import com.helpmeCookies.user.service.ArtistService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class ArtistController { | ||
private final ArtistService artistService; | ||
private final JwtProvider jwtProvider; | ||
|
||
@PostMapping("/v1/artists/students") | ||
public ResponseEntity<StudentArtistRes> registerStudents( | ||
@RequestBody StudentArtistReq studentArtistReq, | ||
@AuthenticationPrincipal JwtUser jwtUser | ||
) { | ||
StudentArtistRes response = StudentArtistRes.from(artistService.registerStudentsArtist(studentArtistReq, jwtUser.getId())); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@PostMapping("/v1/artists/bussinesses") | ||
public ResponseEntity<BusinessArtistRes> registerbussinsess( | ||
@RequestBody BusinessArtistReq businessArtistReq, | ||
@AuthenticationPrincipal JwtUser jwtUser | ||
) { | ||
BusinessArtistRes response = BusinessArtistRes.from(artistService.registerBusinessArtist(businessArtistReq, jwtUser.getId())); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
// 작가 목록 조회(페이징) | ||
// TODO: 6주차 회의 이후 추가 | ||
@GetMapping("/v1/artists") | ||
public String getArtists() { | ||
return "ok"; | ||
} | ||
|
||
// 작가 프로필 조회 | ||
// TODO: 6주차 회의 이후 추가 | ||
@GetMapping("/v1/artists/{userId}") | ||
public String getArtist() { | ||
return "ok"; | ||
} | ||
} |
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
36 changes: 36 additions & 0 deletions
36
src/main/java/com/helpmeCookies/user/controller/UserController.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 com.helpmeCookies.user.controller; | ||
|
||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
|
||
import com.helpmeCookies.global.jwt.JwtUser; | ||
import com.helpmeCookies.user.dto.UserDto; | ||
import com.helpmeCookies.user.service.UserService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Controller | ||
@RequiredArgsConstructor | ||
public class UserController { | ||
private final UserService userService; | ||
|
||
// TODO: 이후 추가되는 요구사항에 따라 별도의 UserRes로 반환 | ||
// TODO: 구매 판매 내역에 대한 추가 정보 필요. Product 도메인 완성이후 추가 | ||
@GetMapping("/v1/users/{userId}") | ||
public UserDto getUsers( | ||
@PathVariable Long userId | ||
) { | ||
return userService.getUser(userId); | ||
} | ||
|
||
//유저 팔로우 목록 조회 | ||
@GetMapping("/v1/users/{userId}/follows") | ||
public String getFollows() { | ||
|
||
return "ok"; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/helpmeCookies/user/dto/ArtistInfoDto.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 com.helpmeCookies.user.dto; | ||
|
||
public record ArtistInfoDto( | ||
Long totalFollowers, | ||
Long totalLikes, | ||
String about | ||
) { | ||
public static ArtistInfoDto of(Long totalFollowers, Long totalLikes, String about) { | ||
return new ArtistInfoDto(totalFollowers, totalLikes, about); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/helpmeCookies/user/dto/BusinessArtistDto.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,27 @@ | ||
package com.helpmeCookies.user.dto; | ||
|
||
import com.helpmeCookies.user.entity.BusinessArtist; | ||
|
||
public record BusinessArtistDto( | ||
Long id, | ||
Long userId, | ||
String businessNumber, | ||
String openDate, | ||
String headName, | ||
ArtistInfoDto artistInfo | ||
) { | ||
public static BusinessArtistDto fromEntity(BusinessArtist businessArtist){ | ||
return new BusinessArtistDto( | ||
businessArtist.getId(), | ||
businessArtist.getUserId(), | ||
businessArtist.getBusinessNumber(), | ||
businessArtist.getOpenDate(), | ||
businessArtist.getHeadName(), | ||
ArtistInfoDto.of( | ||
businessArtist.getArtistInfo().getTotalFollowers(), | ||
businessArtist.getArtistInfo().getTotalLikes(), | ||
businessArtist.getArtistInfo().getAbout() | ||
) | ||
); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/helpmeCookies/user/dto/StudentArtistDto.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,27 @@ | ||
package com.helpmeCookies.user.dto; | ||
|
||
import com.helpmeCookies.user.entity.StudentArtist; | ||
|
||
public record StudentArtistDto( | ||
Long id, | ||
Long userId, | ||
String schoolEmail, | ||
String schoolName, | ||
String major, | ||
ArtistInfoDto artistInfo | ||
) { | ||
public static StudentArtistDto fromEntity(StudentArtist studentArtist) { | ||
return new StudentArtistDto( | ||
studentArtist.getId(), | ||
studentArtist.getUserId(), | ||
studentArtist.getSchoolEmail(), | ||
studentArtist.getSchoolName(), | ||
studentArtist.getMajor(), | ||
ArtistInfoDto.of( | ||
studentArtist.getArtistInfo().getTotalFollowers(), | ||
studentArtist.getArtistInfo().getTotalLikes(), | ||
studentArtist.getArtistInfo().getAbout() | ||
) | ||
); | ||
} | ||
} |
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.helpmeCookies.user.dto; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
import com.helpmeCookies.product.entity.HashTag; | ||
import com.helpmeCookies.user.entity.User; | ||
|
||
public record UserDto( | ||
Long id, | ||
String nickname, | ||
String email, | ||
String birthdate, | ||
String phone, | ||
String address, | ||
LocalDateTime createdAt, | ||
List<HashTag> hashTags | ||
) { | ||
public static UserDto fromEntity(User user) { | ||
return new UserDto( | ||
user.getId(), | ||
user.getNickname(), | ||
user.getEmail(), | ||
user.getBirthdate(), | ||
user.getPhone(), | ||
user.getAddress(), | ||
user.getCreatedAt(), | ||
user.getHashTags() | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/helpmeCookies/user/dto/request/BusinessArtistReq.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 com.helpmeCookies.user.dto.request; | ||
|
||
import com.helpmeCookies.user.dto.ArtistInfoDto; | ||
|
||
public record BusinessArtistReq( | ||
String businessNumber, | ||
String openDate, | ||
String headName | ||
) { | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/helpmeCookies/user/dto/request/StudentArtistReq.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.helpmeCookies.user.dto.request; | ||
|
||
import com.helpmeCookies.user.dto.StudentArtistDto; | ||
|
||
public record StudentArtistReq( | ||
String schoolEmail, | ||
String schoolName, | ||
String major | ||
) { | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/helpmeCookies/user/dto/response/ArtistInfoRes.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,16 @@ | ||
package com.helpmeCookies.user.dto.response; | ||
|
||
import com.helpmeCookies.user.dto.ArtistInfoDto; | ||
|
||
public record ArtistInfoRes( | ||
Long totalFollowers, | ||
Long totalLikes, | ||
String about | ||
) { | ||
public static ArtistInfoRes from(ArtistInfoDto artistInfoDto) { | ||
return new ArtistInfoRes( | ||
artistInfoDto.totalFollowers(), | ||
artistInfoDto.totalLikes(), | ||
artistInfoDto.about()); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/helpmeCookies/user/dto/response/BusinessArtistRes.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,19 @@ | ||
package com.helpmeCookies.user.dto.response; | ||
|
||
import com.helpmeCookies.user.dto.BusinessArtistDto; | ||
|
||
public record BusinessArtistRes( | ||
String businessNumber, | ||
String openDate, | ||
String headName, | ||
ArtistInfoRes artistInfo | ||
) { | ||
public static BusinessArtistRes from(BusinessArtistDto businessArtistDto) { | ||
return new BusinessArtistRes( | ||
businessArtistDto.businessNumber(), | ||
businessArtistDto.openDate(), | ||
businessArtistDto.headName(), | ||
ArtistInfoRes.from(businessArtistDto.artistInfo()) | ||
); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/helpmeCookies/user/dto/response/StudentArtistRes.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,19 @@ | ||
package com.helpmeCookies.user.dto.response; | ||
|
||
import com.helpmeCookies.user.dto.StudentArtistDto; | ||
|
||
public record StudentArtistRes( | ||
String schoolEmail, | ||
String schoolName, | ||
String major, | ||
ArtistInfoRes artistInfo | ||
) { | ||
public static StudentArtistRes from(StudentArtistDto studentArtistDto) { | ||
return new StudentArtistRes( | ||
studentArtistDto.schoolEmail(), | ||
studentArtistDto.schoolName(), | ||
studentArtistDto.major(), | ||
ArtistInfoRes.from(studentArtistDto.artistInfo()) | ||
); | ||
} | ||
} |
Oops, something went wrong.