Skip to content

Commit 9f850ac

Browse files
committed
Bring over changes from local test
1 parent 4c54f6d commit 9f850ac

File tree

71 files changed

+2676
-2972
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2676
-2972
lines changed

src/AStar.Dev.Infrastructure.FilesDb/AStar.Dev.Infrastructure.FilesDb.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
<RepositoryUrl>https://github.com/astar-development/astar-dev-infrastructure-filesdb.git</RepositoryUrl>
3131
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
3232
<Title>AStar Dev Infrastructure FilesDb</Title>
33-
<Version>0.1.0</Version>
33+
<PackageReleaseNotes>Rework the File Classifications area and update for AStar Functional Results.</PackageReleaseNotes>
34+
<Version>0.2.0</Version>
3435
</PropertyGroup>
3536

3637
<ItemGroup>
@@ -40,7 +41,7 @@
4041
</ItemGroup>
4142

4243
<ItemGroup>
43-
<PackageReference Include="AStar.Dev.Infrastructure" Version="0.1.2" />
44+
<PackageReference Include="AStar.Dev.Infrastructure" Version="0.1.2"/>
4445
<PackageReference Include="AStar.Dev.Utilities" Version="1.6.2"/>
4546
<PackageReference Include="AStar.Dev.Functional.Extensions" Version="0.4.5"/>
4647
<PackageReference Include="AStar.Dev.Technical.Debt.Reporting" Version="0.2.1"/>

src/AStar.Dev.Infrastructure.FilesDb/AStar.Dev.Infrastructure.FilesDb.xml

