Update survey response, adding EmployeeId , Location Id as int, adjust end point for ansers submission in batch

This commit is contained in:
Reginald Cherenfant Jasmin
2023-09-13 01:28:24 -04:00
parent 4cf7d9f891
commit 9109d0d793
68 changed files with 525 additions and 540 deletions

View File

@ -6,18 +6,20 @@ namespace DamageAssesment.Api.Locations.Db
public class Location
{
[Key]
public int Id { get; set; }
[ForeignKey("Region")]
public int RegionId { get; set; }
[StringLength(4)]
public string Id { get; set; }
public string LocationCode { get; set; }
[StringLength(50)]
public string Name { get; set; }
[StringLength(1)]
[StringLength(4)]
public string MaintenanceCenter { get; set; }
[StringLength(2)]
public string SchoolType { get; set; }
[ForeignKey("Region")]
public string RegionId { get; set; }
}
}

View File

@ -2,7 +2,7 @@
namespace DamageAssesment.Api.Locations.Db
{
public class LocationDbContext:DbContext
public class LocationDbContext : DbContext
{
public DbSet<Db.Location> Locations { get; set; }
public DbSet<Db.Region> Regions { get; set; }
@ -10,5 +10,17 @@ namespace DamageAssesment.Api.Locations.Db
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Location>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<Region>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
}
}
}

View File

@ -5,15 +5,12 @@ namespace DamageAssesment.Api.Locations.Db
public class Region
{
[Key]
[StringLength(2)]
public string Id { get; set; }
public int Id { get; set; }
[StringLength(50)]
public string Name { get; set; }
[StringLength(5)]
public string Abbreviation { get; set; }
// public ICollection<Location> Locations { get; set; }
}
}