Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into SIMSBIOHUB-632
Browse files Browse the repository at this point in the history
  • Loading branch information
NickPhura committed Nov 25, 2024
2 parents 29b35f3 + 8f48b31 commit 7b3fc1c
Show file tree
Hide file tree
Showing 69 changed files with 2,034 additions and 1,020 deletions.
37 changes: 37 additions & 0 deletions api/src/database-models/method_technique.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { z } from 'zod';

/**
* Method Technique Model.
*
* @description Data model for `method_technique`.
*/
export const MethodTechniqueModel = z.object({
method_technique_id: z.number(),
survey_id: z.number(),
name: z.string(),
description: z.string().nullable(),
distance_threshold: z.number().nullable(),
method_lookup_id: z.number(),
create_date: z.string(),
create_user: z.number(),
update_date: z.string().nullable(),
update_user: z.number().nullable(),
revision_count: z.number()
});

export type MethodTechniqueModel = z.infer<typeof MethodTechniqueModel>;

/**
* Method Technique Record.
*
* @description Data record for `method_technique`.
*/
export const MethodTechniqueRecord = MethodTechniqueModel.omit({
create_date: true,
create_user: true,
update_date: true,
update_user: true,
revision_count: true
});

export type MethodTechniqueRecord = z.infer<typeof MethodTechniqueRecord>;
38 changes: 38 additions & 0 deletions api/src/database-models/survey_block.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { z } from 'zod';

/**
* Survey Block Model.
*
* @description Data model for `survey_block`.
*/
export const SurveyBlockModel = z.object({
survey_block_id: z.number(),
survey_id: z.number(),
name: z.string().nullable(),
description: z.string().nullable(),
geometry: z.null(),
geography: z.string(),
geojson: z.any(),
create_date: z.string(),
create_user: z.number(),
update_date: z.string().nullable(),
update_user: z.number().nullable(),
revision_count: z.number()
});

export type SurveyBlockModel = z.infer<typeof SurveyBlockModel>;

/**
* Survey Block Record.
*
* @description Data record for `survey_block`.
*/
export const SurveyBlockRecord = SurveyBlockModel.omit({
create_date: true,
create_user: true,
update_date: true,
update_user: true,
revision_count: true
});

export type SurveyBlockRecord = z.infer<typeof SurveyBlockRecord>;
34 changes: 34 additions & 0 deletions api/src/database-models/survey_sample_block.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { z } from 'zod';

/**
* Survey Sample Block Model.
*
* @description Data model for `survey_sample_block`.
*/
export const SurveySampleBlockModel = z.object({
survey_sample_block_id: z.number(),
survey_sample_site_id: z.number(),
survey_block_id: z.number(),
create_date: z.string(),
create_user: z.number(),
update_date: z.string().nullable(),
update_user: z.number().nullable(),
revision_count: z.number()
});

export type SurveySampleBlockModel = z.infer<typeof SurveySampleBlockModel>;

/**
* Survey Sample Block Record.
*
* @description Data record for `survey_sample_block`.
*/
export const SurveySampleBlockRecord = SurveySampleBlockModel.omit({
create_date: true,
create_user: true,
update_date: true,
update_user: true,
revision_count: true
});

export type SurveySampleBlockRecord = z.infer<typeof SurveySampleBlockRecord>;
36 changes: 36 additions & 0 deletions api/src/database-models/survey_sample_method.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { z } from 'zod';

/**
* Survey Sample Method Model.
*
* @description Data model for `survey_sample_method`.
*/
export const SurveySampleMethodModel = z.object({
survey_sample_method_id: z.number(),
survey_sample_site_id: z.number(),
description: z.string().nullable(),
method_response_metric_id: z.number(),
method_technique_id: z.number(),
create_date: z.string(),
create_user: z.number(),
update_date: z.string().nullable(),
update_user: z.number().nullable(),
revision_count: z.number()
});

export type SurveySampleMethodModel = z.infer<typeof SurveySampleMethodModel>;

/**
* Survey Sample Method Record.
*
* @description Data record for `survey_sample_method`.
*/
export const SurveySampleMethodRecord = SurveySampleMethodModel.omit({
create_date: true,
create_user: true,
update_date: true,
update_user: true,
revision_count: true
});

export type SurveySampleMethodRecord = z.infer<typeof SurveySampleMethodRecord>;
37 changes: 37 additions & 0 deletions api/src/database-models/survey_sample_period.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { z } from 'zod';

/**
* Survey Sample Period Model.
*
* @description Data model for `survey_sample_period`.
*/
export const SurveySamplePeriodModel = z.object({
survey_sample_period_id: z.number(),
survey_sample_method_id: z.number(),
start_date: z.string().nullable(),
end_date: z.string().nullable(),
start_time: z.string().nullable(),
end_time: z.string().nullable(),
create_date: z.string(),
create_user: z.number(),
update_date: z.string().nullable(),
update_user: z.number().nullable(),
revision_count: z.number()
});

export type SurveySamplePeriodModel = z.infer<typeof SurveySamplePeriodModel>;

/**
* Survey Sample Period Record.
*
* @description Data record for `survey_sample_period`.
*/
export const SurveySamplePeriodRecord = SurveySamplePeriodModel.omit({
create_date: true,
create_user: true,
update_date: true,
update_user: true,
revision_count: true
});

export type SurveySamplePeriodRecord = z.infer<typeof SurveySamplePeriodRecord>;
38 changes: 38 additions & 0 deletions api/src/database-models/survey_sample_site.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { z } from 'zod';

