-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#93 | Implementation of 'Assignment Listing' API Endpoint (#160)
Co-authored-by: Agit Rubar Demir <[email protected]>
- Loading branch information
1 parent
af444a2
commit 5aecf16
Showing
15 changed files
with
536 additions
and
42 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
38 changes: 38 additions & 0 deletions
38
src/main/java/com/ays/assignment/model/dto/response/AssignmentsResponse.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,38 @@ | ||
package com.ays.assignment.model.dto.response; | ||
|
||
import com.ays.assignment.model.enums.AssignmentStatus; | ||
import com.ays.common.model.dto.response.BaseResponse; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
@SuperBuilder | ||
public class AssignmentsResponse extends BaseResponse { | ||
|
||
private String id; | ||
private AssignmentStatus status; | ||
private String description; | ||
private String firstName; | ||
private String lastName; | ||
private Location location; | ||
private User user; | ||
|
||
@Getter | ||
@Setter | ||
public static class Location { | ||
private Double longitude; | ||
private Double latitude; | ||
} | ||
|
||
@Getter | ||
@Setter | ||
public static class User { | ||
private String id; | ||
private String firstName; | ||
private String lastName; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/ays/assignment/model/mapper/AssignmentToAssignmentsResponseMapper.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.ays.assignment.model.mapper; | ||
|
||
import com.ays.assignment.model.Assignment; | ||
import com.ays.assignment.model.dto.response.AssignmentsResponse; | ||
import com.ays.common.model.mapper.BaseMapper; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
/** | ||
* AssignmentEntityToAssignmentMapper is an interface that defines the mapping between an {@link Assignment} and an {@link AssignmentsResponse}. | ||
* 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 AssignmentToAssignmentsResponseMapper extends BaseMapper<Assignment, AssignmentsResponse> { | ||
|
||
@Override | ||
@Mapping(target = "location.longitude", source = "point.x") | ||
@Mapping(target = "location.latitude", source = "point.y") | ||
AssignmentsResponse map(Assignment source); | ||
|
||
/** | ||
* Initializes the mapper. | ||
* | ||
* @return the initialized mapper object. | ||
*/ | ||
static AssignmentToAssignmentsResponseMapper initialize() { | ||
return Mappers.getMapper(AssignmentToAssignmentsResponseMapper.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
Oops, something went wrong.