Skip to content

Commit

Permalink
feat: add default folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Marades committed Jul 5, 2024
1 parent 0a50c8e commit 99a08ed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/modules/users/users.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ import { UsersController } from './users.controller';
import { UsersService } from './users.service';
import { MongooseModule } from '@nestjs/mongoose';
import { JwtStrategy } from './guards/strategy';
import { User, UserSchema } from '@src/infrastructure';
import { Folder, FolderSchema, User, UserSchema } from '@src/infrastructure';
import { UsersRepository } from './users.repository';
import { AuthModule } from '../auth/auth.module';
import { FolderRepository } from '../folders/folders.repository';

@Module({
imports: [
AuthModule,
MongooseModule.forFeature([{ name: User.name, schema: UserSchema }]),
MongooseModule.forFeature([
{ name: User.name, schema: UserSchema },
{ name: Folder.name, schema: FolderSchema },
]),
],
controllers: [UsersController],
providers: [UsersService, UsersRepository, JwtStrategy],
providers: [UsersService, UsersRepository, FolderRepository, JwtStrategy],
})
export class UsersModule {}
10 changes: 10 additions & 0 deletions src/modules/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import { CreateUserDto } from './dto';
import { JwtPayload } from 'src/common/types/type';
import { UsersRepository } from './users.repository';
import { AuthService } from '../auth/auth.service';
import { FolderRepository } from '../folders/folders.repository';
import { FolderType } from '@src/infrastructure/database/types/folder-type.enum';

@Injectable()
export class UsersService {
constructor(
private readonly userRepository: UsersRepository,
private readonly folderRepository: FolderRepository,
private readonly authService: AuthService,
) {}

Expand All @@ -20,6 +23,13 @@ export class UsersService {
};
// JWT Token 발급
const token = await this.authService.issueAccessToken(tokenPayload);

await this.folderRepository.create(
user._id.toString(),
'나중에 읽을 링크',
FolderType.DEFAULT,
);

return token;
}
}

0 comments on commit 99a08ed

Please sign in to comment.