Skip to content

Commit

Permalink
Init db tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathanio123 committed Oct 17, 2024
1 parent ad97ad8 commit 74772ba
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Fusion.Summary.Api/Database/Models/DbProject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore;

namespace Fusion.Summary.Api.Database.Models;

public class DbProject
{
public required Guid Id { get; set; }

public required string Name { get; set; }
public required Guid OrgProjectExternalId { get; set; }


internal static void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<DbProject>(project =>
{
project.ToTable("Projects");
project.HasKey(p => p.Id);
project.HasIndex(p => p.OrgProjectExternalId).IsUnique();
});
}
}
48 changes: 48 additions & 0 deletions src/Fusion.Summary.Api/Database/Models/DbWeeklyTaskOwnerReport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore;

namespace Fusion.Summary.Api.Database.Models;

public class DbWeeklyTaskOwnerReport
{
public required Guid Id { get; set; }
public required Guid ProjectId { get; set; }
public DbProject? Project { get; set; }

public required DateTime Period { get; set; }

internal static void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<DbWeeklyTaskOwnerReport>(report =>
{
report.ToTable("WeeklyTaskOwnerReports");
report.HasKey(r => r.Id);

report.HasOne(r => r.Project)
.WithMany()
.HasForeignKey(r => r.ProjectId)
.OnDelete(DeleteBehavior.Restrict);
});
}
}

public class DbAdminAccessExpiring
{
public required Guid AzureUniqueId { get; set; }
public required string FullName { get; set; }
public required DateTime Expires { get; set; }
}

public class DbActionsAwaitingTaskOwner
{
// TODO: Implement
}

public class DbPositionAllocationsEnding
{
// TODO: Implement
}

public class DbTBNPositionsStartingSoon
{
// TODO: Implement
}

0 comments on commit 74772ba

Please sign in to comment.