Commit 9035cd536b69d532f6c3d1fd00d45805c9799470
1 parent
59f80a46
add RoadToCategory model
Showing
6 changed files
with
123 additions
and
29 deletions
Show diff stats
src/MapsDb/Models/Region.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic; | @@ -3,7 +3,7 @@ using System.Collections.Generic; | ||
3 | 3 | ||
4 | namespace MapsDb.Models | 4 | namespace MapsDb.Models |
5 | { | 5 | { |
6 | - public partial class Region | 6 | + public partial class Region |
7 | { | 7 | { |
8 | public Region() | 8 | public Region() |
9 | { | 9 | { |
@@ -13,6 +13,7 @@ namespace MapsDb.Models | @@ -13,6 +13,7 @@ namespace MapsDb.Models | ||
13 | RoadPassport = new HashSet<RoadPassport>(); | 13 | RoadPassport = new HashSet<RoadPassport>(); |
14 | RoadService = new HashSet<RoadService>(); | 14 | RoadService = new HashSet<RoadService>(); |
15 | RoadSurface = new HashSet<RoadSurface>(); | 15 | RoadSurface = new HashSet<RoadSurface>(); |
16 | + RoadToCategory = new HashSet<RoadToCategory>(); | ||
16 | RoadWidth = new HashSet<RoadWidth>(); | 17 | RoadWidth = new HashSet<RoadWidth>(); |
17 | ServiceObject = new HashSet<ServiceObject>(); | 18 | ServiceObject = new HashSet<ServiceObject>(); |
18 | SettlementAddressLink = new HashSet<SettlementAddressLink>(); | 19 | SettlementAddressLink = new HashSet<SettlementAddressLink>(); |
@@ -28,6 +29,7 @@ namespace MapsDb.Models | @@ -28,6 +29,7 @@ namespace MapsDb.Models | ||
28 | public virtual ICollection<RoadPassport> RoadPassport { get; set; } | 29 | public virtual ICollection<RoadPassport> RoadPassport { get; set; } |
29 | public virtual ICollection<RoadService> RoadService { get; set; } | 30 | public virtual ICollection<RoadService> RoadService { get; set; } |
30 | public virtual ICollection<RoadSurface> RoadSurface { get; set; } | 31 | public virtual ICollection<RoadSurface> RoadSurface { get; set; } |
32 | + public virtual ICollection<RoadToCategory> RoadToCategory { get; set; } | ||
31 | public virtual ICollection<RoadWidth> RoadWidth { get; set; } | 33 | public virtual ICollection<RoadWidth> RoadWidth { get; set; } |
32 | public virtual ICollection<ServiceObject> ServiceObject { get; set; } | 34 | public virtual ICollection<ServiceObject> ServiceObject { get; set; } |
33 | public virtual ICollection<SettlementAddressLink> SettlementAddressLink { get; set; } | 35 | public virtual ICollection<SettlementAddressLink> SettlementAddressLink { get; set; } |
src/MapsDb/Models/Road.cs
@@ -13,6 +13,7 @@ namespace MapsDb.Models | @@ -13,6 +13,7 @@ namespace MapsDb.Models | ||
13 | RoadPassport = new HashSet<RoadPassport>(); | 13 | RoadPassport = new HashSet<RoadPassport>(); |
14 | RoadService = new HashSet<RoadService>(); | 14 | RoadService = new HashSet<RoadService>(); |
15 | RoadSurface = new HashSet<RoadSurface>(); | 15 | RoadSurface = new HashSet<RoadSurface>(); |
16 | + RoadToCategory = new HashSet<RoadToCategory>(); | ||
16 | RoadWidth = new HashSet<RoadWidth>(); | 17 | RoadWidth = new HashSet<RoadWidth>(); |
17 | ServiceObject = new HashSet<ServiceObject>(); | 18 | ServiceObject = new HashSet<ServiceObject>(); |
18 | SettlementAddressLink = new HashSet<SettlementAddressLink>(); | 19 | SettlementAddressLink = new HashSet<SettlementAddressLink>(); |
@@ -37,6 +38,7 @@ namespace MapsDb.Models | @@ -37,6 +38,7 @@ namespace MapsDb.Models | ||
37 | public virtual ICollection<RoadPassport> RoadPassport { get; set; } | 38 | public virtual ICollection<RoadPassport> RoadPassport { get; set; } |
38 | public virtual ICollection<RoadService> RoadService { get; set; } | 39 | public virtual ICollection<RoadService> RoadService { get; set; } |
39 | public virtual ICollection<RoadSurface> RoadSurface { get; set; } | 40 | public virtual ICollection<RoadSurface> RoadSurface { get; set; } |
41 | + public virtual ICollection<RoadToCategory> RoadToCategory { get; set; } | ||
40 | public virtual ICollection<RoadWidth> RoadWidth { get; set; } | 42 | public virtual ICollection<RoadWidth> RoadWidth { get; set; } |
41 | public virtual ICollection<ServiceObject> ServiceObject { get; set; } | 43 | public virtual ICollection<ServiceObject> ServiceObject { get; set; } |
42 | public virtual ICollection<SettlementAddressLink> SettlementAddressLink { get; set; } | 44 | public virtual ICollection<SettlementAddressLink> SettlementAddressLink { get; set; } |
src/MapsDb/Models/RoadCategory.cs
@@ -5,7 +5,14 @@ namespace MapsDb.Models | @@ -5,7 +5,14 @@ namespace MapsDb.Models | ||
5 | { | 5 | { |
6 | public partial class RoadCategory | 6 | public partial class RoadCategory |
7 | { | 7 | { |
8 | + public RoadCategory() | ||
9 | + { | ||
10 | + RoadToCategory = new HashSet<RoadToCategory>(); | ||
11 | + } | ||
12 | + | ||
8 | public int RoadCategoryId { get; set; } | 13 | public int RoadCategoryId { get; set; } |
9 | public string Value { get; set; } | 14 | public string Value { get; set; } |
15 | + | ||
16 | + public virtual ICollection<RoadToCategory> RoadToCategory { get; set; } | ||
10 | } | 17 | } |
11 | } | 18 | } |
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | + | ||
4 | +namespace MapsDb.Models | ||
5 | +{ | ||
6 | + public partial class RoadToCategory | ||
7 | + { | ||
8 | + public int Id { get; set; } | ||
9 | + public int? RegionId { get; set; } | ||
10 | + public int? RoadId { get; set; } | ||
11 | + public double? Begin { get; set; } | ||
12 | + public double? End { get; set; } | ||
13 | + public double? Distance { get; set; } | ||
14 | + public int? RoadCategoryId { get; set; } | ||
15 | + | ||
16 | + public virtual Region Region { get; set; } | ||
17 | + public virtual RoadCategory RoadCategory { get; set; } | ||
18 | + public virtual Road Road { get; set; } | ||
19 | + } | ||
20 | +} |
src/MapsDb/PostgresDbContext.cs
@@ -6,6 +6,30 @@ namespace MapsDb | @@ -6,6 +6,30 @@ namespace MapsDb | ||
6 | { | 6 | { |
7 | public partial class PostgresDbContext : DbContext | 7 | public partial class PostgresDbContext : DbContext |
8 | { | 8 | { |
9 | + public virtual DbSet<BusStop> BusStop { get; set; } | ||
10 | + public virtual DbSet<CrossSection> CrossSection { get; set; } | ||
11 | + public virtual DbSet<DepartmentAffiliation> DepartmentAffiliation { get; set; } | ||
12 | + public virtual DbSet<FlowIntensity> FlowIntensity { get; set; } | ||
13 | + public virtual DbSet<Organization> Organization { get; set; } | ||
14 | + public virtual DbSet<Region> Region { get; set; } | ||
15 | + public virtual DbSet<Road> Road { get; set; } | ||
16 | + public virtual DbSet<RoadCategory> RoadCategory { get; set; } | ||
17 | + public virtual DbSet<RoadDirection> RoadDirection { get; set; } | ||
18 | + public virtual DbSet<RoadPassport> RoadPassport { get; set; } | ||
19 | + public virtual DbSet<RoadService> RoadService { get; set; } | ||
20 | + public virtual DbSet<RoadSurface> RoadSurface { get; set; } | ||
21 | + public virtual DbSet<RoadToCategory> RoadToCategory { get; set; } | ||
22 | + public virtual DbSet<RoadType> RoadType { get; set; } | ||
23 | + public virtual DbSet<RoadWidth> RoadWidth { get; set; } | ||
24 | + public virtual DbSet<ServiceObject> ServiceObject { get; set; } | ||
25 | + public virtual DbSet<ServiceObjectType> ServiceObjectType { get; set; } | ||
26 | + public virtual DbSet<Settlement> Settlement { get; set; } | ||
27 | + public virtual DbSet<SettlementAddressLink> SettlementAddressLink { get; set; } | ||
28 | + public virtual DbSet<SettlementLocation> SettlementLocation { get; set; } | ||
29 | + public virtual DbSet<StateCommon> StateCommon { get; set; } | ||
30 | + public virtual DbSet<SurfaceTreatment> SurfaceTreatment { get; set; } | ||
31 | + public virtual DbSet<SurfaceType> SurfaceType { get; set; } | ||
32 | + | ||
9 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | 33 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |
10 | { | 34 | { |
11 | #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. | 35 | #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. |
@@ -18,7 +42,9 @@ namespace MapsDb | @@ -18,7 +42,9 @@ namespace MapsDb | ||
18 | { | 42 | { |
19 | entity.ToTable("bus_stop"); | 43 | entity.ToTable("bus_stop"); |
20 | 44 | ||
21 | - entity.Property(e => e.Id).HasColumnName("id"); | 45 | + entity.Property(e => e.Id) |
46 | + .HasColumnName("id") | ||
47 | + .HasDefaultValueSql("nextval('bus_stop_bus_stop_id_seq'::regclass)"); | ||
22 | 48 | ||
23 | entity.Property(e => e.AreaLandAvailability).HasColumnName("area_land_availability"); | 49 | entity.Property(e => e.AreaLandAvailability).HasColumnName("area_land_availability"); |
24 | 50 | ||
@@ -99,7 +125,9 @@ namespace MapsDb | @@ -99,7 +125,9 @@ namespace MapsDb | ||
99 | { | 125 | { |
100 | entity.ToTable("cross_section"); | 126 | entity.ToTable("cross_section"); |
101 | 127 | ||
102 | - entity.Property(e => e.Id).HasColumnName("id"); | 128 | + entity.Property(e => e.Id) |
129 | + .HasColumnName("id") | ||
130 | + .HasDefaultValueSql("nextval('cross_section_cross_section_id_seq'::regclass)"); | ||
103 | 131 | ||
104 | entity.Property(e => e.Angle).HasColumnName("angle"); | 132 | entity.Property(e => e.Angle).HasColumnName("angle"); |
105 | 133 | ||
@@ -436,7 +464,9 @@ namespace MapsDb | @@ -436,7 +464,9 @@ namespace MapsDb | ||
436 | { | 464 | { |
437 | entity.ToTable("road_surface"); | 465 | entity.ToTable("road_surface"); |
438 | 466 | ||
439 | - entity.Property(e => e.Id).HasColumnName("id"); | 467 | + entity.Property(e => e.Id) |
468 | + .HasColumnName("id") | ||
469 | + .HasDefaultValueSql("nextval('road_surface_road_surface_id_seq'::regclass)"); | ||
440 | 470 | ||
441 | entity.Property(e => e.Begin).HasColumnName("begin"); | 471 | entity.Property(e => e.Begin).HasColumnName("begin"); |
442 | 472 | ||
@@ -504,6 +534,45 @@ namespace MapsDb | @@ -504,6 +534,45 @@ namespace MapsDb | ||
504 | .HasConstraintName("road_surface_surface_type_id_fkey"); | 534 | .HasConstraintName("road_surface_surface_type_id_fkey"); |
505 | }); | 535 | }); |
506 | 536 | ||
537 | + modelBuilder.Entity<RoadToCategory>(entity => | ||
538 | + { | ||
539 | + entity.ToTable("road_to_category"); | ||
540 | + | ||
541 | + entity.Property(e => e.Id) | ||
542 | + .HasColumnName("id") | ||
543 | + .HasDefaultValueSql("nextval('road_to_category_road_to_category_id_seq'::regclass)"); | ||
544 | + | ||
545 | + entity.Property(e => e.Begin).HasColumnName("begin"); | ||
546 | + | ||
547 | + entity.Property(e => e.Distance).HasColumnName("distance"); | ||
548 | + | ||
549 | + entity.Property(e => e.End).HasColumnName("end"); | ||
550 | + | ||
551 | + entity.Property(e => e.RegionId).HasColumnName("region_id"); | ||
552 | + | ||
553 | + entity.Property(e => e.RoadCategoryId).HasColumnName("road_category_id"); | ||
554 | + | ||
555 | + entity.Property(e => e.RoadId).HasColumnName("road_id"); | ||
556 | + | ||
557 | + entity.HasOne(d => d.Region) | ||
558 | + .WithMany(p => p.RoadToCategory) | ||
559 | + .HasForeignKey(d => d.RegionId) | ||
560 | + .OnDelete(DeleteBehavior.Cascade) | ||
561 | + .HasConstraintName("road_to_category_region_id_fkey"); | ||
562 | + | ||
563 | + entity.HasOne(d => d.RoadCategory) | ||
564 | + .WithMany(p => p.RoadToCategory) | ||
565 | + .HasForeignKey(d => d.RoadCategoryId) | ||
566 | + .OnDelete(DeleteBehavior.Cascade) | ||
567 | + .HasConstraintName("road_to_category_road_category_id_fkey"); | ||
568 | + | ||
569 | + entity.HasOne(d => d.Road) | ||
570 | + .WithMany(p => p.RoadToCategory) | ||
571 | + .HasForeignKey(d => d.RoadId) | ||
572 | + .OnDelete(DeleteBehavior.Cascade) | ||
573 | + .HasConstraintName("road_to_category_road_id_fkey"); | ||
574 | + }); | ||
575 | + | ||
507 | modelBuilder.Entity<RoadType>(entity => | 576 | modelBuilder.Entity<RoadType>(entity => |
508 | { | 577 | { |
509 | entity.ToTable("road_type"); | 578 | entity.ToTable("road_type"); |
@@ -525,7 +594,9 @@ namespace MapsDb | @@ -525,7 +594,9 @@ namespace MapsDb | ||
525 | { | 594 | { |
526 | entity.ToTable("road_width"); | 595 | entity.ToTable("road_width"); |
527 | 596 | ||
528 | - entity.Property(e => e.Id).HasColumnName("id"); | 597 | + entity.Property(e => e.Id) |
598 | + .HasColumnName("id") | ||
599 | + .HasDefaultValueSql("nextval('road_width_road_width_id_seq'::regclass)"); | ||
529 | 600 | ||
530 | entity.Property(e => e.Begin).HasColumnName("begin"); | 601 | entity.Property(e => e.Begin).HasColumnName("begin"); |
531 | 602 | ||
@@ -566,7 +637,9 @@ namespace MapsDb | @@ -566,7 +637,9 @@ namespace MapsDb | ||
566 | { | 637 | { |
567 | entity.ToTable("service_object"); | 638 | entity.ToTable("service_object"); |
568 | 639 | ||
569 | - entity.Property(e => e.Id).HasColumnName("id"); | 640 | + entity.Property(e => e.Id) |
641 | + .HasColumnName("id") | ||
642 | + .HasDefaultValueSql("nextval('service_object_service_object_id_seq'::regclass)"); | ||
570 | 643 | ||
571 | entity.Property(e => e.ArrangementElements).HasColumnName("arrangement_elements"); | 644 | entity.Property(e => e.ArrangementElements).HasColumnName("arrangement_elements"); |
572 | 645 | ||
@@ -744,29 +817,18 @@ namespace MapsDb | @@ -744,29 +817,18 @@ namespace MapsDb | ||
744 | .HasColumnType("varchar") | 817 | .HasColumnType("varchar") |
745 | .HasMaxLength(255); | 818 | .HasMaxLength(255); |
746 | }); | 819 | }); |
747 | - } | ||
748 | 820 | ||
749 | - public virtual DbSet<BusStop> BusStop { get; set; } | ||
750 | - public virtual DbSet<CrossSection> CrossSection { get; set; } | ||
751 | - public virtual DbSet<DepartmentAffiliation> DepartmentAffiliation { get; set; } | ||
752 | - public virtual DbSet<FlowIntensity> FlowIntensity { get; set; } | ||
753 | - public virtual DbSet<Organization> Organization { get; set; } | ||
754 | - public virtual DbSet<Region> Region { get; set; } | ||
755 | - public virtual DbSet<Road> Road { get; set; } | ||
756 | - public virtual DbSet<RoadCategory> RoadCategory { get; set; } | ||
757 | - public virtual DbSet<RoadDirection> RoadDirection { get; set; } | ||
758 | - public virtual DbSet<RoadPassport> RoadPassport { get; set; } | ||
759 | - public virtual DbSet<RoadService> RoadService { get; set; } | ||
760 | - public virtual DbSet<RoadSurface> RoadSurface { get; set; } | ||
761 | - public virtual DbSet<RoadType> RoadType { get; set; } | ||
762 | - public virtual DbSet<RoadWidth> RoadWidth { get; set; } | ||
763 | - public virtual DbSet<ServiceObject> ServiceObject { get; set; } | ||
764 | - public virtual DbSet<ServiceObjectType> ServiceObjectType { get; set; } | ||
765 | - public virtual DbSet<Settlement> Settlement { get; set; } | ||
766 | - public virtual DbSet<SettlementAddressLink> SettlementAddressLink { get; set; } | ||
767 | - public virtual DbSet<SettlementLocation> SettlementLocation { get; set; } | ||
768 | - public virtual DbSet<StateCommon> StateCommon { get; set; } | ||
769 | - public virtual DbSet<SurfaceTreatment> SurfaceTreatment { get; set; } | ||
770 | - public virtual DbSet<SurfaceType> SurfaceType { get; set; } | 821 | + modelBuilder.HasSequence("bus_stop_bus_stop_id_seq"); |
822 | + | ||
823 | + modelBuilder.HasSequence("cross_section_cross_section_id_seq"); | ||
824 | + | ||
825 | + modelBuilder.HasSequence("road_surface_road_surface_id_seq"); | ||
826 | + | ||
827 | + modelBuilder.HasSequence("road_to_category_road_to_category_id_seq"); | ||
828 | + | ||
829 | + modelBuilder.HasSequence("road_width_road_width_id_seq"); | ||
830 | + | ||
831 | + modelBuilder.HasSequence("service_object_service_object_id_seq"); | ||
832 | + } | ||
771 | } | 833 | } |
772 | } | 834 | } |
773 | \ No newline at end of file | 835 | \ No newline at end of file |
src/MapsModels/DsModels/PaginationDsM.cs
@@ -7,6 +7,7 @@ namespace MapsModels.DsModels | @@ -7,6 +7,7 @@ namespace MapsModels.DsModels | ||
7 | public int from { get; set; } | 7 | public int from { get; set; } |
8 | public int per_page; | 8 | public int per_page; |
9 | public string sort { get; set; } | 9 | public string sort { get; set; } |
10 | + public string filter {get; set;} | ||
10 | public int perPage{ | 11 | public int perPage{ |
11 | get{ | 12 | get{ |
12 | if(per_page == 0){ | 13 | if(per_page == 0){ |