mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-19 06:21:35 +01:00
debug
This commit is contained in:
22
app/Controllers/Http/ProjectsController.ts
Normal file
22
app/Controllers/Http/ProjectsController.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
|
||||
import Project from "App/Models/Project";
|
||||
import ProjectValidator from "App/Validators/project/ProjectValidator";
|
||||
|
||||
export default class ProjectsController {
|
||||
|
||||
public async get ({ response }: HttpContextContract) {
|
||||
const projects = await Project.query().orderBy('progress', 'desc')
|
||||
return response.status(200).send({
|
||||
projects
|
||||
})
|
||||
}
|
||||
|
||||
public async add ({ request, response}: HttpContextContract) {
|
||||
const data = await request.validate(ProjectValidator)
|
||||
await Project.create(data)
|
||||
return response.status(200).send({
|
||||
message: 'Project successfully created'
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user