update funciones de notificaciones
This commit is contained in:
parent
c89e501005
commit
b7984b3748
|
@ -1,7 +1,7 @@
|
||||||
# mail
|
# mail
|
||||||
MAIL_HOST=smtp.gmail.com
|
MAIL_HOST=smtp.gmail.com
|
||||||
MAIL_USER=mbonilla.guti@gmail.com
|
MAIL_USER=katoikiap4@gmail.com
|
||||||
MAIL_PASSWORD=laofghlofgffmyry
|
MAIL_PASSWORD=snxwbncohehilkkz
|
||||||
MAIL_FROM=noreply@example.com
|
MAIL_FROM=noreply@example.com
|
||||||
|
|
||||||
# optional
|
# optional
|
||||||
|
|
|
@ -77,4 +77,39 @@ export class EmailController {
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@MessagePattern({ cmd: 'emailCreateUserTenant' })
|
||||||
|
async emailCreateUserTenant(@Payload() user: any) {
|
||||||
|
const url = "http://localhost:3000/";
|
||||||
|
const image = "images/email.png";
|
||||||
|
const logo = "images/Logo Katoikia.png";
|
||||||
|
var response = await this.mailService.sendMail({
|
||||||
|
to: user["email"],
|
||||||
|
from: "mbonilla.guti@gmail.com",
|
||||||
|
subject: 'Usuario registrado',
|
||||||
|
template: 'emailCreateUserTenant',
|
||||||
|
context: {
|
||||||
|
name: user["name"],
|
||||||
|
password: user["password"],
|
||||||
|
date_entry: user["date_entry"],
|
||||||
|
email: user["email"],
|
||||||
|
community_name: user['community_name'],
|
||||||
|
url
|
||||||
|
},
|
||||||
|
attachments: [
|
||||||
|
{
|
||||||
|
filename: 'email.png',
|
||||||
|
path: __dirname + '/mails/images/email.png',
|
||||||
|
cid: 'image_email' //my mistake was putting "cid:logo@cid" here!
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: 'Logo_Katoikia.png',
|
||||||
|
path: __dirname + '/mails/images/Logo_Katoikia.png',
|
||||||
|
cid: 'logoKatoikia' //my mistake was putting "cid:logo@cid" here!
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export class CreateNotificationDto {}
|
|
|
@ -1,6 +0,0 @@
|
||||||
import { PartialType } from '@nestjs/mapped-types';
|
|
||||||
import { CreateNotificationDto } from './create-notification.dto';
|
|
||||||
|
|
||||||
export class UpdateNotificationDto extends PartialType(CreateNotificationDto) {
|
|
||||||
id: number;
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
import { Controller } from '@nestjs/common';
|
|
||||||
import { MessagePattern, Payload } from '@nestjs/microservices';
|
|
||||||
import { NotificationsService } from './notifications.service';
|
|
||||||
import { CreateNotificationDto } from './dto/create-notification.dto';
|
|
||||||
import { UpdateNotificationDto } from './dto/update-notification.dto';
|
|
||||||
|
|
||||||
@Controller()
|
|
||||||
export class NotificationsController {
|
|
||||||
constructor(private readonly notificationsService: NotificationsService) {}
|
|
||||||
|
|
||||||
@MessagePattern({ cmd: 'createNotification' })
|
|
||||||
create(@Payload() createNotificationDto: CreateNotificationDto) {
|
|
||||||
return this.notificationsService.create(createNotificationDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
@MessagePattern({ cmd: 'findAllNotifications' })
|
|
||||||
findAll() {
|
|
||||||
return this.notificationsService.findAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
@MessagePattern({ cmd: 'findOneNotification' })
|
|
||||||
findOne(@Payload() id: number) {
|
|
||||||
return this.notificationsService.findOne(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@MessagePattern({ cmd: 'updateNotification' })
|
|
||||||
update(@Payload() updateNotificationDto: UpdateNotificationDto) {
|
|
||||||
return this.notificationsService.update(
|
|
||||||
updateNotificationDto.id,
|
|
||||||
updateNotificationDto,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@MessagePattern({ cmd: 'removeNotification' })
|
|
||||||
remove(@Payload() id: number) {
|
|
||||||
return this.notificationsService.remove(id);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
import { Module } from '@nestjs/common';
|
|
||||||
import { NotificationsService } from './notifications.service';
|
|
||||||
import { NotificationsController } from './notifications.controller';
|
|
||||||
|
|
||||||
@Module({
|
|
||||||
controllers: [NotificationsController],
|
|
||||||
providers: [NotificationsService],
|
|
||||||
})
|
|
||||||
export class NotificationsModule {}
|
|
|
@ -1,26 +0,0 @@
|
||||||
import { Injectable } from '@nestjs/common';
|
|
||||||
import { CreateNotificationDto } from './dto/create-notification.dto';
|
|
||||||
import { UpdateNotificationDto } from './dto/update-notification.dto';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class NotificationsService {
|
|
||||||
create(createNotificationDto: CreateNotificationDto) {
|
|
||||||
return 'This action adds a new notification';
|
|
||||||
}
|
|
||||||
|
|
||||||
findAll() {
|
|
||||||
return `This action returns all notifications`;
|
|
||||||
}
|
|
||||||
|
|
||||||
findOne(id: number) {
|
|
||||||
return `This action returns a #${id} notification`;
|
|
||||||
}
|
|
||||||
|
|
||||||
update(id: number, updateNotificationDto: UpdateNotificationDto) {
|
|
||||||
return `This action updates a #${id} notification`;
|
|
||||||
}
|
|
||||||
|
|
||||||
remove(id: number) {
|
|
||||||
return `This action removes a #${id} notification`;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
export class Notification {}
|
|
Loading…
Reference in New Issue