diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts
index 4684cfa..711a60e 100644
--- a/backend/src/app.module.ts
+++ b/backend/src/app.module.ts
@@ -1,18 +1,19 @@
+import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
import { Module } from '@nestjs/common';
-import { AppService } from './app.service';
+import { ConfigModule } from '@nestjs/config';
import { GraphQLModule } from '@nestjs/graphql';
-import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
-import { join } from 'path';
import { TypeOrmModule } from '@nestjs/typeorm';
-import { UserModule } from './user/user.module';
-import { User } from './user/user.model';
+import { join } from 'path';
import { AuthModule } from './auth/auth.module';
+import { ChatModule } from './chat/chat.module';
import { ProjectModule } from './project/project.module';
import { TokenModule } from './token/token.module';
-import { ConfigModule, ConfigService } from '@nestjs/config';
-import { JwtModule } from '@nestjs/jwt';
-import { JwtCacheService } from './auth/jwt-cache.service';
-import { ChatModule } from './chat/chat.module';
+import { UserModule } from './user/user.module';
+import { InitModule } from './init/init.module';
+import { RolesGuard } from './guard/roles.guard';
+import { MenuGuard } from './guard/menu.guard';
+import { User } from './user/user.model';
+import { AppResolver } from './app.resolver';
@Module({
imports: [
@@ -32,12 +33,14 @@ import { ChatModule } from './chat/chat.module';
logging: true,
entities: [__dirname + '/**/*.model{.ts,.js}'],
}),
+ InitModule,
UserModule,
AuthModule,
ProjectModule,
TokenModule,
ChatModule,
+ TypeOrmModule.forFeature([User]),
],
- providers: [AppService],
+ providers: [AppResolver],
})
export class AppModule {}
diff --git a/backend/src/app.resolver.ts b/backend/src/app.resolver.ts
new file mode 100644
index 0000000..67f05b6
--- /dev/null
+++ b/backend/src/app.resolver.ts
@@ -0,0 +1,12 @@
+import { Injectable } from '@nestjs/common';
+import { Query, Resolver } from '@nestjs/graphql';
+import { RequireRoles } from './decorator/auth.decorator';
+
+@Resolver()
+export class AppResolver {
+ @Query(() => String)
+ @RequireRoles('Admin')
+ getHello(): string {
+ return 'Hello World!';
+ }
+}
diff --git a/backend/src/app.service.ts b/backend/src/app.service.ts
deleted file mode 100644
index 927d7cc..0000000
--- a/backend/src/app.service.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { Injectable } from '@nestjs/common';
-
-@Injectable()
-export class AppService {
- getHello(): string {
- return 'Hello World!';
- }
-}
diff --git a/backend/src/auth/auth.service.ts b/backend/src/auth/auth.service.ts
index c9c1baa..0f54347 100644
--- a/backend/src/auth/auth.service.ts
+++ b/backend/src/auth/auth.service.ts
@@ -2,6 +2,7 @@ import {
ConflictException,
Injectable,
Logger,
+ NotFoundException,
UnauthorizedException,
} from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
@@ -11,9 +12,11 @@ import { compare, hash } from 'bcrypt';
import { LoginUserInput } from 'src/user/dto/login-user.input';
import { RegisterUserInput } from 'src/user/dto/register-user.input';
import { User } from 'src/user/user.model';
-import { Repository } from 'typeorm';
+import { In, Repository } from 'typeorm';
import { CheckTokenInput } from './dto/check-token.input';
import { JwtCacheService } from 'src/auth/jwt-cache.service';
+import { Menu } from './menu/menu.model';
+import { Role } from './role/role.model';
@Injectable()
export class AuthService {
@@ -23,6 +26,10 @@ export class AuthService {
private jwtService: JwtService,
private jwtCacheService: JwtCacheService,
private configService: ConfigService,
+ @InjectRepository(Menu)
+ private menuRepository: Repository