CUB-32: Add usage logging service with EF Core entity, service, controller, and migration
This commit is contained in:
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; }
|
||||
}
|
||||
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);
|
||||
}
|
||||
@@ -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,6 +23,7 @@ public class ExtrudexDbContext : DbContext
|
||||
public DbSet<AmsUnit> AmsUnits => Set<AmsUnit>();
|
||||
public DbSet<AmsSlot> AmsSlots => Set<AmsSlot>();
|
||||
public DbSet<PrintJob> PrintJobs => Set<PrintJob>();
|
||||
public DbSet<UsageLog> UsageLogs => Set<UsageLog>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
1061
backend/Infrastructure/Data/Migrations/20260426184329_AddUsageLogTable.Designer.cs
generated
Normal file
1061
backend/Infrastructure/Data/Migrations/20260426184329_AddUsageLogTable.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,534 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Extrudex.Infrastructure.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddUsageLogTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "usage_logs",
|
||||
columns: table => new
|
||||
{
|
||||
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: 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),
|
||||
mm_extruded = table.Column<decimal>(type: "numeric(12,2)", precision: 12, scale: 2, nullable: true),
|
||||
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),
|
||||
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'")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_usage_logs", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_usage_logs_print_job",
|
||||
column: x => x.print_job_id,
|
||||
principalTable: "print_jobs",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "fk_usage_logs_printer",
|
||||
column: x => x.printer_id,
|
||||
principalTable: "printers",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "fk_usage_logs_spool",
|
||||
column: x => x.spool_id,
|
||||
principalTable: "spools",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000001"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000002"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000003"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000004"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000005"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000006"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000007"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000008"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000009"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000010"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000011"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000012"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000013"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000014"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000015"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000001"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000002"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000003"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000004"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000005"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000006"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000007"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000008"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000009"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000010"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000011"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
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(
|
||||
name: "ix_usage_logs_data_source",
|
||||
table: "usage_logs",
|
||||
column: "data_source");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_usage_logs_print_job_id",
|
||||
table: "usage_logs",
|
||||
column: "print_job_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_usage_logs_printer_id",
|
||||
table: "usage_logs",
|
||||
column: "printer_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_usage_logs_spool_id",
|
||||
table: "usage_logs",
|
||||
column: "spool_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_usage_logs_usage_timestamp",
|
||||
table: "usage_logs",
|
||||
column: "usage_timestamp");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "usage_logs");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1096), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1096) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1620), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1620) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1630), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1630) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1638), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1638) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1645), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1645) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_bases",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1651), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1652) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000001"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1850), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1850) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000002"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2041), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2041) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000003"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2049), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2049) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000004"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2055), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2056) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000005"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2062), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2062) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000006"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2068), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2068) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000007"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2075), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2075) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000008"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2081), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2081) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000009"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2100), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2100) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000010"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2107), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2107) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000011"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2113), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2113) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000012"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2120), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2120) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000013"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2126), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2126) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000014"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2132), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2133) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_finishes",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("20000000-0000-0000-0000-000000000015"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2139), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2139) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000001"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2304), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2304) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000002"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2463), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2463) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000003"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2471), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2471) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000004"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2477), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2478) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000005"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2484), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2484) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000006"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2490), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2491) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000007"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2497), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2497) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000008"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2503), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2503) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000009"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2510), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2510) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000010"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2516), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2516) });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "material_modifiers",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("30000000-0000-0000-0000-000000000011"),
|
||||
columns: new[] { "created_at", "updated_at" },
|
||||
values: new object[] { new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2522), new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2523) });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,50 +145,50 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1096),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(6535),
|
||||
DensityGperCm3 = 1.24m,
|
||||
Name = "PLA",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1096)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(6535)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1620),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7016),
|
||||
DensityGperCm3 = 1.27m,
|
||||
Name = "PETG",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1620)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7016)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1630),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7027),
|
||||
DensityGperCm3 = 1.04m,
|
||||
Name = "ABS",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1630)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7028)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1638),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7034),
|
||||
DensityGperCm3 = 1.07m,
|
||||
Name = "ASA",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1638)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7035)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1645),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7042),
|
||||
DensityGperCm3 = 1.21m,
|
||||
Name = "TPU",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1645)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7042)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1651),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7049),
|
||||
DensityGperCm3 = 1.14m,
|
||||
Name = "Nylon",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1652)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7049)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -232,122 +232,122 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000001"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1850),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7291),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Basic",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(1850)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7292)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000002"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2041),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7453),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Matte",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2041)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7453)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000003"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2049),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7461),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Silk",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2049)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7461)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000004"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2055),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7468),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Glitter",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2056)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7468)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000005"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2062),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7474),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Marble",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2062)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7474)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000006"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2068),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7480),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Sparkle",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2068)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7481)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000007"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2075),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7487),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
Name = "Basic",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2075)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7487)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000008"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2081),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7493),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
Name = "Matte",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2081)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7493)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000009"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2100),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7500),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
Name = "Silk",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2100)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7500)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000010"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2107),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7507),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
Name = "Basic",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2107)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7507)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000011"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2113),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7513),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
Name = "Matte",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2113)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7513)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000012"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2120),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7519),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
Name = "Basic",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2120)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7520)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000013"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2126),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7526),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
Name = "Matte",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2126)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7526)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000014"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2132),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7532),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
Name = "Basic",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2133)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7532)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000015"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2139),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7538),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
Name = "Basic",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2139)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7539)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -391,90 +391,90 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000001"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2304),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7690),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Carbon Fiber",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2304)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7690)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000002"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2463),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7838),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Glass Fiber",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2463)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7838)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000003"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2471),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7846),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Wood Fill",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2471)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7846)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000004"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2477),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7853),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Name = "Glow-in-the-Dark",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2478)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7853)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000005"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2484),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7859),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
Name = "Carbon Fiber",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2484)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7859)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000006"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2490),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7865),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
Name = "Glass Fiber",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2491)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7866)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000007"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2497),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7872),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
Name = "Carbon Fiber",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2497)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7872)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000008"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2503),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7878),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
Name = "Glass Fiber",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2503)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7879)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000009"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2510),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7885),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
Name = "Carbon Fiber",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2510)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7885)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000010"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2516),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7891),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
Name = "Carbon Fiber",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2516)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7891)
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("30000000-0000-0000-0000-000000000011"),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2522),
|
||||
CreatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7898),
|
||||
MaterialBaseId = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
Name = "Glass Fiber",
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 13, 14, 18, 745, DateTimeKind.Utc).AddTicks(2523)
|
||||
UpdatedAt = new DateTime(2026, 4, 26, 18, 43, 28, 895, DateTimeKind.Utc).AddTicks(7898)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -806,6 +806,81 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
||||
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 =>
|
||||
{
|
||||
b.HasOne("Extrudex.Domain.Entities.AmsUnit", "AmsUnit")
|
||||
@@ -912,6 +987,34 @@ namespace Extrudex.Infrastructure.Data.Migrations
|
||||
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 =>
|
||||
{
|
||||
b.Navigation("Slots");
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,9 @@ builder.Services.AddSwaggerGen(c =>
|
||||
// ── QR Code Generation ──────────────────────────────────────
|
||||
builder.Services.AddSingleton<IQrCodeService, QrCodeService>();
|
||||
|
||||
// ── Usage Logging ───────────────────────────────────────────
|
||||
builder.Services.AddScoped<IUsageLogService, UsageLogService>();
|
||||
|
||||
// ── FluentValidation ──────────────────────────────────────
|
||||
// Registers all validators from the API assembly into DI.
|
||||
builder.Services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
|
||||
|
||||
Reference in New Issue
Block a user