Skip to content

Commit

Permalink
resolving comment and conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
brett-onions committed Nov 22, 2024
1 parent df7ab22 commit b5972e7
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 287 deletions.
1 change: 0 additions & 1 deletion src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const getConfig = () => {
trustSelfSigned: process.env.TRUST_SELF_SIGNED === 'false' ? false : true,
runningMode: process.env.MODE || '',
bodySizeLimit: process.env.BODY_SIZE_LIMIT || '50mb',
createSampleTable: process.env.CREATE_SAMPLE_TABLE === 'true' ? true : false,
minio: {
endPoint: process.env.MINIO_ENDPOINT || 'localhost',
port: process.env.MINIO_PORT ? parseInt(process.env.MINIO_PORT) : 9000,
Expand Down
6 changes: 2 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import routes from './routes/index';
import { setupMediator } from './openhim/openhim';
import {
createMinioBucketListeners,
} from './utils/minio';
} from './utils/minioClient';

const app = express();

const prefix = getConfig().runningMode === 'testing' ? '/' : '/climate';

app.use(prefix, routes);
app.use('/', routes);

createMinioBucketListeners();

Expand Down
2 changes: 1 addition & 1 deletion src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import logger from '../logger';
import fs from 'fs/promises';
import path from 'path';
import e from 'express';
import { uploadToMinio } from '../utils/minio';
import { uploadToMinio } from '../utils/minioClient';

// Constants
const VALID_MIME_TYPES = ['text/csv', 'application/json'] as const;
Expand Down
4 changes: 3 additions & 1 deletion src/utils/file-validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export function validateJsonFile(file: Buffer) {
export function getCsvHeaders(file: Buffer) {
//convert the buffer to a string
const csv = file.toString();
//check if the new line character is \n or \r\n
const newLineChar = csv.includes('\r\n') ? '\r\n' : '\n';
//get the first line of the csv file
const firstLine = csv.split('\n')[0];
const firstLine = csv.split(newLineChar)[0];
//split the first line by commas
const columns = firstLine.split(',');

Expand Down
187 changes: 0 additions & 187 deletions src/utils/minio.ts

This file was deleted.

Loading

0 comments on commit b5972e7

Please sign in to comment.