Skip to content

Migrate missing objects from ObjectAvailability enum to dedicated TblObjectMissing table#225

Merged
LeftofZen merged 5 commits intomasterfrom
copilot/create-tblobjectmissing-table
Dec 28, 2025
Merged

Migrate missing objects from ObjectAvailability enum to dedicated TblObjectMissing table#225
LeftofZen merged 5 commits intomasterfrom
copilot/create-tblobjectmissing-table

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

Missing objects were stored as TblObject records with Availability = ObjectAvailability.Missing, mixing database storage concerns with availability states. This moves them to a dedicated TblObjectMissing table.

Changes

New table structure:

  • Created TblObjectMissing with fields from DtoMissingObjectEntry: DatName, DatChecksum, ObjectType
  • Added unique composite index on (DatName, DatChecksum)
  • Registered as DbSet<TblObjectMissing> MissingObjects in LocoDbContext

Route handler updates:

  • ObjectMissingRouteHandler: Now operates directly on MissingObjects table instead of filtering TblObject
  • ObjectRouteHandler: Checks MissingObjects on upload and removes stale entries when actual object is provided

Before:

// Had to create full TblObject with all metadata, DatObjects, etc.
var tblObject = new TblObject() {
    Name = $"{entry.DatName}_{entry.DatChecksum}",
    Availability = ObjectAvailability.Missing,
    // ... 15+ more properties
};
db.Objects.Add(tblObject);
tblObject.DatObjects.Add(new TblDatObject() { /* ... */ });

After:

// Simple, focused on missing object data only
var tblObjectMissing = new TblObjectMissing() {
    DatName = entry.DatName,
    DatChecksum = entry.DatChecksum,
    ObjectType = entry.ObjectType,
};
db.MissingObjects.Add(tblObjectMissing);

Includes EF Core migration and updated tests. The ObjectAvailability.Missing enum value remains for potential future use but is no longer referenced in the codebase.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll sharp/working/emptyFakeDotnetRoot 01CD7828DF338951F5/missingpackages_workingdir (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll get.config (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Missing objects in ObjectService project are currently stored as a value in the ObjectAvailability enum in TblObject and related classes. However these should be in a new and separate table, TblObjectMissing. Create the table design for this based on the DtoMissingObjectEntry, as well as revise ObjectMissingRouteHandler to use the new table


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 28, 2025 12:29
Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
Copilot AI changed the title [WIP] Add TblObjectMissing table design and update handler Migrate missing objects from ObjectAvailability enum to dedicated TblObjectMissing table Dec 28, 2025
Copilot AI requested a review from LeftofZen December 28, 2025 12:40
@LeftofZen LeftofZen marked this pull request as ready for review December 28, 2025 13:46
Copilot AI review requested due to automatic review settings December 28, 2025 13:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR successfully migrates missing objects from being stored as TblObject records with Availability = ObjectAvailability.Missing to a dedicated TblObjectMissing table, simplifying the data model and improving separation of concerns.

Key changes:

  • Created new TblObjectMissing table with fields for DatName, DatChecksum, and ObjectType, with a unique composite index
  • Introduced new DTOs: DtoObjectMissingEntry (with Id) and DtoObjectMissingUpload (without Id), replacing the former DtoMissingObjectEntry
  • Updated ObjectMissingRouteHandler to operate directly on the new ObjectsMissing table
  • Modified ObjectRouteHandler to check for and remove stale missing entries when actual objects are uploaded
  • Added comprehensive integration tests for the missing objects routes

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Definitions/Database/DataTables/TblObjectMissing.cs Defines new table class with composite unique index on DatName and DatChecksum
Definitions/Database/LocoDbContext.cs Registers ObjectsMissing DbSet
Definitions/Migrations/20251228122835_AddTblObjectMissing.cs EF Core migration creating ObjectsMissing table (also includes unrelated schema changes)
Definitions/DTO/DtoObjectMissingEntry.cs New DTO for missing objects with Id field
Definitions/DTO/DtoObjectMissingUpload.cs Renamed from DtoMissingObjectEntry, used for POST requests
Definitions/DTO/Mappers/DtoExtensions.cs Added mapping methods between TblObjectMissing and DTOs
Definitions/DTO/Comparers/*.cs Updated comparers for renamed/new DTO types
ObjectService/RouteHandlers/TableHandlers/ObjectMissingRouteHandler.cs Completely rewritten to use ObjectsMissing table instead of filtering Objects
ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs Checks and removes missing entries when actual object is uploaded
Gui/ObjectServiceClient.cs Updated return type to DtoObjectMissingEntry for AddMissingObjectAsync
Gui/ViewModels/LocoTypes/SCV5ViewModel.cs Updated to use new DTO types and improved logging format
Definitions/Web/Client.cs Updated AddMissingObjectAsync signature to return DtoObjectMissingEntry
Tests/ObjectServiceIntegrationTests/ObjectMissingRoutesTest.cs New comprehensive integration tests for missing objects CRUD operations
Tests/ObjectServiceIntegrationTests/ObjectRoutesTest.cs Removed obsolete AddMissingObjectAsync test
Files not reviewed (1)
  • Definitions/Migrations/20251228122835_AddTblObjectMissing.Designer.cs: Language not supported

@LeftofZen LeftofZen merged commit d73e7f7 into master Dec 28, 2025
6 checks passed
@LeftofZen LeftofZen deleted the copilot/create-tblobjectmissing-table branch December 28, 2025 13:54
@LeftofZen LeftofZen added this to the 5.7.0 milestone Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants