Skip to content

Commit

Permalink
Merge pull request #76 from Macro-Deck-App/remove-include-downloads
Browse files Browse the repository at this point in the history
Remove Include Downloads on Extensions query
  • Loading branch information
manuelmayer-dev authored Feb 17, 2024
2 parents f714b17 + 299b54f commit 090e1e5
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ public class ExtensionEntity : BaseCreatedUpdatedEntity
public string GitHubRepository { get; set; } = string.Empty;
public ulong? DSupportUserId { get; set; }
public ICollection<ExtensionFileEntity>? ExtensionFiles { get; set; }
public ICollection<ExtensionDownloadInfoEntity>? Downloads { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public override void Configure(EntityTypeBuilder<ExtensionDownloadInfoEntity> bu
.IsRequired();

builder.Property(p => p.ExtensionId)
.HasColumnName("e_ref");
.HasColumnName(ColumnPrefix + "e_ref");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,5 @@ public override void Configure(EntityTypeBuilder<ExtensionEntity> builder)
.WithOne(e => e.ExtensionEntity)
.HasForeignKey(e => e.ExtensionId)
.OnDelete(DeleteBehavior.Cascade);

builder.HasMany(p => p.Downloads)
.WithOne(e => e.ExtensionEntity)
.HasForeignKey(e => e.ExtensionId)
.OnDelete(DeleteBehavior.Cascade);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ public override void Configure(EntityTypeBuilder<ExtensionFileEntity> builder)
.IsRequired();

builder.Property(p => p.ExtensionId)
.HasColumnName("e_ref");
.HasColumnName(ColumnPrefix + "e_ref");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public async ValueTask<string[]> GetCategoriesAsync(Filter filter)
{
return await _context.GetNoTrackingSet<ExtensionEntity>()
.Include(x => x.ExtensionFiles)
.Include(x => x.Downloads)
.FirstOrDefaultAsync(x => x.PackageId == packageId);
}

Expand Down
3 changes: 1 addition & 2 deletions src/ExtensionStoreAPI/AutoMapper/ExtensionProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public ExtensionProfile()
{
CreateMap<ExtensionEntity, Extension>();

CreateMap<Extension, ExtensionEntity>()
.ForMember(dest => dest.Downloads, opt => opt.Ignore());
CreateMap<Extension, ExtensionEntity>();

CreateMap(typeof(PagedList<>), typeof(PagedList<>));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
alter table extension_store.downloads
rename column e_ref to d_e_ref;

alter index extension_store.downloads_e_ref_index rename to downloads_d_e_ref_index;

alter table extension_store.files
rename column e_ref to f_e_ref;

alter index extension_store.files_e_ref_index rename to files_f_e_ref_index;

0 comments on commit 090e1e5

Please sign in to comment.