Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 266 New Contractor view #278

Closed
wants to merge 10 commits into from

Conversation

Quirtelus
Copy link
Contributor

This PR should create a Contractors endpoint that allows contractors to get an overview over Task that are assigned to the owner.
The endpoint are defined as followed:

Get all Tasks assigned to the contractor

  • api/v1/contractors/ownerid/tasks

Get Informations about a specific Task that is assigned to the contractor

  • api/v1/contractors/ownerid/task/taskid

@astanik astanik added the enhancement New feature or request label Dec 17, 2024
@astanik astanik linked an issue Dec 17, 2024 that may be closed by this pull request
@astanik astanik requested a review from MagdalenaCl December 19, 2024 05:25
Copy link
Contributor

@MagdalenaCl MagdalenaCl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is well structured overall and is kept clean. In addition, TaskJson and TaskListJson have been reused so that there is no duplicate code. Due to the incorrect path, the frontend cannot currently work with the backend. The error 404 is returned. If the following errors have been corrected, the connection can be tried again.

Nevertheless, I still have some room for improvement (most of them are also marked as comments in the code):

  • The file ContractorsEnpoint.java should be renamed to ContractorsEndpoint.java.
  • The context and version need to be added to the path so that the path is “api/v1/contractor/...” in ContractorsEndpoint.
  • Both endpoints should use the ownerId so that the path is consistent.
  • Limit and offset can be introduced in the contractors endpoint so that pagination is taken into account. (If it is introduced, then it must also be implemented in the frontend.
  • If only one task is queried, then no list needs to be returned, only the one task. (in ContractorsController.java)
  • Tests missing: ContractorResource.java, ContractorsController.java
  • Checkstyle throws an error in JDK 17 and 21: The indentation depth is incorrect in the ContractorsEndpoint file. Must be corrected. The error should then be gone.


/**
* @author Quirt
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The complete path is missing. We had set the path as "api/v1/contractors/...", so api and v1 are missing here as context and version. My suggestion is the same implementation as in ProjectEndpoint.java.

Suggested change
*/
*/
@Path(ContractorsEndpoint.CONTEXT + "/" + ContractorsEndpoint.VERSION + "/" + ContractorsEndpoint.SERVICE)

*/
public interface ContractorsEnpoint {
String SERVICE = "contractors";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
String CONTEXT = "api";
String VERSION = "v1";

String SERVICE = "contractors";

@GET
@Path("/{contractorId}/tasks")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability and understanding, it would be better to rename the contractorId to ownerId. (Must also be changed in the frontend if it is changed here)

/**
* @author Quirt
*/
public interface ContractorsEnpoint {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is misspelled. It could causes problems.

Suggested change
public interface ContractorsEnpoint {
public interface ContractorsEndpoint {

@@ -0,0 +1,26 @@
package de.remsfal.service.boundary.project;

import de.remsfal.core.api.ContractorsEnpoint;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import must be corrected.

Suggested change
import de.remsfal.core.api.ContractorsEnpoint;
import de.remsfal.core.api.ContractorsEndpoint;

}
}

public List<? extends TaskModel>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only one task is queried, then no list needs to be returned, only the one task.

Comment on lines 29 to 32
@Parameter(description = "Filter to return only tasks of a specific user") @PathParam("owner") @NotNull
@UUID String ownerId,
@Parameter(description = "Filter to return only tasks with a specific status") @QueryParam("status")
TaskModel.Status status);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is incorrect. Must be corrected. (Checkstyle Error)

Comment on lines 42 to 44
@Parameter(description = "Filter to return only tasks of a specific user") @QueryParam("owner") @NotNull
@UUID String ownerId,
@Parameter(description = "ID of the task", required = true) @PathParam("taskId") @NotNull @UUID String taskId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is incorrect. Must be corrected. (Checkstyle Error)

Comment on lines +119 to +122
public TaskModel getTask(final String projectId, final String ownerId, final String taskId) {
logger.infov("Retrieving a task (projectId = {0}, ownerId={1}, taskId = {2})", projectId, ownerId, taskId);
return this.getTask(TaskType.TASK, projectId, taskId);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the projectId here either.

Comment on lines 124 to 125
public TaskModel getDefect(final String projectId, final String taskId) {
logger.infov("Retrieving a defect (projectId = {0}, defectId = {1})", projectId, taskId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the projectId here either.

@Quirtelus
Copy link
Contributor Author

Due to personal Events i dont think I can complete this Pullrequest in time and I would therefore recommend to reject this PR.

@Quirtelus Quirtelus closed this Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Endpoint ContractorView
3 participants