mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 20:19:26 +01:00
Lint and update
This commit is contained in:
@@ -1,32 +1,31 @@
|
||||
import {HttpContextContract} from '@ioc:Adonis/Core/HttpContext'
|
||||
import Location from "App/Models/Location";
|
||||
import LocationValidator from "App/Validators/location/LocationValidator";
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
import Location from 'App/Models/Location'
|
||||
import LocationValidator from 'App/Validators/location/LocationValidator'
|
||||
|
||||
export default class LocationsController {
|
||||
|
||||
public async index ({ response }: HttpContextContract) {
|
||||
public async index({ response }: HttpContextContract) {
|
||||
const location = await Location.query().orderBy('since', 'desc').first()
|
||||
if (location) {
|
||||
return response.status(200).send({
|
||||
location: {
|
||||
place: location.place,
|
||||
left: location.left,
|
||||
since: location.since
|
||||
}
|
||||
since: location.since,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return response.status(200).send({
|
||||
location: 'Location is unknown...'
|
||||
location: 'Location is unknown...',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
public async store ({ request, response }: HttpContextContract) {
|
||||
public async store({ request, response }: HttpContextContract) {
|
||||
const data = await request.validate(LocationValidator)
|
||||
const location = await Location.create(data)
|
||||
return response.status(200).send({
|
||||
location
|
||||
location,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user