-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
142 additions
and
204 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
20 changes: 19 additions & 1 deletion
20
src/main/java/com/sparta/binplay/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 |
---|---|---|
@@ -1,9 +1,27 @@ | ||
package com.sparta.binplay.controller; | ||
|
||
import com.sparta.binplay.service.UserService; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/users") | ||
@RequestMapping("/api/auth") | ||
public class UserController { | ||
private final UserService userService; | ||
|
||
public UserController(UserService userService) { | ||
this.userService = userService; | ||
} | ||
|
||
/* @PostMapping("/signup") | ||
public UserResponseDto createUser(@RequestBody UserRequestDto requestDto) { | ||
return userService.createUser(requestDto); | ||
} | ||
@PutMapping("/users/{id}") | ||
public Long updateUser(@PathVariable Long id, @RequestBody UserRequestDto requestDto) { | ||
return userService.updateUser(id, requestDto); | ||
}*/ | ||
|
||
|
||
} |
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 |
---|---|---|
@@ -1,4 +1,30 @@ | ||
package com.sparta.binplay.dto; | ||
|
||
import com.sparta.binplay.entity.Role; | ||
import jakarta.validation.constraints.Email; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class UserRequestDto { | ||
@NotBlank(message = "이메일은 필수입니다.") | ||
@Email(message = "유효하지않은 이메일입니다.") | ||
private String email; | ||
|
||
@NotBlank(message = "비밀번호는 필수입니다.") | ||
@Size(min = 6, message = "비밀번호는 6자 이상이어야 합니다.") | ||
private String password; | ||
|
||
@NotBlank(message = "이름은 필수입니다.") | ||
private String name; | ||
|
||
@NotNull(message = "역할은 필수입니다.") | ||
private Role role; | ||
|
||
@NotNull(message = "등급은 필수입니다.") | ||
private String grade; | ||
|
||
private boolean isActive; | ||
} |
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 |
---|---|---|
@@ -1,4 +1,27 @@ | ||
package com.sparta.binplay.dto; | ||
|
||
import com.sparta.binplay.entity.Users; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
public class UserResponseDto { | ||
private Long userId; | ||
private String email; | ||
private String grade; | ||
private String role; | ||
private boolean isActive; | ||
private LocalDateTime createdAt; | ||
private LocalDateTime updatedAt; | ||
|
||
public UserResponseDto(Users user) { | ||
this.userId = user.getUserId(); | ||
this.email = user.getEmail(); | ||
this.grade = user.getGrade(); | ||
this.role = user.getRole().name(); | ||
this.isActive = user.isActive(); | ||
this.createdAt = user.getCreatedAt(); | ||
this.updatedAt = user.getUpdatedAt(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
package com.sparta.binplay.entity; | ||
|
||
public enum Role { | ||
USER, | ||
UPLOADER | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
10 changes: 9 additions & 1 deletion
10
src/main/java/com/sparta/binplay/repository/UserRepository.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 |
---|---|---|
@@ -1,7 +1,15 @@ | ||
package com.sparta.binplay.repository; | ||
|
||
import com.sparta.binplay.entity.Users; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public class UserRepository { | ||
public interface UserRepository extends JpaRepository<Users, Long> { | ||
/*Users findByEmail(String email); | ||
Users findByUserId(Long userId); | ||
boolean existsByEmail(String email);*/ | ||
|
||
} |
Oops, something went wrong.