Compare commits
1 Commits
agent/hex/
...
42e90f028a
| Author | SHA1 | Date | |
|---|---|---|---|
| 42e90f028a |
117
backend/API/Controllers/UsageLogsController.cs
Normal file
117
backend/API/Controllers/UsageLogsController.cs
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
using Extrudex.API.DTOs.UsageLogs;
|
||||||
|
using Extrudex.Domain.Enums;
|
||||||
|
using Extrudex.Domain.Interfaces;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace Extrudex.API.Controllers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// API controller for recording and querying filament usage logs.
|
||||||
|
/// Usage logs provide a fine-grained audit trail of filament consumption
|
||||||
|
/// from printer integrations or manual input.
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
[Produces("application/json")]
|
||||||
|
public class UsageLogsController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IUsageLogService _usageLogService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="UsageLogsController"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="usageLogService">The usage log service for recording and querying usage.</param>
|
||||||
|
public UsageLogsController(IUsageLogService usageLogService)
|
||||||
|
{
|
||||||
|
_usageLogService = usageLogService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Records a new filament usage entry.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="request">The usage entry details.</param>
|
||||||
|
/// <returns>The created usage log entry.</returns>
|
||||||
|
[HttpPost]
|
||||||
|
[ProducesResponseType(typeof(UsageLogResponse), StatusCodes.Status201Created)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
public async Task<ActionResult<UsageLogResponse>> Create([FromBody] CreateUsageLogRequest request)
|
||||||
|
{
|
||||||
|
if (!Enum.TryParse<DataSource>(request.DataSource, ignoreCase: true, out var dataSource))
|
||||||
|
{
|
||||||
|
return BadRequest($"Invalid data source: '{request.DataSource}'. Valid values: Mqtt, Moonraker, Manual.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var entry = await _usageLogService.RecordUsageAsync(
|
||||||
|
spoolId: request.SpoolId,
|
||||||
|
gramsUsed: request.GramsUsed,
|
||||||
|
dataSource: dataSource,
|
||||||
|
printerId: request.PrinterId,
|
||||||
|
printJobId: request.PrintJobId,
|
||||||
|
mmExtruded: request.MmExtruded,
|
||||||
|
usageTimestamp: request.UsageTimestamp,
|
||||||
|
notes: request.Notes
|
||||||
|
);
|
||||||
|
|
||||||
|
return CreatedAtAction(
|
||||||
|
nameof(GetBySpool),
|
||||||
|
new { spoolId = entry.SpoolId },
|
||||||
|
MapToResponse(entry));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets usage logs for a specific spool, ordered by most recent first.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="spoolId">The spool ID to filter by.</param>
|
||||||
|
/// <returns>A collection of usage log entries for the spool.</returns>
|
||||||
|
[HttpGet("spool/{spoolId:guid}")]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<UsageLogResponse>), StatusCodes.Status200OK)]
|
||||||
|
public async Task<ActionResult<IEnumerable<UsageLogResponse>>> GetBySpool(Guid spoolId)
|
||||||
|
{
|
||||||
|
var logs = await _usageLogService.GetBySpoolAsync(spoolId);
|
||||||
|
return Ok(logs.Select(MapToResponse));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets usage logs for a specific printer, ordered by most recent first.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="printerId">The printer ID to filter by.</param>
|
||||||
|
/// <returns>A collection of usage log entries for the printer.</returns>
|
||||||
|
[HttpGet("printer/{printerId:guid}")]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<UsageLogResponse>), StatusCodes.Status200OK)]
|
||||||
|
public async Task<ActionResult<IEnumerable<UsageLogResponse>>> GetByPrinter(Guid printerId)
|
||||||
|
{
|
||||||
|
var logs = await _usageLogService.GetByPrinterAsync(printerId);
|
||||||
|
return Ok(logs.Select(MapToResponse));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets usage logs for a specific print job, ordered by most recent first.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="printJobId">The print job ID to filter by.</param>
|
||||||
|
/// <returns>A collection of usage log entries for the print job.</returns>
|
||||||
|
[HttpGet("print-job/{printJobId:guid}")]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<UsageLogResponse>), StatusCodes.Status200OK)]
|
||||||
|
public async Task<ActionResult<IEnumerable<UsageLogResponse>>> GetByPrintJob(Guid printJobId)
|
||||||
|
{
|
||||||
|
var logs = await _usageLogService.GetByPrintJobAsync(printJobId);
|
||||||
|
return Ok(logs.Select(MapToResponse));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maps a UsageLog domain entity to a UsageLogResponse DTO.
|
||||||
|
/// </summary>
|
||||||
|
private static UsageLogResponse MapToResponse(Domain.Entities.UsageLog log) => new()
|
||||||
|
{
|
||||||
|
Id = log.Id,
|
||||||
|
SpoolId = log.SpoolId,
|
||||||
|
PrinterId = log.PrinterId,
|
||||||
|
PrintJobId = log.PrintJobId,
|
||||||
|
GramsUsed = log.GramsUsed,
|
||||||
|
MmExtruded = log.MmExtruded,
|
||||||
|
UsageTimestamp = log.UsageTimestamp,
|
||||||
|
DataSource = log.DataSource.ToString(),
|
||||||
|
Notes = log.Notes,
|
||||||
|
CreatedAt = log.CreatedAt,
|
||||||
|
UpdatedAt = log.UpdatedAt
|
||||||
|
};
|
||||||
|
}
|
||||||
115
backend/API/DTOs/UsageLogs/UsageLogDtos.cs
Normal file
115
backend/API/DTOs/UsageLogs/UsageLogDtos.cs
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Extrudex.API.DTOs.UsageLogs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Request DTO for recording a filament usage entry.
|
||||||
|
/// </summary>
|
||||||
|
public class CreateUsageLogRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The ID of the spool that provided the filament.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public Guid SpoolId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of grams of filament consumed.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
[Range(0.01, double.MaxValue, ErrorMessage = "GramsUsed must be a positive value.")]
|
||||||
|
public decimal GramsUsed { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The source of the usage data (Mqtt, Moonraker, Manual).
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public string DataSource { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The ID of the printer that consumed the filament. Optional.
|
||||||
|
/// </summary>
|
||||||
|
public Guid? PrinterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The ID of the print job associated with this usage. Optional.
|
||||||
|
/// </summary>
|
||||||
|
public Guid? PrintJobId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of millimeters of filament extruded. Optional.
|
||||||
|
/// </summary>
|
||||||
|
public decimal? MmExtruded { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When the usage occurred (UTC). Defaults to now if not specified.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? UsageTimestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional notes about this usage entry.
|
||||||
|
/// </summary>
|
||||||
|
[MaxLength(2000)]
|
||||||
|
public string? Notes { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Response DTO for a usage log entry.
|
||||||
|
/// </summary>
|
||||||
|
public class UsageLogResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Unique identifier for the usage log entry.
|
||||||
|
/// </summary>
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The spool that provided the filament.
|
||||||
|
/// </summary>
|
||||||
|
public Guid SpoolId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The printer that consumed the filament, if applicable.
|
||||||
|
/// </summary>
|
||||||
|
public Guid? PrinterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The print job associated with this usage, if applicable.
|
||||||
|
/// </summary>
|
||||||
|
public Guid? PrintJobId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Grams of filament consumed.
|
||||||
|
/// </summary>
|
||||||
|
public decimal GramsUsed { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Millimeters of filament extruded, if available.
|
||||||
|
/// </summary>
|
||||||
|
public decimal? MmExtruded { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When the usage occurred (UTC).
|
||||||
|
/// </summary>
|
||||||
|
public DateTime UsageTimestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Source of the usage data (Mqtt, Moonraker, Manual).
|
||||||
|
/// </summary>
|
||||||
|
public string DataSource { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional notes about this usage entry.
|
||||||
|
/// </summary>
|
||||||
|
public string? Notes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When the record was created (UTC).
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When the record was last updated (UTC).
|
||||||
|
/// </summary>
|
||||||
|
public DateTime UpdatedAt { get; set; }
|
||||||
|
}
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
using FluentValidation;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
|
||||||
|
|
||||||
namespace Extrudex.API.Filters;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Action filter that automatically validates request DTOs using FluentValidation
|
|
||||||
/// validators registered in DI. Runs before the controller action executes.
|
|
||||||
/// Returns 400 Bad Request with validation errors if validation fails.
|
|
||||||
/// </summary>
|
|
||||||
public class FluentValidationFilter : IAsyncActionFilter
|
|
||||||
{
|
|
||||||
private readonly IServiceProvider _serviceProvider;
|
|
||||||
private readonly ILogger<FluentValidationFilter> _logger;
|
|
||||||
|
|
||||||
public FluentValidationFilter(IServiceProvider serviceProvider, ILogger<FluentValidationFilter> logger)
|
|
||||||
{
|
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
|
||||||
{
|
|
||||||
foreach (var argument in context.ActionArguments.Values)
|
|
||||||
{
|
|
||||||
if (argument is null) continue;
|
|
||||||
|
|
||||||
var argumentType = argument.GetType();
|
|
||||||
var validatorType = typeof(IValidator<>).MakeGenericType(argumentType);
|
|
||||||
|
|
||||||
// Try to resolve a validator for this argument type
|
|
||||||
var validator = _serviceProvider.GetService(validatorType) as IValidator;
|
|
||||||
if (validator is null) continue;
|
|
||||||
|
|
||||||
_logger.LogDebug("Validating {Type} with {Validator}", argumentType.Name, validator.GetType().Name);
|
|
||||||
|
|
||||||
var validationResult = await validator.ValidateAsync(
|
|
||||||
new ValidationContext<object>(argument), context.HttpContext.RequestAborted);
|
|
||||||
|
|
||||||
if (!validationResult.IsValid)
|
|
||||||
{
|
|
||||||
foreach (var error in validationResult.Errors)
|
|
||||||
{
|
|
||||||
context.ModelState.AddModelError(error.PropertyName, error.ErrorMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!context.ModelState.IsValid)
|
|
||||||
{
|
|
||||||
var errors = context.ModelState
|
|
||||||
.Where(kvp => kvp.Value?.Errors.Count > 0)
|
|
||||||
.ToDictionary(
|
|
||||||
kvp => kvp.Key,
|
|
||||||
kvp => kvp.Value!.Errors.Select(e => e.ErrorMessage).ToArray());
|
|
||||||
|
|
||||||
context.Result = new BadRequestObjectResult(new
|
|
||||||
{
|
|
||||||
title = "Validation failed",
|
|
||||||
status = 400,
|
|
||||||
errors
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
using Extrudex.API.DTOs.Filaments;
|
|
||||||
using FluentValidation;
|
|
||||||
|
|
||||||
namespace Extrudex.API.Validators;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Validation rules for creating a Filament (Spool) via the /filaments route.
|
|
||||||
/// Mirrors the domain rules enforced in the controller and ensures consistent
|
|
||||||
/// validation regardless of the request pipeline entry point.
|
|
||||||
/// </summary>
|
|
||||||
public class CreateFilamentRequestValidator : AbstractValidator<CreateFilamentRequest>
|
|
||||||
{
|
|
||||||
public CreateFilamentRequestValidator()
|
|
||||||
{
|
|
||||||
RuleFor(x => x.MaterialBaseId)
|
|
||||||
.NotEmpty().WithMessage("MaterialBaseId is required.");
|
|
||||||
|
|
||||||
RuleFor(x => x.MaterialFinishId)
|
|
||||||
.NotEmpty().WithMessage("MaterialFinishId is required.");
|
|
||||||
|
|
||||||
RuleFor(x => x.Brand)
|
|
||||||
.NotEmpty().WithMessage("Brand is required.")
|
|
||||||
.MaximumLength(200).WithMessage("Brand must not exceed 200 characters.");
|
|
||||||
|
|
||||||
RuleFor(x => x.ColorName)
|
|
||||||
.NotEmpty().WithMessage("ColorName is required.")
|
|
||||||
.MaximumLength(200).WithMessage("ColorName must not exceed 200 characters.");
|
|
||||||
|
|
||||||
RuleFor(x => x.ColorHex)
|
|
||||||
.NotEmpty().WithMessage("ColorHex is required.")
|
|
||||||
.Matches(@"^#[0-9A-Fa-f]{6}$").WithMessage("ColorHex must be a valid hex color code (e.g., #FF0000).");
|
|
||||||
|
|
||||||
RuleFor(x => x.WeightTotalGrams)
|
|
||||||
.GreaterThan(0).WithMessage("Total weight must be greater than zero.");
|
|
||||||
|
|
||||||
RuleFor(x => x.WeightRemainingGrams)
|
|
||||||
.GreaterThanOrEqualTo(0).WithMessage("Remaining weight must be non-negative.");
|
|
||||||
|
|
||||||
RuleFor(x => x.WeightRemainingGrams)
|
|
||||||
.LessThanOrEqualTo(x => x.WeightTotalGrams)
|
|
||||||
.WithMessage("WeightRemainingGrams cannot exceed WeightTotalGrams.");
|
|
||||||
|
|
||||||
RuleFor(x => x.FilamentDiameterMm)
|
|
||||||
.GreaterThan(0).WithMessage("Filament diameter must be greater than zero.");
|
|
||||||
|
|
||||||
RuleFor(x => x.SpoolSerial)
|
|
||||||
.NotEmpty().WithMessage("SpoolSerial is required.")
|
|
||||||
.MaximumLength(200).WithMessage("SpoolSerial must not exceed 200 characters.");
|
|
||||||
|
|
||||||
When(x => x.PurchasePrice.HasValue, () =>
|
|
||||||
{
|
|
||||||
RuleFor(x => x.PurchasePrice!.Value)
|
|
||||||
.GreaterThanOrEqualTo(0).WithMessage("Purchase price must be non-negative.");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Validation rules for updating a Filament (Spool) via the /filaments route.
|
|
||||||
/// Enforces the same domain rules as creation, plus ensures the updated
|
|
||||||
/// WeightRemainingGrams does not exceed the updated WeightTotalGrams.
|
|
||||||
/// </summary>
|
|
||||||
public class UpdateFilamentRequestValidator : AbstractValidator<UpdateFilamentRequest>
|
|
||||||
{
|
|
||||||
public UpdateFilamentRequestValidator()
|
|
||||||
{
|
|
||||||
RuleFor(x => x.MaterialBaseId)
|
|
||||||
.NotEmpty().WithMessage("MaterialBaseId is required.");
|
|
||||||
|
|
||||||
RuleFor(x => x.MaterialFinishId)
|
|
||||||
.NotEmpty().WithMessage("MaterialFinishId is required.");
|
|
||||||
|
|
||||||
RuleFor(x => x.Brand)
|
|
||||||
.NotEmpty().WithMessage("Brand is required.")
|
|
||||||
.MaximumLength(200).WithMessage("Brand must not exceed 200 characters.");
|
|
||||||
|
|
||||||
RuleFor(x => x.ColorName)
|
|
||||||
.NotEmpty().WithMessage("ColorName is required.")
|
|
||||||
.MaximumLength(200).WithMessage("ColorName must not exceed 200 characters.");
|
|
||||||
|
|
||||||
RuleFor(x => x.ColorHex)
|
|
||||||
.NotEmpty().WithMessage("ColorHex is required.")
|
|
||||||
.Matches(@"^#[0-9A-Fa-f]{6}$").WithMessage("ColorHex must be a valid hex color code (e.g., #FF0000).");
|
|
||||||
|
|
||||||
RuleFor(x => x.WeightTotalGrams)
|
|
||||||
.GreaterThan(0).WithMessage("Total weight must be greater than zero.");
|
|
||||||
|
|
||||||
RuleFor(x => x.WeightRemainingGrams)
|
|
||||||
.GreaterThanOrEqualTo(0).WithMessage("Remaining weight must be non-negative.");
|
|
||||||
|
|
||||||
RuleFor(x => x.WeightRemainingGrams)
|
|
||||||
.LessThanOrEqualTo(x => x.WeightTotalGrams)
|
|
||||||
.WithMessage("WeightRemainingGrams cannot exceed WeightTotalGrams.");
|
|
||||||
|
|
||||||
RuleFor(x => x.FilamentDiameterMm)
|
|
||||||
.GreaterThan(0).WithMessage("Filament diameter must be greater than zero.");
|
|
||||||
|
|
||||||
RuleFor(x => x.SpoolSerial)
|
|
||||||
.NotEmpty().WithMessage("SpoolSerial is required.")
|
|
||||||
.MaximumLength(200).WithMessage("SpoolSerial must not exceed 200 characters.");
|
|
||||||
|
|
||||||
When(x => x.PurchasePrice.HasValue, () =>
|
|
||||||
{
|
|
||||||
RuleFor(x => x.PurchasePrice!.Value)
|
|
||||||
.GreaterThanOrEqualTo(0).WithMessage("Purchase price must be non-negative.");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
using Extrudex.Domain.Base;
|
|
||||||
|
|
||||||
namespace Extrudex.Domain.Entities;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tracks filament consumption for a specific print job on a specific spool.
|
|
||||||
/// Each record captures the grams used, which printer consumed it, and when the
|
|
||||||
/// usage was recorded. This enables granular per-job usage analytics, COGS
|
|
||||||
/// reconciliation, and spool weight depletion tracking.
|
|
||||||
///
|
|
||||||
/// A single PrintJob may have multiple FilamentUsage records if multiple spools
|
|
||||||
/// were consumed (e.g., multi-material prints via AMS).
|
|
||||||
/// </summary>
|
|
||||||
public class FilamentUsage : AuditableEntity
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Foreign key to the print job that consumed this filament.
|
|
||||||
/// A usage record is always tied to a print job.
|
|
||||||
/// </summary>
|
|
||||||
public Guid PrintJobId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Navigation to the print job that consumed this filament.
|
|
||||||
/// </summary>
|
|
||||||
public PrintJob PrintJob { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Foreign key to the spool (filament) that provided the material.
|
|
||||||
/// Links usage back to the specific physical spool for inventory tracking.
|
|
||||||
/// </summary>
|
|
||||||
public Guid SpoolId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Navigation to the spool that provided the material.
|
|
||||||
/// </summary>
|
|
||||||
public Spool Spool { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Foreign key to the printer that executed the print job.
|
|
||||||
/// Denormalized from PrintJob for direct querying of per-printer usage.
|
|
||||||
/// </summary>
|
|
||||||
public Guid PrinterId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Navigation to the printer that executed the print job.
|
|
||||||
/// </summary>
|
|
||||||
public Printer Printer { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Grams of filament consumed during this print job.
|
|
||||||
/// Derived from mm_extruded × cross_section_area × material_density,
|
|
||||||
/// or measured directly from AMS weight delta.
|
|
||||||
/// </summary>
|
|
||||||
public decimal GramsUsed { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Millimeters of filament extruded for this usage record.
|
|
||||||
/// The primary physical measurement; grams_used is derived from this.
|
|
||||||
/// </summary>
|
|
||||||
public decimal MmExtruded { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Timestamp when this usage record was created (UTC).
|
|
||||||
/// Represents when the usage was first logged, which may differ from
|
|
||||||
/// the print job's started_at or completed_at timestamps.
|
|
||||||
/// </summary>
|
|
||||||
public DateTime RecordedAt { get; set; } = DateTime.UtcNow;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Optional notes about this usage record (e.g., "AMS tray 3", "manual weight check").
|
|
||||||
/// </summary>
|
|
||||||
public string? Notes { get; set; }
|
|
||||||
}
|
|
||||||
@@ -97,10 +97,4 @@ public class PrintJob : AuditableEntity
|
|||||||
/// Optional notes about the print job (e.g., "First layer adhesion issues").
|
/// Optional notes about the print job (e.g., "First layer adhesion issues").
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Notes { get; set; }
|
public string? Notes { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Navigation collection of filament usage records for this print job.
|
|
||||||
/// Enables tracking granular per-spool consumption within a print.
|
|
||||||
/// </summary>
|
|
||||||
public ICollection<FilamentUsage> FilamentUsages { get; set; } = new List<FilamentUsage>();
|
|
||||||
}
|
}
|
||||||
@@ -94,10 +94,4 @@ public class Printer : AuditableEntity
|
|||||||
/// Navigation collection of print jobs executed on this printer.
|
/// Navigation collection of print jobs executed on this printer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICollection<PrintJob> PrintJobs { get; set; } = new List<PrintJob>();
|
public ICollection<PrintJob> PrintJobs { get; set; } = new List<PrintJob>();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Navigation collection of filament usage records tracking consumption on this printer.
|
|
||||||
/// Enables querying per-printer filament usage and COGS.
|
|
||||||
/// </summary>
|
|
||||||
public ICollection<FilamentUsage> FilamentUsages { get; set; } = new List<FilamentUsage>();
|
|
||||||
}
|
}
|
||||||
@@ -102,10 +102,4 @@ public class Spool : AuditableEntity
|
|||||||
/// Navigation collection of print jobs that consumed filament from this spool.
|
/// Navigation collection of print jobs that consumed filament from this spool.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICollection<PrintJob> PrintJobs { get; set; } = new List<PrintJob>();
|
public ICollection<PrintJob> PrintJobs { get; set; } = new List<PrintJob>();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Navigation collection of filament usage records tracking consumption from this spool.
|
|
||||||
/// Enables querying how much filament was consumed per print job.
|
|
||||||
/// </summary>
|
|
||||||
public ICollection<FilamentUsage> FilamentUsages { get; set; } = new List<FilamentUsage>();
|
|
||||||
}
|
}
|
||||||
72
backend/Domain/Entities/UsageLog.cs
Normal file
72
backend/Domain/Entities/UsageLog.cs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
using Extrudex.Domain.Base;
|
||||||
|
using Extrudex.Domain.Enums;
|
||||||
|
|
||||||
|
namespace Extrudex.Domain.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a single filament usage log entry. Records how much filament
|
||||||
|
/// was consumed, by which printer, at what time, and optionally linked to
|
||||||
|
/// a print job. This provides a fine-grained audit trail of filament consumption
|
||||||
|
/// independent of print job lifecycle.
|
||||||
|
/// </summary>
|
||||||
|
public class UsageLog : AuditableEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Foreign key to the spool that provided the filament.
|
||||||
|
/// </summary>
|
||||||
|
public Guid SpoolId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Navigation to the spool that provided the filament.
|
||||||
|
/// </summary>
|
||||||
|
public Spool Spool { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Foreign key to the printer that consumed the filament.
|
||||||
|
/// Nullable to support manual entries without a specific printer.
|
||||||
|
/// </summary>
|
||||||
|
public Guid? PrinterId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Navigation to the printer that consumed the filament.
|
||||||
|
/// </summary>
|
||||||
|
public Printer? Printer { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Foreign key to the print job associated with this usage entry.
|
||||||
|
/// Nullable because usage can be logged before or without a print job.
|
||||||
|
/// </summary>
|
||||||
|
public Guid? PrintJobId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Navigation to the print job associated with this usage entry.
|
||||||
|
/// </summary>
|
||||||
|
public PrintJob? PrintJob { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of grams of filament consumed in this usage event.
|
||||||
|
/// </summary>
|
||||||
|
public decimal GramsUsed { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of millimeters of filament extruded in this usage event.
|
||||||
|
/// Optional — may not be available for all data sources.
|
||||||
|
/// </summary>
|
||||||
|
public decimal? MmExtruded { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Timestamp when the usage occurred (UTC). This is the actual time of
|
||||||
|
/// consumption, which may differ from CreatedAt if the entry was recorded later.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime UsageTimestamp { get; set; } = DateTime.UtcNow;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The source of the usage data (which integration path provided it).
|
||||||
|
/// </summary>
|
||||||
|
public DataSource DataSource { get; set; } = DataSource.Manual;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional notes about this usage entry.
|
||||||
|
/// </summary>
|
||||||
|
public string? Notes { get; set; }
|
||||||
|
}
|
||||||
57
backend/Domain/Interfaces/IUsageLogService.cs
Normal file
57
backend/Domain/Interfaces/IUsageLogService.cs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
using Extrudex.Domain.Entities;
|
||||||
|
using Extrudex.Domain.Enums;
|
||||||
|
|
||||||
|
namespace Extrudex.Domain.Interfaces;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Service for recording filament usage entries. Writes to the usage_logs table
|
||||||
|
/// and provides query capabilities for usage history.
|
||||||
|
/// </summary>
|
||||||
|
public interface IUsageLogService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Records a filament usage entry.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="spoolId">The spool that provided the filament.</param>
|
||||||
|
/// <param name="gramsUsed">Grams of filament consumed.</param>
|
||||||
|
/// <param name="dataSource">Where the data came from.</param>
|
||||||
|
/// <param name="printerId">Optional printer ID.</param>
|
||||||
|
/// <param name="printJobId">Optional print job ID.</param>
|
||||||
|
/// <param name="mmExtruded">Optional mm extruded.</param>
|
||||||
|
/// <param name="usageTimestamp">When the usage occurred (defaults to UTC now).</param>
|
||||||
|
/// <param name="notes">Optional notes.</param>
|
||||||
|
/// <returns>The created UsageLog entity.</returns>
|
||||||
|
Task<UsageLog> RecordUsageAsync(
|
||||||
|
Guid spoolId,
|
||||||
|
decimal gramsUsed,
|
||||||
|
DataSource dataSource,
|
||||||
|
Guid? printerId = null,
|
||||||
|
Guid? printJobId = null,
|
||||||
|
decimal? mmExtruded = null,
|
||||||
|
DateTime? usageTimestamp = null,
|
||||||
|
string? notes = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves usage logs for a specific spool, ordered by usage timestamp descending.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="spoolId">The spool ID to filter by.</param>
|
||||||
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
|
/// <returns>A collection of usage logs for the spool.</returns>
|
||||||
|
Task<IEnumerable<UsageLog>> GetBySpoolAsync(Guid spoolId, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves usage logs for a specific printer, ordered by usage timestamp descending.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="printerId">The printer ID to filter by.</param>
|
||||||
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
|
/// <returns>A collection of usage logs for the printer.</returns>
|
||||||
|
Task<IEnumerable<UsageLog>> GetByPrinterAsync(Guid printerId, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves usage logs for a specific print job, ordered by usage timestamp descending.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="printJobId">The print job ID to filter by.</param>
|
||||||
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
|
/// <returns>A collection of usage logs for the print job.</returns>
|
||||||
|
Task<IEnumerable<UsageLog>> GetByPrintJobAsync(Guid printJobId, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
using Extrudex.Domain.Entities;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
|
|
||||||
namespace Extrudex.Infrastructure.Data.Configurations;
|
|
||||||
|
|
||||||
public class FilamentUsageConfiguration : BaseEntityConfiguration<FilamentUsage>
|
|
||||||
{
|
|
||||||
public override void Configure(EntityTypeBuilder<FilamentUsage> builder)
|
|
||||||
{
|
|
||||||
base.Configure(builder);
|
|
||||||
|
|
||||||
builder.Property(e => e.PrintJobId)
|
|
||||||
.HasColumnName("print_job_id")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(e => e.SpoolId)
|
|
||||||
.HasColumnName("spool_id")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(e => e.PrinterId)
|
|
||||||
.HasColumnName("printer_id")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(e => e.GramsUsed)
|
|
||||||
.HasColumnName("grams_used")
|
|
||||||
.HasPrecision(10, 2)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(e => e.MmExtruded)
|
|
||||||
.HasColumnName("mm_extruded")
|
|
||||||
.HasPrecision(12, 2)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(e => e.RecordedAt)
|
|
||||||
.HasColumnName("recorded_at")
|
|
||||||
.HasDefaultValueSql("now() at time zone 'utc'")
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Property(e => e.Notes)
|
|
||||||
.HasColumnName("notes")
|
|
||||||
.HasMaxLength(2000);
|
|
||||||
|
|
||||||
// Index on print_job_id for querying usage by print job
|
|
||||||
builder.HasIndex(e => e.PrintJobId)
|
|
||||||
.HasDatabaseName("ix_filament_usages_print_job_id");
|
|
||||||
|
|
||||||
// Index on spool_id for querying usage by spool (filament)
|
|
||||||
builder.HasIndex(e => e.SpoolId)
|
|
||||||
.HasDatabaseName("ix_filament_usages_spool_id");
|
|
||||||
|
|
||||||
// Index on printer_id for querying usage by printer
|
|
||||||
builder.HasIndex(e => e.PrinterId)
|
|
||||||
.HasDatabaseName("ix_filament_usages_printer_id");
|
|
||||||
|
|
||||||
// Index on recorded_at for time-range queries
|
|
||||||
builder.HasIndex(e => e.RecordedAt)
|
|
||||||
.HasDatabaseName("ix_filament_usages_recorded_at");
|
|
||||||
|
|
||||||
// Composite index for querying usage by spool within a date range
|
|
||||||
builder.HasIndex(e => new { e.SpoolId, e.RecordedAt })
|
|
||||||
.HasDatabaseName("ix_filament_usages_spool_id_recorded_at");
|
|
||||||
|
|
||||||
// Relationships
|
|
||||||
builder.HasOne(e => e.PrintJob)
|
|
||||||
.WithMany(e => e.FilamentUsages)
|
|
||||||
.HasForeignKey(e => e.PrintJobId)
|
|
||||||
.HasConstraintName("fk_filament_usages_print_job")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
|
||||||
|
|
||||||
builder.HasOne(e => e.Spool)
|
|
||||||
.WithMany(e => e.FilamentUsages)
|
|
||||||
.HasForeignKey(e => e.SpoolId)
|
|
||||||
.HasConstraintName("fk_filament_usages_spool")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
|
|
||||||
builder.HasOne(e => e.Printer)
|
|
||||||
.WithMany(e => e.FilamentUsages)
|
|
||||||
.HasForeignKey(e => e.PrinterId)
|
|
||||||
.HasConstraintName("fk_filament_usages_printer")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
using Extrudex.Domain.Entities;
|
||||||
|
using Extrudex.Domain.Enums;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
|
|
||||||
|
namespace Extrudex.Infrastructure.Data.Configurations;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EF Core configuration for the UsageLog entity.
|
||||||
|
/// Maps to the usage_logs table with snake_case columns and appropriate indexes.
|
||||||
|
/// </summary>
|
||||||
|
public class UsageLogConfiguration : BaseEntityConfiguration<UsageLog>
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public override void Configure(EntityTypeBuilder<UsageLog> builder)
|
||||||
|
{
|
||||||
|
base.Configure(builder);
|
||||||
|
|
||||||
|
builder.Property(e => e.SpoolId)
|
||||||
|
.HasColumnName("spool_id")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(e => e.PrinterId)
|
||||||
|
.HasColumnName("printer_id");
|
||||||
|
|
||||||
|
builder.Property(e => e.PrintJobId)
|
||||||
|
.HasColumnName("print_job_id");
|
||||||
|
|
||||||
|
builder.Property(e => e.GramsUsed)
|
||||||
|
.HasColumnName("grams_used")
|
||||||
|
.HasPrecision(10, 2)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(e => e.MmExtruded)
|
||||||
|
.HasColumnName("mm_extruded")
|
||||||
|
.HasPrecision(12, 2);
|
||||||
|
|
||||||
|
builder.Property(e => e.UsageTimestamp)
|
||||||
|
.HasColumnName("usage_timestamp")
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(e => e.DataSource)
|
||||||
|
.HasColumnName("data_source")
|
||||||
|
.HasConversion<string>()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
builder.Property(e => e.Notes)
|
||||||
|
.HasColumnName("notes")
|
||||||
|
.HasMaxLength(2000);
|
||||||
|
|
||||||
|
// Index on spool_id for querying usage by spool
|
||||||
|
builder.HasIndex(e => e.SpoolId)
|
||||||
|
.HasDatabaseName("ix_usage_logs_spool_id");
|
||||||
|
|
||||||
|
// Index on printer_id for querying usage by printer
|
||||||
|
builder.HasIndex(e => e.PrinterId)
|
||||||
|
.HasDatabaseName("ix_usage_logs_printer_id");
|
||||||
|
|
||||||
|
// Index on print_job_id for querying usage by print job
|
||||||
|
builder.HasIndex(e => e.PrintJobId)
|
||||||
|
.HasDatabaseName("ix_usage_logs_print_job_id");
|
||||||
|
|
||||||
|
// Index on usage_timestamp for chronological queries
|
||||||
|
builder.HasIndex(e => e.UsageTimestamp)
|
||||||
|
.HasDatabaseName("ix_usage_logs_usage_timestamp");
|
||||||
|
|
||||||
|
// Index on data_source for filtering by integration path
|
||||||
|
builder.HasIndex(e => e.DataSource)
|
||||||
|
.HasDatabaseName("ix_usage_logs_data_source");
|
||||||
|
|
||||||
|
// Relationships
|
||||||
|
builder.HasOne(e => e.Spool)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(e => e.SpoolId)
|
||||||
|
.HasConstraintName("fk_usage_logs_spool")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
builder.HasOne(e => e.Printer)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(e => e.PrinterId)
|
||||||
|
.HasConstraintName("fk_usage_logs_printer")
|
||||||
|
.OnDelete(DeleteBehavior.SetNull);
|
||||||
|
|
||||||
|
builder.HasOne(e => e.PrintJob)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(e => e.PrintJobId)
|
||||||
|
.HasConstraintName("fk_usage_logs_print_job")
|
||||||
|
.OnDelete(DeleteBehavior.SetNull);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ public class ExtrudexDbContext : DbContext
|
|||||||
public DbSet<AmsUnit> AmsUnits => Set<AmsUnit>();
|
public DbSet<AmsUnit> AmsUnits => Set<AmsUnit>();
|
||||||
public DbSet<AmsSlot> AmsSlots => Set<AmsSlot>();
|
public DbSet<AmsSlot> AmsSlots => Set<AmsSlot>();
|
||||||
public DbSet<PrintJob> PrintJobs => Set<PrintJob>();
|
public DbSet<PrintJob> PrintJobs => Set<PrintJob>();
|
||||||
public DbSet<FilamentUsage> FilamentUsages => Set<FilamentUsage>();
|
public DbSet<UsageLog> UsageLogs => Set<UsageLog>();
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace Extrudex.Infrastructure.Data.Migrations
|
namespace Extrudex.Infrastructure.Data.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ExtrudexDbContext))]
|
[DbContext(typeof(ExtrudexDbContext))]
|
||||||
[Migration("20260426183433_AddFilamentUsageTrackingModel")]
|
[Migration("20260426184329_AddUsageLogTable")]
|
||||||
partial class AddFilamentUsageTrackingModel
|
partial class AddUsageLogTable
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -107,77 +107,6 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.ToTable("ams_units", (string)null);
|
b.ToTable("ams_units", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.FilamentUsage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.HasColumnType("uuid")
|
|
||||||
.HasColumnName("id");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasColumnName("created_at")
|
|
||||||
.HasDefaultValueSql("now() at time zone 'utc'");
|
|
||||||
|
|
||||||
b.Property<decimal>("GramsUsed")
|
|
||||||
.HasPrecision(10, 2)
|
|
||||||
.HasColumnType("numeric(10,2)")
|
|
||||||
.HasColumnName("grams_used");
|
|
||||||
|
|
||||||
b.Property<decimal>("MmExtruded")
|
|
||||||
.HasPrecision(12, 2)
|
|
||||||
.HasColumnType("numeric(12,2)")
|
|
||||||
.HasColumnName("mm_extruded");
|
|
||||||
|
|
||||||
b.Property<string>("Notes")
|
|
||||||
.HasMaxLength(2000)
|
|
||||||
.HasColumnType("character varying(2000)")
|
|
||||||
.HasColumnName("notes");
|
|
||||||
|
|
||||||
b.Property<Guid>("PrintJobId")
|
|
||||||
.HasColumnType("uuid")
|
|
||||||
.HasColumnName("print_job_id");
|
|
||||||
|
|
||||||
b.Property<Guid>("PrinterId")
|
|
||||||
.HasColumnType("uuid")
|
|
||||||
.HasColumnName("printer_id");
|
|
||||||
|
|
||||||
b.Property<DateTime>("RecordedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasColumnName("recorded_at")
|
|
||||||
.HasDefaultValueSql("now() at time zone 'utc'");
|
|
||||||
|
|
||||||
b.Property<Guid>("SpoolId")
|
|
||||||
.HasColumnType("uuid")
|
|
||||||
.HasColumnName("spool_id");
|
|
||||||
|
|
||||||
b.Property<DateTime>("UpdatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasColumnName("updated_at")
|
|
||||||
.HasDefaultValueSql("now() at time zone 'utc'");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("PrintJobId")
|
|
||||||
.HasDatabaseName("ix_filament_usages_print_job_id");
|
|
||||||
|
|
||||||
b.HasIndex("PrinterId")
|
|
||||||
.HasDatabaseName("ix_filament_usages_printer_id");
|
|
||||||
|
|
||||||
b.HasIndex("RecordedAt")
|
|
||||||
.HasDatabaseName("ix_filament_usages_recorded_at");
|
|
||||||
|
|
||||||
b.HasIndex("SpoolId")
|
|
||||||
.HasDatabaseName("ix_filament_usages_spool_id");
|
|
||||||
|
|
||||||
b.HasIndex("SpoolId", "RecordedAt")
|
|
||||||
.HasDatabaseName("ix_filament_usages_spool_id_recorded_at");
|
|
||||||
|
|
||||||
b.ToTable("filament_usages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.MaterialBase", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.MaterialBase", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
@@ -219,50 +148,50 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9388),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(6535),
|
||||||
DensityGperCm3 = 1.24m,
|
DensityGperCm3 = 1.24m,
|
||||||
Name = "PLA",
|
Name = "PLA",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9388)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(6535)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9871),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7016),
|
||||||
DensityGperCm3 = 1.27m,
|
DensityGperCm3 = 1.27m,
|
||||||
Name = "PETG",
|
Name = "PETG",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9871)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7016)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9881),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7027),
|
||||||
DensityGperCm3 = 1.04m,
|
DensityGperCm3 = 1.04m,
|
||||||
Name = "ABS",
|
Name = "ABS",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9881)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7028)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9888),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7034),
|
||||||
DensityGperCm3 = 1.07m,
|
DensityGperCm3 = 1.07m,
|
||||||
Name = "ASA",
|
Name = "ASA",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9888)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7035)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9895),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7042),
|
||||||
DensityGperCm3 = 1.21m,
|
DensityGperCm3 = 1.21m,
|
||||||
Name = "TPU",
|
Name = "TPU",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9895)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7042)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9901),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7049),
|
||||||
DensityGperCm3 = 1.14m,
|
DensityGperCm3 = 1.14m,
|
||||||
Name = "Nylon",
|
Name = "Nylon",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9902)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7049)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -306,122 +235,122 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000001"),
|
Id = new Guid("20000000-0000-0000-0000-000000000001"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(90),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7291),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(90)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7292)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000002"),
|
Id = new Guid("20000000-0000-0000-0000-000000000002"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(251),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7453),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Matte",
|
Name = "Matte",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(251)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7453)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000003"),
|
Id = new Guid("20000000-0000-0000-0000-000000000003"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(259),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7461),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Silk",
|
Name = "Silk",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(259)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7461)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000004"),
|
Id = new Guid("20000000-0000-0000-0000-000000000004"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(266),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7468),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Glitter",
|
Name = "Glitter",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(266)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7468)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000005"),
|
Id = new Guid("20000000-0000-0000-0000-000000000005"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(272),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7474),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Marble",
|
Name = "Marble",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(272)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7474)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000006"),
|
Id = new Guid("20000000-0000-0000-0000-000000000006"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(278),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7480),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Sparkle",
|
Name = "Sparkle",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(278)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7481)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000007"),
|
Id = new Guid("20000000-0000-0000-0000-000000000007"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(285),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7487),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(285)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7487)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000008"),
|
Id = new Guid("20000000-0000-0000-0000-000000000008"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(291),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7493),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Matte",
|
Name = "Matte",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(291)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7493)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000009"),
|
Id = new Guid("20000000-0000-0000-0000-000000000009"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(297),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7500),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Silk",
|
Name = "Silk",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(298)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7500)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000010"),
|
Id = new Guid("20000000-0000-0000-0000-000000000010"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(304),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7507),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(304)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7507)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000011"),
|
Id = new Guid("20000000-0000-0000-0000-000000000011"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(310),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7513),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
Name = "Matte",
|
Name = "Matte",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(310)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7513)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000012"),
|
Id = new Guid("20000000-0000-0000-0000-000000000012"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(316),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7519),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(317)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7520)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000013"),
|
Id = new Guid("20000000-0000-0000-0000-000000000013"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(323),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7526),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||||
Name = "Matte",
|
Name = "Matte",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(323)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7526)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000014"),
|
Id = new Guid("20000000-0000-0000-0000-000000000014"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(329),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7532),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000005"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(329)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7532)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000015"),
|
Id = new Guid("20000000-0000-0000-0000-000000000015"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(336),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7538),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(336)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7539)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -465,90 +394,90 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000001"),
|
Id = new Guid("30000000-0000-0000-0000-000000000001"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(482),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7690),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(482)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7690)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000002"),
|
Id = new Guid("30000000-0000-0000-0000-000000000002"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(805),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7838),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Glass Fiber",
|
Name = "Glass Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(806)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7838)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000003"),
|
Id = new Guid("30000000-0000-0000-0000-000000000003"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(815),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7846),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Wood Fill",
|
Name = "Wood Fill",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(815)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7846)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000004"),
|
Id = new Guid("30000000-0000-0000-0000-000000000004"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(821),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7853),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Glow-in-the-Dark",
|
Name = "Glow-in-the-Dark",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(821)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7853)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000005"),
|
Id = new Guid("30000000-0000-0000-0000-000000000005"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(828),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7859),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(828)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7859)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000006"),
|
Id = new Guid("30000000-0000-0000-0000-000000000006"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(834),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7865),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Glass Fiber",
|
Name = "Glass Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(834)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7866)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000007"),
|
Id = new Guid("30000000-0000-0000-0000-000000000007"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(840),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7872),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(840)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7872)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000008"),
|
Id = new Guid("30000000-0000-0000-0000-000000000008"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(847),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7878),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
Name = "Glass Fiber",
|
Name = "Glass Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(847)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7879)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000009"),
|
Id = new Guid("30000000-0000-0000-0000-000000000009"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(853),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7885),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(853)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7885)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000010"),
|
Id = new Guid("30000000-0000-0000-0000-000000000010"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(859),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7891),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(860)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7891)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000011"),
|
Id = new Guid("30000000-0000-0000-0000-000000000011"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(866),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7898),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||||
Name = "Glass Fiber",
|
Name = "Glass Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(866)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7898)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -880,6 +809,81 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.ToTable("spools", (string)null);
|
b.ToTable("spools", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Extrudex.Domain.Entities.UsageLog", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("created_at")
|
||||||
|
.HasDefaultValueSql("now() at time zone 'utc'");
|
||||||
|
|
||||||
|
b.Property<string>("DataSource")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)")
|
||||||
|
.HasColumnName("data_source");
|
||||||
|
|
||||||
|
b.Property<decimal>("GramsUsed")
|
||||||
|
.HasPrecision(10, 2)
|
||||||
|
.HasColumnType("numeric(10,2)")
|
||||||
|
.HasColumnName("grams_used");
|
||||||
|
|
||||||
|
b.Property<decimal?>("MmExtruded")
|
||||||
|
.HasPrecision(12, 2)
|
||||||
|
.HasColumnType("numeric(12,2)")
|
||||||
|
.HasColumnName("mm_extruded");
|
||||||
|
|
||||||
|
b.Property<string>("Notes")
|
||||||
|
.HasMaxLength(2000)
|
||||||
|
.HasColumnType("character varying(2000)")
|
||||||
|
.HasColumnName("notes");
|
||||||
|
|
||||||
|
b.Property<Guid?>("PrintJobId")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("print_job_id");
|
||||||
|
|
||||||
|
b.Property<Guid?>("PrinterId")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("printer_id");
|
||||||
|
|
||||||
|
b.Property<Guid>("SpoolId")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("spool_id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedAt")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("updated_at")
|
||||||
|
.HasDefaultValueSql("now() at time zone 'utc'");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UsageTimestamp")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("usage_timestamp");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("DataSource")
|
||||||
|
.HasDatabaseName("ix_usage_logs_data_source");
|
||||||
|
|
||||||
|
b.HasIndex("PrintJobId")
|
||||||
|
.HasDatabaseName("ix_usage_logs_print_job_id");
|
||||||
|
|
||||||
|
b.HasIndex("PrinterId")
|
||||||
|
.HasDatabaseName("ix_usage_logs_printer_id");
|
||||||
|
|
||||||
|
b.HasIndex("SpoolId")
|
||||||
|
.HasDatabaseName("ix_usage_logs_spool_id");
|
||||||
|
|
||||||
|
b.HasIndex("UsageTimestamp")
|
||||||
|
.HasDatabaseName("ix_usage_logs_usage_timestamp");
|
||||||
|
|
||||||
|
b.ToTable("usage_logs", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.AmsSlot", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.AmsSlot", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Extrudex.Domain.Entities.AmsUnit", "AmsUnit")
|
b.HasOne("Extrudex.Domain.Entities.AmsUnit", "AmsUnit")
|
||||||
@@ -912,36 +916,6 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.Navigation("Printer");
|
b.Navigation("Printer");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.FilamentUsage", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Extrudex.Domain.Entities.PrintJob", "PrintJob")
|
|
||||||
.WithMany("FilamentUsages")
|
|
||||||
.HasForeignKey("PrintJobId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_filament_usages_print_job");
|
|
||||||
|
|
||||||
b.HasOne("Extrudex.Domain.Entities.Printer", "Printer")
|
|
||||||
.WithMany("FilamentUsages")
|
|
||||||
.HasForeignKey("PrinterId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_filament_usages_printer");
|
|
||||||
|
|
||||||
b.HasOne("Extrudex.Domain.Entities.Spool", "Spool")
|
|
||||||
.WithMany("FilamentUsages")
|
|
||||||
.HasForeignKey("SpoolId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_filament_usages_spool");
|
|
||||||
|
|
||||||
b.Navigation("PrintJob");
|
|
||||||
|
|
||||||
b.Navigation("Printer");
|
|
||||||
|
|
||||||
b.Navigation("Spool");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.MaterialFinish", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.MaterialFinish", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Extrudex.Domain.Entities.MaterialBase", "MaterialBase")
|
b.HasOne("Extrudex.Domain.Entities.MaterialBase", "MaterialBase")
|
||||||
@@ -1016,6 +990,34 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.Navigation("MaterialModifier");
|
b.Navigation("MaterialModifier");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Extrudex.Domain.Entities.UsageLog", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Extrudex.Domain.Entities.PrintJob", "PrintJob")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PrintJobId")
|
||||||
|
.OnDelete(DeleteBehavior.SetNull)
|
||||||
|
.HasConstraintName("fk_usage_logs_print_job");
|
||||||
|
|
||||||
|
b.HasOne("Extrudex.Domain.Entities.Printer", "Printer")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PrinterId")
|
||||||
|
.OnDelete(DeleteBehavior.SetNull)
|
||||||
|
.HasConstraintName("fk_usage_logs_printer");
|
||||||
|
|
||||||
|
b.HasOne("Extrudex.Domain.Entities.Spool", "Spool")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SpoolId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("fk_usage_logs_spool");
|
||||||
|
|
||||||
|
b.Navigation("PrintJob");
|
||||||
|
|
||||||
|
b.Navigation("Printer");
|
||||||
|
|
||||||
|
b.Navigation("Spool");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.AmsUnit", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.AmsUnit", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Slots");
|
b.Navigation("Slots");
|
||||||
@@ -1040,17 +1042,10 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.Navigation("Spools");
|
b.Navigation("Spools");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.PrintJob", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("FilamentUsages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.Printer", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.Printer", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("AmsUnits");
|
b.Navigation("AmsUnits");
|
||||||
|
|
||||||
b.Navigation("FilamentUsages");
|
|
||||||
|
|
||||||
b.Navigation("PrintJobs");
|
b.Navigation("PrintJobs");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1058,8 +1053,6 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Navigation("AmsSlots");
|
b.Navigation("AmsSlots");
|
||||||
|
|
||||||
b.Navigation("FilamentUsages");
|
|
||||||
|
|
||||||
b.Navigation("PrintJobs");
|
b.Navigation("PrintJobs");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
@@ -6,43 +6,44 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace Extrudex.Infrastructure.Data.Migrations
|
namespace Extrudex.Infrastructure.Data.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class AddFilamentUsageTrackingModel : Migration
|
public partial class AddUsageLogTable : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "filament_usages",
|
name: "usage_logs",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
print_job_id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
spool_id = table.Column<Guid>(type: "uuid", nullable: false),
|
spool_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
printer_id = table.Column<Guid>(type: "uuid", nullable: false),
|
printer_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
print_job_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
grams_used = table.Column<decimal>(type: "numeric(10,2)", precision: 10, scale: 2, nullable: false),
|
grams_used = table.Column<decimal>(type: "numeric(10,2)", precision: 10, scale: 2, nullable: false),
|
||||||
mm_extruded = table.Column<decimal>(type: "numeric(12,2)", precision: 12, scale: 2, nullable: false),
|
mm_extruded = table.Column<decimal>(type: "numeric(12,2)", precision: 12, scale: 2, nullable: true),
|
||||||
recorded_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now() at time zone 'utc'"),
|
usage_timestamp = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||||
|
data_source = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||||
notes = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
|
notes = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: true),
|
||||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now() at time zone 'utc'"),
|
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now() at time zone 'utc'"),
|
||||||
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now() at time zone 'utc'")
|
updated_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "now() at time zone 'utc'")
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_filament_usages", x => x.id);
|
table.PrimaryKey("PK_usage_logs", x => x.id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_filament_usages_print_job",
|
name: "fk_usage_logs_print_job",
|
||||||
column: x => x.print_job_id,
|
column: x => x.print_job_id,
|
||||||
principalTable: "print_jobs",
|
principalTable: "print_jobs",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.SetNull);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_filament_usages_printer",
|
name: "fk_usage_logs_printer",
|
||||||
column: x => x.printer_id,
|
column: x => x.printer_id,
|
||||||
principalTable: "printers",
|
principalTable: "printers",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.SetNull);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "fk_filament_usages_spool",
|
name: "fk_usage_logs_spool",
|
||||||
column: x => x.spool_id,
|
column: x => x.spool_id,
|
||||||
principalTable: "spools",
|
principalTable: "spools",
|
||||||
principalColumn: "id",
|
principalColumn: "id",
|
||||||
@@ -54,256 +55,256 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("10000000-0000-0000-0000-000000000001"),
|
keyValue: new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9388), new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9388) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(6535), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(6535) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_bases",
|
table: "material_bases",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("10000000-0000-0000-0000-000000000002"),
|
keyValue: new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9871), new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9871) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7016), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7016) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_bases",
|
table: "material_bases",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("10000000-0000-0000-0000-000000000003"),
|
keyValue: new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9881), new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9881) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7027), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7028) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_bases",
|
table: "material_bases",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("10000000-0000-0000-0000-000000000004"),
|
keyValue: new Guid("10000000-0000-0000-0000-000000000004"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9888), new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9888) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7034), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7035) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_bases",
|
table: "material_bases",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("10000000-0000-0000-0000-000000000005"),
|
keyValue: new Guid("10000000-0000-0000-0000-000000000005"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9895), new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9895) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7042), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7042) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_bases",
|
table: "material_bases",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("10000000-0000-0000-0000-000000000006"),
|
keyValue: new Guid("10000000-0000-0000-0000-000000000006"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9901), new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9902) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7049), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7049) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000001"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000001"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(90), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(90) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7291), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7292) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000002"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000002"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(251), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(251) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7453), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7453) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000003"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000003"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(259), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(259) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7461), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7461) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000004"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000004"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(266), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(266) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7468), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7468) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000005"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000005"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(272), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(272) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7474), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7474) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000006"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000006"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(278), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(278) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7480), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7481) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000007"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000007"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(285), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(285) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7487), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7487) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000008"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000008"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(291), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(291) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7493), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7493) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000009"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000009"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(297), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(298) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7500), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7500) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000010"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000010"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(304), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(304) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7507), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7507) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000011"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000011"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(310), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(310) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7513), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7513) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000012"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000012"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(316), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(317) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7519), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7520) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000013"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000013"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(323), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(323) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7526), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7526) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000014"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000014"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(329), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(329) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7532), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7532) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_finishes",
|
table: "material_finishes",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("20000000-0000-0000-0000-000000000015"),
|
keyValue: new Guid("20000000-0000-0000-0000-000000000015"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(336), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(336) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7538), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7539) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000001"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000001"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(482), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(482) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7690), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7690) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000002"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000002"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(805), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(806) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7838), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7838) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000003"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000003"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(815), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(815) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7846), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7846) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000004"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000004"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(821), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(821) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7853), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7853) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000005"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000005"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(828), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(828) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7859), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7859) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000006"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000006"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(834), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(834) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7865), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7866) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000007"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000007"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(840), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(840) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7872), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7872) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000008"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000008"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(847), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(847) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7878), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7879) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000009"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000009"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(853), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(853) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7885), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7885) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000010"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000010"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(859), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(860) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7891), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7891) });
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_modifiers",
|
table: "material_modifiers",
|
||||||
keyColumn: "id",
|
keyColumn: "id",
|
||||||
keyValue: new Guid("30000000-0000-0000-0000-000000000011"),
|
keyValue: new Guid("30000000-0000-0000-0000-000000000011"),
|
||||||
columns: new[] { "created_at", "updated_at" },
|
columns: new[] { "created_at", "updated_at" },
|
||||||
values: new object[] { new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(866), new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(866) });
|
values: new object[] { new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7898), new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7898) });
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_filament_usages_print_job_id",
|
name: "ix_usage_logs_data_source",
|
||||||
table: "filament_usages",
|
table: "usage_logs",
|
||||||
|
column: "data_source");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_usage_logs_print_job_id",
|
||||||
|
table: "usage_logs",
|
||||||
column: "print_job_id");
|
column: "print_job_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_filament_usages_printer_id",
|
name: "ix_usage_logs_printer_id",
|
||||||
table: "filament_usages",
|
table: "usage_logs",
|
||||||
column: "printer_id");
|
column: "printer_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_filament_usages_recorded_at",
|
name: "ix_usage_logs_spool_id",
|
||||||
table: "filament_usages",
|
table: "usage_logs",
|
||||||
column: "recorded_at");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "ix_filament_usages_spool_id",
|
|
||||||
table: "filament_usages",
|
|
||||||
column: "spool_id");
|
column: "spool_id");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "ix_filament_usages_spool_id_recorded_at",
|
name: "ix_usage_logs_usage_timestamp",
|
||||||
table: "filament_usages",
|
table: "usage_logs",
|
||||||
columns: new[] { "spool_id", "recorded_at" });
|
column: "usage_timestamp");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "filament_usages");
|
name: "usage_logs");
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
migrationBuilder.UpdateData(
|
||||||
table: "material_bases",
|
table: "material_bases",
|
||||||
@@ -104,77 +104,6 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.ToTable("ams_units", (string)null);
|
b.ToTable("ams_units", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.FilamentUsage", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.HasColumnType("uuid")
|
|
||||||
.HasColumnName("id");
|
|
||||||
|
|
||||||
b.Property<DateTime>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasColumnName("created_at")
|
|
||||||
.HasDefaultValueSql("now() at time zone 'utc'");
|
|
||||||
|
|
||||||
b.Property<decimal>("GramsUsed")
|
|
||||||
.HasPrecision(10, 2)
|
|
||||||
.HasColumnType("numeric(10,2)")
|
|
||||||
.HasColumnName("grams_used");
|
|
||||||
|
|
||||||
b.Property<decimal>("MmExtruded")
|
|
||||||
.HasPrecision(12, 2)
|
|
||||||
.HasColumnType("numeric(12,2)")
|
|
||||||
.HasColumnName("mm_extruded");
|
|
||||||
|
|
||||||
b.Property<string>("Notes")
|
|
||||||
.HasMaxLength(2000)
|
|
||||||
.HasColumnType("character varying(2000)")
|
|
||||||
.HasColumnName("notes");
|
|
||||||
|
|
||||||
b.Property<Guid>("PrintJobId")
|
|
||||||
.HasColumnType("uuid")
|
|
||||||
.HasColumnName("print_job_id");
|
|
||||||
|
|
||||||
b.Property<Guid>("PrinterId")
|
|
||||||
.HasColumnType("uuid")
|
|
||||||
.HasColumnName("printer_id");
|
|
||||||
|
|
||||||
b.Property<DateTime>("RecordedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasColumnName("recorded_at")
|
|
||||||
.HasDefaultValueSql("now() at time zone 'utc'");
|
|
||||||
|
|
||||||
b.Property<Guid>("SpoolId")
|
|
||||||
.HasColumnType("uuid")
|
|
||||||
.HasColumnName("spool_id");
|
|
||||||
|
|
||||||
b.Property<DateTime>("UpdatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone")
|
|
||||||
.HasColumnName("updated_at")
|
|
||||||
.HasDefaultValueSql("now() at time zone 'utc'");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("PrintJobId")
|
|
||||||
.HasDatabaseName("ix_filament_usages_print_job_id");
|
|
||||||
|
|
||||||
b.HasIndex("PrinterId")
|
|
||||||
.HasDatabaseName("ix_filament_usages_printer_id");
|
|
||||||
|
|
||||||
b.HasIndex("RecordedAt")
|
|
||||||
.HasDatabaseName("ix_filament_usages_recorded_at");
|
|
||||||
|
|
||||||
b.HasIndex("SpoolId")
|
|
||||||
.HasDatabaseName("ix_filament_usages_spool_id");
|
|
||||||
|
|
||||||
b.HasIndex("SpoolId", "RecordedAt")
|
|
||||||
.HasDatabaseName("ix_filament_usages_spool_id_recorded_at");
|
|
||||||
|
|
||||||
b.ToTable("filament_usages", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.MaterialBase", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.MaterialBase", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
@@ -216,50 +145,50 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9388),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(6535),
|
||||||
DensityGperCm3 = 1.24m,
|
DensityGperCm3 = 1.24m,
|
||||||
Name = "PLA",
|
Name = "PLA",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9388)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(6535)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9871),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7016),
|
||||||
DensityGperCm3 = 1.27m,
|
DensityGperCm3 = 1.27m,
|
||||||
Name = "PETG",
|
Name = "PETG",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9871)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7016)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9881),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7027),
|
||||||
DensityGperCm3 = 1.04m,
|
DensityGperCm3 = 1.04m,
|
||||||
Name = "ABS",
|
Name = "ABS",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9881)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7028)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9888),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7034),
|
||||||
DensityGperCm3 = 1.07m,
|
DensityGperCm3 = 1.07m,
|
||||||
Name = "ASA",
|
Name = "ASA",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9888)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7035)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9895),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7042),
|
||||||
DensityGperCm3 = 1.21m,
|
DensityGperCm3 = 1.21m,
|
||||||
Name = "TPU",
|
Name = "TPU",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9895)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7042)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9901),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7049),
|
||||||
DensityGperCm3 = 1.14m,
|
DensityGperCm3 = 1.14m,
|
||||||
Name = "Nylon",
|
Name = "Nylon",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 291, DateTimeKind.Utc).AddTicks(9902)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7049)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -303,122 +232,122 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000001"),
|
Id = new Guid("20000000-0000-0000-0000-000000000001"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(90),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7291),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(90)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7292)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000002"),
|
Id = new Guid("20000000-0000-0000-0000-000000000002"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(251),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7453),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Matte",
|
Name = "Matte",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(251)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7453)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000003"),
|
Id = new Guid("20000000-0000-0000-0000-000000000003"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(259),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7461),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Silk",
|
Name = "Silk",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(259)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7461)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000004"),
|
Id = new Guid("20000000-0000-0000-0000-000000000004"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(266),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7468),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Glitter",
|
Name = "Glitter",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(266)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7468)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000005"),
|
Id = new Guid("20000000-0000-0000-0000-000000000005"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(272),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7474),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Marble",
|
Name = "Marble",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(272)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7474)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000006"),
|
Id = new Guid("20000000-0000-0000-0000-000000000006"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(278),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7480),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Sparkle",
|
Name = "Sparkle",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(278)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7481)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000007"),
|
Id = new Guid("20000000-0000-0000-0000-000000000007"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(285),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7487),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(285)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7487)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000008"),
|
Id = new Guid("20000000-0000-0000-0000-000000000008"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(291),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7493),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Matte",
|
Name = "Matte",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(291)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7493)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000009"),
|
Id = new Guid("20000000-0000-0000-0000-000000000009"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(297),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7500),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Silk",
|
Name = "Silk",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(298)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7500)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000010"),
|
Id = new Guid("20000000-0000-0000-0000-000000000010"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(304),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7507),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(304)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7507)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000011"),
|
Id = new Guid("20000000-0000-0000-0000-000000000011"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(310),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7513),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
Name = "Matte",
|
Name = "Matte",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(310)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7513)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000012"),
|
Id = new Guid("20000000-0000-0000-0000-000000000012"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(316),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7519),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(317)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7520)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000013"),
|
Id = new Guid("20000000-0000-0000-0000-000000000013"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(323),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7526),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||||
Name = "Matte",
|
Name = "Matte",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(323)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7526)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000014"),
|
Id = new Guid("20000000-0000-0000-0000-000000000014"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(329),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7532),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000005"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(329)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7532)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("20000000-0000-0000-0000-000000000015"),
|
Id = new Guid("20000000-0000-0000-0000-000000000015"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(336),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7538),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||||
Name = "Basic",
|
Name = "Basic",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(336)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7539)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -462,90 +391,90 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000001"),
|
Id = new Guid("30000000-0000-0000-0000-000000000001"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(482),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7690),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(482)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7690)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000002"),
|
Id = new Guid("30000000-0000-0000-0000-000000000002"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(805),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7838),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Glass Fiber",
|
Name = "Glass Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(806)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7838)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000003"),
|
Id = new Guid("30000000-0000-0000-0000-000000000003"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(815),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7846),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Wood Fill",
|
Name = "Wood Fill",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(815)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7846)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000004"),
|
Id = new Guid("30000000-0000-0000-0000-000000000004"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(821),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7853),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||||
Name = "Glow-in-the-Dark",
|
Name = "Glow-in-the-Dark",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(821)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7853)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000005"),
|
Id = new Guid("30000000-0000-0000-0000-000000000005"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(828),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7859),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(828)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7859)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000006"),
|
Id = new Guid("30000000-0000-0000-0000-000000000006"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(834),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7865),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||||
Name = "Glass Fiber",
|
Name = "Glass Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(834)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7866)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000007"),
|
Id = new Guid("30000000-0000-0000-0000-000000000007"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(840),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7872),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(840)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7872)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000008"),
|
Id = new Guid("30000000-0000-0000-0000-000000000008"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(847),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7878),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||||
Name = "Glass Fiber",
|
Name = "Glass Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(847)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7879)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000009"),
|
Id = new Guid("30000000-0000-0000-0000-000000000009"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(853),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7885),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(853)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7885)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000010"),
|
Id = new Guid("30000000-0000-0000-0000-000000000010"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(859),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7891),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||||
Name = "Carbon Fiber",
|
Name = "Carbon Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(860)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7891)
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = new Guid("30000000-0000-0000-0000-000000000011"),
|
Id = new Guid("30000000-0000-0000-0000-000000000011"),
|
||||||
CreatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(866),
|
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7898),
|
||||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||||
Name = "Glass Fiber",
|
Name = "Glass Fiber",
|
||||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 34, 33, 292, DateTimeKind.Utc).AddTicks(866)
|
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7898)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -877,6 +806,81 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.ToTable("spools", (string)null);
|
b.ToTable("spools", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Extrudex.Domain.Entities.UsageLog", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("created_at")
|
||||||
|
.HasDefaultValueSql("now() at time zone 'utc'");
|
||||||
|
|
||||||
|
b.Property<string>("DataSource")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(50)
|
||||||
|
.HasColumnType("character varying(50)")
|
||||||
|
.HasColumnName("data_source");
|
||||||
|
|
||||||
|
b.Property<decimal>("GramsUsed")
|
||||||
|
.HasPrecision(10, 2)
|
||||||
|
.HasColumnType("numeric(10,2)")
|
||||||
|
.HasColumnName("grams_used");
|
||||||
|
|
||||||
|
b.Property<decimal?>("MmExtruded")
|
||||||
|
.HasPrecision(12, 2)
|
||||||
|
.HasColumnType("numeric(12,2)")
|
||||||
|
.HasColumnName("mm_extruded");
|
||||||
|
|
||||||
|
b.Property<string>("Notes")
|
||||||
|
.HasMaxLength(2000)
|
||||||
|
.HasColumnType("character varying(2000)")
|
||||||
|
.HasColumnName("notes");
|
||||||
|
|
||||||
|
b.Property<Guid?>("PrintJobId")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("print_job_id");
|
||||||
|
|
||||||
|
b.Property<Guid?>("PrinterId")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("printer_id");
|
||||||
|
|
||||||
|
b.Property<Guid>("SpoolId")
|
||||||
|
.HasColumnType("uuid")
|
||||||
|
.HasColumnName("spool_id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UpdatedAt")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("updated_at")
|
||||||
|
.HasDefaultValueSql("now() at time zone 'utc'");
|
||||||
|
|
||||||
|
b.Property<DateTime>("UsageTimestamp")
|
||||||
|
.HasColumnType("timestamp with time zone")
|
||||||
|
.HasColumnName("usage_timestamp");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("DataSource")
|
||||||
|
.HasDatabaseName("ix_usage_logs_data_source");
|
||||||
|
|
||||||
|
b.HasIndex("PrintJobId")
|
||||||
|
.HasDatabaseName("ix_usage_logs_print_job_id");
|
||||||
|
|
||||||
|
b.HasIndex("PrinterId")
|
||||||
|
.HasDatabaseName("ix_usage_logs_printer_id");
|
||||||
|
|
||||||
|
b.HasIndex("SpoolId")
|
||||||
|
.HasDatabaseName("ix_usage_logs_spool_id");
|
||||||
|
|
||||||
|
b.HasIndex("UsageTimestamp")
|
||||||
|
.HasDatabaseName("ix_usage_logs_usage_timestamp");
|
||||||
|
|
||||||
|
b.ToTable("usage_logs", (string)null);
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.AmsSlot", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.AmsSlot", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Extrudex.Domain.Entities.AmsUnit", "AmsUnit")
|
b.HasOne("Extrudex.Domain.Entities.AmsUnit", "AmsUnit")
|
||||||
@@ -909,36 +913,6 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.Navigation("Printer");
|
b.Navigation("Printer");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.FilamentUsage", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("Extrudex.Domain.Entities.PrintJob", "PrintJob")
|
|
||||||
.WithMany("FilamentUsages")
|
|
||||||
.HasForeignKey("PrintJobId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_filament_usages_print_job");
|
|
||||||
|
|
||||||
b.HasOne("Extrudex.Domain.Entities.Printer", "Printer")
|
|
||||||
.WithMany("FilamentUsages")
|
|
||||||
.HasForeignKey("PrinterId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_filament_usages_printer");
|
|
||||||
|
|
||||||
b.HasOne("Extrudex.Domain.Entities.Spool", "Spool")
|
|
||||||
.WithMany("FilamentUsages")
|
|
||||||
.HasForeignKey("SpoolId")
|
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_filament_usages_spool");
|
|
||||||
|
|
||||||
b.Navigation("PrintJob");
|
|
||||||
|
|
||||||
b.Navigation("Printer");
|
|
||||||
|
|
||||||
b.Navigation("Spool");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.MaterialFinish", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.MaterialFinish", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Extrudex.Domain.Entities.MaterialBase", "MaterialBase")
|
b.HasOne("Extrudex.Domain.Entities.MaterialBase", "MaterialBase")
|
||||||
@@ -1013,6 +987,34 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.Navigation("MaterialModifier");
|
b.Navigation("MaterialModifier");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Extrudex.Domain.Entities.UsageLog", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Extrudex.Domain.Entities.PrintJob", "PrintJob")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PrintJobId")
|
||||||
|
.OnDelete(DeleteBehavior.SetNull)
|
||||||
|
.HasConstraintName("fk_usage_logs_print_job");
|
||||||
|
|
||||||
|
b.HasOne("Extrudex.Domain.Entities.Printer", "Printer")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PrinterId")
|
||||||
|
.OnDelete(DeleteBehavior.SetNull)
|
||||||
|
.HasConstraintName("fk_usage_logs_printer");
|
||||||
|
|
||||||
|
b.HasOne("Extrudex.Domain.Entities.Spool", "Spool")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("SpoolId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.IsRequired()
|
||||||
|
.HasConstraintName("fk_usage_logs_spool");
|
||||||
|
|
||||||
|
b.Navigation("PrintJob");
|
||||||
|
|
||||||
|
b.Navigation("Printer");
|
||||||
|
|
||||||
|
b.Navigation("Spool");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.AmsUnit", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.AmsUnit", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Slots");
|
b.Navigation("Slots");
|
||||||
@@ -1037,17 +1039,10 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
b.Navigation("Spools");
|
b.Navigation("Spools");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.PrintJob", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("FilamentUsages");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("Extrudex.Domain.Entities.Printer", b =>
|
modelBuilder.Entity("Extrudex.Domain.Entities.Printer", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("AmsUnits");
|
b.Navigation("AmsUnits");
|
||||||
|
|
||||||
b.Navigation("FilamentUsages");
|
|
||||||
|
|
||||||
b.Navigation("PrintJobs");
|
b.Navigation("PrintJobs");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1055,8 +1050,6 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
|||||||
{
|
{
|
||||||
b.Navigation("AmsSlots");
|
b.Navigation("AmsSlots");
|
||||||
|
|
||||||
b.Navigation("FilamentUsages");
|
|
||||||
|
|
||||||
b.Navigation("PrintJobs");
|
b.Navigation("PrintJobs");
|
||||||
});
|
});
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
|
|||||||
81
backend/Infrastructure/Services/UsageLogService.cs
Normal file
81
backend/Infrastructure/Services/UsageLogService.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using Extrudex.Domain.Entities;
|
||||||
|
using Extrudex.Domain.Enums;
|
||||||
|
using Extrudex.Domain.Interfaces;
|
||||||
|
using Extrudex.Infrastructure.Data;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Extrudex.Infrastructure.Services;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Implementation of <see cref="IUsageLogService"/> that persists usage entries
|
||||||
|
/// to the usage_logs table via EF Core.
|
||||||
|
/// </summary>
|
||||||
|
public class UsageLogService : IUsageLogService
|
||||||
|
{
|
||||||
|
private readonly ExtrudexDbContext _dbContext;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="UsageLogService"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbContext">The EF Core database context for data persistence.</param>
|
||||||
|
public UsageLogService(ExtrudexDbContext dbContext)
|
||||||
|
{
|
||||||
|
_dbContext = dbContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<UsageLog> RecordUsageAsync(
|
||||||
|
Guid spoolId,
|
||||||
|
decimal gramsUsed,
|
||||||
|
DataSource dataSource,
|
||||||
|
Guid? printerId = null,
|
||||||
|
Guid? printJobId = null,
|
||||||
|
decimal? mmExtruded = null,
|
||||||
|
DateTime? usageTimestamp = null,
|
||||||
|
string? notes = null)
|
||||||
|
{
|
||||||
|
var entry = new UsageLog
|
||||||
|
{
|
||||||
|
SpoolId = spoolId,
|
||||||
|
GramsUsed = gramsUsed,
|
||||||
|
DataSource = dataSource,
|
||||||
|
PrinterId = printerId,
|
||||||
|
PrintJobId = printJobId,
|
||||||
|
MmExtruded = mmExtruded,
|
||||||
|
UsageTimestamp = usageTimestamp ?? DateTime.UtcNow,
|
||||||
|
Notes = notes
|
||||||
|
};
|
||||||
|
|
||||||
|
_dbContext.UsageLogs.Add(entry);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<IEnumerable<UsageLog>> GetBySpoolAsync(Guid spoolId, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
return await _dbContext.UsageLogs
|
||||||
|
.Where(u => u.SpoolId == spoolId)
|
||||||
|
.OrderByDescending(u => u.UsageTimestamp)
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<IEnumerable<UsageLog>> GetByPrinterAsync(Guid printerId, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
return await _dbContext.UsageLogs
|
||||||
|
.Where(u => u.PrinterId == printerId)
|
||||||
|
.OrderByDescending(u => u.UsageTimestamp)
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public async Task<IEnumerable<UsageLog>> GetByPrintJobAsync(Guid printJobId, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
return await _dbContext.UsageLogs
|
||||||
|
.Where(u => u.PrintJobId == printJobId)
|
||||||
|
.OrderByDescending(u => u.UsageTimestamp)
|
||||||
|
.ToListAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Extrudex.API.Filters;
|
|
||||||
using Extrudex.API.Hubs;
|
using Extrudex.API.Hubs;
|
||||||
using Extrudex.Domain.Interfaces;
|
using Extrudex.Domain.Interfaces;
|
||||||
using Extrudex.Infrastructure.Data;
|
using Extrudex.Infrastructure.Data;
|
||||||
@@ -24,10 +23,7 @@ builder.Services.AddDbContext<ExtrudexDbContext>(options =>
|
|||||||
options.UseNpgsql(connectionString));
|
options.UseNpgsql(connectionString));
|
||||||
|
|
||||||
// ── API Services ───────────────────────────────────────────
|
// ── API Services ───────────────────────────────────────────
|
||||||
builder.Services.AddControllers(options =>
|
builder.Services.AddControllers();
|
||||||
{
|
|
||||||
options.Filters.AddService<FluentValidationFilter>();
|
|
||||||
});
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen(c =>
|
builder.Services.AddSwaggerGen(c =>
|
||||||
{
|
{
|
||||||
@@ -50,14 +46,13 @@ builder.Services.AddSwaggerGen(c =>
|
|||||||
// ── QR Code Generation ──────────────────────────────────────
|
// ── QR Code Generation ──────────────────────────────────────
|
||||||
builder.Services.AddSingleton<IQrCodeService, QrCodeService>();
|
builder.Services.AddSingleton<IQrCodeService, QrCodeService>();
|
||||||
|
|
||||||
|
// ── Usage Logging ───────────────────────────────────────────
|
||||||
|
builder.Services.AddScoped<IUsageLogService, UsageLogService>();
|
||||||
|
|
||||||
// ── FluentValidation ──────────────────────────────────────
|
// ── FluentValidation ──────────────────────────────────────
|
||||||
// Registers all validators from the API assembly into DI.
|
// Registers all validators from the API assembly into DI.
|
||||||
builder.Services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
|
builder.Services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
|
||||||
|
|
||||||
// Register the FluentValidation action filter so validators run automatically
|
|
||||||
// on all API controller actions before the action executes.
|
|
||||||
builder.Services.AddScoped<FluentValidationFilter>();
|
|
||||||
|
|
||||||
// ── CORS (kiosk + remote browser) ─────────────────────────
|
// ── CORS (kiosk + remote browser) ─────────────────────────
|
||||||
// AllowAnyOrigin disallows credentials by spec; this is fine for
|
// AllowAnyOrigin disallows credentials by spec; this is fine for
|
||||||
// REST API calls. SignalR WebSockets negotiate without credentials
|
// REST API calls. SignalR WebSockets negotiate without credentials
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
# Editor configuration, see https://editorconfig.org
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
[*.ts]
|
|
||||||
quote_type = single
|
|
||||||
ij_typescript_use_double_quotes = false
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
max_line_length = off
|
|
||||||
trim_trailing_whitespace = false
|
|
||||||
44
frontend/.gitignore
vendored
44
frontend/.gitignore
vendored
@@ -1,44 +0,0 @@
|
|||||||
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
|
|
||||||
|
|
||||||
# Compiled output
|
|
||||||
/dist
|
|
||||||
/tmp
|
|
||||||
/out-tsc
|
|
||||||
/bazel-out
|
|
||||||
|
|
||||||
# Node
|
|
||||||
/node_modules
|
|
||||||
npm-debug.log
|
|
||||||
yarn-error.log
|
|
||||||
|
|
||||||
# IDEs and editors
|
|
||||||
.idea/
|
|
||||||
.project
|
|
||||||
.classpath
|
|
||||||
.c9/
|
|
||||||
*.launch
|
|
||||||
.settings/
|
|
||||||
*.sublime-workspace
|
|
||||||
|
|
||||||
# Visual Studio Code
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
!.vscode/mcp.json
|
|
||||||
.history/*
|
|
||||||
|
|
||||||
# Miscellaneous
|
|
||||||
/.angular/cache
|
|
||||||
.sass-cache/
|
|
||||||
/connect.lock
|
|
||||||
/coverage
|
|
||||||
/libpeerconnection.log
|
|
||||||
testem.log
|
|
||||||
/typings
|
|
||||||
__screenshots__/
|
|
||||||
|
|
||||||
# System files
|
|
||||||
.DS_Store
|
|
||||||
Thumbs.db
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"printWidth": 100,
|
|
||||||
"singleQuote": true,
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": "*.html",
|
|
||||||
"options": {
|
|
||||||
"parser": "angular"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
4
frontend/.vscode/extensions.json
vendored
4
frontend/.vscode/extensions.json
vendored
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
|
|
||||||
"recommendations": ["angular.ng-template"]
|
|
||||||
}
|
|
||||||
20
frontend/.vscode/launch.json
vendored
20
frontend/.vscode/launch.json
vendored
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "ng serve",
|
|
||||||
"type": "chrome",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "npm: start",
|
|
||||||
"url": "http://localhost:4200/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ng test",
|
|
||||||
"type": "chrome",
|
|
||||||
"request": "launch",
|
|
||||||
"preLaunchTask": "npm: test",
|
|
||||||
"url": "http://localhost:9876/debug.html"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
9
frontend/.vscode/mcp.json
vendored
9
frontend/.vscode/mcp.json
vendored
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
// For more information, visit: https://angular.dev/ai/mcp
|
|
||||||
"servers": {
|
|
||||||
"angular-cli": {
|
|
||||||
"command": "npx",
|
|
||||||
"args": ["-y", "@angular/cli", "mcp"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
42
frontend/.vscode/tasks.json
vendored
42
frontend/.vscode/tasks.json
vendored
@@ -1,42 +0,0 @@
|
|||||||
{
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"type": "npm",
|
|
||||||
"script": "start",
|
|
||||||
"isBackground": true,
|
|
||||||
"problemMatcher": {
|
|
||||||
"owner": "typescript",
|
|
||||||
"pattern": "$tsc",
|
|
||||||
"background": {
|
|
||||||
"activeOnStart": true,
|
|
||||||
"beginsPattern": {
|
|
||||||
"regexp": "Changes detected"
|
|
||||||
},
|
|
||||||
"endsPattern": {
|
|
||||||
"regexp": "bundle generation (complete|failed)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "npm",
|
|
||||||
"script": "test",
|
|
||||||
"isBackground": true,
|
|
||||||
"problemMatcher": {
|
|
||||||
"owner": "typescript",
|
|
||||||
"pattern": "$tsc",
|
|
||||||
"background": {
|
|
||||||
"activeOnStart": true,
|
|
||||||
"beginsPattern": {
|
|
||||||
"regexp": "Changes detected"
|
|
||||||
},
|
|
||||||
"endsPattern": {
|
|
||||||
"regexp": "bundle generation (complete|failed)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
# Frontend
|
|
||||||
|
|
||||||
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.2.8.
|
|
||||||
|
|
||||||
## Development server
|
|
||||||
|
|
||||||
To start a local development server, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng serve
|
|
||||||
```
|
|
||||||
|
|
||||||
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
|
|
||||||
|
|
||||||
## Code scaffolding
|
|
||||||
|
|
||||||
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng generate component component-name
|
|
||||||
```
|
|
||||||
|
|
||||||
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng generate --help
|
|
||||||
```
|
|
||||||
|
|
||||||
## Building
|
|
||||||
|
|
||||||
To build the project run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng build
|
|
||||||
```
|
|
||||||
|
|
||||||
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
|
|
||||||
|
|
||||||
## Running unit tests
|
|
||||||
|
|
||||||
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng test
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running end-to-end tests
|
|
||||||
|
|
||||||
For end-to-end (e2e) testing, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ng e2e
|
|
||||||
```
|
|
||||||
|
|
||||||
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
||||||
|
|
||||||
## Additional Resources
|
|
||||||
|
|
||||||
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
||||||
"version": 1,
|
|
||||||
"cli": {
|
|
||||||
"packageManager": "npm"
|
|
||||||
},
|
|
||||||
"newProjectRoot": "projects",
|
|
||||||
"projects": {
|
|
||||||
"frontend": {
|
|
||||||
"projectType": "application",
|
|
||||||
"schematics": {
|
|
||||||
"@schematics/angular:component": {
|
|
||||||
"style": "scss"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "",
|
|
||||||
"sourceRoot": "src",
|
|
||||||
"prefix": "app",
|
|
||||||
"architect": {
|
|
||||||
"build": {
|
|
||||||
"builder": "@angular/build:application",
|
|
||||||
"options": {
|
|
||||||
"browser": "src/main.ts",
|
|
||||||
"tsConfig": "tsconfig.app.json",
|
|
||||||
"inlineStyleLanguage": "scss",
|
|
||||||
"assets": [
|
|
||||||
{
|
|
||||||
"glob": "**/*",
|
|
||||||
"input": "public"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"styles": [
|
|
||||||
"src/styles.scss"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"configurations": {
|
|
||||||
"production": {
|
|
||||||
"budgets": [
|
|
||||||
{
|
|
||||||
"type": "initial",
|
|
||||||
"maximumWarning": "500kB",
|
|
||||||
"maximumError": "1MB"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "anyComponentStyle",
|
|
||||||
"maximumWarning": "4kB",
|
|
||||||
"maximumError": "8kB"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outputHashing": "all"
|
|
||||||
},
|
|
||||||
"development": {
|
|
||||||
"optimization": false,
|
|
||||||
"extractLicenses": false,
|
|
||||||
"sourceMap": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultConfiguration": "production"
|
|
||||||
},
|
|
||||||
"serve": {
|
|
||||||
"builder": "@angular/build:dev-server",
|
|
||||||
"configurations": {
|
|
||||||
"production": {
|
|
||||||
"buildTarget": "frontend:build:production"
|
|
||||||
},
|
|
||||||
"development": {
|
|
||||||
"buildTarget": "frontend:build:development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultConfiguration": "development"
|
|
||||||
},
|
|
||||||
"test": {
|
|
||||||
"builder": "@angular/build:unit-test"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
8873
frontend/package-lock.json
generated
8873
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "frontend",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"scripts": {
|
|
||||||
"ng": "ng",
|
|
||||||
"start": "ng serve",
|
|
||||||
"build": "ng build",
|
|
||||||
"watch": "ng build --watch --configuration development",
|
|
||||||
"test": "ng test"
|
|
||||||
},
|
|
||||||
"private": true,
|
|
||||||
"packageManager": "npm@11.11.0",
|
|
||||||
"dependencies": {
|
|
||||||
"@angular/cdk": "^21.2.8",
|
|
||||||
"@angular/common": "^21.2.0",
|
|
||||||
"@angular/compiler": "^21.2.0",
|
|
||||||
"@angular/core": "^21.2.0",
|
|
||||||
"@angular/forms": "^21.2.0",
|
|
||||||
"@angular/material": "^21.2.8",
|
|
||||||
"@angular/platform-browser": "^21.2.0",
|
|
||||||
"@angular/router": "^21.2.0",
|
|
||||||
"rxjs": "~7.8.0",
|
|
||||||
"tslib": "^2.3.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@angular/build": "^21.2.8",
|
|
||||||
"@angular/cli": "^21.2.8",
|
|
||||||
"@angular/compiler-cli": "^21.2.0",
|
|
||||||
"@vitest/browser-playwright": "^4.1.5",
|
|
||||||
"jsdom": "^28.0.0",
|
|
||||||
"prettier": "^3.8.1",
|
|
||||||
"typescript": "~5.9.2",
|
|
||||||
"vitest": "^4.0.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
@@ -1,11 +0,0 @@
|
|||||||
import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
|
|
||||||
import { provideRouter } from '@angular/router';
|
|
||||||
|
|
||||||
import { routes } from './app.routes';
|
|
||||||
|
|
||||||
export const appConfig: ApplicationConfig = {
|
|
||||||
providers: [
|
|
||||||
provideBrowserGlobalErrorListeners(),
|
|
||||||
provideRouter(routes)
|
|
||||||
]
|
|
||||||
};
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<!-- Extrudex — Homepage (Main Hub) -->
|
|
||||||
<main class="main-content">
|
|
||||||
<h1 class="sr-only">Extrudex Dashboard</h1>
|
|
||||||
|
|
||||||
<!-- Status Summary Bar — fleet-wide health at a glance -->
|
|
||||||
<app-dashboard-summary></app-dashboard-summary>
|
|
||||||
|
|
||||||
<!-- Filament Inventory — routed view -->
|
|
||||||
<router-outlet />
|
|
||||||
</main>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { Routes } from '@angular/router';
|
|
||||||
import { FilamentTableComponent } from './components/filament-table/filament-table.component';
|
|
||||||
|
|
||||||
export const routes: Routes = [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
component: FilamentTableComponent,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
:host {
|
|
||||||
display: block;
|
|
||||||
min-height: 100vh;
|
|
||||||
background: #1a1a2e;
|
|
||||||
color: #e0e0e0;
|
|
||||||
font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-content {
|
|
||||||
padding: 16px;
|
|
||||||
|
|
||||||
@media (min-width: 800px) {
|
|
||||||
padding: 24px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px;
|
|
||||||
height: 1px;
|
|
||||||
padding: 0;
|
|
||||||
margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap;
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
|
||||||
import { App } from './app';
|
|
||||||
|
|
||||||
describe('App', () => {
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
imports: [App],
|
|
||||||
}).compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create the app', () => {
|
|
||||||
const fixture = TestBed.createComponent(App);
|
|
||||||
const app = fixture.componentInstance;
|
|
||||||
expect(app).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render title', async () => {
|
|
||||||
const fixture = TestBed.createComponent(App);
|
|
||||||
await fixture.whenStable();
|
|
||||||
const compiled = fixture.nativeElement as HTMLElement;
|
|
||||||
expect(compiled.querySelector('h1')?.textContent).toContain('Extrudex Dashboard');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import { Component, ViewChild } from '@angular/core';
|
|
||||||
import { RouterOutlet } from '@angular/router';
|
|
||||||
import { DashboardSummaryComponent } from './components/dashboard-summary/dashboard-summary.component';
|
|
||||||
import { AgentSummary, SystemHealth } from './models/agent.model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-root',
|
|
||||||
imports: [RouterOutlet, DashboardSummaryComponent],
|
|
||||||
templateUrl: './app.html',
|
|
||||||
styleUrl: './app.scss'
|
|
||||||
})
|
|
||||||
export class App {
|
|
||||||
@ViewChild(DashboardSummaryComponent) summaryComponent!: DashboardSummaryComponent;
|
|
||||||
|
|
||||||
/** Sample data for development — will be replaced by real service data */
|
|
||||||
readonly sampleSummary: AgentSummary = {
|
|
||||||
total: 7,
|
|
||||||
active: 4,
|
|
||||||
idle: 1,
|
|
||||||
thinking: 1,
|
|
||||||
error: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
readonly sampleHealth: SystemHealth = {
|
|
||||||
connected: true,
|
|
||||||
status: 'healthy',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
<!-- Dashboard Summary Bar — Fleet-wide health at a glance -->
|
|
||||||
<section class="dashboard-summary" role="status" aria-label="Dashboard summary">
|
|
||||||
|
|
||||||
<!-- System Health Indicator -->
|
|
||||||
<div class="summary-item health-indicator"
|
|
||||||
[class.healthy]="health().status === 'healthy'"
|
|
||||||
[class.degraded]="isDegraded()"
|
|
||||||
[class.down]="isDown()"
|
|
||||||
[matTooltip]="statusLabel()"
|
|
||||||
matTooltipPosition="below">
|
|
||||||
<span class="connection-dot" [class.connected]="health().connected"></span>
|
|
||||||
<span class="health-label">{{ statusLabel() }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Total Active Agents -->
|
|
||||||
<div class="summary-item" matTooltip="Total active agents" matTooltipPosition="below">
|
|
||||||
<mat-icon aria-hidden="true">smart_toy</mat-icon>
|
|
||||||
<span class="metric-value">{{ summary().active }} / {{ summary().total }}</span>
|
|
||||||
<span class="metric-label">Active</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Status Breakdown -->
|
|
||||||
<div class="summary-item status-breakdown">
|
|
||||||
<mat-chip-set aria-label="Agent status breakdown">
|
|
||||||
<mat-chip
|
|
||||||
class="status-chip chip-active"
|
|
||||||
[class.has-count]="summary().active > 0"
|
|
||||||
matTooltip="Active agents">
|
|
||||||
<mat-icon matChipStart>check_circle</mat-icon>
|
|
||||||
<span class="chip-count">{{ summary().active }}</span>
|
|
||||||
<span class="chip-label">Active</span>
|
|
||||||
</mat-chip>
|
|
||||||
|
|
||||||
<mat-chip
|
|
||||||
class="status-chip chip-idle"
|
|
||||||
[class.has-count]="summary().idle > 0"
|
|
||||||
matTooltip="Idle agents">
|
|
||||||
<mat-icon matChipStart>pause_circle</mat-icon>
|
|
||||||
<span class="chip-count">{{ summary().idle }}</span>
|
|
||||||
<span class="chip-label">Idle</span>
|
|
||||||
</mat-chip>
|
|
||||||
|
|
||||||
<mat-chip
|
|
||||||
class="status-chip chip-thinking"
|
|
||||||
[class.has-count]="summary().thinking > 0"
|
|
||||||
matTooltip="Thinking agents">
|
|
||||||
<mat-icon matChipStart>psychology</mat-icon>
|
|
||||||
<span class="chip-count">{{ summary().thinking }}</span>
|
|
||||||
<span class="chip-label">Thinking</span>
|
|
||||||
</mat-chip>
|
|
||||||
|
|
||||||
<mat-chip
|
|
||||||
class="status-chip chip-error"
|
|
||||||
[class.has-count]="hasErrors()"
|
|
||||||
matTooltip="Agents in error">
|
|
||||||
<mat-icon matChipStart>error</mat-icon>
|
|
||||||
<span class="chip-count">{{ summary().error }}</span>
|
|
||||||
<span class="chip-label">Error</span>
|
|
||||||
</mat-chip>
|
|
||||||
</mat-chip-set>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
/**
|
|
||||||
* Dashboard Summary Component Styles
|
|
||||||
* Touch-optimized for kiosk (Raspberry Pi 5) and mobile PWA
|
|
||||||
* Uses Angular Material utility classes where possible
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Touch-optimized sizing
|
|
||||||
$touch-target-min: 48px;
|
|
||||||
$kiosk-font-primary: 20px;
|
|
||||||
$mobile-font-primary: 16px;
|
|
||||||
$spacing-unit: 8px;
|
|
||||||
|
|
||||||
// Status colors — high contrast for workshop/bright environments
|
|
||||||
$color-active: #4ade70; // Green — printing/active
|
|
||||||
$color-idle: #94a3b8; // Gray — idle/offline
|
|
||||||
$color-thinking: #60a5fa; // Blue — thinking/processing
|
|
||||||
$color-error: #f87171; // Red — error/failed
|
|
||||||
$color-connected: #4ade70; // Green — SignalR connected
|
|
||||||
$color-disconnected: #f87171; // Red — disconnected
|
|
||||||
|
|
||||||
.dashboard-summary {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: $spacing-unit * 2;
|
|
||||||
padding: $spacing-unit * 2;
|
|
||||||
overflow-x: auto;
|
|
||||||
-webkit-overflow-scrolling: touch;
|
|
||||||
|
|
||||||
// Responsive: on mobile, allow horizontal scroll
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
padding: $spacing-unit;
|
|
||||||
gap: $spacing-unit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: $spacing-unit;
|
|
||||||
min-height: $touch-target-min;
|
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
.metric-value {
|
|
||||||
font-size: $kiosk-font-primary;
|
|
||||||
font-weight: 600;
|
|
||||||
line-height: 1.2;
|
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
font-size: $mobile-font-primary;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.metric-label {
|
|
||||||
font-size: 12px;
|
|
||||||
color: rgba(255, 255, 255, 0.7);
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.05em;
|
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Health indicator
|
|
||||||
.health-indicator {
|
|
||||||
padding: $spacing-unit $spacing-unit * 2;
|
|
||||||
border-radius: 24px;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
|
|
||||||
&.healthy {
|
|
||||||
background-color: rgba($color-active, 0.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.degraded {
|
|
||||||
background-color: rgba($color-thinking, 0.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.down {
|
|
||||||
background-color: rgba($color-error, 0.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
.connection-dot {
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
border-radius: 50%;
|
|
||||||
display: inline-block;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
|
|
||||||
&.connected {
|
|
||||||
background-color: $color-connected;
|
|
||||||
box-shadow: 0 0 6px $color-connected;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:not(.connected) {
|
|
||||||
background-color: $color-disconnected;
|
|
||||||
box-shadow: 0 0 6px $color-disconnected;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.health-label {
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Status breakdown chips
|
|
||||||
.status-breakdown {
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-chip {
|
|
||||||
min-height: $touch-target-min !important;
|
|
||||||
font-size: 14px !important;
|
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
min-height: 40px !important;
|
|
||||||
font-size: 12px !important;
|
|
||||||
padding: 0 8px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chip-count {
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chip-label {
|
|
||||||
font-size: 12px;
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
font-size: 18px !important;
|
|
||||||
width: 18px !important;
|
|
||||||
height: 18px !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Status chip color variants
|
|
||||||
.chip-active {
|
|
||||||
--mdc-chip-outline-color: #{$color-active};
|
|
||||||
|
|
||||||
&.has-count {
|
|
||||||
background-color: rgba($color-active, 0.15) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.chip-idle {
|
|
||||||
--mdc-chip-outline-color: #{$color-idle};
|
|
||||||
|
|
||||||
&.has-count {
|
|
||||||
background-color: rgba($color-idle, 0.15) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.chip-thinking {
|
|
||||||
--mdc-chip-outline-color: #{$color-thinking};
|
|
||||||
|
|
||||||
&.has-count {
|
|
||||||
background-color: rgba($color-thinking, 0.15) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.chip-error {
|
|
||||||
--mdc-chip-outline-color: #{$color-error};
|
|
||||||
|
|
||||||
&.has-count {
|
|
||||||
background-color: rgba($color-error, 0.2) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
import { DashboardSummaryComponent } from './dashboard-summary.component';
|
|
||||||
import { AgentSummary, SystemHealth } from '../../models/agent.model';
|
|
||||||
|
|
||||||
describe('DashboardSummaryComponent', () => {
|
|
||||||
let component: DashboardSummaryComponent;
|
|
||||||
let fixture: ComponentFixture<DashboardSummaryComponent>;
|
|
||||||
|
|
||||||
const mockSummary: AgentSummary = {
|
|
||||||
total: 7,
|
|
||||||
active: 4,
|
|
||||||
idle: 1,
|
|
||||||
thinking: 1,
|
|
||||||
error: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
const mockHealthy: SystemHealth = {
|
|
||||||
connected: true,
|
|
||||||
status: 'healthy',
|
|
||||||
};
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
imports: [DashboardSummaryComponent],
|
|
||||||
}).compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(DashboardSummaryComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should default to zeroed summary', () => {
|
|
||||||
const summary = component.summary();
|
|
||||||
expect(summary.total).toBe(0);
|
|
||||||
expect(summary.active).toBe(0);
|
|
||||||
expect(summary.idle).toBe(0);
|
|
||||||
expect(summary.thinking).toBe(0);
|
|
||||||
expect(summary.error).toBe(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should default to disconnected/down health', () => {
|
|
||||||
const health = component.health();
|
|
||||||
expect(health.connected).toBe(false);
|
|
||||||
expect(health.status).toBe('down');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should update summary data', () => {
|
|
||||||
component.updateSummary(mockSummary);
|
|
||||||
expect(component.summary()).toEqual(mockSummary);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should update health data', () => {
|
|
||||||
component.updateHealth(mockHealthy);
|
|
||||||
expect(component.health()).toEqual(mockHealthy);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should compute hasErrors correctly', () => {
|
|
||||||
expect(component.hasErrors()).toBe(false);
|
|
||||||
component.updateSummary({ ...mockSummary, error: 2 });
|
|
||||||
expect(component.hasErrors()).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should compute connectionColor correctly', () => {
|
|
||||||
expect(component.connectionColor()).toBe('disconnected');
|
|
||||||
component.updateHealth({ connected: true, status: 'healthy' });
|
|
||||||
expect(component.connectionColor()).toBe('connected');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should compute statusLabel for each state', () => {
|
|
||||||
component.updateHealth({ connected: true, status: 'healthy' });
|
|
||||||
expect(component.statusLabel()).toBe('All Systems Go');
|
|
||||||
|
|
||||||
component.updateHealth({ connected: true, status: 'degraded' });
|
|
||||||
expect(component.statusLabel()).toBe('Degraded');
|
|
||||||
|
|
||||||
component.updateHealth({ connected: false, status: 'down' });
|
|
||||||
expect(component.statusLabel()).toBe('Offline');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render summary values in template', () => {
|
|
||||||
component.updateSummary(mockSummary);
|
|
||||||
component.updateHealth(mockHealthy);
|
|
||||||
fixture.detectChanges();
|
|
||||||
|
|
||||||
const compiled = fixture.nativeElement as HTMLElement;
|
|
||||||
expect(compiled.textContent).toContain('4 / 7');
|
|
||||||
expect(compiled.textContent).toContain('Active');
|
|
||||||
expect(compiled.textContent).toContain('All Systems Go');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render status breakdown chips', () => {
|
|
||||||
component.updateSummary(mockSummary);
|
|
||||||
fixture.detectChanges();
|
|
||||||
|
|
||||||
const compiled = fixture.nativeElement as HTMLElement;
|
|
||||||
expect(compiled.textContent).toContain('4'); // active count
|
|
||||||
expect(compiled.textContent).toContain('1'); // idle count (multiple)
|
|
||||||
expect(compiled.textContent).toContain('Error');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
import { ChangeDetectionStrategy, Component, Input, OnDestroy, signal, computed } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
|
||||||
import { MatChipsModule } from '@angular/material/chips';
|
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
||||||
import { AgentSummary, SystemHealth } from '../../models/agent.model';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-dashboard-summary',
|
|
||||||
standalone: true,
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
MatButtonModule,
|
|
||||||
MatIconModule,
|
|
||||||
MatChipsModule,
|
|
||||||
MatTooltipModule,
|
|
||||||
],
|
|
||||||
templateUrl: './dashboard-summary.component.html',
|
|
||||||
styleUrls: ['./dashboard-summary.component.scss'],
|
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
})
|
|
||||||
export class DashboardSummaryComponent implements OnDestroy {
|
|
||||||
/** Agent summary data — reactive signal, updatable via updateSummary() */
|
|
||||||
readonly summary = signal<AgentSummary>({
|
|
||||||
total: 0,
|
|
||||||
active: 0,
|
|
||||||
idle: 0,
|
|
||||||
thinking: 0,
|
|
||||||
error: 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** System health data — reactive signal, updatable via updateHealth() */
|
|
||||||
readonly health = signal<SystemHealth>({
|
|
||||||
connected: false,
|
|
||||||
status: 'down',
|
|
||||||
});
|
|
||||||
|
|
||||||
/** Computed signal: whether there are errors to highlight */
|
|
||||||
readonly hasErrors = computed(() => this.summary().error > 0);
|
|
||||||
|
|
||||||
/** Computed signal: whether system is degraded */
|
|
||||||
readonly isDegraded = computed(() => this.health().status === 'degraded');
|
|
||||||
|
|
||||||
/** Computed signal: whether system is down */
|
|
||||||
readonly isDown = computed(() => this.health().status === 'down');
|
|
||||||
|
|
||||||
/** Computed signal: connection indicator color */
|
|
||||||
readonly connectionColor = computed(() =>
|
|
||||||
this.health().connected ? 'connected' : 'disconnected'
|
|
||||||
);
|
|
||||||
|
|
||||||
/** Computed signal: overall status label */
|
|
||||||
readonly statusLabel = computed(() => {
|
|
||||||
const h = this.health();
|
|
||||||
if (h.status === 'healthy') return 'All Systems Go';
|
|
||||||
if (h.status === 'degraded') return 'Degraded';
|
|
||||||
return 'Offline';
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the agent summary. Called by the parent or a service
|
|
||||||
* when new data arrives (e.g., via SignalR).
|
|
||||||
*/
|
|
||||||
updateSummary(data: AgentSummary): void {
|
|
||||||
this.summary.set(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the system health. Called by the parent or a service
|
|
||||||
* when the connection state changes.
|
|
||||||
*/
|
|
||||||
updateHealth(data: SystemHealth): void {
|
|
||||||
this.health.set(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
|
||||||
// Cleanup handled by signals — no manual subscription teardown needed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
<!-- Filament Inventory Table — with low stock indicators -->
|
|
||||||
<div class="filament-table-container" role="region" aria-label="Filament inventory">
|
|
||||||
|
|
||||||
<!-- Low Stock Alert Banner — shown when critical or low stock spools exist -->
|
|
||||||
@if (criticalCount() > 0) {
|
|
||||||
<div class="alert-banner critical" role="alert">
|
|
||||||
<mat-icon aria-hidden="true">error</mat-icon>
|
|
||||||
<span>{{ criticalCount() }} spool{{ criticalCount() > 1 ? 's' : '' }} critically low (≤10% remaining)</span>
|
|
||||||
</div>
|
|
||||||
} @else if (lowStockCount() > 0) {
|
|
||||||
<div class="alert-banner low" role="alert">
|
|
||||||
<mat-icon aria-hidden="true">warning</mat-icon>
|
|
||||||
<span>{{ lowStockCount() }} spool{{ lowStockCount() > 1 ? 's' : '' }} running low (≤25% remaining)</span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<!-- Filament Table -->
|
|
||||||
<table mat-table
|
|
||||||
[dataSource]="sortedFilaments()"
|
|
||||||
matSort
|
|
||||||
(matSortChange)="sortData($event)"
|
|
||||||
class="filament-table"
|
|
||||||
aria-label="Filament inventory table">
|
|
||||||
|
|
||||||
<!-- Color Column -->
|
|
||||||
<ng-container matColumnDef="color">
|
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="color">Color</th>
|
|
||||||
<td mat-cell *matCellDef="let filament">
|
|
||||||
<span class="color-swatch"
|
|
||||||
[style.background-color]="filament.colorHex"
|
|
||||||
[matTooltip]="filament.colorName"
|
|
||||||
matTooltipPosition="after"
|
|
||||||
[attr.aria-label]="filament.colorName">
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Material Column -->
|
|
||||||
<ng-container matColumnDef="material">
|
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="material">Material</th>
|
|
||||||
<td mat-cell *matCellDef="let filament">
|
|
||||||
<span class="material-name">{{ filament.materialBaseName }}</span>
|
|
||||||
@if (filament.materialModifierName) {
|
|
||||||
<span class="material-modifier"> {{ filament.materialModifierName }}</span>
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Brand Column -->
|
|
||||||
<ng-container matColumnDef="brand">
|
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="brand">Brand</th>
|
|
||||||
<td mat-cell *matCellDef="let filament">{{ filament.brand }}</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Serial Column -->
|
|
||||||
<ng-container matColumnDef="serial">
|
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="serial">Serial</th>
|
|
||||||
<td mat-cell *matCellDef="let filament" class="serial-cell">{{ filament.spoolSerial }}</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Remaining Weight Column -->
|
|
||||||
<ng-container matColumnDef="remaining">
|
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="remaining">Remaining</th>
|
|
||||||
<td mat-cell *matCellDef="let filament">
|
|
||||||
<div class="remaining-cell">
|
|
||||||
<span class="remaining-text">
|
|
||||||
{{ formatWeight(filament.weightRemainingGrams) }} / {{ formatWeight(filament.weightTotalGrams) }}
|
|
||||||
</span>
|
|
||||||
<mat-progress-bar
|
|
||||||
mode="determinate"
|
|
||||||
[value]="getRemainingPercent(filament)"
|
|
||||||
[ngClass]="classifyStockLevel(filament)"
|
|
||||||
[matTooltip]="getRemainingPercent(filament).toFixed(0) + '% remaining'"
|
|
||||||
matTooltipPosition="below">
|
|
||||||
</mat-progress-bar>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Stock Level Indicator Column -->
|
|
||||||
<ng-container matColumnDef="stockLevel">
|
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="stockLevel">Stock</th>
|
|
||||||
<td mat-cell *matCellDef="let filament">
|
|
||||||
@let level = classifyStockLevel(filament);
|
|
||||||
<mat-chip-set aria-label="Stock level">
|
|
||||||
<mat-chip
|
|
||||||
[ngClass]="level"
|
|
||||||
[matTooltip]="stockLevelLabel(level) + ' — ' + getRemainingPercent(filament).toFixed(0) + '% remaining'"
|
|
||||||
matTooltipPosition="below">
|
|
||||||
<mat-icon matChipStart [ngClass]="level">{{ stockLevelIcon(level) }}</mat-icon>
|
|
||||||
<span>{{ stockLevelLabel(level) }}</span>
|
|
||||||
</mat-chip>
|
|
||||||
</mat-chip-set>
|
|
||||||
</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<!-- Status Column -->
|
|
||||||
<ng-container matColumnDef="status">
|
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header="status">Status</th>
|
|
||||||
<td mat-cell *matCellDef="let filament">
|
|
||||||
<span class="status-badge"
|
|
||||||
[class.active]="filament.isActive"
|
|
||||||
[class.inactive]="!filament.isActive">
|
|
||||||
{{ filament.isActive ? 'Active' : 'Inactive' }}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<tr mat-header-row *matHeaderRowDef="columns()"></tr>
|
|
||||||
<tr mat-row *matRowDef="let row; columns: columns();"
|
|
||||||
[class.row-critical]="classifyStockLevel(row) === 'critical'"
|
|
||||||
[class.row-low]="classifyStockLevel(row) === 'low'">
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<!-- Empty state -->
|
|
||||||
@if (filaments().length === 0) {
|
|
||||||
<div class="empty-state" role="status">
|
|
||||||
<mat-icon aria-hidden="true">inventory_2</mat-icon>
|
|
||||||
<p>No filament spools found</p>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
@@ -1,259 +0,0 @@
|
|||||||
/**
|
|
||||||
* Filament Table Component Styles
|
|
||||||
* Touch-optimized for kiosk (Raspberry Pi 5) and mobile PWA
|
|
||||||
* Low stock indicators use high-contrast colors for workshop visibility
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Touch-optimized sizing
|
|
||||||
$touch-target-min: 48px;
|
|
||||||
$spacing-unit: 8px;
|
|
||||||
|
|
||||||
// Stock level colors — high contrast, accessible
|
|
||||||
$color-critical: #ef4444; // Red — critically low
|
|
||||||
$color-low: #f59e0b; // Amber — running low
|
|
||||||
$color-moderate: #3b82f6; // Blue — moderate
|
|
||||||
$color-healthy: #22c55e; // Green — healthy/OK
|
|
||||||
$color-active: #22c55e; // Green — active spool
|
|
||||||
$color-inactive: #94a3b8; // Gray — inactive spool
|
|
||||||
|
|
||||||
.filament-table-container {
|
|
||||||
width: 100%;
|
|
||||||
overflow-x: auto;
|
|
||||||
-webkit-overflow-scrolling: touch;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alert banner for low stock warnings
|
|
||||||
.alert-banner {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: $spacing-unit;
|
|
||||||
padding: $spacing-unit * 1.5 $spacing-unit * 2;
|
|
||||||
border-radius: 8px;
|
|
||||||
margin-bottom: $spacing-unit * 2;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
font-size: 20px !important;
|
|
||||||
width: 20px !important;
|
|
||||||
height: 20px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.critical {
|
|
||||||
background-color: rgba($color-critical, 0.12);
|
|
||||||
color: $color-critical;
|
|
||||||
border: 1px solid rgba($color-critical, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.low {
|
|
||||||
background-color: rgba($color-low, 0.12);
|
|
||||||
color: $color-low;
|
|
||||||
border: 1px solid rgba($color-low, 0.3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Table styling
|
|
||||||
.filament-table {
|
|
||||||
width: 100%;
|
|
||||||
min-width: 700px;
|
|
||||||
|
|
||||||
th {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 13px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.04em;
|
|
||||||
color: var(--mat-sys-on-surface-variant);
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 12px 16px !important;
|
|
||||||
min-height: $touch-target-min;
|
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
padding: 8px 12px !important;
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Row highlight for low stock
|
|
||||||
.mat-mdc-row {
|
|
||||||
transition: background-color 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.row-critical {
|
|
||||||
background-color: rgba($color-critical, 0.06) !important;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: rgba($color-critical, 0.1) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.row-low {
|
|
||||||
background-color: rgba($color-low, 0.06) !important;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: rgba($color-low, 0.1) !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Color swatch
|
|
||||||
.color-swatch {
|
|
||||||
display: inline-block;
|
|
||||||
width: 28px;
|
|
||||||
height: 28px;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 2px solid rgba(0, 0, 0, 0.12);
|
|
||||||
vertical-align: middle;
|
|
||||||
cursor: default;
|
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Material name
|
|
||||||
.material-name {
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.material-modifier {
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--mat-sys-on-surface-variant);
|
|
||||||
margin-left: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Serial cell — monospace
|
|
||||||
.serial-cell {
|
|
||||||
font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
|
|
||||||
font-size: 13px;
|
|
||||||
letter-spacing: 0.02em;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remaining weight cell
|
|
||||||
.remaining-cell {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 4px;
|
|
||||||
min-width: 120px;
|
|
||||||
|
|
||||||
.remaining-text {
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--mat-sys-on-surface-variant);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Progress bar stock level variants
|
|
||||||
mat-progress-bar {
|
|
||||||
&.critical {
|
|
||||||
--mat-progress-bar-active-indicator-color: #{$color-critical};
|
|
||||||
}
|
|
||||||
|
|
||||||
&.low {
|
|
||||||
--mat-progress-bar-active-indicator-color: #{$color-low};
|
|
||||||
}
|
|
||||||
|
|
||||||
&.moderate {
|
|
||||||
--mat-progress-bar-active-indicator-color: #{$color-moderate};
|
|
||||||
}
|
|
||||||
|
|
||||||
&.healthy {
|
|
||||||
--mat-progress-bar-active-indicator-color: #{$color-healthy};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stock level chip variants
|
|
||||||
mat-chip {
|
|
||||||
min-height: 32px !important;
|
|
||||||
font-size: 12px !important;
|
|
||||||
|
|
||||||
&.critical {
|
|
||||||
background-color: rgba($color-critical, 0.15) !important;
|
|
||||||
color: $color-critical;
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
color: $color-critical;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.low {
|
|
||||||
background-color: rgba($color-low, 0.15) !important;
|
|
||||||
color: $color-low;
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
color: $color-low;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.moderate {
|
|
||||||
background-color: rgba($color-moderate, 0.1) !important;
|
|
||||||
color: $color-moderate;
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
color: $color-moderate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.healthy {
|
|
||||||
background-color: rgba($color-healthy, 0.1) !important;
|
|
||||||
color: $color-healthy;
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
color: $color-healthy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
font-size: 16px !important;
|
|
||||||
width: 16px !important;
|
|
||||||
height: 16px !important;
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Status badge
|
|
||||||
.status-badge {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 4px 12px;
|
|
||||||
border-radius: 12px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 600;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.04em;
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background-color: rgba($color-active, 0.12);
|
|
||||||
color: $color-active;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.inactive {
|
|
||||||
background-color: rgba($color-inactive, 0.12);
|
|
||||||
color: $color-inactive;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Empty state
|
|
||||||
.empty-state {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 48px $spacing-unit * 2;
|
|
||||||
color: var(--mat-sys-on-surface-variant);
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
font-size: 48px !important;
|
|
||||||
width: 48px !important;
|
|
||||||
height: 48px !important;
|
|
||||||
opacity: 0.4;
|
|
||||||
margin-bottom: $spacing-unit * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
font-size: 16px;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
|
||||||
import {
|
|
||||||
Filament,
|
|
||||||
StockLevel,
|
|
||||||
getRemainingPercent,
|
|
||||||
classifyStockLevel,
|
|
||||||
} from '../../models/filament.model';
|
|
||||||
|
|
||||||
/** Create a test filament with defaults — override specific fields */
|
|
||||||
function createFilament(overrides: Partial<Filament> = {}): Filament {
|
|
||||||
return {
|
|
||||||
id: '00000000-0000-0000-0000-000000000001',
|
|
||||||
materialBaseId: '10000000-0000-0000-0000-000000000001',
|
|
||||||
materialBaseName: 'PLA',
|
|
||||||
materialFinishId: '20000000-0000-0000-0000-000000000001',
|
|
||||||
materialFinishName: 'Basic',
|
|
||||||
materialModifierId: null,
|
|
||||||
materialModifierName: null,
|
|
||||||
brand: 'Bambu Lab',
|
|
||||||
colorName: 'White',
|
|
||||||
colorHex: '#FFFFFF',
|
|
||||||
weightTotalGrams: 1000,
|
|
||||||
weightRemainingGrams: 750,
|
|
||||||
filamentDiameterMm: 1.75,
|
|
||||||
spoolSerial: 'SN-001',
|
|
||||||
purchasePrice: null,
|
|
||||||
purchaseDate: null,
|
|
||||||
isActive: true,
|
|
||||||
createdAt: '2026-01-01T00:00:00Z',
|
|
||||||
updatedAt: '2026-01-01T00:00:00Z',
|
|
||||||
qrCodeUrl: '',
|
|
||||||
...overrides,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('getRemainingPercent', () => {
|
|
||||||
it('should return correct percentage', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 1000, weightRemainingGrams: 250 });
|
|
||||||
expect(getRemainingPercent(filament)).toBe(25);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return 0 when total weight is 0', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 0, weightRemainingGrams: 0 });
|
|
||||||
expect(getRemainingPercent(filament)).toBe(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should cap at 100%', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 100, weightRemainingGrams: 200 });
|
|
||||||
expect(getRemainingPercent(filament)).toBe(100);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should floor at 0%', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 100, weightRemainingGrams: -10 });
|
|
||||||
expect(getRemainingPercent(filament)).toBe(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('classifyStockLevel', () => {
|
|
||||||
it('should classify as critical when ≤10%', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 1000, weightRemainingGrams: 50 });
|
|
||||||
expect(classifyStockLevel(filament)).toBe('critical');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should classify as critical at exactly 10%', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 1000, weightRemainingGrams: 100 });
|
|
||||||
expect(classifyStockLevel(filament)).toBe('critical');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should classify as low when ≤25%', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 1000, weightRemainingGrams: 200 });
|
|
||||||
expect(classifyStockLevel(filament)).toBe('low');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should classify as moderate when ≤50%', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 1000, weightRemainingGrams: 400 });
|
|
||||||
expect(classifyStockLevel(filament)).toBe('moderate');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should classify as healthy when >50%', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 1000, weightRemainingGrams: 750 });
|
|
||||||
expect(classifyStockLevel(filament)).toBe('healthy');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should classify 0 grams remaining as critical', () => {
|
|
||||||
const filament = createFilament({ weightTotalGrams: 1000, weightRemainingGrams: 0 });
|
|
||||||
expect(classifyStockLevel(filament)).toBe('critical');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,315 +0,0 @@
|
|||||||
import {
|
|
||||||
ChangeDetectionStrategy,
|
|
||||||
Component,
|
|
||||||
Input,
|
|
||||||
computed,
|
|
||||||
signal,
|
|
||||||
} from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { MatTableModule } from '@angular/material/table';
|
|
||||||
import { MatChipsModule } from '@angular/material/chips';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
|
||||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
||||||
import { MatSortModule, Sort } from '@angular/material/sort';
|
|
||||||
import {
|
|
||||||
Filament,
|
|
||||||
StockLevel,
|
|
||||||
getRemainingPercent,
|
|
||||||
classifyStockLevel,
|
|
||||||
} from '../../models/filament.model';
|
|
||||||
|
|
||||||
/** Display column definitions for the filament table */
|
|
||||||
export type FilamentColumn =
|
|
||||||
| 'color'
|
|
||||||
| 'material'
|
|
||||||
| 'brand'
|
|
||||||
| 'serial'
|
|
||||||
| 'remaining'
|
|
||||||
| 'stockLevel'
|
|
||||||
| 'status';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-filament-table',
|
|
||||||
standalone: true,
|
|
||||||
imports: [
|
|
||||||
CommonModule,
|
|
||||||
MatTableModule,
|
|
||||||
MatChipsModule,
|
|
||||||
MatIconModule,
|
|
||||||
MatProgressBarModule,
|
|
||||||
MatTooltipModule,
|
|
||||||
MatSortModule,
|
|
||||||
],
|
|
||||||
templateUrl: './filament-table.component.html',
|
|
||||||
styleUrl: './filament-table.component.scss',
|
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
})
|
|
||||||
export class FilamentTableComponent {
|
|
||||||
/** Filament data input — reactive signal for live updates */
|
|
||||||
readonly filaments = signal<Filament[]>([]);
|
|
||||||
|
|
||||||
/** Columns to display — defaults to all columns */
|
|
||||||
@Input()
|
|
||||||
set displayedColumns(cols: FilamentColumn[]) {
|
|
||||||
this._displayedColumns.set(cols);
|
|
||||||
}
|
|
||||||
get displayedColumns(): FilamentColumn[] {
|
|
||||||
return this._displayedColumns();
|
|
||||||
}
|
|
||||||
private readonly _displayedColumns = signal<FilamentColumn[]>([
|
|
||||||
'color',
|
|
||||||
'material',
|
|
||||||
'brand',
|
|
||||||
'serial',
|
|
||||||
'remaining',
|
|
||||||
'stockLevel',
|
|
||||||
'status',
|
|
||||||
]);
|
|
||||||
|
|
||||||
/** Default columns for template binding */
|
|
||||||
readonly columns = this._displayedColumns;
|
|
||||||
|
|
||||||
/** Sorted filament data */
|
|
||||||
readonly sortedFilaments = signal<Filament[]>([]);
|
|
||||||
|
|
||||||
/** Computed: count of low/critical spools */
|
|
||||||
readonly lowStockCount = computed(() =>
|
|
||||||
this.filaments().filter(
|
|
||||||
(f) => classifyStockLevel(f) === 'low' || classifyStockLevel(f) === 'critical'
|
|
||||||
).length
|
|
||||||
);
|
|
||||||
|
|
||||||
/** Computed: count of critical spools */
|
|
||||||
readonly criticalCount = computed(() =>
|
|
||||||
this.filaments().filter((f) => classifyStockLevel(f) === 'critical').length
|
|
||||||
);
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
// Initialize sorted data from filaments
|
|
||||||
// (MatSort handles sorting via sortChange; we start unsorted)
|
|
||||||
|
|
||||||
// Development: seed with sample data for visual testing
|
|
||||||
// TODO: Replace with service data from FilamentService / SignalR
|
|
||||||
this.updateFilaments([
|
|
||||||
{
|
|
||||||
id: '1',
|
|
||||||
materialBaseId: 'm1',
|
|
||||||
materialBaseName: 'PLA',
|
|
||||||
materialFinishId: 'f1',
|
|
||||||
materialFinishName: 'Basic',
|
|
||||||
materialModifierId: null,
|
|
||||||
materialModifierName: null,
|
|
||||||
brand: 'Bambu Lab',
|
|
||||||
colorName: 'White',
|
|
||||||
colorHex: '#F5F5F5',
|
|
||||||
weightTotalGrams: 1000,
|
|
||||||
weightRemainingGrams: 850,
|
|
||||||
filamentDiameterMm: 1.75,
|
|
||||||
spoolSerial: 'SN-001',
|
|
||||||
purchasePrice: 25.00,
|
|
||||||
purchaseDate: '2026-01-15T00:00:00Z',
|
|
||||||
isActive: true,
|
|
||||||
createdAt: '2026-01-15T00:00:00Z',
|
|
||||||
updatedAt: '2026-04-20T00:00:00Z',
|
|
||||||
qrCodeUrl: '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2',
|
|
||||||
materialBaseId: 'm2',
|
|
||||||
materialBaseName: 'PETG',
|
|
||||||
materialFinishId: 'f2',
|
|
||||||
materialFinishName: 'Matte',
|
|
||||||
materialModifierId: 'mod1',
|
|
||||||
materialModifierName: 'Carbon Fiber',
|
|
||||||
brand: 'Polymaker',
|
|
||||||
colorName: 'Fire Engine Red',
|
|
||||||
colorHex: '#FF0000',
|
|
||||||
weightTotalGrams: 1000,
|
|
||||||
weightRemainingGrams: 80,
|
|
||||||
filamentDiameterMm: 1.75,
|
|
||||||
spoolSerial: 'SN-002',
|
|
||||||
purchasePrice: 35.00,
|
|
||||||
purchaseDate: '2026-02-01T00:00:00Z',
|
|
||||||
isActive: true,
|
|
||||||
createdAt: '2026-02-01T00:00:00Z',
|
|
||||||
updatedAt: '2026-04-25T00:00:00Z',
|
|
||||||
qrCodeUrl: '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3',
|
|
||||||
materialBaseId: 'm1',
|
|
||||||
materialBaseName: 'PLA',
|
|
||||||
materialFinishId: 'f1',
|
|
||||||
materialFinishName: 'Basic',
|
|
||||||
materialModifierId: null,
|
|
||||||
materialModifierName: null,
|
|
||||||
brand: 'eSun',
|
|
||||||
colorName: 'Sky Blue',
|
|
||||||
colorHex: '#87CEEB',
|
|
||||||
weightTotalGrams: 1000,
|
|
||||||
weightRemainingGrams: 200,
|
|
||||||
filamentDiameterMm: 1.75,
|
|
||||||
spoolSerial: 'SN-003',
|
|
||||||
purchasePrice: 20.00,
|
|
||||||
purchaseDate: '2026-03-10T00:00:00Z',
|
|
||||||
isActive: true,
|
|
||||||
createdAt: '2026-03-10T00:00:00Z',
|
|
||||||
updatedAt: '2026-04-26T00:00:00Z',
|
|
||||||
qrCodeUrl: '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '4',
|
|
||||||
materialBaseId: 'm3',
|
|
||||||
materialBaseName: 'ABS',
|
|
||||||
materialFinishId: 'f1',
|
|
||||||
materialFinishName: 'Basic',
|
|
||||||
materialModifierId: null,
|
|
||||||
materialModifierName: null,
|
|
||||||
brand: 'Hatchbox',
|
|
||||||
colorName: 'Black',
|
|
||||||
colorHex: '#1A1A1A',
|
|
||||||
weightTotalGrams: 1000,
|
|
||||||
weightRemainingGrams: 450,
|
|
||||||
filamentDiameterMm: 1.75,
|
|
||||||
spoolSerial: 'SN-004',
|
|
||||||
purchasePrice: 22.00,
|
|
||||||
purchaseDate: null,
|
|
||||||
isActive: true,
|
|
||||||
createdAt: '2026-01-20T00:00:00Z',
|
|
||||||
updatedAt: '2026-04-18T00:00:00Z',
|
|
||||||
qrCodeUrl: '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '5',
|
|
||||||
materialBaseId: 'm1',
|
|
||||||
materialBaseName: 'PLA',
|
|
||||||
materialFinishId: 'f3',
|
|
||||||
materialFinishName: 'Silk',
|
|
||||||
materialModifierId: null,
|
|
||||||
materialModifierName: null,
|
|
||||||
brand: 'Overturn',
|
|
||||||
colorName: 'Gold',
|
|
||||||
colorHex: '#FFD700',
|
|
||||||
weightTotalGrams: 500,
|
|
||||||
weightRemainingGrams: 15,
|
|
||||||
filamentDiameterMm: 1.75,
|
|
||||||
spoolSerial: 'SN-005',
|
|
||||||
purchasePrice: 28.00,
|
|
||||||
purchaseDate: null,
|
|
||||||
isActive: false,
|
|
||||||
createdAt: '2025-12-01T00:00:00Z',
|
|
||||||
updatedAt: '2026-04-01T00:00:00Z',
|
|
||||||
qrCodeUrl: '',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Update filament data — called by parent or service */
|
|
||||||
updateFilaments(data: Filament[]): void {
|
|
||||||
this.filaments.set(data);
|
|
||||||
this.sortedFilaments.set([...data]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Handle sort changes from MatSort */
|
|
||||||
sortData(sort: Sort): void {
|
|
||||||
const data = [...this.filaments()];
|
|
||||||
if (!sort.active || sort.direction === '') {
|
|
||||||
this.sortedFilaments.set(data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const sorted = data.sort((a, b) => {
|
|
||||||
const isAsc = sort.direction === 'asc';
|
|
||||||
switch (sort.active as FilamentColumn) {
|
|
||||||
case 'material':
|
|
||||||
return compare(a.materialBaseName, b.materialBaseName, isAsc);
|
|
||||||
case 'brand':
|
|
||||||
return compare(a.brand, b.brand, isAsc);
|
|
||||||
case 'serial':
|
|
||||||
return compare(a.spoolSerial, b.spoolSerial, isAsc);
|
|
||||||
case 'remaining':
|
|
||||||
return compare(
|
|
||||||
getRemainingPercent(a),
|
|
||||||
getRemainingPercent(b),
|
|
||||||
isAsc
|
|
||||||
);
|
|
||||||
case 'stockLevel':
|
|
||||||
return compare(
|
|
||||||
stockLevelOrder(classifyStockLevel(a)),
|
|
||||||
stockLevelOrder(classifyStockLevel(b)),
|
|
||||||
isAsc
|
|
||||||
);
|
|
||||||
case 'status':
|
|
||||||
return compare(
|
|
||||||
a.isActive ? 0 : 1,
|
|
||||||
b.isActive ? 0 : 1,
|
|
||||||
isAsc
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.sortedFilaments.set(sorted);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Template helper: get remaining percent */
|
|
||||||
getRemainingPercent = getRemainingPercent;
|
|
||||||
|
|
||||||
/** Template helper: classify stock level */
|
|
||||||
classifyStockLevel = classifyStockLevel;
|
|
||||||
|
|
||||||
/** Template helper: stock level icon */
|
|
||||||
stockLevelIcon(level: StockLevel): string {
|
|
||||||
switch (level) {
|
|
||||||
case 'critical':
|
|
||||||
return 'error';
|
|
||||||
case 'low':
|
|
||||||
return 'warning';
|
|
||||||
case 'moderate':
|
|
||||||
return 'info';
|
|
||||||
case 'healthy':
|
|
||||||
return 'check_circle';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Template helper: stock level label */
|
|
||||||
stockLevelLabel(level: StockLevel): string {
|
|
||||||
switch (level) {
|
|
||||||
case 'critical':
|
|
||||||
return 'Critical';
|
|
||||||
case 'low':
|
|
||||||
return 'Low';
|
|
||||||
case 'moderate':
|
|
||||||
return 'Moderate';
|
|
||||||
case 'healthy':
|
|
||||||
return 'Healthy';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Template helper: format remaining weight */
|
|
||||||
formatWeight(grams: number): string {
|
|
||||||
if (grams >= 1000) {
|
|
||||||
return `${(grams / 1000).toFixed(1)}kg`;
|
|
||||||
}
|
|
||||||
return `${Math.round(grams)}g`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Compare helper for sorting */
|
|
||||||
function compare(a: number | string, b: number | string, isAsc: boolean): number {
|
|
||||||
return (a < b ? -1 : a > b ? 1 : 0) * (isAsc ? 1 : -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Stock level sort order (critical=0, healthy=3) */
|
|
||||||
function stockLevelOrder(level: StockLevel): number {
|
|
||||||
switch (level) {
|
|
||||||
case 'critical':
|
|
||||||
return 0;
|
|
||||||
case 'low':
|
|
||||||
return 1;
|
|
||||||
case 'moderate':
|
|
||||||
return 2;
|
|
||||||
case 'healthy':
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* Represents the status of a single agent/printer in the system.
|
|
||||||
*/
|
|
||||||
export type AgentStatus = 'active' | 'idle' | 'thinking' | 'error';
|
|
||||||
|
|
||||||
export interface AgentSummary {
|
|
||||||
/** Total number of agents in the system */
|
|
||||||
total: number;
|
|
||||||
/** Number of currently active agents */
|
|
||||||
active: number;
|
|
||||||
/** Number of currently idle agents */
|
|
||||||
idle: number;
|
|
||||||
/** Number of currently thinking/processing agents */
|
|
||||||
thinking: number;
|
|
||||||
/** Number of agents in error state */
|
|
||||||
error: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SystemHealth {
|
|
||||||
/** Whether the SignalR connection is live */
|
|
||||||
connected: boolean;
|
|
||||||
/** Overall system health: healthy, degraded, or down */
|
|
||||||
status: 'healthy' | 'degraded' | 'down';
|
|
||||||
}
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
/**
|
|
||||||
* Filament model matching the Extrudex backend FilamentResponse DTO.
|
|
||||||
* Used for displaying spool inventory in the filament table UI.
|
|
||||||
*/
|
|
||||||
export interface Filament {
|
|
||||||
/** Unique identifier for the filament spool. */
|
|
||||||
id: string;
|
|
||||||
|
|
||||||
/** Foreign key to the base material. */
|
|
||||||
materialBaseId: string;
|
|
||||||
|
|
||||||
/** Name of the base material (e.g., "PLA", "PETG"). */
|
|
||||||
materialBaseName: string;
|
|
||||||
|
|
||||||
/** Foreign key to the material finish. */
|
|
||||||
materialFinishId: string;
|
|
||||||
|
|
||||||
/** Name of the material finish (e.g., "Basic", "Matte"). */
|
|
||||||
materialFinishName: string;
|
|
||||||
|
|
||||||
/** Foreign key to the optional material modifier. */
|
|
||||||
materialModifierId: string | null;
|
|
||||||
|
|
||||||
/** Name of the material modifier (e.g., "Carbon Fiber"). Null if none. */
|
|
||||||
materialModifierName: string | null;
|
|
||||||
|
|
||||||
/** Brand name (e.g., "Bambu Lab", "Polymaker"). */
|
|
||||||
brand: string;
|
|
||||||
|
|
||||||
/** Human-readable color name (e.g., "Fire Engine Red"). */
|
|
||||||
colorName: string;
|
|
||||||
|
|
||||||
/** Hex color code (e.g., "#FF0000"). */
|
|
||||||
colorHex: string;
|
|
||||||
|
|
||||||
/** Total spool weight in grams when full. */
|
|
||||||
weightTotalGrams: number;
|
|
||||||
|
|
||||||
/** Current remaining weight in grams. */
|
|
||||||
weightRemainingGrams: number;
|
|
||||||
|
|
||||||
/** Filament diameter in millimeters. Typically 1.75mm. */
|
|
||||||
filamentDiameterMm: number;
|
|
||||||
|
|
||||||
/** Manufacturer-assigned serial number. */
|
|
||||||
spoolSerial: string;
|
|
||||||
|
|
||||||
/** Purchase price per spool. Null if not tracked. */
|
|
||||||
purchasePrice: number | null;
|
|
||||||
|
|
||||||
/** Date the spool was purchased or received. */
|
|
||||||
purchaseDate: string | null;
|
|
||||||
|
|
||||||
/** Whether the spool is currently active and available. */
|
|
||||||
isActive: boolean;
|
|
||||||
|
|
||||||
/** Timestamp when this record was created (UTC). */
|
|
||||||
createdAt: string;
|
|
||||||
|
|
||||||
/** Timestamp when this record was last updated (UTC). */
|
|
||||||
updatedAt: string;
|
|
||||||
|
|
||||||
/** URL to the QR code image for this spool. */
|
|
||||||
qrCodeUrl: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stock level classification for low stock indicators.
|
|
||||||
* - critical: ≤ 10% remaining
|
|
||||||
* - low: ≤ 25% remaining
|
|
||||||
* - moderate: ≤ 50% remaining
|
|
||||||
* - healthy: > 50% remaining
|
|
||||||
*/
|
|
||||||
export type StockLevel = 'critical' | 'low' | 'moderate' | 'healthy';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compute the remaining weight percentage for a filament spool.
|
|
||||||
* Returns a value from 0 to 100.
|
|
||||||
*/
|
|
||||||
export function getRemainingPercent(filament: Filament): number {
|
|
||||||
if (filament.weightTotalGrams <= 0) return 0;
|
|
||||||
const pct = (filament.weightRemainingGrams / filament.weightTotalGrams) * 100;
|
|
||||||
return Math.min(Math.max(pct, 0), 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Classify the stock level based on remaining percentage.
|
|
||||||
* Thresholds:
|
|
||||||
* critical — ≤ 10% (nearly empty, red alert)
|
|
||||||
* low — ≤ 25% (getting low, amber warning)
|
|
||||||
* moderate — ≤ 50% (half or less, yellow info)
|
|
||||||
* healthy — > 50% (plenty left, green OK)
|
|
||||||
*/
|
|
||||||
export function classifyStockLevel(filament: Filament): StockLevel {
|
|
||||||
const pct = getRemainingPercent(filament);
|
|
||||||
if (pct <= 10) return 'critical';
|
|
||||||
if (pct <= 25) return 'low';
|
|
||||||
if (pct <= 50) return 'moderate';
|
|
||||||
return 'healthy';
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title>Frontend</title>
|
|
||||||
<base href="/" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
||||||
<link
|
|
||||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
|
|
||||||
rel="stylesheet"
|
|
||||||
/>
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<app-root></app-root>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import { bootstrapApplication } from '@angular/platform-browser';
|
|
||||||
import { appConfig } from './app/app.config';
|
|
||||||
import { App } from './app/app';
|
|
||||||
|
|
||||||
bootstrapApplication(App, appConfig)
|
|
||||||
.catch((err) => console.error(err));
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
// Include theming for Angular Material with `mat.theme()`.
|
|
||||||
// This Sass mixin will define CSS variables that are used for styling Angular Material
|
|
||||||
// components according to the Material 3 design spec.
|
|
||||||
// Learn more about theming and how to use it for your application's
|
|
||||||
// custom components at https://material.angular.dev/guide/theming
|
|
||||||
@use '@angular/material' as mat;
|
|
||||||
|
|
||||||
html {
|
|
||||||
height: 100%;
|
|
||||||
@include mat.theme(
|
|
||||||
(
|
|
||||||
color: (
|
|
||||||
primary: mat.$azure-palette,
|
|
||||||
tertiary: mat.$blue-palette,
|
|
||||||
),
|
|
||||||
typography: Roboto,
|
|
||||||
density: 0,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
// Default the application to a light color theme. This can be changed to
|
|
||||||
// `dark` to enable the dark color theme, or to `light dark` to defer to the
|
|
||||||
// user's system settings.
|
|
||||||
color-scheme: light;
|
|
||||||
|
|
||||||
// Set a default background, font and text colors for the application using
|
|
||||||
// Angular Material's system-level CSS variables. Learn more about these
|
|
||||||
// variables at https://material.angular.dev/guide/system-variables
|
|
||||||
background-color: var(--mat-sys-surface);
|
|
||||||
color: var(--mat-sys-on-surface);
|
|
||||||
font: var(--mat-sys-body-medium);
|
|
||||||
|
|
||||||
// Reset the user agent margin.
|
|
||||||
margin: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
/* You can add global styles to this file, and also import other style files */
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
||||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./out-tsc/app",
|
|
||||||
"types": []
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"src/**/*.spec.ts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
||||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
||||||
{
|
|
||||||
"compileOnSave": false,
|
|
||||||
"compilerOptions": {
|
|
||||||
"strict": true,
|
|
||||||
"noImplicitOverride": true,
|
|
||||||
"noPropertyAccessFromIndexSignature": true,
|
|
||||||
"noImplicitReturns": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"importHelpers": true,
|
|
||||||
"target": "ES2022",
|
|
||||||
"module": "preserve"
|
|
||||||
},
|
|
||||||
"angularCompilerOptions": {
|
|
||||||
"enableI18nLegacyMessageIdFormat": false,
|
|
||||||
"strictInjectionParameters": true,
|
|
||||||
"strictInputAccessModifiers": true,
|
|
||||||
"strictTemplates": true
|
|
||||||
},
|
|
||||||
"files": [],
|
|
||||||
"references": [
|
|
||||||
{
|
|
||||||
"path": "./tsconfig.app.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "./tsconfig.spec.json"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
||||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./out-tsc/spec",
|
|
||||||
"types": [
|
|
||||||
"vitest/globals"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src/**/*.d.ts",
|
|
||||||
"src/**/*.spec.ts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user