Skip to content

Commit

Permalink
Fix comments and remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblurie29 committed Apr 15, 2024
1 parent 72fab48 commit b372d46
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 72 deletions.
3 changes: 0 additions & 3 deletions src/controllers/Dashboard.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import type { Request, Response } from 'express';
* @param res - the response object
*/
export const getDashboardStats = async (req: Request, res: Response) => {
// use Joi to validate the request body
// ...

const base = new Airtable({ apiKey: process.env.AIRTABLE_API_KEY || '' }).base(
'appwPsfAb6U8CV3mf'
);
Expand Down
65 changes: 0 additions & 65 deletions src/controllers/FlightRequest.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-irregular-whitespace */
import { createTestFlightLegData } from '../data/test-data';
import logger from '../util/logger';
import { trimFlightLeg, trimRequest } from '../util/trim';
import Airtable from 'airtable';
Expand All @@ -13,20 +11,6 @@ const base = new Airtable({
apiKey: process.env.AIRTABLE_API_KEY || '',
}).base('appwPsfAb6U8CV3mf');

/**
* This function returns all flight requests for a given user
*
* Steps to complete:
* 1. Get the userId from the query parameters, if it doesn't exist return a 400
* 2. Make a call to AirTable to get all flight requests for the user, if that fails return a 500 (hint, use try/catch)
*    If there are no flight requests for the user return a 400. (hint: use the AirTable API, see TestControllers/retrievePassengers.ts for an example)
*    Another hint - we will be filtering by the "Passenger ID" field in the AirTable
* 3. Remove any unnecessary data from the flight requests (there is a lot of data in the AirTable response we don't need)
* 4. Return the flight requests for the user
*
* @param req - the request object
* @param res - the response object
*/
/**
* Get all flight requests for a given user
*
Expand Down Expand Up @@ -177,52 +161,3 @@ export const getFlightLegsById = async (req: Request, res: Response) => {

return res.status(200).send(flightLegs);
};

/**
* This function creates a flight request for a given user
*
* Steps to complete:
* 1. Use Joi to validate the request body, if it doesn't exist or is invalid return a 400
* 2. Create a fake flight request by making a call to JotForm. If that fails return a 500 (hint, use try/catch)
* 3. Return the flight request that was created
*
* @param req - the request object
* @param res - the response object
*/
export const createFlightRequest = async (req: Request, res: Response) => {
// get the flight request data from the request body
// const data = req.body;

// use Joi to validate the request body
// ...

// create a fake flight request
const flightRequest = createTestFlightLegData(); // return the flight request

res.status(200).send(flightRequest);
};

/**
* This function updates a flight request for a given flightRequestId
*
* Steps to complete:
* 1. Get the flightRequestId from the path parameters, if it doesn't exist return a 400
* 2. Use Joi to validate the request body, if it doesn't exist or is invalid return a 400
* 3. Update the flight request by making a call to AirTable. If that fails return a 500 (hint, use try/catch)
* 4. Return the entire flight request that was updated, once again removing any unnecessary data
*
* @param req - the request object
* @param res - the response object
*/
export const updateFlightRequest = async (req: Request, res: Response) => {
// get the flightRequestId from the path parameters
// const { flightRequestId } = req.params;

// use Joi to validate the request body
// ...

// create a fake flight request that was "updated"
const flightRequest = createTestFlightLegData(); // return the flight request

res.status(200).send(flightRequest);
};
4 changes: 0 additions & 4 deletions src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import {
getAllFlightRequestsForUser,
getFlightRequestById,
getFlightLegsById,
createFlightRequest,
updateFlightRequest,
} from '../controllers/FlightRequest.controller';
import express from 'express';
import type { Request, Response } from 'express';
Expand Down Expand Up @@ -51,7 +49,5 @@ router.get('/dashboard/', getDashboardStats);
router.get('/requests', validateAuth, getAllFlightRequestsForUser);
router.get('/requests/:id', validateAuth, getFlightRequestById);
router.get('/requests/:id/legs', validateAuth, getFlightLegsById);
router.post('/requests/', validateAuth, createFlightRequest);
router.put('/requests/:id', validateAuth, updateFlightRequest);

export default router;

0 comments on commit b372d46

Please sign in to comment.