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-627: Fix Survey Spatial Telemetry Components #1453

Merged
merged 25 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
606a535
Minor UI cleanup/tweaks.
NickPhura Dec 11, 2024
39765ab
Update delete survey procedure
NickPhura Dec 12, 2024
a4cdc88
Delete old bctw-related api code
NickPhura Dec 12, 2024
ff76ba0
Fix telemetry credential upload endpoint
NickPhura Dec 12, 2024
d2ffebd
Misc fix
NickPhura Dec 12, 2024
793d598
Fix Manual telemetry create, edit, delete.
NickPhura Dec 12, 2024
068d15a
Update backend service/repo functions. Remove some duplicate code.
NickPhura Dec 13, 2024
19ddb45
Add telemetry pagination/sorting.
NickPhura Dec 13, 2024
f8a0dce
Disable telemetry import button
NickPhura Dec 13, 2024
f82a406
Fix Tests
NickPhura Dec 13, 2024
282056c
WIP: Add tabs to survey telemetry spatial table. Load deployments in …
NickPhura Dec 13, 2024
0720f6f
Update Survey spatial components (telemetry)
NickPhura Dec 14, 2024
b33a7a4
Merge remote-tracking branch 'origin/SIMSBIOHUB-627' into SIMSBIOHUB-…
NickPhura Dec 16, 2024
55318d9
Change deployments2 to deployments
NickPhura Dec 16, 2024
80b874c
Rename trigger
NickPhura Dec 16, 2024
8c62494
Remove more deprecated env vars
NickPhura Dec 16, 2024
494f156
ignore-skip
NickPhura Dec 16, 2024
ec60a53
Fix migration
NickPhura Dec 16, 2024
7d25d8c
fix: dropped telemetryContext + useTelemetryContext
MacQSL Dec 16, 2024
e794f01
Merge branch 'SIMSBIOHUB-627-cleanup-2' of https://github.com/bcgov/b…
MacQSL Dec 16, 2024
2ae93f4
fix: jsdoc
MacQSL Dec 16, 2024
8107cff
Telemetry context tweaks.
NickPhura Dec 17, 2024
b5be819
Remove logs
NickPhura Dec 17, 2024
6feadcf
Merge branch 'SIMSBIOHUB-627-cleanup-2' of https://github.com/bcgov/b…
NickPhura Dec 17, 2024
4d304ce
Fix telemetry sorting
NickPhura Dec 17, 2024
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
2 changes: 1 addition & 1 deletion api/src/database-models/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { z } from 'zod';
* @description Data model for `deployment`.
*/
export const DeploymentModel = z.object({
deployment2_id: z.number(),
deployment_id: z.number(),
survey_id: z.number(),
critter_id: z.number(),
device_id: z.number(),
Expand Down
2 changes: 1 addition & 1 deletion api/src/database-models/telemetry_manual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { z } from 'zod';
*/
export const TelemetryManualModel = z.object({
telemetry_manual_id: z.string().uuid(),
deployment2_id: z.number(),
deployment_id: z.number(),
latitude: z.number(),
longitude: z.number(),
acquisition_date: z.string(),
Expand Down
18 changes: 0 additions & 18 deletions api/src/models/survey-deployment.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { TelemetryDeploymentService } from '../../../../../../../../services/tel
import { getLogger } from '../../../../../../../../utils/logger';
import { numberOrNull } from '../../../../../../../../utils/string-utils';

const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/critters/{critterId}/deployments2');
const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/critters/{critterId}/deployments');

export const POST: Operation = [
authorizeRequestHandler((req) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import sinon from 'sinon';
import sinonChai from 'sinon-chai';
import * as db from '../../../../../../database/db';
import { TelemetryDeploymentService } from '../../../../../../services/telemetry-services/telemetry-deployment-service';
import { getMockDBConnection, getRequestHandlerMocks } from '../../../.././../../__mocks__/db';
import { getMockDBConnection, getRequestHandlerMocks } from '../../../../../../__mocks__/db';
import { deleteDeploymentsInSurvey } from './delete';

chai.use(sinonChai);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { authorizeRequestHandler } from '../../../../../../request-handlers/secu
import { TelemetryDeploymentService } from '../../../../../../services/telemetry-services/telemetry-deployment-service';
import { getLogger } from '../../../../../../utils/logger';

const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments2/delete');
const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments/delete');

export const POST: Operation = [
authorizeRequestHandler((req) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('getDeploymentsInSurvey', () => {
const mockDeployments = [
{
// deployment data
deployment2_id: 1,
deployment_id: 1,
survey_id: 66,
critter_id: 2,
device_id: 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
makePaginationResponse
} from '../../../../../../utils/pagination';

const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments2/index');
const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments/index');

export const GET: Operation = [
authorizeRequestHandler((req) => {
Expand Down Expand Up @@ -86,7 +86,7 @@ GET.apiDoc = {
additionalProperties: false,
required: [
// deployment data
'deployment2_id',
'deployment_id',
'survey_id',
'critter_id',
'device_id',
Expand All @@ -109,7 +109,7 @@ GET.apiDoc = {
'critterbase_critter_id'
],
properties: {
deployment2_id: {
deployment_id: {
type: 'integer',
description: 'Id of the deployment in the Survey.'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { authorizeRequestHandler } from '../../../../../../../request-handlers/s
import { TelemetryVendorService } from '../../../../../../../services/telemetry-services/telemetry-vendor-service';
import { getLogger } from '../../../../../../../utils/logger';

const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments2/telemetry/index');
const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments/telemetry/index');

export const GET: Operation = [
authorizeRequestHandler((req) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { authorizeRequestHandler } from '../../../../../../../../request-handler
import { TelemetryVendorService } from '../../../../../../../../services/telemetry-services/telemetry-vendor-service';
import { getLogger } from '../../../../../../../../utils/logger';

const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments2/telemetry/manual/delete');
const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments/telemetry/manual/delete');

export const POST: Operation = [
authorizeRequestHandler((req) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('index', () => {

const mockTelemetry = [
{
deployment2_id: 1,
deployment_id: 1,
latitude: 1,
longitude: 1,
acquisition_date: '2021-01-01',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { authorizeRequestHandler } from '../../../../../../../../request-handler
import { TelemetryVendorService } from '../../../../../../../../services/telemetry-services/telemetry-vendor-service';
import { getLogger } from '../../../../../../../../utils/logger';

const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments2/telemetry/manual/index');
const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments/telemetry/manual/index');

export const POST: Operation = [
authorizeRequestHandler((req) => {
Expand Down Expand Up @@ -76,9 +76,9 @@ POST.apiDoc = {
items: {
type: 'object',
additionalProperties: false,
required: ['deployment2_id', 'latitude', 'longitude', 'acquisition_date', 'transmission_date'],
required: ['deployment_id', 'latitude', 'longitude', 'acquisition_date', 'transmission_date'],
properties: {
deployment2_id: {
deployment_id: {
type: 'integer',
minimum: 1
},
Expand Down Expand Up @@ -235,7 +235,7 @@ PUT.apiDoc = {
additionalProperties: false,
required: [
'telemetry_manual_id',
'deployment2_id',
'deployment_id',
'latitude',
'longitude',
'acquisition_date',
Expand All @@ -246,7 +246,7 @@ PUT.apiDoc = {
type: 'string',
format: 'uuid'
},
deployment2_id: {
deployment_id: {
type: 'integer',
minimum: 1
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('getDeploymentById', () => {
sinon.stub(db, 'getDBConnection').returns(mockDBConnection);

const mockDeployment = {
deployment2_id: 2,
deployment_id: 2,
survey_id: 3,
critter_id: 4,
device_id: 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ GET.apiDoc = {
type: 'object',
additionalProperties: false,
required: [
'deployment2_id',
'deployment_id',
'survey_id',
'critter_id',
'device_id',
Expand All @@ -108,7 +108,7 @@ GET.apiDoc = {
'critterbase_critter_id'
],
properties: {
deployment2_id: {
deployment_id: {
type: 'integer',
description: 'Id of the deployment in the Survey.'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { authorizeRequestHandler } from '../../../../../../../../request-handler
import { TelemetryVendorService } from '../../../../../../../../services/telemetry-services/telemetry-vendor-service';
import { getLogger } from '../../../../../../../../utils/logger';

const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments2/{deploymentId}/telemetry/index');
const defaultLog = getLogger('paths/project/{projectId}/survey/{surveyId}/deployments/{deploymentId}/telemetry/index');

export const GET: Operation = [
authorizeRequestHandler((req) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const CreateDeployment = DeploymentRecord.omit({
attachment_start_timestamp: true,
attachment_end_timestamp: true,
// Primary key
deployment2_id: true
deployment_id: true
});

export type CreateDeployment = z.infer<typeof CreateDeployment>;
Expand All @@ -34,7 +34,7 @@ export const UpdateDeployment = DeploymentRecord.omit({
attachment_start_timestamp: true,
attachment_end_timestamp: true,
// Primary key and survey not updatable
deployment2_id: true,
deployment_id: true,
survey_id: true
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('TelemetryDeploymentRepository', () => {
describe('getDeploymentsForSurvey', () => {
it('should get deployments by survey ID successfully', async () => {
const mockDeploymentRecord = {
deployment2_id: 1,
deployment_id: 1,
survey_id: 1,
critter_id: 1,
device_id: 1,
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('TelemetryDeploymentRepository', () => {

it('should get a deployment by ID successfully', async () => {
const mockDeploymentRecord = {
deployment2_id: 1,
deployment_id: 1,
survey_id: 1,
critter_id: 1,
device_id: 1,
Expand Down Expand Up @@ -179,7 +179,7 @@ describe('TelemetryDeploymentRepository', () => {
describe('getDeploymentsForCritterId', () => {
it('should get deployments by critter ID successfully', async () => {
const mockDeploymentRecord = {
deployment2_id: 1,
deployment_id: 1,
survey_id: 1,
critter_id: 1,
device_id: 1,
Expand Down
Loading
Loading