Skip to content

Commit b5972e7

Browse files
committed
resolving comment and conflicts
1 parent df7ab22 commit b5972e7

File tree

7 files changed

+195
-287
lines changed

7 files changed

+195
-287
lines changed

src/config/config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const getConfig = () => {
2323
trustSelfSigned: process.env.TRUST_SELF_SIGNED === 'false' ? false : true,
2424
runningMode: process.env.MODE || '',
2525
bodySizeLimit: process.env.BODY_SIZE_LIMIT || '50mb',
26-
createSampleTable: process.env.CREATE_SAMPLE_TABLE === 'true' ? true : false,
2726
minio: {
2827
endPoint: process.env.MINIO_ENDPOINT || 'localhost',
2928
port: process.env.MINIO_PORT ? parseInt(process.env.MINIO_PORT) : 9000,

src/index.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ import routes from './routes/index';
66
import { setupMediator } from './openhim/openhim';
77
import {
88
createMinioBucketListeners,
9-
} from './utils/minio';
9+
} from './utils/minioClient';
1010

1111
const app = express();
1212

13-
const prefix = getConfig().runningMode === 'testing' ? '/' : '/climate';
14-
15-
app.use(prefix, routes);
13+
app.use('/', routes);
1614

1715
createMinioBucketListeners();
1816

src/routes/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import logger from '../logger';
66
import fs from 'fs/promises';
77
import path from 'path';
88
import e from 'express';
9-
import { uploadToMinio } from '../utils/minio';
9+
import { uploadToMinio } from '../utils/minioClient';
1010

1111
// Constants
1212
const VALID_MIME_TYPES = ['text/csv', 'application/json'] as const;

src/utils/file-validators.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ export function validateJsonFile(file: Buffer) {
1111
export function getCsvHeaders(file: Buffer) {
1212
//convert the buffer to a string
1313
const csv = file.toString();
14+
//check if the new line character is \n or \r\n
15+
const newLineChar = csv.includes('\r\n') ? '\r\n' : '\n';
1416
//get the first line of the csv file
15-
const firstLine = csv.split('\n')[0];
17+
const firstLine = csv.split(newLineChar)[0];
1618
//split the first line by commas
1719
const columns = firstLine.split(',');
1820

src/utils/minio.ts

-187
This file was deleted.

0 commit comments

Comments
 (0)