Skip to content

Commit

Permalink
Merge pull request #70 from FidelCly/feat/hmtl-data
Browse files Browse the repository at this point in the history
feat: changes textDate to htmlData
  • Loading branch information
andim-dev authored Aug 17, 2023
2 parents 7c1cf53 + 72df8a6 commit b950fe8
Show file tree
Hide file tree
Showing 4 changed files with 403 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/campaign/email.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export class EmailRequestDto implements SendRequest {
@IsString()
readonly subject: string;

@IsOptional()
@IsString()
readonly textData: string;
// @IsOptional()
// @IsString()
// readonly textData: string;

@IsOptional()
@IsString()
Expand Down
8 changes: 6 additions & 2 deletions src/campaign/maijet.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,18 @@ export class MailjetService {
})),

Subject: data.subject,
TextPart: data.textData,
// TextPart: data.textData,
HTMLPart: data.htmlData,
},
],
});

return { status: 200, errors: null } as SendResponse;
} catch (error) {
return { status: 500, errors: [error] } as SendResponse;
return {
status: error.response.status,
errors: [error.orginalMessage || 'Une erreur est survenue'],
} as SendResponse;
}
}
}
6 changes: 4 additions & 2 deletions src/mailjet/maijet.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ export class MailjetService {

return { status: 200, errors: null } as SendResponse;
} catch (error) {
console.error('🚀 sendEmail ~ error:', error);
return { status: 500, errors: [error] } as SendResponse;
return {
status: error.response.statuss,
errors: [error.orginalMessage || 'Une erreur est survenue'],
} as SendResponse;
}
}
}
Loading

0 comments on commit b950fe8

Please sign in to comment.