-
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.
Merge pull request #14 from jv-jun23-team5/{CONTROLLER]-added-Authent…
…icationController [Controller] Added AuthenticationController and UserDto for login an…
- Loading branch information
Showing
7 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/com/project/carsharingapp/controller/AuthenticationController.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,34 @@ | ||
package com.project.carsharingapp.controller; | ||
|
||
import com.project.carsharingapp.dto.user.UserLoginRequestDto; | ||
import com.project.carsharingapp.dto.user.UserLoginResponseDto; | ||
import com.project.carsharingapp.dto.user.UserRegistrationRequestDto; | ||
import com.project.carsharingapp.dto.user.UserResponseDto; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/auth") | ||
@Tag(name = "Authentication", description = "Endpoints for managing login and register user") | ||
public class AuthenticationController { | ||
|
||
@PostMapping("/login") | ||
@Operation(summary = "Login user") | ||
public UserLoginResponseDto login(@RequestBody @Valid UserLoginRequestDto requestDto) { | ||
return null; | ||
} | ||
|
||
@PostMapping("/register") | ||
@ResponseStatus(HttpStatus.CREATED) | ||
@Operation(summary = "Register user") | ||
public UserResponseDto register(@RequestBody @Valid UserRegistrationRequestDto requestDto) { | ||
return null; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/project/carsharingapp/dto/user/UserLoginRequestDto.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,12 @@ | ||
package com.project.carsharingapp.dto.user; | ||
|
||
import jakarta.validation.constraints.NotEmpty; | ||
import jakarta.validation.constraints.Size; | ||
|
||
public class UserLoginRequestDto { | ||
@NotEmpty | ||
@Size(min = 8, max = 20) | ||
private String email; | ||
|
||
private String password; | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/project/carsharingapp/dto/user/UserLoginResponseDto.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,4 @@ | ||
package com.project.carsharingapp.dto.user; | ||
|
||
public class UserLoginResponseDto { | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/project/carsharingapp/dto/user/UserRegistrationRequestDto.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,17 @@ | ||
package com.project.carsharingapp.dto.user; | ||
|
||
import jakarta.validation.constraints.NotEmpty; | ||
|
||
public class UserRegistrationRequestDto { | ||
|
||
private String email; | ||
@NotEmpty | ||
private String password; | ||
private String repeatPassword; | ||
@NotEmpty | ||
private String firstName; | ||
@NotEmpty | ||
private String lastName; | ||
@NotEmpty | ||
private String shippingAddress; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/project/carsharingapp/dto/user/UserResponseDto.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,14 @@ | ||
package com.project.carsharingapp.dto.user; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class UserResponseDto { | ||
private Long id; | ||
private String email; | ||
private String firstName; | ||
private String lastName; | ||
private String shippingAddress; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/project/carsharingapp/security/AuthenticationService.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,7 @@ | ||
package com.project.carsharingapp.security; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public class AuthenticationService { | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/project/carsharingapp/service/UserService.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.project.carsharingapp.service; | ||
|
||
public interface UserService { | ||
|
||
} |