mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-14 12:14:33 +01:00
@@ -1,16 +1,24 @@
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
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 get ({ response }: HttpContextContract) {
|
||||
const location = await Location.query().orderBy('since', 'desc').firstOrFail()
|
||||
return response.status(200).send({
|
||||
place: location.place,
|
||||
left: location.left,
|
||||
since: location.since
|
||||
})
|
||||
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
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return response.status(200).send({
|
||||
location: 'Location is unknown...'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
public async store ({ request, response }: HttpContextContract) {
|
||||
|
||||
Reference in New Issue
Block a user