Add PowerSupplyAsset model and repository, and implement WorkLogEntry for asset tracking
This commit is contained in:
@@ -5,6 +5,8 @@ import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a generic asset in the inventory system.
|
||||
*/
|
||||
@@ -65,4 +67,7 @@ public class GenericAsset
|
||||
@Property("Warranty Expiration Date")
|
||||
@HideInOverview
|
||||
private String warrantyExpirationDate;
|
||||
|
||||
@OneToMany(mappedBy = "asset", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<WorkLogEntry> workLog;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package be.seeseepuff.pcinv.models;
|
||||
|
||||
import be.seeseepuff.pcinv.meta.*;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@AssetInfo(
|
||||
displayName = "Power Supply",
|
||||
pluralName = "Power Supplies",
|
||||
type = "psu"
|
||||
)
|
||||
@Table(name = "psu_assets")
|
||||
public class PowerSupplyAsset implements Asset
|
||||
{
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private long id;
|
||||
|
||||
/// The generic asset associated with this RAM.
|
||||
@OneToOne(orphanRemoval = true)
|
||||
private GenericAsset asset;
|
||||
|
||||
@Description("The wattage rating of the power supply in watts.")
|
||||
@Property("Wattage")
|
||||
private int wattage;
|
||||
|
||||
@Description("The efficiency rating of the power supply, e.g., 80 Plus Bronze, Silver, Gold, Platinum, Titanium.")
|
||||
@Property("Efficiency Rating")
|
||||
@InputList
|
||||
private String efficiencyRating;
|
||||
|
||||
@Description("The form factor of the power supply, e.g., ATX, SFX, etc.")
|
||||
@Property("Form Factor")
|
||||
@InputList
|
||||
private String formFactor;
|
||||
|
||||
@Description("The number number of Molex connectors.")
|
||||
@Property("4-pin Molex Connectors")
|
||||
private int molexConnectors;
|
||||
|
||||
@Description("The number of 4-pin floppy connectors.")
|
||||
@Property("4-pin Floppy Connectors")
|
||||
private int floppyConnectors;
|
||||
|
||||
@Description("The number of SATA power connectors.")
|
||||
@Property("15-pin SATA Connectors")
|
||||
private int sataConnectors;
|
||||
|
||||
@Description("The number of 6-pin PCIe connectors.")
|
||||
@Property("6-pin PCIe Connectors")
|
||||
private int pcie6Connectors;
|
||||
|
||||
@Description("The number of 8-pin PCIe connectors.")
|
||||
@Property("8-pin PCIe Connectors")
|
||||
private int pcie8Connectors;
|
||||
|
||||
@Description("The number of 4-pin ATX 12V connectors.")
|
||||
@Property("4-pin ATX 12V Connectors")
|
||||
private int atx12vConnectors;
|
||||
}
|
||||
27
src/main/java/be/seeseepuff/pcinv/models/WorkLogEntry.java
Normal file
27
src/main/java/be/seeseepuff/pcinv/models/WorkLogEntry.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package be.seeseepuff.pcinv.models;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
/**
|
||||
* Represents a work log entry in the system.
|
||||
*/
|
||||
@Entity
|
||||
public class WorkLogEntry {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private long id;
|
||||
|
||||
@ManyToOne(optional = false)
|
||||
private GenericAsset asset;
|
||||
|
||||
/// The description of the work log entry.
|
||||
private String description;
|
||||
|
||||
/// The date and time when the work log entry was created.
|
||||
private ZonedDateTime date;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package be.seeseepuff.pcinv.repositories;
|
||||
|
||||
import be.seeseepuff.pcinv.models.PowerSupplyAsset;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public interface PowerSupplyRepository extends JpaRepository<PowerSupplyAsset, Long>, AssetRepository<PowerSupplyAsset> {
|
||||
@Override
|
||||
default Class<PowerSupplyAsset> getAssetType() {
|
||||
return PowerSupplyAsset.class;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user