Changed rest endpoints format
MODIFY
src/assets/server/rest/v1/docs/open-api-standard.json
src/assets/server/rest/v1/docs/open-api-standard.json
},
"captcha": {
"type": "string",
- "example": "03AGdBq261sQ2KzqROGD8E2Xb2ljxLkmQbUumIL9m6FqtJZau9Z5Aq4Pp8K-VzbjTwuvnBvdaZBgD-6VU0IY8PMSyGmSJNH9Ctkgde4l8XoQUVLYLhspglIRSjkPS15-DZQtJ2gLG910Kq3RXE-S5M9gkuXBfEh6Y-81qC9gRb-FFwN_Ao5_NO7j6iu1kZqJHpyxHvwVqtbLK5APvTngU_8gx9tRDfXUBtLMmgZAofmkIE1qbefMNTDceJsiNKtHHykP-xFIt-lNRN1H6h_HZ8EbRjncT5k_AeqjL8ClBTZy9Pdqwy9jkpvas4l5EH7WPVT-9VPV0C0tuwKkwwwesMhzYSo2Vso_wN15G5x1Zgji8xsndjvMthTkIWe4zyRNKNr2gc4z1Sgfy-dGcRkDc7lUnet0fJfII5bXKl_njo_S8no8KGVZ2IeOTzhTKigA7A0hdtNrKnAOmU"
+ "example": "03AGdBq26Ca8rdqn0-odDV18kJCLnVytzGPXVPyW811IY4pqyQuak-o59MZlYfUIVS-ToLBiL4o7fBfPPvmkAhQLKoMXtqitKxRTG016wmGbFLvZWnOSkJKreB1Kx6n3dB7uYd302UVyVpJJ0BGFcmXWnWZmGnR3ZJC8IE1r7oVohcYVLttnKXtuhJwg5IdHe0HleYzOjxCBw9FnCJhVoSmaPn6FeVjWC9d8vSDwBq-18dA_cm6CQb7BhZm6LXWhMdW1_e_5DcSs1koj_vn3FGB7UQESsPp81WBfr6msCNiddNc1D4MRfF4wXeimJ1wplqoGOmMmI2Y_i-120grLrjkfzBNgDPQPWvfpUjeyW1f_T-5SaObYpUFEEZ4YW6Xt2revAWMmZ6i9_QOWWUcukaZU3jr_MzR1YIMscKrnBP3Zhl45zLXOY-0Bi28z6XxsMqqSHE8lY_C8B-7M-X3PNc_293qtrEnE2rhG9PU-RdFJG4dqBcwU6YfZJwwyXDWG7eyNG8iJoBDgCWrbib2jLKTmuwWCowApAoeA"
},
"tenant": {
"type": "string",

MODIFY
src/server/rest/v1/router/auth/AuthRouter.ts
src/server/rest/v1/router/auth/AuthRouter.ts
@@ -42,32 +42,32 @@ export default class AuthRouter {
}
protected buildRoutePasswordReset(): void {
- this.router.post(`/password/${ServerAction.REST_RESET}`, async (req: Request, res: Response, next: NextFunction) => {
- await RouterUtils.handleServerAction(AuthService.handleUserPasswordReset.bind(this), ServerAction.REST_RESET, req, res, next);
+ this.router.post(`/${ServerAction.REST_PASSWORD_RESET}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(AuthService.handleUserPasswordReset.bind(this), ServerAction.REST_PASSWORD_RESET, req, res, next);
});
}
protected buildRouteResendVerificationMail(): void {
- this.router.post(`/mail/${ServerAction.REST_RESEND}`, async (req: Request, res: Response, next: NextFunction) => {
- await RouterUtils.handleServerAction(AuthService.handleResendVerificationEmail.bind(this), ServerAction.REST_RESEND, req, res, next);
+ this.router.post(`/${ServerAction.REST_MAIL_RESEND}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(AuthService.handleResendVerificationEmail.bind(this), ServerAction.REST_MAIL_RESEND, req, res, next);
});
}
protected buildRouteVerifyMail(): void {
- this.router.get(`/mail/${ServerAction.REST_CHECK}`, async (req: Request, res: Response, next: NextFunction) => {
- await RouterUtils.handleServerAction(AuthService.handleVerifyEmail.bind(this), ServerAction.REST_CHECK, req, res, next);
+ this.router.get(`/${ServerAction.REST_MAIL_CHECK}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(AuthService.handleVerifyEmail.bind(this), ServerAction.REST_MAIL_CHECK, req, res, next);
});
}
protected buildRouteEndUserLicenseAgreement(): void {
- this.router.get('/eula', async (req: Request, res: Response, next: NextFunction) => {
+ this.router.get(`/${ServerAction.REST_END_USER_LICENSE_AGREEMENT}`, async (req: Request, res: Response, next: NextFunction) => {
await RouterUtils.handleServerAction(AuthService.handleGetEndUserLicenseAgreement.bind(this), ServerAction.END_USER_LICENSE_AGREEMENT, req, res, next);
});
}
protected buildRouteCheckEndUserLicenseAgreement(): void {
- this.router.get(`/eula/${ServerAction.REST_CHECK}`, async (req: Request, res: Response, next: NextFunction) => {
- await RouterUtils.handleServerAction(AuthService.handleCheckEndUserLicenseAgreement.bind(this), ServerAction.REST_CHECK, req, res, next);
+ this.router.get(`/${ServerAction.REST_END_USER_LICENSE_AGREEMENT_CHECK}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(AuthService.handleCheckEndUserLicenseAgreement.bind(this), ServerAction.REST_END_USER_LICENSE_AGREEMENT_CHECK, req, res, next);
});
}
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -377,9 +377,13 @@ export enum ServerAction {
REST_SIGNIN = 'signin',
REST_SIGNON = 'signon',
REST_SIGNOUT = 'signout',
- REST_CHECK = 'check',
- REST_RESEND = 'resend',
- REST_RESET = 'reset',
+
+ REST_PASSWORD_RESET = 'password/reset',
+ REST_END_USER_LICENSE_AGREEMENT = 'eula',
+ REST_END_USER_LICENSE_AGREEMENT_CHECK = 'eula/check',
+ REST_MAIL_CHECK = 'mail/check',
+ REST_MAIL_RESEND = 'mail/resend',
+
REST_PING = 'ping',
REST_TENANTS = 'tenants'
}

MODIFY
test/api/UserTest.ts
test/api/UserTest.ts
@@ -5,6 +5,7 @@ import ChargingStationContext from './context/ChargingStationContext';
import ContextDefinition from './context/ContextDefinition';
import ContextProvider from './context/ContextProvider';
import Factory from '../factories/Factory';
+import { ServerAction } from '../../src/types/Server';
import SiteContext from './context/SiteContext';
import Tag from '../types/Tag';
import TenantContext from './context/TenantContext';
@@ -104,7 +105,7 @@ describe('User tests', function() {
// Send
const response = await testData.userService._baseApi.send({
method: 'GET',
- url: `/client/auth/CheckEndUserLicenseAgreement?Email=${testData.userContext.email}&Tenant=${testData.tenantContext.getTenant().subdomain}`,
+ url: '/v1/auth/' + ServerAction.REST_END_USER_LICENSE_AGREEMENT_CHECK + `?Email=${testData.userContext.email}&Tenant=${testData.tenantContext.getTenant().subdomain}`,
headers: {
'Content-Type': 'application/json'
}

MODIFY
test/api/client/AuthenticationApi.ts
test/api/client/AuthenticationApi.ts
@@ -61,7 +61,7 @@ export default class AuthenticationApi {
// Send
const response = await this._baseApi.send({
method: 'POST',
- url: '/v1/auth/password/' + ServerAction.REST_RESET,
+ url: '/v1/auth/' + ServerAction.REST_PASSWORD_RESET,
headers: {
'Content-Type': 'application/json'
},
@@ -79,7 +79,7 @@ export default class AuthenticationApi {
// Send
const response = await this._baseApi.send({
method: 'POST',
- url: '/v1/auth/mail/' + ServerAction.REST_RESEND,
+ url: '/v1/auth/' + ServerAction.REST_MAIL_RESEND,
headers: {
'Content-Type': 'application/json'
},
@@ -97,7 +97,7 @@ export default class AuthenticationApi {
// Send
const response = await this._baseApi.send({
method: 'GET',
- url: '/v1/auth/mail/' + ServerAction.REST_CHECK,
+ url: '/v1/auth/' + ServerAction.REST_MAIL_CHECK,
headers: {
'Content-Type': 'application/json'
},

Changed rest endpoints format