Skip to content

Commit

Permalink
Merge pull request #294 from Roger13579/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
y0000ga authored Jun 24, 2024
2 parents 139bb7d + b088a0c commit e2f279b
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 6 deletions.
78 changes: 74 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"passport-local": "^1.0.0",
"swagger-autogen": "^2.23.7",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.0"
"swagger-ui-express": "^5.0.0",
"uuid": "^10.0.0"
},
"devDependencies": {
"@types/cookie-parser": "^1.4.7",
Expand All @@ -56,6 +57,7 @@
"@types/passport-local": "^1.0.38",
"@types/swagger-jsdoc": "^6.0.4",
"@types/swagger-ui-express": "^4.1.6",
"@types/uuid": "^10.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.29.1",
Expand Down
3 changes: 2 additions & 1 deletion src/dto/upload/uploadFileDto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path';
import { IUser } from '../../models/user';
import { IUploadFileReq } from '../../types/upload.type';
import { v4 as uuidv4 } from 'uuid';

export class UploadFileDTO {
private readonly _file: Express.Multer.File;
Expand All @@ -16,6 +17,6 @@ export class UploadFileDTO {
constructor(req: IUploadFileReq) {
const { files, params, user } = req;
this._file = files[0];
this._name = `${params.type}/${params.category}/${(user as IUser)._id}${path.extname(files[0].originalname).toLowerCase()}`;
this._name = `${params.type}/${params.category}/${(user as IUser)._id}${uuidv4() + path.extname(files[0].originalname).toLowerCase()}`;
}
}

0 comments on commit e2f279b

Please sign in to comment.