Working on new version of website

Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
2021-08-05 15:26:36 +02:00
parent ed17d86913
commit 721eb3addc
43 changed files with 525 additions and 320 deletions

View File

@@ -0,0 +1,23 @@
import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext";
import Profile from "App/Models/Profile";
import ProfileUpdateValidator from "App/Validators/profile/ProfileUpdateValidator";
export default class ProfilesController {
public async index ( { response }: HttpContextContract ) {
return response.status(200).send({
profile: await Profile.first()
})
}
public async update ( { response, request }: HttpContextContract ) {
const profile = await Profile.firstOrFail()
const data = await request.validate(ProfileUpdateValidator)
await profile.merge(data).save()
return response.status(200).send({
profile
})
}
}