mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 12:14:33 +01:00
Working on form
This commit is contained in:
17
app/Controllers/Http/FormsController.ts
Normal file
17
app/Controllers/Http/FormsController.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
import FormValidator from "App/Validators/FormValidator";
|
||||
import Form from "App/Models/Form";
|
||||
|
||||
export default class FormsController {
|
||||
|
||||
public async send({ request, response }: HttpContextContract) {
|
||||
const data = await request.validate(FormValidator)
|
||||
|
||||
await Form.create(data)
|
||||
//todo send confirmation email + email to me
|
||||
return response.status(200).send({
|
||||
status: 200
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user