@@ -1,26 +0,0 @@
 | 
			
		||||
import { Authorized, JsonController, Post } from 'routing-controllers';
 | 
			
		||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
 | 
			
		||||
import { config } from '../config';
 | 
			
		||||
import { Mailer } from '../mailer';
 | 
			
		||||
import { ResponseEmpty } from '../models/responses/ResponseEmpty';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@JsonController('/mails')
 | 
			
		||||
@OpenAPI({ security: [{ "AuthToken": [] }, { "RefreshTokenCookie": [] }] })
 | 
			
		||||
export class MailController {
 | 
			
		||||
 | 
			
		||||
	private mailer: Mailer;
 | 
			
		||||
 | 
			
		||||
	constructor() {
 | 
			
		||||
		this.mailer = new Mailer();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Post('/test')
 | 
			
		||||
	@Authorized(["MAIL:CREATE"])
 | 
			
		||||
	@ResponseSchema(ResponseEmpty, { statusCode: 200 })
 | 
			
		||||
	@OpenAPI({ description: 'Sends a test email to the configured from-address.' })
 | 
			
		||||
	async get() {
 | 
			
		||||
		await this.mailer.sendTestMail(config.mail_from);
 | 
			
		||||
		return new ResponseEmpty();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user