removed left overs from ohter approaches
MODIFY
package.json
package.json
"xmake:download-node-headers": "wget https://nexus.wdf.sap.corp:8443/nexus/service/local/repositories/3rd-party.releases.manual-uploads.hosted/content/org/nodejs/download/node/node-headers/12.13.0/node-headers-12.13.0.tar.gz -P ${WORKSPACE}/gen/tmp/"
},
"dependencies": {
- "JSONStream": "^1.3.5",
"ajv": "^6.12.6",
"ajv-sanitizer": "^1.1.4",
"axios": "^0.21.1",
"csvtojson": "^2.0.10",
"ejs": "^3.1.5",
"emailjs": "^3.3.0",
- "event-stream": "^4.0.1",
"express": "^4.17.1",
"express-sanitizer": "^1.0.5",
"file-type": "^16.2.0",
"firebase-admin": "^9.4.2",
- "gridfs-stream": "^1.1.1",
"helmet": "^4.2.0",
"hpp": "^0.2.3",
"http-status-codes": "^2.1.4",
"i18n-iso-countries": "^6.4.0",
"i18n-js": "^3.8.0",
"intl": "^1.2.5",
- "json-array-streams": "^1.0.1",
"jsonwebtoken": "^8.5.1",
"locale": "^0.1.0",
"lodash": "^4.17.20",
"mongo-uri-builder": "^3.2.2",
"mongodb": "^3.6.3",
"morgan": "^1.10.0",
- "multer": "^1.4.2",
"mustache": "^4.0.1",
"node-cron": "^2.0.3",
"object-sizeof": "^1.6.1",

MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -18,12 +18,10 @@ import Cypher from '../../../../utils/Cypher';
import { DataResult } from '../../../../types/DataResult';
import EmspOCPIClient from '../../../../client/ocpi/EmspOCPIClient';
import I18nManager from '../../../../utils/I18nManager';
-import JSONStream from 'JSONStream';
import Logging from '../../../../utils/Logging';
import NotificationHandler from '../../../../notification/NotificationHandler';
import OCPIClientFactory from '../../../../client/ocpi/OCPIClientFactory';
import { OCPIRole } from '../../../../types/ocpi/OCPIRole';
-import { Readable } from 'stream';
import { ServerAction } from '../../../../types/Server';
import SettingStorage from '../../../../storage/mongodb/SettingStorage';
import SiteStorage from '../../../../storage/mongodb/SiteStorage';
@@ -38,15 +36,9 @@ import UserSecurity from './security/UserSecurity';
import UserStorage from '../../../../storage/mongodb/UserStorage';
import Utils from '../../../../utils/Utils';
import UtilsService from './UtilsService';
-import csvStream from 'csv-stream';
import csvToJson from 'csvtojson/v2';
import fs from 'fs';
-import { inspect } from 'util';
import moment from 'moment';
-import os from 'os';
-import path from 'path';
-import { resolve } from 'bluebird';
-import through from 'through';
const MODULE_NAME = 'UserService';
@@ -868,77 +860,6 @@ export default class UserService {
resolve();
}));
-
- // Const cStream = new csvStream()
- // const busboy = new Busboy({ headers: req.headers });
- // const jStream = JSONStream.parse('users.*');
-
- // busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
- // file.pipe(cStream);
- // });
-
- // cStream.on('data', async function(data) {
- // await UserStorage.saveImportedUser(req.user.tenantID, data);
- // });
-
- // jStream.on('data', async function(data) {
- // await UserStorage.saveImportedUser(req.user.tenantID, data);
- // });
-
- // busboy.on('finish', function() {
- // res.end('That\'s all folks!');
- // });
-
- // csvToJson().fromStream(req).subscribe(async (json) => new Promise((resolve, reject) => {
- // console.log(json);
- // }).then());
-
- // req.pipe(busboy);
-
- // res.json('uploading');
- // next();
-
-
- // Return req.pipe(busboy);
-
- // JStream.on(function(data) {
- // console.log('received:', data);
- // });
-
- // busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
- // console.log('File [' + fieldname + ']: filename: ' + filename + ', encoding: ' + encoding + ', mimetype: ' + mimetype);
- // file.on('data', function(data) {
- // console.log('File [' + fieldname + '] got ' + data.length + ' bytes');
- // console.log(data);
- // });
- // file.on('end', function() {
- // console.log('File [' + fieldname + '] Finished');
- // });
- // });
- // busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) {
- // console.log('Field [' + fieldname + ']: value: ' + val);
- // });
- // busboy.on('finish', function() {
- // console.log('Done parsing form!');
- // res.end();
- // });
-
-
- // Upload(req, res, function(err) {
- // if (err) {
- // res.redirect(req.headers.referer + '/error.html');
- // return;
- // }
-
- // if (!req) {
- // res.redirect(req.headers.referer + '/error.html');
-
- // } else {
- // // Implement your own logic if needed. Like moving the file, renaming the file, etc.
- // res.redirect(req.headers.referer);
- // }
- // }).single('test');
-
}
public static async handleCreateUser(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {

removed left overs from ohter approaches