/**
* Survey Sample Site Model.
*
* @description Data model for `survey_sample_site`.
*/
export const SurveySampleSiteModel = z.object({
survey_sample_site_id: z.number(),
survey_id: z.number(),
name: z.string(),
description: z.string().nullable(),
geometry: z.null(),
geography: z.string(),
geojson: z.any(),
create_date: z.string(),
create_user: z.number(),
update_date: z.string().nullable(),
update_user: z.number().nullable(),
revision_count: z.number()
});

export type SurveySampleSiteModel = z.infer<typeof SurveySampleSiteModel>;

/**
* Survey Sample Site Record.
*
* @description Data record for `survey_sample_site`.
*/
export const SurveySampleSiteRecord = SurveySampleSiteModel.omit({
create_date: true,
create_user: true,
update_date: true,
update_user: true,
revision_count: true
});

export type SurveySampleSiteRecord = z.infer<typeof SurveySampleSiteRecord>;
34 changes: 34 additions & 0 deletions api/src/database-models/survey_sample_stratum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { z } from 'zod';

/**
* Survey Sample Stratum Model.
*
* @description Data model for `survey_sample_stratum`.
*/
export const SurveySampleStratumModel = z.object({
survey_sample_stratum_id: z.number(),
survey_sample_site_id: z.number(),
survey_stratum_id: z.number(),
create_date: z.string(),
create_user: z.number(),
update_date: z.string().nullable(),
update_user: z.number().nullable(),
revision_count: z.number()
});

export type SurveySampleStratumModel = z.infer<typeof SurveySampleStratumModel>;

/**
* Survey Sample Stratum Record.
*
* @description Data record for `survey_sample_stratum`.
*/
export const SurveySampleStratumRecord = SurveySampleStratumModel.omit({
create_date: true,
create_user: true,
update_date: true,
update_user: true,
revision_count: true
});

export type SurveySampleStratumRecord = z.infer<typeof SurveySampleStratumRecord>;
35 changes: 35 additions & 0 deletions api/src/database-models/survey_stratum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { z } from 'zod';

/**
* Survey Stratum Model.
*
* @description Data model for `survey_stratum`.
*/
export const SurveyStratumModel = z.object({
survey_stratum_id: z.number(),
survey_id: z.number(),
name: z.string(),
description: z.string(),
create_date: z.string(),
create_user: z.number(),
update_date: z.string().nullable(),
update_user: z.number().nullable(),
revision_count: z.number()
});

export type SurveyStratumModel = z.infer<typeof SurveyStratumModel>;

/**
* Survey Stratum Record.
*
* @description Data record for `survey_stratum`.
*/
export const SurveyStratumRecord = SurveyStratumModel.omit({
create_date: true,
create_user: true,
update_date: true,
update_user: true,
revision_count: true
});

export type SurveyStratumRecord = z.infer<typeof SurveyStratumRecord>;
2 changes: 1 addition & 1 deletion api/src/openapi/schemas/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ export const surveyBlockSchema: OpenAPIV3.SchemaObject = {
title: 'Survey Block',
type: 'object',
additionalProperties: false,
required: ['name', 'description', 'survey_id', 'geojson'],
required: ['name', 'description', 'geojson'],
properties: {
survey_block_id: {
description: 'Survey block id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
paginationRequestQueryParamSchema,
paginationResponseSchema
} from '../../../../../../openapi/schemas/pagination';
import { surveyBlockSchema } from '../../../../../../openapi/schemas/survey';
import { techniqueSimpleViewSchema } from '../../../../../../openapi/schemas/technique';
import { authorizeRequestHandler } from '../../../../../../request-handlers/security/authorization';
import { PostSampleLocations, SampleLocationService } from '../../../../../../services/sample-location-service';
Expand Down Expand Up @@ -437,47 +438,7 @@ POST.apiDoc = {
},
blocks: {
type: 'array',
items: {
type: 'object',
additionalProperties: false,
required: ['survey_block_id'],
properties: {
survey_block_id: {
type: 'number'
},
survey_id: {
type: 'integer'
},
name: {
type: 'string'
},
description: {
type: 'string'
},
sample_block_count: {
type: 'number'
},
create_date: {
type: 'string',
nullable: true
},
create_user: {
type: 'integer',
nullable: true
},
update_date: {
type: 'string',
nullable: true
},
update_user: {
type: 'integer',
nullable: true
},
revision_count: {
type: 'number'
}
}
}
items: surveyBlockSchema
},
stratums: {
type: 'array',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ describe('getTechniques', () => {

expect(mockRes.jsonValue).to.eql({
techniques: [techniqueRecord],
count: 1,
pagination: {
total: 1,
per_page: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,14 @@ GET.apiDoc = {
'application/json': {
schema: {
type: 'object',
required: ['techniques', 'count'],
required: ['techniques', 'pagination'],
additionalProperties: false,
properties: {
techniques: {
type: 'array',
items: techniqueViewSchema
},
count: {
type: 'number',
description: 'Count of method techniques in the respective survey.'
},
pagination: { ...paginationResponseSchema }
pagination: paginationResponseSchema
}
}
}
Expand Down Expand Up @@ -254,7 +250,6 @@ export function getTechniques(): RequestHandler {

return res.status(200).json({
techniques,
count: techniquesCount,
pagination: makePaginationResponse(techniquesCount, paginationOptions)
});
} catch (error) {
Expand Down
Loading

0 comments on commit 7b3fc1c

Please sign in to comment.