Skip to content

Commit

Permalink
Merge pull request #674 from Laixer/develop
Browse files Browse the repository at this point in the history
3.6.3
  • Loading branch information
yorickdewid authored Jul 7, 2022
2 parents 14f82fe + 53f5580 commit 0412b39
Show file tree
Hide file tree
Showing 14 changed files with 34,686 additions and 99,572 deletions.
19,713 changes: 19,712 additions & 1 deletion database/data/seed_data.sql

Large diffs are not rendered by default.

112,660 changes: 14,039 additions & 98,621 deletions database/data/seed_geocoder.sql

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions database/data/seed_report.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ SET row_security = off;
--

COPY report.incident (id, foundation_type, chained_building, owner, foundation_recovery, neightbor_recovery, foundation_damage_cause, document_file, note, contact, create_date, update_date, delete_date, foundation_damage_characteristics, environment_damage_characteristics, address, meta, audit_status, internal_note, question_type) FROM stdin;
FIR122021-1 wood f t t t drystand {deposit.dwf,adapter_e_enable.viv} \N Brady_Gorczany17@gmail.com 2021-03-19 15:50:26.566311+00 \N \N {crack,jamming_door_window,skewed} {sagging_sewer_connection,vegetation_nearby} gfm-351cc5645ab7457b92d3629e8c163f0b {"SessionUser": "1a93cfb3-f097-4697-a998-71cdd9cfaead", "SessionOrganization": "05203318-6c55-43c1-a6a6-bb8c83f930c3"} todo \N financial
FIR122021-2 wood t t f t bio_fungus_infection {payment_credit_card_account_dynamic.jsonld,tasty_steel_keyboard_input_b2b.xdm} \N Jany_Ritchie24@yahoo.com 2021-03-19 15:50:38.136926+00 \N \N {threshold_below_subsurface} {increasing_traffic,vegetation_nearby,sewage_leakage,sagging_cables_pipes,low_ground_water,construction_nearby,foundation_damage_nearby,elevation} gfm-351cc5645ab7457b92d3629e8c163f0b {"SessionUser": "1a93cfb3-f097-4697-a998-71cdd9cfaead", "SessionOrganization": "05203318-6c55-43c1-a6a6-bb8c83f930c3"} todo \N research
FIR122021-3 no_pile_strips t t t f drainage {circuit_object_based_sas.svgz,valley_deposit_synthesizing.qwd,background.fxp} sunt Zetta81@hotmail.com 2021-03-19 15:50:46.847066+00 \N \N {crawlspace_flooding,threshold_below_subsurface,skewed} {flooding,sagging_cables_pipes,subsidence,construction_nearby,increasing_traffic,sagging_sewer_connection,low_ground_water,vegetation_nearby,sewage_leakage,foundation_damage_nearby} gfm-351cc5645ab7457b92d3629e8c163f0b {"SessionUser": "1a93cfb3-f097-4697-a998-71cdd9cfaead", "SessionOrganization": "05203318-6c55-43c1-a6a6-bb8c83f930c3"} todo \N buy_sell
FIR122021-1 wood f t t t drystand {deposit.dwf,adapter_e_enable.viv} \N Brady_Gorczany17@gmail.com 2021-03-19 15:50:26.566311+00 \N \N {crack,jamming_door_window,skewed} {sagging_sewer_connection,vegetation_nearby} gfm-449226a8dec74564812275862771b1bb {"SessionUser": "1a93cfb3-f097-4697-a998-71cdd9cfaead", "SessionOrganization": "05203318-6c55-43c1-a6a6-bb8c83f930c3"} todo \N financial
FIR122021-2 wood t t f t bio_fungus_infection {payment_credit_card_account_dynamic.jsonld,tasty_steel_keyboard_input_b2b.xdm} \N Jany_Ritchie24@yahoo.com 2021-03-19 15:50:38.136926+00 \N \N {threshold_below_subsurface} {increasing_traffic,vegetation_nearby,sewage_leakage,sagging_cables_pipes,low_ground_water,construction_nearby,foundation_damage_nearby,elevation} gfm-84d2960f0c874964a3ce6d938d0c8a00 {"SessionUser": "1a93cfb3-f097-4697-a998-71cdd9cfaead", "SessionOrganization": "05203318-6c55-43c1-a6a6-bb8c83f930c3"} todo \N research
FIR122021-3 no_pile_strips t t t f drainage {circuit_object_based_sas.svgz,valley_deposit_synthesizing.qwd,background.fxp} sunt Zetta81@hotmail.com 2021-03-19 15:50:46.847066+00 \N \N {crawlspace_flooding,threshold_below_subsurface,skewed} {flooding,sagging_cables_pipes,subsidence,construction_nearby,increasing_traffic,sagging_sewer_connection,low_ground_water,vegetation_nearby,sewage_leakage,foundation_damage_nearby} gfm-09aff7bb457b4019b9886b5fae666385 {"SessionUser": "1a93cfb3-f097-4697-a998-71cdd9cfaead", "SessionOrganization": "05203318-6c55-43c1-a6a6-bb8c83f930c3"} todo \N buy_sell
\.


