first commit
This commit is contained in:
81
backend/it-asset-management-client/pom.xml
Normal file
81
backend/it-asset-management-client/pom.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.ikon</groupId>
|
||||
<artifactId>it-asset-management</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>it-asset-management-client</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<!-- Attach source JAR -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
</plugin>
|
||||
|
||||
<!-- Attach Javadoc JAR -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.ikon.itassetmanagement.api;
|
||||
|
||||
public class CreateSoftwareRequest {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.ikon.itassetmanagement.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.ikon.itassetmanagement.dto.request.SoftwareRequest;
|
||||
|
||||
import com.ikon.itassetmanagement.dto.response.SoftwareResponse;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@RequestMapping("/software")
|
||||
public interface SoftwareApi{
|
||||
|
||||
@PostMapping
|
||||
ResponseEntity<SoftwareResponse> createSoftware(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@RequestBody SoftwareRequest request);
|
||||
@GetMapping("/{id}")
|
||||
ResponseEntity<SoftwareResponse> getSoftwareById(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@PathVariable Long id);
|
||||
@GetMapping
|
||||
ResponseEntity<List<SoftwareResponse>> getAllSoftware(
|
||||
@RequestHeader("Authorization") String accessToken);
|
||||
@DeleteMapping("/{id}")
|
||||
ResponseEntity<Void> deleteSoftware(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@PathVariable Long id);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.ikon.itassetmanagement.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.ikon.itassetmanagement.dto.request.CreateSoftwareConfig;
|
||||
import com.ikon.itassetmanagement.dto.response.SoftwareConfigurationResponse;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
@RequestMapping("/softwareCategory")
|
||||
public interface SoftwareConfigurationApi {
|
||||
@PostMapping
|
||||
ResponseEntity<SoftwareConfigurationResponse> createSoftwareConfiguration(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@Valid @RequestBody CreateSoftwareConfig request);
|
||||
|
||||
@GetMapping("/{id}")
|
||||
ResponseEntity<SoftwareConfigurationResponse> getSoftwareConfigurationById(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@PathVariable Long id);
|
||||
|
||||
@GetMapping
|
||||
ResponseEntity<List<SoftwareConfigurationResponse>> getAllSoftwareConfigurations(
|
||||
@RequestHeader("Authorization") String accessToken);
|
||||
|
||||
@PutMapping("/{id}")
|
||||
ResponseEntity<SoftwareConfigurationResponse> updateSoftwareConfiguration(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@PathVariable(required = true) Long id,
|
||||
@Valid @RequestBody CreateSoftwareConfig request);
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
ResponseEntity<Void> deleteSoftwareConfiguration(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@PathVariable(required = true) Long id);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.ikon.itassetmanagement.api;
|
||||
|
||||
import com.ikon.itassetmanagement.dto.request.TaskRequest;
|
||||
import com.ikon.itassetmanagement.dto.response.TaskResponse;
|
||||
import com.ikon.itassetmanagement.enums.TaskPriority;
|
||||
import com.ikon.itassetmanagement.enums.TaskStatus;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "Task Management", description = "APIs for managing tasks with CRUD operations")
|
||||
@RequestMapping("/tasks")
|
||||
public interface TaskApi {
|
||||
|
||||
@Operation(summary = "Create a new task", description = "Creates a new task with the provided details")
|
||||
@ApiResponses(value = {
|
||||
|
||||
@ApiResponse(responseCode = "201", description = "Task created successfully"),
|
||||
@ApiResponse(responseCode = "400", description = "Invalid input data")
|
||||
})
|
||||
@PostMapping
|
||||
ResponseEntity<TaskResponse> createTask(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@Valid @RequestBody TaskRequest request);
|
||||
|
||||
@Operation(summary = "Get task by ID", description = "Retrieves a specific task by its ID")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "Task found"),
|
||||
@ApiResponse(responseCode = "404", description = "Task not found")
|
||||
})
|
||||
@GetMapping("/{id}")
|
||||
ResponseEntity<TaskResponse> getTaskById(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@Parameter(description = "Task ID", required = true) @PathVariable Long id);
|
||||
|
||||
@Operation(summary = "Get all tasks", description = "Retrieves all tasks with optional filtering by status, priority, or search term")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "Tasks retrieved successfully")
|
||||
})
|
||||
@GetMapping
|
||||
ResponseEntity<List<TaskResponse>> getAllTasks(@RequestHeader("Authorization") String accessToken,
|
||||
@Parameter(description = "Filter by status") @RequestParam(required = false) TaskStatus status,
|
||||
@Parameter(description = "Filter by priority") @RequestParam(required = false) TaskPriority priority,
|
||||
@Parameter(description = "Search by title") @RequestParam(required = false) String search);
|
||||
|
||||
@Operation(summary = "Get paginated tasks", description = "Retrieves tasks with pagination and optional filtering")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "Tasks retrieved successfully with pagination")
|
||||
})
|
||||
@GetMapping("/paginated")
|
||||
ResponseEntity<Page<TaskResponse>> getTasksPaginated(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
Pageable pageable,
|
||||
|
||||
@Parameter(description = "Filter by status") @RequestParam(required = false) TaskStatus status,
|
||||
|
||||
@Parameter(description = "Filter by priority") @RequestParam(required = false) TaskPriority priority,
|
||||
|
||||
@Parameter(description = "Search by title") @RequestParam(required = false) String search);
|
||||
|
||||
@Operation(summary = "Update a task", description = "Updates an existing task with new details")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "Task updated successfully"),
|
||||
@ApiResponse(responseCode = "404", description = "Task not found"),
|
||||
@ApiResponse(responseCode = "400", description = "Invalid input data")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
ResponseEntity<TaskResponse> updateTask(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@Parameter(description = "Task ID", required = true) @PathVariable Long id,
|
||||
@Valid @RequestBody TaskRequest request);
|
||||
|
||||
@Operation(summary = "Delete a task", description = "Deletes a task by its ID")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "204", description = "Task deleted successfully"),
|
||||
@ApiResponse(responseCode = "404", description = "Task not found")
|
||||
})
|
||||
@DeleteMapping("/{id}")
|
||||
ResponseEntity<Void> deleteTask(
|
||||
@RequestHeader("Authorization") String accessToken,
|
||||
@Parameter(description = "Task ID", required = true) @PathVariable Long id);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ikon.itassetmanagement.dto.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
public class CreateHardwareAssetRequest {
|
||||
|
||||
private String assetTag;
|
||||
|
||||
private String name;
|
||||
|
||||
private String manufacturer;
|
||||
|
||||
private String model;
|
||||
|
||||
private String serialNumber;
|
||||
|
||||
private String hardwareTypeId;
|
||||
|
||||
private String locationId;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ikon.itassetmanagement.dto.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class CreateHardwareLocationRequest {
|
||||
private String location;
|
||||
private String address;
|
||||
|
||||
// public String getLocation() {
|
||||
// return location;
|
||||
// }
|
||||
|
||||
// public void setLocation(String location) {
|
||||
// this.location = location;
|
||||
// }
|
||||
|
||||
// public String getAddress() {
|
||||
// return address;
|
||||
// }
|
||||
|
||||
// public void setAddress(String address) {
|
||||
// this.address = address;
|
||||
// }
|
||||
|
||||
// private String address;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ikon.itassetmanagement.dto.request;
|
||||
public class CreateHardwareTypeRequest {
|
||||
|
||||
private String hardwareType;
|
||||
private String abbreviation;
|
||||
|
||||
public String getHardwareType() {
|
||||
return hardwareType;
|
||||
}
|
||||
|
||||
public void setHardwareType(String hardwareType) {
|
||||
this.hardwareType = hardwareType;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ikon.itassetmanagement.dto.request;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class CreateSoftwareConfig {
|
||||
private String softwareCategory;
|
||||
private String softwareAbbreviation;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ikon.itassetmanagement.dto.request;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
|
||||
public class SoftwareRequest {
|
||||
private String softwareName;
|
||||
private String softwareVendor;
|
||||
private String softwareCategoryId;
|
||||
private String softwareVersion;
|
||||
private int totalLicenses;
|
||||
private int costPerLicense;
|
||||
private String webSiteURL;
|
||||
private String invoiceURL;
|
||||
private String logInCredentials;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ikon.itassetmanagement.dto.request;
|
||||
|
||||
import com.ikon.itassetmanagement.enums.TaskPriority;
|
||||
import com.ikon.itassetmanagement.enums.TaskStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TaskRequest {
|
||||
|
||||
@NotBlank(message = "Title is required")
|
||||
@Size(min = 3, max = 100, message = "Title must be between 3 and 100 characters")
|
||||
private String title;
|
||||
|
||||
@Size(max = 500, message = "Description must not exceed 500 characters")
|
||||
private String description;
|
||||
|
||||
private TaskStatus status;
|
||||
|
||||
private TaskPriority priority;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ikon.itassetmanagement.dto.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HardwareAssetResponse {
|
||||
private Long id;
|
||||
|
||||
private String assetTag;
|
||||
|
||||
private String name;
|
||||
|
||||
private String manufacturer;
|
||||
|
||||
private String model;
|
||||
|
||||
private String serialNumber;
|
||||
|
||||
private Long hardwareTypeId;
|
||||
|
||||
private Long locationId;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ikon.itassetmanagement.dto.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HardwareLocationResponse {
|
||||
|
||||
private Long id;
|
||||
private String locationName;
|
||||
private String address;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ikon.itassetmanagement.dto.response;
|
||||
|
||||
public class HardwareTypeResponse {
|
||||
|
||||
private Long id;
|
||||
private String hardwareType;
|
||||
private String abbreviation;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getHardwareType() {
|
||||
return hardwareType;
|
||||
}
|
||||
|
||||
public void setHardwareType(String hardwareType) {
|
||||
this.hardwareType = hardwareType;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ikon.itassetmanagement.dto.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SoftwareConfigurationResponse {
|
||||
private Long id;
|
||||
private String softwareCategory;
|
||||
private String softwareAbbreviation;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ikon.itassetmanagement.dto.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SoftwareResponse {
|
||||
private Long id;
|
||||
private String softwareName;
|
||||
private String softwareVendor;
|
||||
private String softwareCategoryId;
|
||||
private String softwareVersion;
|
||||
private int totalLicenses;
|
||||
private int costPerLicense;
|
||||
private String webSiteURL;
|
||||
private String invoiceURL;
|
||||
private String logInCredentials;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ikon.itassetmanagement.dto.response;
|
||||
|
||||
import com.ikon.itassetmanagement.enums.TaskPriority;
|
||||
import com.ikon.itassetmanagement.enums.TaskStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TaskResponse {
|
||||
|
||||
private Long id;
|
||||
private String title;
|
||||
private String description;
|
||||
private TaskStatus status;
|
||||
private TaskPriority priority;
|
||||
private LocalDateTime createdAt;
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ikon.itassetmanagement.enums;
|
||||
|
||||
public enum TaskPriority {
|
||||
LOW,
|
||||
MEDIUM,
|
||||
HIGH
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ikon.itassetmanagement.enums;
|
||||
|
||||
public enum TaskStatus {
|
||||
PENDING,
|
||||
IN_PROGRESS,
|
||||
COMPLETED
|
||||
}
|
||||
Reference in New Issue
Block a user