Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIMSBIOHUB-177: Survey Study Area enhancements #1136

Merged
merged 67 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
5738f58
stubbed out survey area
al-rosenthal Oct 12, 2023
54c93cd
Merge branch 'dev' into SIMSBIOHUB-177
al-rosenthal Oct 12, 2023
acf6516
stubbed out basic list
al-rosenthal Oct 12, 2023
f0abcb8
got basic UI implemented
al-rosenthal Oct 13, 2023
9de6940
adding loading button to dialog
al-rosenthal Oct 13, 2023
218779d
modifying location list to work for survey create/ edit pages
al-rosenthal Oct 13, 2023
9366001
wired up basic edit form
al-rosenthal Oct 13, 2023
a4c4587
setting up study area map control
al-rosenthal Oct 16, 2023
0c472a8
uploading now displays new cards
al-rosenthal Oct 16, 2023
4ad1fc3
dialog opens with data
al-rosenthal Oct 16, 2023
6291144
wired up basic delete
al-rosenthal Oct 16, 2023
5241cce
renamed functions
al-rosenthal Oct 16, 2023
dedc07c
updated handler functions for uploads
al-rosenthal Oct 16, 2023
e3fb038
refactored update boundary
al-rosenthal Oct 16, 2023
e19a8b9
added new shallow json zod schema
al-rosenthal Oct 17, 2023
e2f00ec
map goes to bounds
al-rosenthal Oct 17, 2023
d85fddb
stubbing out region changes
al-rosenthal Oct 18, 2023
a003a1e
added new region auto complete
al-rosenthal Oct 19, 2023
cf0aad8
refactoring survey study area map
al-rosenthal Oct 19, 2023
0e2088c
added helper for layer feature names
al-rosenthal Oct 19, 2023
506263d
added feature group to the map
al-rosenthal Oct 19, 2023
5dc9cf5
moving control from component to form page
al-rosenthal Oct 19, 2023
e15670b
pulled out import dialog into own component
al-rosenthal Oct 20, 2023
df9b716
Add new draw controls
NickPhura Oct 20, 2023
6683104
draw feature wired up
al-rosenthal Oct 20, 2023
212f476
features will properly submit updated drawn features
al-rosenthal Oct 23, 2023
9416fb5
survey will now update survey locations
al-rosenthal Oct 23, 2023
c4c99e8
Removed depreacted tests and updated test method names
JeremyQuartech Oct 23, 2023
87dc853
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Oct 23, 2023
4b1f62d
update now deletes locations
al-rosenthal Oct 23, 2023
cd13b0d
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
al-rosenthal Oct 23, 2023
93f8c3a
wired up delete controls
al-rosenthal Oct 23, 2023
0dca144
Added test stubs for insertUpdateDeleteSurveyLocation
JeremyQuartech Oct 23, 2023
ddb7e38
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Oct 23, 2023
4aced1e
importing boundaries is additive
al-rosenthal Oct 23, 2023
a2290d3
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
al-rosenthal Oct 23, 2023
e84fcf6
clean up
al-rosenthal Oct 23, 2023
5d377e8
Merge branch 'dev-staging' into SIMSBIOHUB-177
al-rosenthal Oct 23, 2023
0aa8a6f
map popups stay in the bounds of the map now
al-rosenthal Oct 23, 2023
5470234
Added tests for survey-location-repository
JeremyQuartech Oct 23, 2023
d947ea6
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Oct 23, 2023
8f03978
UI Updates
jeznorth Oct 23, 2023
4827cfe
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
jeznorth Oct 23, 2023
fd2a572
fixed issue with parsing data for survey
al-rosenthal Oct 23, 2023
077eda3
Added survey-location-service tests
JeremyQuartech Oct 23, 2023
a8e2c88
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Oct 23, 2023
f55c590
Fixed failing test for expected null instead of empty string
JeremyQuartech Oct 23, 2023
0be0c00
fixing code smells
al-rosenthal Oct 23, 2023
970e2d5
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
al-rosenthal Oct 23, 2023
db91612
Added missing assertions to survey-location-repository tests
JeremyQuartech Oct 23, 2023
25af50d
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Oct 23, 2023
ef48cf1
removed unused prop
al-rosenthal Oct 23, 2023
7d58a58
fixing more smells
al-rosenthal Oct 23, 2023
27f6f81
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
al-rosenthal Oct 23, 2023
7e15dfc
Updates
NickPhura Oct 23, 2023
70473a0
Updated survey-service tests for insertUpdateDeleteSurveyLocation met…
JeremyQuartech Oct 23, 2023
e7916e5
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
JeremyQuartech Oct 23, 2023
cbfc425
Merge branch 'dev-staging' into SIMSBIOHUB-177
al-rosenthal Oct 24, 2023
f30b294
Merge branch 'SIMSBIOHUB-177' of https://github.com/bcgov/biohubbc in…
al-rosenthal Oct 24, 2023
f028585
fixing tests
al-rosenthal Oct 24, 2023
4827254
added documentation
al-rosenthal Oct 24, 2023
59d8e00
clean up
al-rosenthal Oct 24, 2023
3c03c76
added more docs
al-rosenthal Oct 24, 2023
bd625a8
resolved github comments
al-rosenthal Oct 24, 2023
7c267a7
ran make fix
al-rosenthal Oct 24, 2023
8974052
Merge branch 'dev-staging' into SIMSBIOHUB-177
al-rosenthal Oct 24, 2023
38e9cbe
Fix code smells
NickPhura Oct 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 0 additions & 49 deletions api/src/models/survey-create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { expect } from 'chai';
import { describe } from 'mocha';
import {
PostAgreementsData,
PostLocationData,
PostPartnershipsData,
PostPermitData,
PostProprietorData,
Expand Down Expand Up @@ -362,54 +361,6 @@ describe('PostProprietorData', () => {
});
});

