Removes track path editing from the music track update flow

Stops Track.UpdateDetails and Artist.UpdateTrackInAlbum from assigning a path, so a track path can be set only when the track is created. Removes Path from UpdateTrackRequest, UpdateTrackCommand, UpdateTrackCommandValidator and UpdateMusicTrackRequest, and removes the path containment check and IPathService dependency from UpdateTrackCommandHandler. The path stays visible in TrackResponse, MusicTrackDto and the read-only field of the track page. Updates the endpoint summary, request and API docs, and the affected tests.
This commit is contained in:
BinaryAlley committed 2026-10-13 20:14:12 +03:00
1 parent 728a879bb8
commit 1aa427b1e2
29 files changed
+47 -243

No files matched your search

@@ -638,11 +638,11 @@ public sealed class Artist : AggregateRoot<ArtistId>
/// <remarks>
/// A track is a child entity of the artist aggregate, not an aggregate root, so it is mutated through its owning artist,
/// which is the consistency boundary. Book is itself an aggregate root, so its update flow reconstitutes it directly
/// with its own Create method instead. This difference is intentional.
/// with its own Create method instead. This difference is intentional. The file system path of the track is never updated
/// here: a track path is set only when the track is created by the scanner.
/// </remarks>
/// <param name="album">The album the track belongs to.</param>
/// <param name="track">The track to update.</param>
/// <param name="path">The file system path of the track.</param>
/// <param name="metadata">The audio metadata of the track.</param>
/// <param name="disambiguation">The optional disambiguation comment of the track.</param>
/// <param name="trackNumber">The number of the track on its disc.</param>
@@ -662,7 +662,6 @@ public sealed class Artist : AggregateRoot<ArtistId>
public Result<Updated> UpdateTrackInAlbum(
Album album,
Track track,
string path,
AudioMetadata metadata,
Optional<string> disambiguation,
int trackNumber,
@@ -686,7 +685,6 @@ public sealed class Artist : AggregateRoot<ArtistId>
return Errors.Music.TrackNotFound;
track.UpdateDetails(
path,
metadata,
disambiguation,
trackNumber,
@@ -343,9 +343,12 @@ public sealed class Track : Entity<TrackId>
}
/// <summary>
/// Updates the details of the track, without touching the moods, the ISRCs, the media contributors, and the ratings.
/// Updates the details of the track, without touching the file system path, the moods, the ISRCs, the media contributors, and the ratings.
/// </summary>
/// <param name="path">The file system path of the track.</param>
/// <remarks>
/// The file system path is intentionally not editable here: it is set only when the track is created by the scanner, so that a client
/// can never point an existing track at an arbitrary file of the host.
/// </remarks>
/// <param name="metadata">The audio metadata of the track.</param>
/// <param name="disambiguation">The optional disambiguation comment of the track.</param>
/// <param name="trackNumber">The number of the track on its disc.</param>
@@ -359,7 +362,6 @@ public sealed class Track : Entity<TrackId>
/// <param name="musicBrainzTrackId">The optional MusicBrainz identifier of the track.</param>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
internal Result<Updated> UpdateDetails(
string path,
AudioMetadata metadata,
Optional<string> disambiguation,
int trackNumber,
@@ -372,7 +374,6 @@ public sealed class Track : Entity<TrackId>
Optional<MusicBrainzId> musicBrainzRecordingId,
Optional<MusicBrainzId> musicBrainzTrackId)
{
Path = path;
Metadata = metadata;
Disambiguation = disambiguation;
TrackNumber = trackNumber;