feat(report-service): add html option to report endpoint
This commit is contained in:
parent
9346996c18
commit
f079375572
@ -2,8 +2,9 @@ import { FastifyInstance, RouteShorthandOptions } from 'fastify';
|
|||||||
import { sendMail } from 'services/mailing';
|
import { sendMail } from 'services/mailing';
|
||||||
|
|
||||||
type PostReportBody = {
|
type PostReportBody = {
|
||||||
|
html?: string;
|
||||||
subject: string;
|
subject: string;
|
||||||
text: string;
|
text?: string;
|
||||||
to: string;
|
to: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -14,6 +15,9 @@ export default (server: FastifyInstance, options: RouteShorthandOptions, done: (
|
|||||||
schema: {
|
schema: {
|
||||||
body: {
|
body: {
|
||||||
properties: {
|
properties: {
|
||||||
|
html: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
subject: {
|
subject: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
@ -24,15 +28,15 @@ export default (server: FastifyInstance, options: RouteShorthandOptions, done: (
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
required: ['subject', 'text', 'to'],
|
required: ['subject', 'to'],
|
||||||
type: 'object',
|
type: 'object',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async (request, reply) => {
|
async (request, reply) => {
|
||||||
const { subject, text, to } = request.body;
|
const { html, subject, text, to } = request.body;
|
||||||
|
|
||||||
sendMail({ text, to, subject });
|
sendMail({ html, text, to, subject });
|
||||||
reply.send({ success: true });
|
reply.send({ success: true });
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user