Lines changed: 246 additions & 156 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
2+
3+
namespace AStar.Dev.Infrastructure.FilesDb.Configurations;
4+
5+
/// <summary>
6+
/// </summary>
7+
public static class ComplexPropertyBuilderConfiguration
8+
{
9+
/// <summary>
10+
/// </summary>
11+
/// <param name="propertyBuilder"></param>
12+
/// <param name="configuration"></param>
13+
/// <typeparam name="TEntity"></typeparam>
14+
/// <returns></returns>
15+
public static ComplexPropertyBuilder<TEntity> Configure<TEntity>(this ComplexPropertyBuilder<TEntity> propertyBuilder, IComplexPropertyConfiguration<TEntity> configuration)
16+
{
17+
configuration.Configure(propertyBuilder);
18+
19+
return propertyBuilder;
20+
}
21+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using AStar.Dev.Infrastructure.FilesDb.Models;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
4+
5+
namespace AStar.Dev.Infrastructure.FilesDb.Configurations;
6+
7+
internal sealed class DeletionStatusConfiguration : IEntityTypeConfiguration<DeletionStatus>
8+
{
9+
public void Configure(EntityTypeBuilder<DeletionStatus> builder)
10+
{
11+
_ = builder
12+
.ToTable(nameof(DeletionStatus), Constants.SchemaName)
13+
.HasKey(deletionStatus => deletionStatus.Id);
14+
15+
_ = builder
16+
.Property(deletionStatus => deletionStatus.HardDeletePending)
17+
.HasColumnName("HardDeletePending")
18+
.HasColumnType("datetimeoffset");
19+
20+
_ = builder
21+
.Property(deletionStatus => deletionStatus.SoftDeletePending)
22+
.HasColumnName("SoftDeletePending")
23+
.HasColumnType("datetimeoffset");
24+
25+
_ = builder
26+
.Property(deletionStatus => deletionStatus.SoftDeleted)
27+
.HasColumnName("SoftDeleted")
28+
.HasColumnType("datetimeoffset");
29+
}
30+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using AStar.Dev.Infrastructure.FilesDb.Models;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
4+
5+
namespace AStar.Dev.Infrastructure.FilesDb.Configurations;
6+
7+
internal sealed class DirectoryNameConfiguration : IComplexPropertyConfiguration<DirectoryName>
8+
{
9+
public void Configure(ComplexPropertyBuilder<DirectoryName> builder)
10+
=> builder.Property(directoryName => directoryName.Value)
11+
.HasColumnName("DirectoryName")
12+
.HasColumnType("nvarchar(256)");
13+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using AStar.Dev.Infrastructure.FilesDb.Models;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
4+
5+
namespace AStar.Dev.Infrastructure.FilesDb.Configurations;
6+
7+
/// <summary>
8+
/// </summary>
9+
public class EventConfiguration : IEntityTypeConfiguration<Event>
10+
{
11+
/// <inheritdoc />
12+
public void Configure(EntityTypeBuilder<Event> builder)
13+
{
14+
_ = builder
15+
.ToTable(nameof(Event), Constants.SchemaName)
16+
.HasKey(fileDetail => fileDetail.Id);
17+
18+
_ = builder.Property(fileDetail => fileDetail.FileName).HasMaxLength(256);
19+
_ = builder.Property(fileDetail => fileDetail.DirectoryName).HasMaxLength(256);
20+
_ = builder.Property(fileDetail => fileDetail.Handle).HasMaxLength(256);
21+
_ = builder.Property(fileDetail => fileDetail.UpdatedBy).HasMaxLength(30);
22+
23+
_ = builder.ComplexProperty(fileDetail => fileDetail.Type).Configure(new EventTypeConfiguration());
24+
}
25+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using AStar.Dev.Infrastructure.FilesDb.Models;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
4+
5+
namespace AStar.Dev.Infrastructure.FilesDb.Configurations;
6+
7+
internal sealed class EventTypeConfiguration : IComplexPropertyConfiguration<EventType>
8+
{
9+
public void Configure(ComplexPropertyBuilder<EventType> builder)
10+
{
11+
_ = builder.Property(eventType => eventType.Value).HasColumnName("EventType").IsRequired();
12+
_ = builder.Property(eventType => eventType.Name).HasColumnName("EventName").IsRequired();
13+
}
14+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using AStar.Dev.Infrastructure.FilesDb.Models;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
4+
5+
namespace AStar.Dev.Infrastructure.FilesDb.Configurations;
6+
7+
/// <summary>
8+
/// </summary>
9+
public class FileAccessDetailConfiguration : IEntityTypeConfiguration<FileAccessDetail>
10+
{
11+
/// <inheritdoc />
12+
public void Configure(EntityTypeBuilder<FileAccessDetail> builder)
13+
=> _ = builder
14+
.ToTable(nameof(FileAccessDetail), Constants.SchemaName)
15+
.HasKey(fileAccessDetail => fileAccessDetail.Id);
16+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using AStar.Dev.Infrastructure.FilesDb.Models;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
4+
5+
namespace AStar.Dev.Infrastructure.FilesDb.Configurations;
6+
7+
/// <summary>
8+
/// </summary>
9+
public class FileClassificationConfiguration : IEntityTypeConfiguration<FileClassification>
10+
{
11+
/// <inheritdoc />
12+
public void Configure(EntityTypeBuilder<FileClassification> builder)
13+
{
14+
_ = builder
15+
.ToTable(nameof(FileClassification), Constants.SchemaName)
16+
.HasKey(fileClassification => fileClassification.Id);
17+
18+
_ = builder.HasIndex(fileClassification => fileClassification.Name).IsUnique();
19+
20+
//_ = builder.HasMany<FileNamePart>();
21+
_ = builder.Property(fileClassification => fileClassification.Name).HasMaxLength(150);
22+
}
23+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using AStar.Dev.Infrastructure.FilesDb.Models;
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
4+
5+
namespace AStar.Dev.Infrastructure.FilesDb.Configurations;
6+
7+
/// <summary>
8+
/// </summary>
9+
public class FileDetailConfiguration : IEntityTypeConfiguration<FileDetail>
10+
{
11+
/// <inheritdoc />
12+
public void Configure(EntityTypeBuilder<FileDetail> builder)
13+
{
14+
_ = builder.ToTable("FileDetail");
15+
16+
_ = builder.HasKey(file => file.Id);
17+
18+
_ = builder.Property(file => file.Id)
19+
.HasConversion(fileId => fileId.Value, fileId => new(fileId));
20+
21+
_ = builder.Ignore(fileDetail => fileDetail.FileName);
22+
_ = builder.Ignore(fileDetail => fileDetail.DirectoryName);
23+
_ = builder.Ignore(fileDetail => fileDetail.FullNameWithPath);
24+
25+
_ = builder.Property(file => file.FileHandle)
26+
.HasColumnType("nvarchar(256)")
27+
.HasConversion(fileHandle => fileHandle.Value, fileHandle => new(fileHandle));
28+
29+
_ = builder.ComplexProperty(fileDetail => fileDetail.DirectoryName)
30+
.Configure(new DirectoryNameConfiguration());
31+
32+
_ = builder.ComplexProperty(fileDetail => fileDetail.FileName)
33+
.Configure(new FileNameConfiguration());
34+
35+
_ = builder.HasIndex(fileDetail => fileDetail.FileHandle).IsUnique();
36+
_ = builder.HasIndex(fileDetail => fileDetail.FileSize);
37+
38+
// Composite index to optimize duplicate images search (partial optimization)
39+
// Note: ImageHeight and ImageWidth can't be indexed directly as they're complex properties
40+
_ = builder.HasIndex(fileDetail => new { fileDetail.IsImage, fileDetail.FileSize })
41+
.HasDatabaseName("IX_FileDetail_DuplicateImages");
42+
}
43+
}

0 commit comments

Comments
 (0)