clean up
This commit is contained in:
parent
fa9e7e6db3
commit
0bdce79739
@ -4,10 +4,11 @@ import { AdminService } from './admin.service';
|
||||
import { PrismaModule } from '../prisma/prisma.module';
|
||||
import { S3Module } from '../s3/s3.module';
|
||||
import { EmailModule } from '../email/email.module';
|
||||
import { AuthModule } from '../auth/auth.module';
|
||||
|
||||
@Module({
|
||||
controllers: [AdminController],
|
||||
providers: [AdminService],
|
||||
imports: [PrismaModule, S3Module, EmailModule],
|
||||
imports: [PrismaModule, S3Module, EmailModule, AuthModule],
|
||||
})
|
||||
export class AdminModule {}
|
||||
|
||||
@ -5,6 +5,7 @@ import { UpdateDocumentDto } from '../dto/update-document.dto';
|
||||
import { CreateUserDto } from '../dto/create-user.dto';
|
||||
import * as bcrypt from 'bcrypt';
|
||||
import { EmailService } from '../email/email.service';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
|
||||
@Injectable()
|
||||
export class AdminService {
|
||||
@ -14,6 +15,7 @@ export class AdminService {
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly s3Service: S3Service,
|
||||
private readonly emailService: EmailService,
|
||||
private readonly authService: AuthService,
|
||||
) {}
|
||||
|
||||
async getAllDocuments() {
|
||||
@ -45,14 +47,8 @@ export class AdminService {
|
||||
}
|
||||
|
||||
async createUser(createUserDto: CreateUserDto) {
|
||||
const hashedPassword = await bcrypt.hash(createUserDto.password, 10);
|
||||
|
||||
return this.prisma.user.create({
|
||||
data: {
|
||||
...createUserDto,
|
||||
password: hashedPassword,
|
||||
},
|
||||
});
|
||||
this.logger.log('Delegating user creation to AuthService');
|
||||
return this.authService.createUser(createUserDto, createUserDto.isAdmin);
|
||||
}
|
||||
|
||||
async updateDocument(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user