describe('PostLocationData', () => {
describe('No values provided', () => {
let data: PostLocationData;

before(() => {
data = new PostLocationData(null);
});

it('sets name', () => {
expect(data.name).to.equal(null);
});

it('sets description', () => {
expect(data.description).to.equal(null);
});

it('sets geojson', () => {
expect(data.geojson).to.eql([]);
});
});

describe('All values provided with first nations id', () => {
let data: PostLocationData;

const obj = {
name: 'area name',
description: 'area description',
geojson: [{}]
};

before(() => {
data = new PostLocationData(obj);
});

it('sets name', () => {
expect(data.name).to.equal(obj.name);
});

it('sets description', () => {
expect(data.description).to.equal(obj.description);
});

it('sets geojson', () => {
expect(data.geojson).to.eql(obj.geojson);
});
});
});

describe('PostPurposeAndMethodologyData', () => {
describe('No values provided', () => {
let data: PostPurposeAndMethodologyData;
Expand Down
18 changes: 3 additions & 15 deletions api/src/models/survey-create.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Feature } from 'geojson';
import { SurveyStratum } from '../repositories/site-selection-strategy-repository';
import { PostSurveyBlock } from '../repositories/survey-block-repository';
import { PostSurveyLocationData } from './survey-update';

export class PostSurveyObject {
survey_details: PostSurveyDetailsData;
Expand All @@ -9,7 +9,7 @@ export class PostSurveyObject {
funding_sources: PostFundingSourceData[];
proprietor: PostProprietorData;
purpose_and_methodology: PostPurposeAndMethodologyData;
locations: PostLocationData[];
locations: PostSurveyLocationData[];
agreements: PostAgreementsData;
participants: PostParticipationData[];
partnerships: PostPartnershipsData;
Expand All @@ -29,7 +29,7 @@ export class PostSurveyObject {
this.participants =
(obj?.participants?.length && obj.participants.map((p: any) => new PostParticipationData(p))) || [];
this.partnerships = (obj?.partnerships && new PostPartnershipsData(obj.partnerships)) || null;
this.locations = (obj?.locations && obj.locations.map((p: any) => new PostLocationData(p))) || [];
this.locations = (obj?.locations && obj.locations.map((p: any) => new PostSurveyLocationData(p))) || [];
this.site_selection = (obj?.site_selection && new PostSiteSelectionData(obj)) || null;
this.blocks = (obj?.blocks && obj.blocks.map((p: any) => p as PostSurveyBlock)) || [];
}
Expand Down Expand Up @@ -120,18 +120,6 @@ export class PostProprietorData {
}
}

export class PostLocationData {
name: string;
description: string;
geojson: Feature[];

constructor(obj?: any) {
this.name = obj?.name || null;
this.description = obj?.description || null;
this.geojson = (obj?.geojson?.length && obj.geojson) || [];
}
}

export class PostPurposeAndMethodologyData {
intended_outcome_id: number;
additional_details: string;
Expand Down
12 changes: 6 additions & 6 deletions api/src/models/survey-update.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect } from 'chai';
import { describe } from 'mocha';
import {
PostSurveyLocationData,
PutPartnershipsData,
PutSurveyDetailsData,
PutSurveyLocationData,
PutSurveyObject,
PutSurveyPermitData,
PutSurveyProprietorData,
Expand Down Expand Up @@ -410,18 +410,18 @@ describe('PutPurposeAndMethodologyData', () => {

describe('PutLocationData', () => {
describe('No values provided', () => {
let data: PutSurveyLocationData;
let data: PostSurveyLocationData;

before(() => {
data = new PutSurveyLocationData(null);
data = new PostSurveyLocationData(null);
});

it('sets name', () => {
expect(data.name).to.equal(null);
});

it('sets description', () => {
expect(data.description).to.equal(null);
expect(data.description).to.equal('');
});

it('sets geojson', () => {
Expand All @@ -434,7 +434,7 @@ describe('PutLocationData', () => {
});

describe('All values provided with first nations id', () => {
let data: PutSurveyLocationData;
let data: PostSurveyLocationData;

const obj = {
name: 'area name',
Expand All @@ -444,7 +444,7 @@ describe('PutLocationData', () => {
};

before(() => {
data = new PutSurveyLocationData(obj);
data = new PostSurveyLocationData(obj);
});

it('sets name', () => {
Expand Down
13 changes: 7 additions & 6 deletions api/src/models/survey-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class PutSurveyObject {
funding_sources: PutFundingSourceData[];
proprietor: PutSurveyProprietorData;
purpose_and_methodology: PutSurveyPurposeAndMethodologyData;
locations: PutSurveyLocationData[];
locations: PostSurveyLocationData[];
participants: PutSurveyParticipantsData[];
partnerships: PutPartnershipsData;
site_selection: PutSiteSelectionData;
Expand All @@ -26,7 +26,7 @@ export class PutSurveyObject {
(obj?.purpose_and_methodology && new PutSurveyPurposeAndMethodologyData(obj.purpose_and_methodology)) || null;
this.participants =
(obj?.participants?.length && obj.participants.map((p: any) => new PutSurveyParticipantsData(p))) || [];
this.locations = (obj?.locations && obj.locations.map((p: any) => new PutSurveyLocationData(p))) || [];
this.locations = (obj?.locations && obj.locations.map((p: any) => new PostSurveyLocationData(p))) || [];
this.partnerships = (obj?.partnerships && new PutPartnershipsData(obj.partnerships)) || null;
this.site_selection = (obj?.site_selection && new PutSiteSelectionData(obj)) || null;
this.blocks = (obj?.blocks && obj.blocks.map((p: any) => p as PostSurveyBlock)) || [];
Expand Down Expand Up @@ -150,17 +150,18 @@ export class PutSurveyPurposeAndMethodologyData {
}
}

export class PutSurveyLocationData {
survey_location_id: number;
// This class is used for both insert and updating a survey location
export class PostSurveyLocationData {
survey_location_id: number | undefined;
name: string;
description: string;
geojson: Feature[];
revision_count: number;
revision_count: number | undefined;

constructor(obj?: any) {
this.survey_location_id = obj?.survey_location_id || null;
this.name = obj?.name || null;
this.description = obj?.description || null;
this.description = obj?.description || '';
this.geojson = (obj?.geojson?.length && obj.geojson) || [];
this.revision_count = obj?.revision_count ?? null;
}
Expand Down
4 changes: 2 additions & 2 deletions api/src/repositories/administrative-activity-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ADMINISTRATIVE_ACTIVITY_TYPE
} from '../constants/administrative-activity';
import { ApiExecuteSQLError } from '../errors/api-error';
import { jsonSchema } from '../zod-schema/json';
import { shallowJsonSchema } from '../zod-schema/json';
import { BaseRepository } from './base-repository';

export const IAdministrativeActivityStanding = z.object({
Expand All @@ -22,7 +22,7 @@ export const IAdministrativeActivity = z.object({
status: z.number(),
status_name: z.string(),
description: z.string().nullable(),
data: jsonSchema,
data: shallowJsonSchema,
notes: z.string().nullable(),
create_date: z.string()
});
Expand Down
4 changes: 2 additions & 2 deletions api/src/repositories/draft-repository.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import SQL, { SQLStatement } from 'sql-template-strings';
import { z } from 'zod';
import { ApiExecuteSQLError } from '../errors/api-error';
import { jsonSchema } from '../zod-schema/json';
import { shallowJsonSchema } from '../zod-schema/json';
import { BaseRepository } from './base-repository';

export const WebformDraft = z.object({
webform_draft_id: z.number(),
name: z.string(),
data: jsonSchema,
data: shallowJsonSchema,
create_date: z.string(),
update_date: z.string().nullable()
});
Expand Down
2 changes: 0 additions & 2 deletions api/src/repositories/sample-location-repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ describe('SampleLocationRepository', () => {
} catch (error) {
expect(dbConnectionObj.sql).to.have.been.calledOnce;
expect((error as ApiExecuteSQLError).message).to.be.eql('Failed to insert sample location');
expect(dbConnectionObj.sql).to.have.been.calledOnce;
}
});
});
Expand Down Expand Up @@ -151,7 +150,6 @@ describe('SampleLocationRepository', () => {
} catch (error) {
expect(dbConnectionObj.sql).to.have.been.calledOnce;
expect((error as ApiExecuteSQLError).message).to.be.eql('Failed to delete survey block record');
expect(dbConnectionObj.sql).to.have.been.calledOnce;
}
});
});
Expand Down
2 changes: 0 additions & 2 deletions api/src/repositories/sample-method-repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ describe('SampleMethodRepository', () => {
} catch (error) {
expect(dbConnectionObj.sql).to.have.been.calledOnce;
expect((error as ApiExecuteSQLError).message).to.be.eql('Failed to insert sample method');
expect(dbConnectionObj.sql).to.have.been.calledOnce;
}
});
});
Expand Down Expand Up @@ -163,7 +162,6 @@ describe('SampleMethodRepository', () => {
} catch (error) {
expect(dbConnectionObj.sql).to.have.been.calledOnce;
expect((error as ApiExecuteSQLError).message).to.be.eql('Failed to delete sample method');
expect(dbConnectionObj.sql).to.have.been.calledOnce;
}
});
});
Expand Down
2 changes: 0 additions & 2 deletions api/src/repositories/sample-period-repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ describe('SamplePeriodRepository', () => {
} catch (error) {
expect(dbConnectionObj.sql).to.have.been.calledOnce;
expect((error as ApiExecuteSQLError).message).to.be.eql('Failed to insert sample period');
expect(dbConnectionObj.sql).to.have.been.calledOnce;
}
});
});
Expand Down Expand Up @@ -147,7 +146,6 @@ describe('SamplePeriodRepository', () => {
} catch (error) {
expect(dbConnectionObj.sql).to.have.been.calledOnce;
expect((error as ApiExecuteSQLError).message).to.be.eql('Failed to delete sample period');
expect(dbConnectionObj.sql).to.have.been.calledOnce;
}
});
});
Expand Down
Loading