Moved models to their own files
This commit is contained in:
parent
d450ecbf7c
commit
9ce86ebef7
@ -1,7 +1,8 @@
|
|||||||
import { IsString } from 'class-validator';
|
|
||||||
import { Authorized, JsonController, Post, QueryParam } from 'routing-controllers';
|
import { Authorized, JsonController, Post, QueryParam } from 'routing-controllers';
|
||||||
import { OpenAPI } from 'routing-controllers-openapi';
|
import { OpenAPI } from 'routing-controllers-openapi';
|
||||||
import { Mailer } from '../Mailer';
|
import { Mailer } from '../Mailer';
|
||||||
|
import { locales } from '../models/LocaleEnum';
|
||||||
|
import { SuccessResponse } from '../models/SuccessResponse';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mail controller handels all endpoints concerning Mail sending.
|
* The mail controller handels all endpoints concerning Mail sending.
|
||||||
@ -44,27 +45,3 @@ export class MailController {
|
|||||||
return new SuccessResponse(locale);
|
return new SuccessResponse(locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple success response class to make everyone happy :)
|
|
||||||
*/
|
|
||||||
export class SuccessResponse {
|
|
||||||
|
|
||||||
@IsString()
|
|
||||||
success: boolean = true;
|
|
||||||
|
|
||||||
@IsString()
|
|
||||||
message: string = "Sent!"
|
|
||||||
|
|
||||||
@IsString()
|
|
||||||
locale: locales;
|
|
||||||
|
|
||||||
constructor(locale?: locales) {
|
|
||||||
this.locale = locale || locales.en;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum locales {
|
|
||||||
de = "de",
|
|
||||||
en = "en"
|
|
||||||
}
|
|
4
src/models/LocaleEnum.ts
Normal file
4
src/models/LocaleEnum.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export enum locales {
|
||||||
|
de = "de",
|
||||||
|
en = "en"
|
||||||
|
}
|
21
src/models/SuccessResponse.ts
Normal file
21
src/models/SuccessResponse.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { IsBoolean, IsString } from 'class-validator';
|
||||||
|
import { locales } from './LocaleEnum';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple success response class to make everyone happy :)
|
||||||
|
*/
|
||||||
|
export class SuccessResponse {
|
||||||
|
|
||||||
|
@IsBoolean()
|
||||||
|
success: boolean = true;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
message: string = "Sent!"
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
locale: locales;
|
||||||
|
|
||||||
|
constructor(locale?: locales) {
|
||||||
|
this.locale = locale || locales.en;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user