mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
17 lines
508 B
TypeScript
17 lines
508 B
TypeScript
import {HttpContextContract} from "@ioc:Adonis/Core/HttpContext";
|
|
import GuestBookMessage from "../../Models/GuestBookMessage";
|
|
import StoreValidator from "../../Validators/guestbook/StoreValidator";
|
|
|
|
export default class GuestBookController {
|
|
|
|
public async index () {
|
|
return GuestBookMessage.query().orderBy('created_at', 'desc')
|
|
}
|
|
|
|
public async store ({request}: HttpContextContract) {
|
|
const data = await request.validate(StoreValidator)
|
|
return await GuestBookMessage.create(data)
|
|
}
|
|
|
|
}
|