Make mobile phone not mandatory in the endpoint
Added mobile in OAS
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
"description": "Charging Station Management Software",
"version": "1.0.0",
"contact": {
- "name": "Serge FABIANO",
- "email": "serge.fabiano@sap.com"
- },
- "license": {
- "name": "Apache 2.0",
- "url": "https://github.com/sap-labs-france/ev-server/blob/master/LICENSE"
+ "name": "Serge FABIANO"
}
},
"tags": [
"properties": {
"email": {
"type": "string",
- "example": "demo.demo@sap.com"
+ "example": "user@domain.com"
},
"password": {
"type": "string",
- "example": "DeM*Us$r1"
+ "example": "password"
},
"acceptEula": {
"type": "boolean",
"properties": {
"email": {
"type": "string",
- "example": "demo.demo@sap.com"
+ "example": "user@domain.com"
},
"name": {
"type": "string",
},
"password": {
"type": "string",
- "example": "DeM*Us$r1"
+ "example": "password"
+ },
+ "mobile": {
+ "type": "string",
+ "example": "+33666696969"
},
"acceptEula": {
"type": "boolean",
"properties": {
"email": {
"type": "string",
- "example": "demo.demo@sap.com"
+ "example": "user@domain.com"
},
"password": {
"type": "string"
"resetRequest": {
"summary": "Request a password reset",
"value": {
- "email": "demo.demo@sap.com",
+ "email": "user@domain.com",
"captcha": "03AGdBq26Ca8rdqn0-odDV18kJCLnVytzGPXVPyW811IY4pqyQuak-o59MZlYfUIVS-ToLBiL4o7fBfPPvmkAhQLKoMXtqitKxRTG016wmGbFLvZWnOSkJKreB1Kx6n3dB7uYd302UVyVpJJ0BGFcmXWnWZmGnR3ZJC8IE1r7oVohcYVLttnKXtuhJwg5IdHe0HleYzOjxCBw9FnCJhVoSmaPn6FeVjWC9d8vSDwBq-18dA_cm6CQb7BhZm6LXWhMdW1_e_5DcSs1koj_vn3FGB7UQESsPp81WBfr6msCNiddNc1D4MRfF4wXeimJ1wplqoGOmMmI2Y_i-120grLrjkfzBNgDPQPWvfpUjeyW1f_T-5SaObYpUFEEZ4YW6Xt2revAWMmZ6i9_QOWWUcukaZU3jr_MzR1YIMscKrnBP3Zhl45zLXOY-0Bi28z6XxsMqqSHE8lY_C8B-7M-X3PNc_293qtrEnE2rhG9PU-RdFJG4dqBcwU6YfZJwwyXDWG7eyNG8iJoBDgCWrbib2jLKTmuwWCowApAoeA",
"tenant": "slf"
}
"resetValidation": {
"summary": "Validate password reset",
"value": {
- "email": "demo.demo@sap.com",
+ "email": "user@domain.com",
"captcha": "03AGdBq26Ca8rdqn0-odDV18kJCLnVytzGPXVPyW811IY4pqyQuak-o59MZlYfUIVS-ToLBiL4o7fBfPPvmkAhQLKoMXtqitKxRTG016wmGbFLvZWnOSkJKreB1Kx6n3dB7uYd302UVyVpJJ0BGFcmXWnWZmGnR3ZJC8IE1r7oVohcYVLttnKXtuhJwg5IdHe0HleYzOjxCBw9FnCJhVoSmaPn6FeVjWC9d8vSDwBq-18dA_cm6CQb7BhZm6LXWhMdW1_e_5DcSs1koj_vn3FGB7UQESsPp81WBfr6msCNiddNc1D4MRfF4wXeimJ1wplqoGOmMmI2Y_i-120grLrjkfzBNgDPQPWvfpUjeyW1f_T-5SaObYpUFEEZ4YW6Xt2revAWMmZ6i9_QOWWUcukaZU3jr_MzR1YIMscKrnBP3Zhl45zLXOY-0Bi28z6XxsMqqSHE8lY_C8B-7M-X3PNc_293qtrEnE2rhG9PU-RdFJG4dqBcwU6YfZJwwyXDWG7eyNG8iJoBDgCWrbib2jLKTmuwWCowApAoeA",
"hash": "dcff1ec7-cecb-4c2f-99da-47aeb1f83509",
"password": "Azerty123?",
"required": true,
"schema": {
"type": "string",
- "example": "demo.demo@sap.com"
+ "example": "user@domain.com"
}
},
{
"required": true,
"schema": {
"type": "string",
- "example": "demo.demo@sap.com"
+ "example": "user@domain.com"
}
},
{
"required": true,
"schema": {
"type": "string",
- "example": "demo.demo@sap.com"
+ "example": "user@domain.com"
}
},
{
"properties": {
"email": {
"type": "string",
- "example": "demo.demo@sap.com"
+ "example": "user@domain.com"
},
"tenant": {
"type": "string",
"text/csv": {
"schema": {
"type": "string",
- "example": "Charging Station\tName\tValue\tSite Area\tSite\nSAP-Mougins-03\tAllowOfflineTxForUnknownId\ttrue\tMougins - South\tSAP Labs Mougins\nSAP-Mougins-03\tallowpluggedcable\true\tMougins - South\tSAP Labs Mougins"
+ "example": "Charging Station\tName\tValue\tSite Area\tSite\nCS-03\tAllowOfflineTxForUnknownId\ttrue\tMougins - South\tLabs Mougins\nCS-03\tallowpluggedcable\true\tMougins - South\tLabs Mougins"
}
}
}
},
"password": {
"type": "string",
- "example": "DeM*Us$r1"
+ "example": "password"
},
"phone": {
"type": "string",
},
"email": {
"type": "string",
- "example": "user.demo@sap.com"
+ "example": "user@domain.com"
},
"issuer": {
"type": "boolean"
"description": "Users exported successfully",
"content": {
"text/csv": {
- "example": "id,name,firstName,locale,role,status,email,eulaAcceptedOn,createdOn,changedOn,changedBy\n\"###\",\"DEMO\",\"User\",\"en_EN\",\"B\",\"P\",\"user.demo@sap.com\",\"2021-06-09\",\"2021-04-23\",\"2021-06-09\",\"\""
+ "example": "id,name,firstName,locale,role,status,email,eulaAcceptedOn,createdOn,changedOn,changedBy\n\"###\",\"DEMO\",\"User\",\"en_EN\",\"B\",\"P\",\"user@domain.com\",\"2021-06-09\",\"2021-04-23\",\"2021-06-09\",\"\""
}
}
},
"properties": {
"id": {
"type": "string",
- "example": "5be7fb271014d90008992347",
+ "example": "66666666666666666666666",
"readOnly": true
},
"name": {
"type": "string",
- "example": "SAP Labs France"
+ "example": "Labs France"
},
"email": {
"type": "string",
- "example": "serge.fabiano@sap.com"
+ "example": "user@domain.com"
},
"subdomain": {
"type": "string",
},
"password": {
"type": "string",
- "example": "DeM*Us$r1"
+ "example": "password"
},
"phone": {
"type": "string",
},
"email": {
"type": "string",
- "example": "user.demo@sap.com"
+ "example": "user@domain.com"
},
"issuer": {
"type": "boolean"

MODIFY
src/assets/server/rest/v1/schemas/auth/auth-signon.json
src/assets/server/rest/v1/schemas/auth/auth-signon.json
"firstName",
"password",
"acceptEula",
- "captcha",
- "mobile"
+ "captcha"
]
}

MODIFY
src/server/rest/v1/service/UtilsService.ts
src/server/rest/v1/service/UtilsService.ts
@@ -1747,7 +1747,7 @@ export default class UtilsService {
actionOnUser: filteredRequest.id
});
}
- if (!filteredRequest.mobile) {
+ if (filteredRequest.mobile && !Utils.isPhoneValid(filteredRequest.mobile)) {
throw new AppError({
errorCode: HTTPError.GENERAL_ERROR,
message: 'User Mobile is mandatory',
@@ -1757,16 +1757,6 @@ export default class UtilsService {
actionOnUser: filteredRequest.id
});
}
- if (!Utils.isPhoneValid(filteredRequest.mobile)) {
- throw new AppError({
- errorCode: HTTPError.GENERAL_ERROR,
- message: `User Mobile '${filteredRequest.mobile}' is not valid`,
- module: MODULE_NAME,
- method: 'checkIfUserValid',
- user: req.user.id,
- actionOnUser: filteredRequest.id
- });
- }
if (filteredRequest.plateID && !Utils.isPlateIDValid(filteredRequest.plateID)) {
throw new AppError({
errorCode: HTTPError.GENERAL_ERROR,

Make mobile phone not mandatory in the endpoint
Added mobile in OAS