Skip to content

Commit

Permalink
Update interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
NickPhura committed Dec 14, 2023
1 parent e310ec1 commit 990d05b
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import DialogTitle from '@mui/material/DialogTitle';
import useTheme from '@mui/material/styles/useTheme';
import useMediaQuery from '@mui/material/useMediaQuery';
import CompleteSecurityReviewStatusMessage from 'features/submissions/components/PublishSecurityReview/CompleteSecurityReviewStatusMessage';
import { SubmissionRecordWithSecurity } from 'interfaces/useDatasetApi.interface';
import { SubmissionRecordWithSecurity } from 'interfaces/useSubmissionsApi.interface';

export interface ICompleteSecurityReviewDialogProps {
submission: SubmissionRecordWithSecurity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import Icon from '@mdi/react';
import Alert from '@mui/material/Alert';
import AlertTitle from '@mui/material/AlertTitle';
import { Box } from '@mui/system';
import { SECURITY_APPLIED_STATUS, SubmissionRecordWithSecurity } from 'interfaces/useDatasetApi.interface';
import { SECURITY_APPLIED_STATUS } from 'interfaces/useDatasetApi.interface';
import { SubmissionRecordWithSecurity } from 'interfaces/useSubmissionsApi.interface';

export interface ICompleteSecurityReviewStatusMessageProps {
submission: SubmissionRecordWithSecurity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Button from '@mui/material/Button';
import CompleteSecurityReviewDialog from 'features/submissions/components/PublishSecurityReview/CompleteSecurityReviewDialog';
import RemoveSecurityReviewDialog from 'features/submissions/components/PublishSecurityReview/RemoveSecurityReviewDialog';
import { SubmissionRecordWithSecurity } from 'interfaces/useDatasetApi.interface';
import { SubmissionRecordWithSecurity } from 'interfaces/useSubmissionsApi.interface';
import { useState } from 'react';

export interface IPublishSecurityReviewButtonProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { mdiClipboardTextOutline, mdiLock, mdiLockAlertOutline, mdiLockOpenVaria
import Icon from '@mdi/react';
import Typography from '@mui/material/Typography';
import { DATE_FORMAT } from 'constants/dateTimeFormats';
import { SECURITY_APPLIED_STATUS, SubmissionRecordWithSecurity } from 'interfaces/useDatasetApi.interface';
import { SECURITY_APPLIED_STATUS } from 'interfaces/useDatasetApi.interface';
import { SubmissionRecordWithSecurity } from 'interfaces/useSubmissionsApi.interface';
import { getFormattedDate } from 'utils/Utils';

export interface ISubmissionHeaderSecurityStatusProps {
Expand Down
25 changes: 11 additions & 14 deletions app/src/hooks/api/useSubmissionsApi.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { AxiosInstance } from 'axios';
import { SECURITY_APPLIED_STATUS, SubmissionRecord } from 'interfaces/useDatasetApi.interface';
import { IGetSubmissionResponse, IListSubmissionsResponse, ISubmission } from 'interfaces/useSubmissionsApi.interface';
import { SECURITY_APPLIED_STATUS } from 'interfaces/useDatasetApi.interface';
import {
IGetSubmissionResponse,
IListSubmissionsResponse,
ISubmission,
SubmissionRecordWithRootFeature
} from 'interfaces/useSubmissionsApi.interface';

/**
* Returns a set of supported CRUD api methods submissions.
Expand Down Expand Up @@ -86,13 +91,9 @@ const useSubmissionsApi = (axios: AxiosInstance) => {
/**
* Fetch all submissions that have not completed security review.
*
* @return {*} {(Promise<
* (SubmissionRecord & { feature_type_id: number; feature_type: string })[]
* >)}
* @return {*} {Promise<SubmissionRecordWithRootFeature[]>}
*/
const getUnreviewedSubmissions = async (): Promise<
(SubmissionRecord & { feature_type_id: number; feature_type: string })[]
> => {
const getUnreviewedSubmissions = async (): Promise<SubmissionRecordWithRootFeature[]> => {
const { data } = await axios.get(`api/administrative/submission/unreviewed`);

return data;
Expand All @@ -101,13 +102,9 @@ const useSubmissionsApi = (axios: AxiosInstance) => {
/**
* Fetch all submissions that have completed security review.
*
* @return {*} {(Promise<
* (SubmissionRecord & { feature_type_id: number; feature_type: string })[]
* >)}
* @return {*} {Promise<SubmissionRecordWithRootFeature[]>}
*/
const getReviewedSubmissions = async (): Promise<
(SubmissionRecord & { feature_type_id: number; feature_type: string })[]
> => {
const getReviewedSubmissions = async (): Promise<SubmissionRecordWithRootFeature[]> => {
const { data } = await axios.get(`api/administrative/submission/reviewed`);

return data;
Expand Down
29 changes: 0 additions & 29 deletions app/src/interfaces/useDatasetApi.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,35 +59,6 @@ export interface IDatasetForReview {
keywords: string[];
}

export type SubmissionRecord = {
submission_id: number;
uuid: string;
security_review_timestamp: string | null;
source_system: string;
name: string;
description: string;
create_date: string;
create_user: number;
update_date: string | null;
update_user: number | null;
revision_count: number;
};

export type SubmissionRecordWithSecurity = {
submission_id: number;
uuid: string;
security_review_timestamp: string | null;
source_system: string;
name: string;
description: string;
create_date: string;
create_user: number;
update_date: string | null;
update_user: number | null;
revision_count: number;
security: SECURITY_APPLIED_STATUS;
};

export interface ISubmission {
submission_id: number;
uuid: string;
Expand Down
25 changes: 24 additions & 1 deletion app/src/interfaces/useSubmissionsApi.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SECURITY_APPLIED_STATUS, SubmissionRecordWithSecurity } from './useDatasetApi.interface';
import { SECURITY_APPLIED_STATUS } from './useDatasetApi.interface';

export type IListSubmissionsResponse = Array<{
submission_id: number;
Expand All @@ -20,6 +20,29 @@ export type IListSubmissionsResponse = Array<{

/** NET-NEW INTERFACES FOR UPDATED SCHEMA **/

export type SubmissionRecord = {
submission_id: number;
uuid: string;
security_review_timestamp: string | null;
source_system: string;
name: string;
description: string;
create_date: string;
create_user: number;
update_date: string | null;
update_user: number | null;
revision_count: number;
};

export type SubmissionRecordWithSecurity = SubmissionRecord & {
security: SECURITY_APPLIED_STATUS;
};

export type SubmissionRecordWithRootFeature = SubmissionRecord & {
feature_type_id: number;
feature_type: string;
};

export interface ISubmission {
submission_id: number;
submission_feature_id: number;
Expand Down

0 comments on commit 990d05b

Please sign in to comment.