diff --git a/servicio-notificaciones/.env b/servicio-notificaciones/.env index 80c3aee2..7b8f623a 100644 --- a/servicio-notificaciones/.env +++ b/servicio-notificaciones/.env @@ -1,7 +1,7 @@ # mail MAIL_HOST=smtp.gmail.com -MAIL_USER=mbonilla.guti@gmail.com -MAIL_PASSWORD=laofghlofgffmyry +MAIL_USER=katoikiap4@gmail.com +MAIL_PASSWORD=snxwbncohehilkkz MAIL_FROM=noreply@example.com # optional diff --git a/servicio-notificaciones/src/email.controller.ts b/servicio-notificaciones/src/email.controller.ts index d1363138..b342079f 100644 --- a/servicio-notificaciones/src/email.controller.ts +++ b/servicio-notificaciones/src/email.controller.ts @@ -77,4 +77,39 @@ export class EmailController { }); 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; + } } diff --git a/servicio-notificaciones/src/notifications/dto/create-notification.dto.ts b/servicio-notificaciones/src/notifications/dto/create-notification.dto.ts deleted file mode 100644 index 98ca4791..00000000 --- a/servicio-notificaciones/src/notifications/dto/create-notification.dto.ts +++ /dev/null @@ -1 +0,0 @@ -export class CreateNotificationDto {} diff --git a/servicio-notificaciones/src/notifications/dto/update-notification.dto.ts b/servicio-notificaciones/src/notifications/dto/update-notification.dto.ts deleted file mode 100644 index f639cde4..00000000 --- a/servicio-notificaciones/src/notifications/dto/update-notification.dto.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { PartialType } from '@nestjs/mapped-types'; -import { CreateNotificationDto } from './create-notification.dto'; - -export class UpdateNotificationDto extends PartialType(CreateNotificationDto) { - id: number; -} diff --git a/servicio-notificaciones/src/notifications/notifications.controller.ts b/servicio-notificaciones/src/notifications/notifications.controller.ts deleted file mode 100644 index 4d8484f7..00000000 --- a/servicio-notificaciones/src/notifications/notifications.controller.ts +++ /dev/null @@ -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); - } -} diff --git a/servicio-notificaciones/src/notifications/notifications.module.ts b/servicio-notificaciones/src/notifications/notifications.module.ts deleted file mode 100644 index a3b7b79c..00000000 --- a/servicio-notificaciones/src/notifications/notifications.module.ts +++ /dev/null @@ -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 {} diff --git a/servicio-notificaciones/src/notifications/notifications.service.ts b/servicio-notificaciones/src/notifications/notifications.service.ts deleted file mode 100644 index 41219fe1..00000000 --- a/servicio-notificaciones/src/notifications/notifications.service.ts +++ /dev/null @@ -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`; - } -} diff --git a/servicio-notificaciones/src/notifications/schemas/notification.schemas.ts b/servicio-notificaciones/src/notifications/schemas/notification.schemas.ts deleted file mode 100644 index b79d7d57..00000000 --- a/servicio-notificaciones/src/notifications/schemas/notification.schemas.ts +++ /dev/null @@ -1 +0,0 @@ -export class Notification {}