This commit is contained in:
Hugo Falcao
2022-06-20 20:07:12 -03:00
parent 5505b9981a
commit 888391b930
2 changed files with 5 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
import { Router } from 'express';
import { getRepository } from 'typeorm';
import ensureAuthenticated from '../middlewares/ensureAuthenticated';
import UserSearching from '../models/UsersSearching';
import CalculateDistanceBetweenCoords from '../services/CalculateDistanceBetweenCoords';
import CreateUserSearchingService from '../services/CreateUserSearchingService';
@@ -33,8 +34,8 @@ searchRoutes.get('/list', async (request, response) => {
return response.json({ data: searches });
});
searchRoutes.post('/', async (request, response) => {
const { id_user, latitude_from, longitude_from, address_to } = request.body;
searchRoutes.post('/', ensureAuthenticated, async (request, response) => {
const { latitude_from, longitude_from, address_to } = request.body;
const getCoordinates = new GetCoordinatesByAddress();
@@ -46,7 +47,7 @@ searchRoutes.post('/', async (request, response) => {
const createUserSearching = new CreateUserSearchingService();
const search = await createUserSearching.execute({
id_user,
id_user:request.user.id_user,
latitude_from,
longitude_from,
latitude_to,

View File

@@ -34,7 +34,7 @@ app.use((err: Error, request: Request, response: Response, _: NextFunction) => {
});
});
const port = 10002
const port = 3333
app.listen(port, () => {
console.log(`🚀 Server started on port ${port}!`);