Implement issue reporting and workflows
This commit is contained in:
1 parent
6ad3d5bbaa
commit
b80ec57589
23 files changed
+1407
-17
No files matched your search
@@ -0,0 +1,75 @@
|
||||
using Helpdesk.Domain.Catalogs;
|
||||
using Helpdesk.Domain.Issues;
|
||||
using Helpdesk.Domain.Users;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Helpdesk.Infrastructure.Persistence;
|
||||
|
||||
internal sealed class IssueConfiguration : IEntityTypeConfiguration<Issue>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Issue> b)
|
||||
{
|
||||
b.ToTable("issue");
|
||||
b.Property(x => x.Title).HasMaxLength(200);
|
||||
b.Property(x => x.Description).HasColumnType("text");
|
||||
b.Property(x => x.LocationDetail).HasMaxLength(255);
|
||||
b.Property(x => x.Status).HasConversion<EnumCodeConverter<IssueStatus>>().HasMaxLength(30);
|
||||
b.Property(x => x.Priority).HasConversion<EnumCodeConverter<IssuePriority>>().HasMaxLength(10);
|
||||
b.Property(x => x.RowVersion).IsConcurrencyToken();
|
||||
b.HasOne<IssueCategory>().WithMany().HasForeignKey(x => x.CategoryId);
|
||||
b.HasOne<Building>().WithMany().HasForeignKey(x => x.BuildingId);
|
||||
b.HasOne<User>().WithMany().HasForeignKey(x => x.ReporterId);
|
||||
b.HasOne<User>().WithMany().HasForeignKey(x => x.AssigneeId);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class IssueEventConfiguration : IEntityTypeConfiguration<IssueEvent>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<IssueEvent> b)
|
||||
{
|
||||
b.ToTable("issue_event");
|
||||
b.Property(x => x.EventType).HasConversion<EnumCodeConverter<IssueEventType>>().HasMaxLength(20);
|
||||
b.Property(x => x.FromStatus).HasConversion<EnumCodeConverter<IssueStatus>>().HasMaxLength(30);
|
||||
b.Property(x => x.ToStatus).HasConversion<EnumCodeConverter<IssueStatus>>().HasMaxLength(30);
|
||||
b.Property(x => x.Note).HasColumnType("text");
|
||||
b.HasOne(x => x.Issue).WithMany().HasForeignKey(x => x.IssueId);
|
||||
b.HasOne<User>().WithMany().HasForeignKey(x => x.ActorId);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class AttachmentConfiguration : IEntityTypeConfiguration<Attachment>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Attachment> b)
|
||||
{
|
||||
b.ToTable("attachment");
|
||||
b.Property(x => x.OriginalFileName).HasMaxLength(255);
|
||||
b.Property(x => x.StoredFileName).HasMaxLength(36);
|
||||
b.Property(x => x.ContentType).HasMaxLength(100);
|
||||
b.HasOne(x => x.Issue).WithMany().HasForeignKey(x => x.IssueId);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class IssueNotificationConfiguration : IEntityTypeConfiguration<IssueNotification>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<IssueNotification> b)
|
||||
{
|
||||
b.ToTable("notification");
|
||||
b.Property(x => x.Type).HasConversion<EnumCodeConverter<NotificationType>>().HasMaxLength(40);
|
||||
b.Property(x => x.Title).HasMaxLength(200);
|
||||
b.Property(x => x.Message).HasMaxLength(1000);
|
||||
b.HasOne(x => x.Issue).WithMany().HasForeignKey(x => x.IssueId).IsRequired(false);
|
||||
b.HasOne<User>().WithMany().HasForeignKey(x => x.UserId);
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class NotificationDeliveryConfiguration : IEntityTypeConfiguration<NotificationDelivery>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<NotificationDelivery> b)
|
||||
{
|
||||
b.ToTable("notification_delivery");
|
||||
b.Property(x => x.Channel).HasConversion<EnumCodeConverter<DeliveryChannel>>().HasMaxLength(10);
|
||||
b.Property(x => x.Status).HasConversion<EnumCodeConverter<DeliveryStatus>>().HasMaxLength(10);
|
||||
b.HasOne(x => x.Notification).WithMany().HasForeignKey(x => x.NotificationId);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user