mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
Rename profile to information
This commit is contained in:
23
app/Controllers/Http/InformationsController.ts
Normal file
23
app/Controllers/Http/InformationsController.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext";
|
||||
import Information from "App/Models/Information";
|
||||
import InformationUpdateValidator from "App/Validators/information/InformationUpdateValidator";
|
||||
|
||||
export default class InformationsController {
|
||||
|
||||
public async index ( { response }: HttpContextContract ) {
|
||||
return response.status(200).send({
|
||||
informations: await Information.first()
|
||||
})
|
||||
}
|
||||
|
||||
public async update ( { response, request }: HttpContextContract ) {
|
||||
const information = await Information.firstOrFail()
|
||||
const data = await request.validate(InformationUpdateValidator)
|
||||
await information.merge(data).save()
|
||||
|
||||
return response.status(200).send({
|
||||
information
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user