Skip to content

Commit

Permalink
[back] ✨ feat: create list location route
Browse files Browse the repository at this point in the history
  • Loading branch information
FaelSantoss committed Nov 28, 2024
1 parent ca848e2 commit b4a4d33
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions apps/server/src/app/fastify/routes/locations-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { DeleteLocationsController, RegisterLocationController } from "@/api/con
import type { FastifyInstance } from "fastify";
import { FastifyHttp } from "../fastify-http";
import { UpdateLocationController } from "@/api/controllers/locations/update-location-controller";
import { ListLocationsController } from "@/api/controllers/locations/list-locations-controller";

export const LocationsRoutes = async (app: FastifyInstance) => {
const registerLocationController = new RegisterLocationController()
const deleteLocationsController = new DeleteLocationsController()
const updateLocationController = new UpdateLocationController()
const listLocationsController = new ListLocationsController()

app.post('/', async (request, response) => {
const http = new FastifyHttp(request, response)
Expand All @@ -18,8 +20,13 @@ export const LocationsRoutes = async (app: FastifyInstance) => {
return deleteLocationsController.handle(http)
})

app.put('/:locationId', async (request, Response) => {
const http = new FastifyHttp(request, Response)
app.put('/:locationId', async (request, response) => {
const http = new FastifyHttp(request, response)
return updateLocationController.handle(http)
})

app.get('/', async (request, response) => {
const http = new FastifyHttp(request, response)
return listLocationsController.handle(http)
})
}

0 comments on commit b4a4d33

Please sign in to comment.