Expand All @@ -42,8 +42,8 @@ COPY report.inquiry (id, document_name, inspection, joint_measurement, floor_mea
--

COPY report.inquiry_sample (id, inquiry, address, create_date, update_date, delete_date, note, built_year, substructure, overall_quality, wood_quality, construction_quality, wood_capacity_horizontal_quality, pile_wood_capacity_vertical_quality, carrying_capacity_quality, mason_quality, wood_quality_necessity, construction_level, wood_level, pile_diameter_top, pile_diameter_bottom, pile_head_level, pile_tip_level, foundation_depth, mason_level, concrete_charger_length, pile_distance_length, wood_penetration_depth, cpt, monitoring_well, groundwater_level_temp, groundlevel, groundwater_level_net, foundation_type, enforcement_term, recovery_advised, damage_cause, damage_characteristics, construction_pile, wood_type, wood_encroachement, crack_indoor_restored, crack_indoor_type, crack_indoor_size, crack_facade_front_restored, crack_facade_front_type, crack_facade_front_size, crack_facade_back_restored, crack_facade_back_type, crack_facade_back_size, crack_facade_left_restored, crack_facade_left_type, crack_facade_left_size, crack_facade_right_restored, crack_facade_right_type, crack_facade_right_size, deformed_facade, threshold_updown_skewed, threshold_front_level, threshold_back_level, skewed_parallel, skewed_perpendicular, skewed_facade, settlement_speed, skewed_window_frame) FROM stdin;
1 1 gfm-351cc5645ab7457b92d3629e8c163f0b 2021-03-19 19:27:52.309562+00 \N \N \N \N \N \N \N \N large small \N \N \N \N 15.39 -25.02 \N \N 15.23 36.17 \N \N 23.90 \N Chips Shoes -48.03 \N \N wood term05 t negative_cling jamming_door_window punched pine \N \N big 9.44 t very_small 0.95 t big \N f \N \N t mediocre 4.33 f f \N \N \N \N nil -16.4465279627808 f
2 2 gfm-351cc5645ab7457b92d3629e8c163f0b 2021-03-19 19:28:01.911134+00 \N \N Non deleniti labore facere sapiente. Laboriosam aperiam est. Odio exercitationem consectetur quia accusantium eligendi vero. Pariatur quo quo laborum et quasi aliquid nemo. Et voluptatem quod est voluptas ipsam. \N crawlspace mediocre_good area2 \N \N \N \N \N t 30.57 \N -27.34 \N \N 15.10 \N \N \N -8.95 4.53 Sausages \N 14.35 \N \N concrete \N f bio_fungus_infection \N pinched spruce bio_infection f \N 2.88 t small \N \N \N \N \N very_small 4.34 \N \N 1.52 \N t -10.64 -23.56 -9.33 \N \N \N \N
1 1 gfm-3371f3503ef542ebb924b1e7e93087b2 2021-03-19 19:27:52.309562+00 \N \N \N \N \N \N \N \N large small \N \N \N \N 15.39 -25.02 \N \N 15.23 36.17 \N \N 23.90 \N Chips Shoes -48.03 \N \N wood term05 t negative_cling jamming_door_window punched pine \N \N big 9.44 t very_small 0.95 t big \N f \N \N t mediocre 4.33 f f \N \N \N \N nil -16.4465279627808 f
2 2 gfm-82f9ce761c58420caa8352b31914c02c 2021-03-19 19:28:01.911134+00 \N \N Non deleniti labore facere sapiente. Laboriosam aperiam est. Odio exercitationem consectetur quia accusantium eligendi vero. Pariatur quo quo laborum et quasi aliquid nemo. Et voluptatem quod est voluptas ipsam. \N crawlspace mediocre_good area2 \N \N \N \N \N t 30.57 \N -27.34 \N \N 15.10 \N \N \N -8.95 4.53 Sausages \N 14.35 \N \N concrete \N f bio_fungus_infection \N pinched spruce bio_infection f \N 2.88 t small \N \N \N \N \N very_small 4.34 \N \N 1.52 \N t -10.64 -23.56 -9.33 \N \N \N \N
\.


Expand All @@ -62,8 +62,8 @@ COPY report.recovery (id, create_date, update_date, delete_date, note, attributi
--

COPY report.recovery_sample (id, recovery, address, create_date, update_date, delete_date, note, status, type, pile_type, contractor, facade, permit, permit_date, recovery_date) FROM stdin;
1 1 gfm-351cc5645ab7457b92d3629e8c163f0b 2021-03-19 15:53:29.845684+00 2021-03-19 15:53:30.005427+00 \N Aliquam harum aut. requested beam_on_pile press 62af863e-2021-4438-a5ea-730ed3db9eda {sidewall_right,front,sidewall_left} Fish 1996-03-02 2003-12-27
2 2 gfm-351cc5645ab7457b92d3629e8c163f0b 2021-03-19 15:58:20.582106+00 2021-03-19 15:58:20.757614+00 \N Voluptatem exercitationem et deleniti. Molestiae eveniet et dolorem non est. Recusandae facere voluptatem earum ullam ut rerum totam. Nulla dolor facere dolorem. Rerum dolor ut officia numquam est nisi eos et. requested unknown press 62af863e-2021-4438-a5ea-730ed3db9eda {sidewall_right} Pizza 2001-04-11 2006-10-09
1 1 gfm-806e1bf162244223860212b562043897 2021-03-19 15:53:29.845684+00 2021-03-19 15:53:30.005427+00 \N Aliquam harum aut. requested beam_on_pile press 62af863e-2021-4438-a5ea-730ed3db9eda {sidewall_right,front,sidewall_left} Fish 1996-03-02 2003-12-27
2 2 gfm-794039b458c743429846c6e357217e7d 2021-03-19 15:58:20.582106+00 2021-03-19 15:58:20.757614+00 \N Voluptatem exercitationem et deleniti. Molestiae eveniet et dolorem non est. Recusandae facere voluptatem earum ullam ut rerum totam. Nulla dolor facere dolorem. Rerum dolor ut officia numquam est nisi eos et. requested unknown press 62af863e-2021-4438-a5ea-730ed3db9eda {sidewall_right} Pizza 2001-04-11 2006-10-09
\.


Expand Down
11 changes: 0 additions & 11 deletions database/fundermaps_base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2947,17 +2947,6 @@ ALTER TABLE geocoder.district OWNER TO fundermaps;
COMMENT ON TABLE geocoder.district IS 'Contains all districts in our own format.';


--
-- Name: identifier; Type: TABLE; Schema: geocoder; Owner: postgres
--

CREATE TABLE geocoder.identifier (
"?column?" integer
);


ALTER TABLE geocoder.identifier OWNER TO postgres;

--
-- Name: municipality; Type: TABLE; Schema: geocoder; Owner: fundermaps
--
Expand Down
2 changes: 1 addition & 1 deletion src/FunderMaps.Core/Entities/Incident.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Incident()
/// Foundation damage cause.
/// </summary>
[EnumDataType(typeof(FoundationDamageCause))]
public FoundationDamageCause FoundationDamageCause { get; set; }
public FoundationDamageCause? FoundationDamageCause { get; set; }

/// <summary>
/// Document name.
Expand Down
1 change: 1 addition & 0 deletions src/FunderMaps.Core/IncidentReport/IncidentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public static string ToFoundationDamageCause(FoundationDamageCause? value)
FoundationDamageCause.Gas => "Gaswinning/mijnbouw",
FoundationDamageCause.Vibrations => "Verkeer",
FoundationDamageCause.PartialFoundationRecovery => "Naastgelegen funderingsherstel",
FoundationDamageCause.JapanseKnotweed => "Japanse duizendknoop",
_ => "Onbekend",
};

Expand Down
2 changes: 1 addition & 1 deletion src/FunderMaps.Data/Repositories/IncidentRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static Incident MapFromReader(DbDataReader reader, int offset = 0)
Owner = reader.GetBoolean(offset++),
FoundationRecovery = reader.GetBoolean(offset++),
NeighborRecovery = reader.GetBoolean(offset++),
FoundationDamageCause = reader.GetFieldValue<FoundationDamageCause>(offset++),
FoundationDamageCause = reader.GetFieldValue<FoundationDamageCause?>(offset++),
DocumentFile = reader.GetSafeFieldValue<string[]>(offset++),
Note = reader.GetSafeString(offset++),
InternalNote = reader.GetSafeString(offset++),
Expand Down
114 changes: 57 additions & 57 deletions tests/FunderMaps.IntegrationTests/Backend/Geocoder/AddressTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,73 @@
using System.Net;
using Xunit;

namespace FunderMaps.IntegrationTests.Backend.Geocoder
namespace FunderMaps.IntegrationTests.Backend.Geocoder;

// TODO: Include test for inactive address
public class AddressTests : IClassFixture<BackendFixtureFactory>
{
public class AddressTests : IClassFixture<BackendFixtureFactory>
{
private BackendFixtureFactory Factory { get; }
private BackendFixtureFactory Factory { get; }

/// <summary>
/// Create new instance.
/// </summary>
public AddressTests(BackendFixtureFactory factory)
=> Factory = factory;
/// <summary>
/// Create new instance.
/// </summary>
public AddressTests(BackendFixtureFactory factory)
=> Factory = factory;

[Fact]
public async Task GetAddressByIdReturnSingleAddress()
{
// Arrange
using var client = Factory.CreateClient();
[Fact]
public async Task GetAddressByIdReturnSingleAddress()
{
// Arrange
using var client = Factory.CreateClient();

// Act
var response = await client.GetAsync($"api/address/gfm-35952a0487304368b0069b4485a69b4b");
var returnObject = await response.Content.ReadFromJsonAsync<AddressDto>();
// Act
var response = await client.GetAsync($"api/address/gfm-059f268aad9d43339afe56a32cf641cc");
var returnObject = await response.Content.ReadFromJsonAsync<AddressDto>();

// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("gfm-35952a0487304368b0069b4485a69b4b", returnObject.Id);
Assert.Equal("gfm-0b50e18111754ed3b5c1408f9f64bf22", returnObject.BuildingId);
Assert.Equal("4d", returnObject.BuildingNumber);
Assert.Equal("2612PA", returnObject.PostalCode);
Assert.Equal("Poortweg", returnObject.Street);
Assert.Equal("Delft", returnObject.City);
Assert.True(response.Headers.CacheControl.Public);
}
// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("gfm-059f268aad9d43339afe56a32cf641cc", returnObject.Id);
Assert.Equal("gfm-629e12e409bb4d0893640ae9ef3a53b7", returnObject.BuildingId);
Assert.Equal("319b", returnObject.BuildingNumber);
Assert.Equal("3023DG", returnObject.PostalCode);
Assert.Equal("Rochussenstraat", returnObject.Street);
Assert.Equal("Rotterdam", returnObject.City);
Assert.True(response.Headers.CacheControl.Public);
}

[Theory]
[InlineData("gfm-6d70df27db5347f88d932faa3a72d3b3", "gfm-6d70df27db5347f88d932faa3a72d3b3")]
[InlineData("NL.IMBAG.NUMMERAANDUIDING.0503200000018943", "gfm-09e3b90972de425ea140ae27e49d60b5")]
[InlineData("0503200000019289", "gfm-9ecb0f685cb84355ae464e2a358ac158")]
public async Task GetAddressByGeoIdReturnSingleAddress(string address, string expected)
{
// Arrange
using var client = Factory.CreateClient();
[Theory]
[InlineData("gfm-08e199f14ecc41d8927476e0d28c6ed4", "gfm-08e199f14ecc41d8927476e0d28c6ed4")]
[InlineData("NL.IMBAG.NUMMERAANDUIDING.0599200000187924", "gfm-2a3472fa13b94cd189d5917bdf42491f")]
[InlineData("0599200100024846", "gfm-ba0deefb78844d45b5f9e55f89cc384c")]
public async Task GetAddressByGeoIdReturnSingleAddress(string address, string expected)
{
// Arrange
using var client = Factory.CreateClient();

// Act
var response = await client.GetAsync($"api/address/{address}");
var returnObject = await response.Content.ReadFromJsonAsync<AddressDto>();
// Act
var response = await client.GetAsync($"api/address/{address}");
var returnObject = await response.Content.ReadFromJsonAsync<AddressDto>();

// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal(expected, returnObject.Id);
Assert.True(response.Headers.CacheControl.Public);
}
// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal(expected, returnObject.Id);
Assert.True(response.Headers.CacheControl.Public);
}

[Theory]
[InlineData(OrganizationRole.Superuser)]
[InlineData(OrganizationRole.Verifier)]
[InlineData(OrganizationRole.Writer)]
public async Task GetAddressByIdReturnOk(OrganizationRole role)
{
// Arrange
using var client = Factory.CreateClient(role);
[Theory]
[InlineData(OrganizationRole.Superuser)]
[InlineData(OrganizationRole.Verifier)]
[InlineData(OrganizationRole.Writer)]
public async Task GetAddressByIdReturnOk(OrganizationRole role)
{
// Arrange
using var client = Factory.CreateClient(role);

// Act
var response = await client.GetAsync($"api/address/gfm-6d70df27db5347f88d932faa3a72d3b3");
// Act
var response = await client.GetAsync($"api/address/gfm-b2a766e060444d3487c30d8de51fa408");

// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.True(response.Headers.CacheControl.Public);
}
// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.True(response.Headers.CacheControl.Public);
}
}
Loading

0 comments on commit 0412b39

Please sign in to comment.