Skip to content

Commit

Permalink
Merge branch 'dev' into SIMSBIOHUB-169
Browse files Browse the repository at this point in the history
  • Loading branch information
al-rosenthal committed Aug 28, 2023
2 parents 99b4cad + 0e5cf65 commit fca78cb
Show file tree
Hide file tree
Showing 110 changed files with 4,366 additions and 642 deletions.
16 changes: 8 additions & 8 deletions api/package-lock.json

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

8 changes: 1 addition & 7 deletions api/src/constants/codes.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { expect } from 'chai';
import { describe } from 'mocha';
import { region, regional_offices } from './codes';
import { region } from './codes';

describe('region', () => {
it('has values', () => {
expect(region).is.not.empty;
});
});

describe('regional_offices', () => {
it('has values', () => {
expect(regional_offices).is.not.empty;
});
});
6 changes: 0 additions & 6 deletions api/src/constants/codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,3 @@ export const region = [
{ id: 8, name: 'Northeast' },
{ id: 9, name: 'Province' }
];

export const regional_offices = [
{ id: 1, name: 'Office 1' },
{ id: 2, name: 'Office 2' },
{ id: 3, name: 'Office 3' }
];
10 changes: 0 additions & 10 deletions api/src/models/project-create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe('PostProjectObject', () => {
project: {
project_name: 'name_test_data',
project_programs: [1],
project_types: [1, 2],
start_date: 'start_date_test_data',
end_date: 'end_date_test_data',
comments: 'comments_test_data'
Expand Down Expand Up @@ -126,10 +125,6 @@ describe('PostProjectData', () => {
expect(projectPostData.project_programs).to.have.length(0);
});

it('sets types', function () {
expect(projectPostData.project_types).to.have.length(0);
});

it('sets start_date', function () {
expect(projectPostData.start_date).to.equal(null);
});
Expand All @@ -149,7 +144,6 @@ describe('PostProjectData', () => {
const obj = {
project_name: 'name_test_data',
project_programs: [1],
project_types: [1, 2],
start_date: 'start_date_test_data',
end_date: 'end_date_test_data',
comments: 'comments_test_data'
Expand All @@ -167,10 +161,6 @@ describe('PostProjectData', () => {
expect(projectPostData.project_programs).to.eql([1]);
});

it('sets activities', function () {
expect(projectPostData.project_types).to.eql([1, 2]);
});

it('sets start_date', function () {
expect(projectPostData.start_date).to.equal('start_date_test_data');
});
Expand Down
2 changes: 0 additions & 2 deletions api/src/models/project-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class PostCoordinatorData {
export class PostProjectData {
name: string;
project_programs: number[];
project_types: number[];
start_date: string;
end_date: string;
comments: string;
Expand All @@ -76,7 +75,6 @@ export class PostProjectData {

this.name = obj?.project_name || null;
this.project_programs = obj?.project_programs || [];
this.project_types = obj?.project_types || [];
this.start_date = obj?.start_date || null;
this.end_date = obj?.end_date || null;
this.comments = obj?.comments || null;
Expand Down
9 changes: 0 additions & 9 deletions api/src/models/project-update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ describe('PutProjectData', () => {
expect(data.project_programs).to.eql([]);
});

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

it('sets start_date', () => {
expect(data.start_date).to.equal(null);
});
Expand All @@ -46,7 +42,6 @@ describe('PutProjectData', () => {
const obj = {
project_name: 'project name',
project_programs: [1],
project_types: [1, 2],
start_date: '2020-04-20T07:00:00.000Z',
end_date: '2020-05-20T07:00:00.000Z',
revision_count: 1
Expand All @@ -66,10 +61,6 @@ describe('PutProjectData', () => {
expect(data.project_programs).to.eql([1]);
});

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

it('sets start_date', () => {
expect(data.start_date).to.eql('2020-04-20T07:00:00.000Z');
});
Expand Down
2 changes: 0 additions & 2 deletions api/src/models/project-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const defaultLog = getLogger('models/project-update');
export class PutProjectData {
name: string;
project_programs: number[];
project_types: number[];
start_date: string;
end_date: string;
revision_count: number;
Expand All @@ -16,7 +15,6 @@ export class PutProjectData {

this.name = obj?.project_name || null;
this.project_programs = obj?.project_programs || [];
this.project_types = obj?.project_types || [];
this.start_date = obj?.start_date || null;
this.end_date = obj?.end_date || null;
this.revision_count = obj?.revision_count ?? null;
Expand Down
10 changes: 0 additions & 10 deletions api/src/models/project-view.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe('ProjectData', () => {
uuid: 'uuid',
project_name: '',
project_programs: [],
project_types: [],
start_date: '2005-01-01',
end_date: '2006-01-01',
comments: '',
Expand All @@ -41,10 +40,6 @@ describe('ProjectData', () => {
expect(data.project_programs).to.eql([]);
});

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

it('sets start_date', () => {
expect(data.start_date).to.eql('2005-01-01');
});
Expand Down Expand Up @@ -72,7 +67,6 @@ describe('ProjectData', () => {
uuid: 'uuid',
project_name: 'project name',
project_programs: [1],
project_types: [1, 2],
start_date: '2020-04-20T07:00:00.000Z',
end_date: '2020-05-20T07:00:00.000Z',
comments: '',
Expand All @@ -92,10 +86,6 @@ describe('ProjectData', () => {
expect(data.project_programs).to.eql([1]);
});

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

it('sets start_date', () => {
expect(data.start_date).to.eql('2020-04-20T07:00:00.000Z');
});
Expand Down
2 changes: 0 additions & 2 deletions api/src/models/project-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const ProjectData = z.object({
uuid: z.string(),
project_name: z.string(),
project_programs: z.array(z.number()),
project_types: z.array(z.number()),
start_date: z.string(),
end_date: z.string().nullable(),
comments: z.string().nullable(),
Expand All @@ -45,7 +44,6 @@ export const ProjectListData = z.object({
project_name: z.string(),
coordinator_agency: z.string(),
project_programs: z.array(z.number()).default([]),
project_types: z.array(z.number()).default([]),
regions: z.array(z.string()).default([]),
start_date: z.string(),
end_date: z.string().nullable().optional()
Expand Down
2 changes: 2 additions & 0 deletions api/src/models/survey-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ export class PostSurveyDetailsData {
end_date: string;
biologist_first_name: string;
biologist_last_name: string;
survey_types: number[];

constructor(obj?: any) {
this.survey_name = obj?.survey_name || null;
this.start_date = obj?.start_date || null;
this.end_date = obj?.end_date || null;
this.biologist_first_name = obj?.biologist_first_name || null;
this.biologist_last_name = obj?.biologist_last_name || null;
this.survey_types = (obj?.survey_types?.length && obj.survey_types) || [];
}
}

Expand Down
2 changes: 2 additions & 0 deletions api/src/models/survey-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class PutSurveyDetailsData {
end_date: string;
lead_first_name: string;
lead_last_name: string;
survey_types: number[];
revision_count: number;

constructor(obj?: any) {
Expand All @@ -50,6 +51,7 @@ export class PutSurveyDetailsData {
this.end_date = obj?.end_date || null;
this.lead_first_name = obj?.biologist_first_name || null;
this.lead_last_name = obj?.biologist_last_name || null;
this.survey_types = (obj?.survey_types?.length && obj.survey_types) || [];
this.revision_count = obj?.revision_count ?? null;
}
}
Expand Down
2 changes: 2 additions & 0 deletions api/src/models/survey-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class GetSurveyData {
biologist_last_name: string;
survey_area_name: string;
geometry: Feature[];
survey_types: number[];
revision_count: number;

constructor(obj?: any) {
Expand All @@ -36,6 +37,7 @@ export class GetSurveyData {
this.biologist_first_name = obj?.lead_first_name || '';
this.biologist_last_name = obj?.lead_last_name || '';
this.survey_area_name = obj?.location_name || '';
this.survey_types = (obj?.survey_types?.length && obj.survey_types) || [];
this.revision_count = obj?.revision_count || 0;
}
}
Expand Down
6 changes: 0 additions & 6 deletions api/src/openapi/schemas/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ export const projectCreatePostRequestObject = {
type: 'number'
}
},
project_types: {
type: 'array',
items: {
type: 'number'
}
},
start_date: {
type: 'string',
description: 'ISO 8601 date string'
Expand Down
50 changes: 21 additions & 29 deletions api/src/paths/codes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ GET.apiDoc = {
'application/json': {
schema: {
type: 'object',
required: [
'management_action_type',
'first_nations',
'agency',
'investment_action_category',
'type',
'iucn_conservation_action_level_1_classification',
'iucn_conservation_action_level_2_subclassification',
'iucn_conservation_action_level_3_subclassification',
'program',
'proprietor_type',
'system_roles',
'project_roles',
'administrative_activity_status_type',
'field_methods',
'ecological_seasons',
'intended_outcomes',
'vantage_codes'
],
properties: {
management_action_type: {
type: 'array',
Expand Down Expand Up @@ -79,8 +98,9 @@ GET.apiDoc = {
}
}
},
project_type: {
type: {
type: 'array',
description: 'Types of surveys',
items: {
type: 'object',
properties: {
Expand All @@ -107,20 +127,6 @@ GET.apiDoc = {
}
}
},
region: {
type: 'array',
items: {
type: 'object',
properties: {
id: {
type: 'number'
},
name: {
type: 'string'
}
}
}
},
species: {
type: 'array',
items: {
Expand Down Expand Up @@ -228,20 +234,6 @@ GET.apiDoc = {
}
}
},
regional_offices: {
type: 'array',
items: {
type: 'object',
properties: {
id: {
type: 'number'
},
name: {
type: 'string'
}
}
}
},
administrative_activity_status_type: {
type: 'array',
items: {
Expand Down
Loading

0 comments on commit fca78cb

Please sign in to comment.