-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#150 | Revert | Fix response type of save user endpoint (#155)
- Loading branch information
1 parent
5cddddf
commit 729a674
Showing
9 changed files
with
132 additions
and
12 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
31 changes: 31 additions & 0 deletions
31
src/main/java/com/ays/user/model/dto/response/UserSavedResponse.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.ays.user.model.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
/** | ||
* A DTO class representing the response data returned when a user is saved. | ||
* <p> | ||
* This class provides getters and setters for the username and password fields. | ||
* It also includes a builder pattern implementation for constructing instances of this class with optional parameters. | ||
* <p> | ||
* The purpose of this class is to encapsulate the response data related to saving a user, allowing for easy | ||
* transfer of the data between different layers of the application. | ||
*/ | ||
@Getter | ||
@Setter | ||
@Builder | ||
public class UserSavedResponse { | ||
|
||
/** | ||
* This field is created by the application. | ||
*/ | ||
private String username; | ||
|
||
/** | ||
* This field is created by the application. | ||
*/ | ||
private String password; | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/ays/user/model/mapper/UserToUserSavedResponseMapper.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.ays.user.model.mapper; | ||
|
||
import com.ays.common.model.mapper.BaseMapper; | ||
import com.ays.user.model.User; | ||
import com.ays.user.model.dto.response.UserSavedResponse; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
/** | ||
* UserToUserResponseMapper is an interface that defines the mapping between an {@link User} and an {@link UserSavedResponse}. | ||
* This interface uses the MapStruct annotation @Mapper to generate an implementation of this interface at compile-time. | ||
* <p>The class provides a static method {@code initialize()} that returns an instance of the generated mapper implementation. | ||
* <p>The interface extends the MapStruct interface {@link BaseMapper}, which defines basic mapping methods. | ||
* The interface adds no additional mapping methods, but simply defines the types to be used in the mapping process. | ||
*/ | ||
@Mapper | ||
public interface UserToUserSavedResponseMapper extends BaseMapper<User, UserSavedResponse> { | ||
|
||
/** | ||
* Initializes the mapper. | ||
* | ||
* @return the initialized mapper object. | ||
*/ | ||
static UserToUserSavedResponseMapper initialize() { | ||
return Mappers.getMapper(UserToUserSavedResponseMapper.class); | ||
} | ||
|
||
} |
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 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
21 changes: 21 additions & 0 deletions
21
src/test/java/com/ays/user/model/dto/response/UserSavedResponseBuilder.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,21 @@ | ||
package com.ays.user.model.dto.response; | ||
|
||
import com.ays.common.model.TestDataBuilder; | ||
|
||
public class UserSavedResponseBuilder extends TestDataBuilder<UserSavedResponse> { | ||
|
||
public UserSavedResponseBuilder() { | ||
super(UserSavedResponse.class); | ||
} | ||
|
||
public UserSavedResponseBuilder withUsername(String username) { | ||
data.setUsername(username); | ||
return this; | ||
} | ||
|
||
public UserSavedResponseBuilder withPassword(String password) { | ||
data.setPassword(password); | ||
return this; | ||
} | ||
|
||
} |
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