import { Injectable } from '@nestjs/common' ; import { LogEntity , LogRepository } from '@notifire/dal' ; import { CreateLogCommand } from './create-log.command' ; @ Injectable ( ) export class CreateLog { constructor ( private logRepository ) { } async execute ( command ) { let rawData = null ; if ( command . raw ) { try { rawData = JSON . stringify ( command . raw ) ; } catch ( e ) { } } return await this . logRepository . create ( { _applicationId : command . applicationId , transactionId : command . transactionId , _organizationId : command . organizationId , _notificationId : command . notificationId , _messageId : command . messageId , _subscriberId : command . subscriberId , status : command . status , text : command . text , code : command . code , raw : rawData , } ) ; } }