Skip to content

Commit

Permalink
BHBC-1841: Remove Project/Survey Publish Buttons And Related Code (#804)
Browse files Browse the repository at this point in the history
 - Project and survey UI no longer include publish button
 - API no longer has endpoints for publishing
  • Loading branch information
curtisupshall authored Jul 19, 2022
1 parent 5fdfc1e commit bfd211f
Show file tree
Hide file tree
Showing 73 changed files with 220 additions and 1,548 deletions.
2 changes: 1 addition & 1 deletion api/package-lock.json

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

1 change: 0 additions & 1 deletion api/src/constants/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export enum SUBMISSION_STATUS_TYPE {
'SUBMISSION_DATA_INGESTED' = 'Submission Data Ingested',
'SECURED' = 'Secured',
'AWAITING CURRATION' = 'Awaiting Curration',
'PUBLISHED' = 'Published',
'REJECTED' = 'Rejected',
'ON HOLD' = 'On Hold',
'SYSTEM_ERROR' = 'System Error'
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 @@ -29,7 +29,6 @@ export class GetProjectData {
end_date: string;
comments: string;
completion_status: string;
publish_date: string;
revision_count: number;

constructor(projectData?: any, activityData?: any[]) {
Expand All @@ -46,7 +45,6 @@ export class GetProjectData {
moment(projectData.end_date).endOf('day').isBefore(moment()) &&
COMPLETION_STATUS.COMPLETED) ||
COMPLETION_STATUS.ACTIVE;
this.publish_date = String(projectData?.publish_date || '');
this.revision_count = projectData?.revision_count ?? null;
}
}
Expand Down
4 changes: 2 additions & 2 deletions api/src/models/public/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getLogger } from '../../utils/logger';
const defaultLog = getLogger('models/public/project');

/**
* Pre-processes GET /projects/{id} coordinator data for public (published) projects
* Pre-processes GET /projects/{id} coordinator data for public projects
*
* @export
* @class GetPublicCoordinatorData
Expand All @@ -30,7 +30,7 @@ export class GetPublicCoordinatorData {
}

/**
* Pre-processes GET public (published) project attachments data
* Pre-processes GET public project attachments data
*
* @export
* @class GetPublicAttachmentsData
Expand Down
2 changes: 0 additions & 2 deletions api/src/models/survey-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export class GetSurveyData {
end_date: string;
biologist_first_name: string;
biologist_last_name: string;
publish_date: string;
survey_area_name: string;
geometry: Feature[];
revision_count: number;
Expand All @@ -29,7 +28,6 @@ export class GetSurveyData {
this.survey_name = obj?.name || '';
this.start_date = obj?.start_date || null;
this.end_date = obj?.end_date || null;
this.publish_date = String(obj?.publish_date || '');
this.geometry = (obj?.geojson?.length && obj.geojson) || [];
this.biologist_first_name = obj?.lead_first_name || '';
this.biologist_last_name = obj?.lead_last_name || '';
Expand Down
36 changes: 0 additions & 36 deletions api/src/paths/project/{projectId}/delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,42 +140,6 @@ describe('deleteProject', () => {
}
});

it('should throw a 400 error when user has insufficient role to delete published project', async () => {
sinon.stub(db, 'getDBConnection').returns({
...dbConnectionObj,
systemUserId: () => {
return 20;
},
query: async () => {
return {
rowCount: 1,
rows: [
{
id: 1,
publish_date: 'some date'
}
]
} as QueryResult<any>;
}
});

try {
const result = delete_project.deleteProject();

await result(
{ ...sampleReq, system_user: { role_names: [SYSTEM_ROLE.PROJECT_CREATOR] } },
(null as unknown) as any,
(null as unknown) as any
);
expect.fail();
} catch (actualError) {
expect((actualError as HTTPError).status).to.equal(400);
expect((actualError as HTTPError).message).to.equal(
'Cannot delete a published project if you are not a system administrator.'
);
}
});

it('should throw a 400 error when failed to get result for project attachments', async () => {
const mockQuery = sinon.stub();

Expand Down
3 changes: 1 addition & 2 deletions api/src/paths/project/{projectId}/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,13 @@ export function deleteProject(): RequestHandler {

const connection = getDBConnection(req['keycloak_token']);
const projectId = Number(req.params.projectId);
const userRoles = req['system_user']['role_names'];

try {
await connection.open();

const projectService = new ProjectService(connection);

const resp = await projectService.deleteProject(projectId, userRoles);
const resp = await projectService.deleteProject(projectId);

await connection.commit();

Expand Down
141 changes: 0 additions & 141 deletions api/src/paths/project/{projectId}/publish.test.ts

This file was deleted.

Loading

0 comments on commit bfd211f

Please sign in to comment.