-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'edge' into chore_no-unsafe-argument
- Loading branch information
Showing
47 changed files
with
1,030 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { uploadCsvFile } from './uploadCsvFile' | ||
|
||
export * from './types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Represents the parameters for uploading a CSV file. | ||
* | ||
* @interface UploadCsvFileParams | ||
* @property {File | string} [fileData] - File object for Desktop app and string for USB drive on ODD | ||
*/ | ||
|
||
export type FileData = File | string | ||
|
||
interface CsvFileData { | ||
id: string | ||
createdAt: string | ||
name: string | ||
} | ||
|
||
export interface UploadedCsvFileResponse { | ||
data: CsvFileData | ||
} | ||
|
||
export interface UploadedCsvFilesResponse { | ||
data: { | ||
files: CsvFileData[] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { v4 as uuidv4 } from 'uuid' | ||
// import { POST, request } from '../request' | ||
|
||
// import type { ResponsePromise } from '../request' | ||
import type { HostConfig } from '../types' | ||
import type { FileData /** UploadedCsvFileResponse */ } from './types' | ||
|
||
// export function uploadCsvFile( | ||
// config: HostConfig, | ||
// data FileData | ||
// ): ResponsePromise<UploadedCsvFileResponse> { | ||
// return request<UploadedCsvFileResponse>( | ||
// POST, | ||
// '/dataFiles', | ||
// null, | ||
// config, | ||
// data | ||
// ) | ||
// } | ||
|
||
// ToDo (kk:06/14/2024) remove when activate the above code | ||
export function uploadCsvFile( | ||
config: HostConfig, | ||
data: FileData | ||
// Note (kk: 06/14/2024) temporary using any for useUploadCsvFileMutation | ||
): Promise<any> { | ||
const fileId = uuidv4() | ||
const stub = { | ||
data: { | ||
id: fileId, | ||
createdAt: '2024-06-07T19:19:56.268029+00:00', | ||
name: 'rtp_mock_file.csv', | ||
}, | ||
} | ||
return Promise.resolve(stub) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { v4 as uuidv4 } from 'uuid' | ||
|
||
// import { GET, request } from '../request' | ||
|
||
// import type { ResponsePromise } from '../request' | ||
import type { HostConfig } from '../types' | ||
import type { UploadedCsvFilesResponse } from '../dataFiles/types' | ||
|
||
/** | ||
export function getCsvFiles( | ||
config: HostConfig, | ||
protocolId: string | ||
): ResponsePromise<UploadCsvFilesResponse> { | ||
return request<UploadCsvFilesResponse>( | ||
GET, | ||
`/protocols/${protocolId}/dataFiles`, | ||
null, | ||
config | ||
) | ||
} | ||
*/ | ||
|
||
// ToDo (kk:06/14/2024) remove when activate the above code | ||
export function getCsvFiles( | ||
config: HostConfig, | ||
protocolId: string | ||
): Promise<{ data: UploadedCsvFilesResponse }> { | ||
const fileIdOne = uuidv4() | ||
const fileIdTwo = uuidv4() | ||
const stub = { | ||
data: { | ||
files: [ | ||
{ | ||
id: fileIdOne, | ||
createdAt: '2024-06-07T19:19:56.268029+00:00', | ||
name: 'rtp_mock_file1.csv', | ||
}, | ||
{ | ||
id: fileIdTwo, | ||
createdAt: '2024-06-17T19:19:56.268029+00:00', | ||
name: 'rtp_mock_file2.csv', | ||
}, | ||
], | ||
}, | ||
} | ||
return Promise.resolve({ data: stub }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.