Skip to content

Commit

Permalink
Linting and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Deep Akabari committed Aug 16, 2024
1 parent 6a7e8bd commit 1e5b513
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 43 deletions.
36 changes: 0 additions & 36 deletions .vscode/settings.json

This file was deleted.

6 changes: 3 additions & 3 deletions src/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import winston from 'winston';

export const logger = winston.createLogger({
level: 'info', // Set the desired log level (e.g., 'info', 'error', 'debug')
level: 'info',
format: winston.format.combine(
winston.format.colorize(),
winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), // Customize timestamp format
winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
winston.format.printf(({ timestamp, level, message }) => {
return `${timestamp} [${level}]: ${message}`;
}),
),
transports: [
new winston.transports.Console(), // Log to console (you can add more transports here)
new winston.transports.Console(),
],
});
8 changes: 4 additions & 4 deletions src/utils/multerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import multer, { StorageEngine } from 'multer';
import { Request } from 'express';
import { existsSync } from 'fs';

const uploadDirectory = './src/public/images'
const uploadDirectory = './src/public/images';
export const fileStorage: StorageEngine = multer.diskStorage({
destination: (req, file, cb) => {
cb(null, uploadDirectory);
},
filename: (req, file, cb) => {
let fileName = file.originalname;
const extension = fileName.split('.').pop();
const baseFileName = fileName.substring(0, fileName.lastIndexOf('.'))
const baseFileName = fileName.substring(0, fileName.lastIndexOf('.'));

let counter = 1;
while(existsSync(`${uploadDirectory}/${fileName}`)) {
fileName = `${baseFileName} (${counter}).${extension}`
while (existsSync(`${uploadDirectory}/${fileName}`)) {
fileName = `${baseFileName} (${counter}).${extension}`;
counter++;
}
cb(null, fileName);
Expand Down

0 comments on commit 1e5b513

Please sign in to comment.