Mailservice
This commit is contained in:
@@ -3,10 +3,11 @@ import { SystemService } from './system.service';
|
||||
import { SystemController } from './system.controller';
|
||||
import { AuthModule } from '../auth/auth.module';
|
||||
import { DatabaseModule } from 'src/shared/database/database.module';
|
||||
import { MailModule } from '../mail/mail.module';
|
||||
|
||||
@Module({
|
||||
controllers: [SystemController],
|
||||
providers: [SystemService],
|
||||
imports: [AuthModule, DatabaseModule],
|
||||
imports: [AuthModule, DatabaseModule, MailModule],
|
||||
})
|
||||
export class SystemModule {}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { UpdateSystemDto } from './dto/update-system.dto';
|
||||
import { ActivityRepository, KeySystemRepository, UserRepository } from 'src/model/repositories';
|
||||
import { User } from 'src/model/entitites';
|
||||
import { IUser } from 'src/model/interface';
|
||||
import { MailService } from '../mail/mail.service';
|
||||
|
||||
@Injectable()
|
||||
export class SystemService {
|
||||
@@ -11,6 +12,7 @@ export class SystemService {
|
||||
private systemRepo: KeySystemRepository,
|
||||
private userRepo: UserRepository,
|
||||
private systemActivityRepo: ActivityRepository,
|
||||
private mailService: MailService
|
||||
) {}
|
||||
|
||||
async create(user: User, createSystemDto: CreateSystemDto) {
|
||||
@@ -80,6 +82,7 @@ export class SystemService {
|
||||
sys.managers = sys.managers.filter( m => m.username != manageObject.email);
|
||||
|
||||
await this.systemRepo.save(sys);
|
||||
this.mailService.sendAccessRemovedMail({to: manageObject.email, firstName: manageObject.email, systemName: sys.name})
|
||||
return sys.managers;
|
||||
}
|
||||
|
||||
@@ -94,6 +97,7 @@ export class SystemService {
|
||||
|
||||
sys.managers.push(user);
|
||||
await this.systemRepo.save(sys);
|
||||
this.mailService.sendAccessGrantedMail({to: user.username, firstName: user.firstName, systemName: sys.name})
|
||||
return sys.managers;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user