Skip to content

Commit

Permalink
chore: add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
stonith404 committed Oct 13, 2022
1 parent b57092c commit 9c3ab1c
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 153 deletions.
20 changes: 4 additions & 16 deletions backend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
{
"env": {
"browser": true,
"es2021": true
},
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true
}
220 changes: 102 additions & 118 deletions backend/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
"@types/node": "^18.7.23",
"@types/passport-jwt": "^3.0.7",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"cross-env": "^7.0.3",
"dotenv-cli": "^6.0.0",
"eslint": "^8.0.1",
"eslint": "^8.25.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"newman": "^5.3.2",
Expand All @@ -59,6 +59,6 @@
"ts-loader": "^9.4.1",
"ts-node": "^10.9.1",
"tsconfig-paths": "4.1.0",
"typescript": "^4.3.5"
"typescript": "^4.8.4"
}
}
1 change: 0 additions & 1 deletion backend/src/auth/dto/authRegister.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { PickType } from "@nestjs/swagger";
import { UserDTO } from "src/user/dto/user.dto";

export class AuthRegisterDTO extends UserDTO {}
2 changes: 1 addition & 1 deletion backend/src/auth/dto/refreshAccessToken.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsNotEmpty, IsString } from "class-validator";
import { IsNotEmpty } from "class-validator";

export class RefreshAccessTokenDTO {
@IsNotEmpty()
Expand Down
2 changes: 1 addition & 1 deletion backend/src/auth/strategy/jwt.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
});
}

async validate(payload: any) {
async validate(payload: { sub: string }) {
const user: User = await this.prisma.user.findUnique({
where: { id: payload.sub },
});
Expand Down
3 changes: 0 additions & 3 deletions backend/src/file/dto/file.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export class FileDTO {
@Expose()
size: string;

@Expose()
url: boolean;

share: ShareDTO;

from(partial: Partial<FileDTO>) {
Expand Down
1 change: 0 additions & 1 deletion backend/src/file/file.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Module } from "@nestjs/common";
import { JwtModule } from "@nestjs/jwt";
import { ShareModule } from "src/share/share.module";
import { ShareService } from "src/share/share.service";
import { FileController } from "./file.controller";
import { FileService } from "./file.service";

Expand Down
2 changes: 0 additions & 2 deletions backend/src/share/dto/sharePassword.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { IsNotEmpty } from "class-validator";

export class SharePasswordDto {
password: string;
}
7 changes: 1 addition & 6 deletions backend/src/share/share.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class ShareService {
}

async get(id: string) {
let share: any = await this.prisma.share.findUnique({
const share : any = await this.prisma.share.findUnique({
where: { id },
include: {
files: true,
Expand All @@ -115,11 +115,6 @@ export class ShareService {
if (!share || !share.uploadLocked)
throw new NotFoundException("Share not found");

share.files = share.files.map((file) => {
file["url"] = `http://localhost:8080/file/${file.id}`;
return file;
});

return share;
}

Expand Down

0 comments on commit 9c3ab1c

Please sign in to comment.