Fixed Linting Problems
This commit is contained in:
parent
9fae60cb73
commit
4d41bb204c
@ -10,8 +10,8 @@
|
|||||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
"start": "nest start",
|
"start": "nest start",
|
||||||
"start:dev": "nest start --watch",
|
"start:dev": "nest start --watch",
|
||||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
|
"lint": "eslint \"src/**/*.ts\"",
|
||||||
"lint-fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
"lint-fix": "eslint \"src/**/*.ts\" --fix",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"test:cov": "jest --coverage",
|
"test:cov": "jest --coverage",
|
||||||
|
@ -1,57 +1,57 @@
|
|||||||
import { Controller, Get, Module } from '@nestjs/common';
|
import { Controller, Get, Module } from '@nestjs/common';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { INode, JWTToken, User, UserRole } from './entities';
|
import { INode, JWTToken, User, UserRole } from './entities';
|
||||||
import FileSystemModule from './modules/filesystem';
|
import FileSystemModule from './modules/filesystem';
|
||||||
import { JWTAuthGuard, Role, RoleGuard } from './authguards';
|
import { JWTAuthGuard, Role, RoleGuard } from './authguards';
|
||||||
import AuthModule from './modules/auth';
|
import AuthModule from './modules/auth';
|
||||||
import { ServeStaticModule } from '@nestjs/serve-static';
|
import { ServeStaticModule } from '@nestjs/serve-static';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
declare const PROD: boolean | undefined;
|
declare const PROD: boolean | undefined;
|
||||||
|
|
||||||
@Controller('test')
|
@Controller('test')
|
||||||
class TestController {
|
class TestController {
|
||||||
@Role(UserRole.USER)
|
@Role(UserRole.USER)
|
||||||
@Get('hello')
|
@Get('hello')
|
||||||
getHello(): string {
|
getHello(): string {
|
||||||
return 'UwU';
|
return 'UwU';
|
||||||
}
|
}
|
||||||
|
|
||||||
@Role(UserRole.ADMIN)
|
@Role(UserRole.ADMIN)
|
||||||
@Get('hello2')
|
@Get('hello2')
|
||||||
getHelloAdmin(): string {
|
getHelloAdmin(): string {
|
||||||
return 'UwU Admin';
|
return 'UwU Admin';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
TypeOrmModule.forRoot({
|
TypeOrmModule.forRoot({
|
||||||
type: 'sqlite',
|
type: 'sqlite',
|
||||||
database: 'sqlite.db',
|
database: 'sqlite.db',
|
||||||
synchronize: true,
|
synchronize: true,
|
||||||
entities: [User, INode, JWTToken]
|
entities: [User, INode, JWTToken]
|
||||||
}),
|
}),
|
||||||
ServeStaticModule.forRoot({
|
ServeStaticModule.forRoot({
|
||||||
rootPath:
|
rootPath:
|
||||||
typeof PROD !== 'undefined' && PROD
|
typeof PROD !== 'undefined' && PROD
|
||||||
? join(__dirname, 'frontend')
|
? join(__dirname, 'frontend')
|
||||||
: join(__dirname, '..', '..', 'frontend', 'dist'),
|
: join(__dirname, '..', '..', 'frontend', 'dist'),
|
||||||
exclude: ['/api*']
|
exclude: ['/api*']
|
||||||
}),
|
}),
|
||||||
FileSystemModule,
|
FileSystemModule,
|
||||||
AuthModule
|
AuthModule
|
||||||
],
|
],
|
||||||
controllers: [TestController],
|
controllers: [TestController],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: 'APP_GUARD',
|
provide: 'APP_GUARD',
|
||||||
useClass: JWTAuthGuard
|
useClass: JWTAuthGuard
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: 'APP_GUARD',
|
provide: 'APP_GUARD',
|
||||||
useClass: RoleGuard
|
useClass: RoleGuard
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
Loading…
Reference in New Issue
Block a user