Finish server-side translations in controllers
This commit is contained in:
@@ -43,7 +43,7 @@ class ProfileController extends Controller {
|
||||
|
||||
if ( !user )
|
||||
return res.status(404)
|
||||
.message('No user found with the specified ID.')
|
||||
.message(req.T('api.user_not_found'))
|
||||
.api()
|
||||
|
||||
// Make sure the required fields are provided
|
||||
@@ -51,14 +51,14 @@ class ProfileController extends Controller {
|
||||
for ( const field of required_fields ) {
|
||||
if ( !req.body[field]?.trim() )
|
||||
return res.status(400)
|
||||
.message(`Required field "${field}" is missing or invalid.`)
|
||||
.message(`${req.T('api.missing_field')} ${field}`)
|
||||
.api()
|
||||
}
|
||||
|
||||
// Validate the e-mail
|
||||
if ( !Validator.validate(req.body.email) )
|
||||
return res.status(400)
|
||||
.message(`"email" field must be a valid e-mail address.`)
|
||||
.message(`${req.T('api.improper_field')} email ${req.T('api.email')}`)
|
||||
.api()
|
||||
|
||||
// Update the user's profile
|
||||
@@ -80,12 +80,12 @@ class ProfileController extends Controller {
|
||||
|
||||
if ( !user )
|
||||
return res.status(404)
|
||||
.message('No user found with the specified ID.')
|
||||
.message(req.T('api.user_not_found'))
|
||||
.api()
|
||||
|
||||
if ( !req?.uploads?.photo )
|
||||
return res.status(400)
|
||||
.message('Missing required field: file')
|
||||
.message(`${req.T('api.missing_field')} file`)
|
||||
.api()
|
||||
|
||||
user.photo_file_id = req.uploads.photo.id
|
||||
@@ -101,7 +101,7 @@ class ProfileController extends Controller {
|
||||
|
||||
if ( !user )
|
||||
return res.status(404)
|
||||
.message('No user found with the specified ID.')
|
||||
.message(req.T('api.user_not_found'))
|
||||
.api()
|
||||
|
||||
const photo = await user.photo()
|
||||
|
||||
Reference in New Issue
Block a user