3 Commits

9 changed files with 136 additions and 18 deletions

View File

@@ -1,5 +1,8 @@
name: Build name: Build
on: [push] on:
push:
branches:
- '*'
jobs: jobs:
build: build:
runs-on: standard-latest runs-on: standard-latest

View File

@@ -10,6 +10,13 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21'
cache: 'gradle'
- name: Login - name: Login
with: # Set the secret as an input with: # Set the secret as an input
package_rw: ${{ secrets.PACKAGE_RW }} package_rw: ${{ secrets.PACKAGE_RW }}

View File

@@ -5,6 +5,8 @@ import jakarta.persistence.*;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.List;
/** /**
* Represents a generic asset in the inventory system. * Represents a generic asset in the inventory system.
*/ */
@@ -65,4 +67,7 @@ public class GenericAsset
@Property("Warranty Expiration Date") @Property("Warranty Expiration Date")
@HideInOverview @HideInOverview
private String warrantyExpirationDate; private String warrantyExpirationDate;
@OneToMany(mappedBy = "asset", cascade = CascadeType.ALL, orphanRemoval = true)
private List<WorkLogEntry> workLog;
} }

View File

@@ -9,12 +9,12 @@ import lombok.Setter;
@Setter @Setter
@Entity @Entity
@AssetInfo( @AssetInfo(
displayName = "CD Drive", displayName = "Optical Drive",
pluralName = "CD Drives", pluralName = "Optical Drives",
type = "cd_drive" type = "optical_drive"
) )
@Table(name = "cd_drive_assets") @Table(name = "optical_drive_assets")
public class CdDriveAsset implements Asset public class OpticalDriveAsset implements Asset
{ {
@Id @Id
@GeneratedValue @GeneratedValue

View File

@@ -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;
}

View 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;
}

View File

@@ -1,12 +0,0 @@
package be.seeseepuff.pcinv.repositories;
import be.seeseepuff.pcinv.models.CdDriveAsset;
import org.springframework.data.jpa.repository.JpaRepository;
@SuppressWarnings("unused")
public interface CdDriveRepository extends JpaRepository<CdDriveAsset, Long>, AssetRepository<CdDriveAsset> {
@Override
default Class<CdDriveAsset> getAssetType() {
return CdDriveAsset.class;
}
}

View File

@@ -0,0 +1,12 @@
package be.seeseepuff.pcinv.repositories;
import be.seeseepuff.pcinv.models.OpticalDriveAsset;
import org.springframework.data.jpa.repository.JpaRepository;
@SuppressWarnings("unused")
public interface OpticalDriveRepository extends JpaRepository<OpticalDriveAsset, Long>, AssetRepository<OpticalDriveAsset> {
@Override
default Class<OpticalDriveAsset> getAssetType() {
return OpticalDriveAsset.class;
}
}

View File

@@ -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;
}
}