Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian0KIM committed Dec 7, 2024
1 parent 78f08b1 commit 850b728
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 1 addition & 8 deletions back/database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ const setSession2 = function(id, cookie) {
const getSession = function(id) {
return session.find(user => user.id == id)['Cookie'];
}
const getSession2 = function(id) {
return session.find(user => user.id == id)['Cookie2'];
}
const getSession3= function(id) {
return session.find(user => user.id == id)['reserveReserve'];
}
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;


Expand All @@ -68,7 +62,6 @@ function getpublickey(callback) {
}



function login(id, pw, callback, ecallback) {
getpublickey((key, cookie) => {
let enc = new JSEncrypt()
Expand Down Expand Up @@ -718,5 +711,5 @@ async function fetchBusHistory(routeId, stationId, staOrder, date) {


module.exports = {
login,getMID, setSession, getSession, setSession2, getSession2, getUserInfo, getSession3, mybusinfo, getUserSession, getBusArrival, getStoredPredictions, startMonitoring, stopMonitoring, getStoredPredictionsByStation, getPastBusArrival, getStaOrder, stationRouteOrder,busRouteMap,stationMap,logout
login,getMID, setSession, getSession, setSession2, getUserInfo,mybusinfo, getUserSession, getBusArrival, getStoredPredictions, startMonitoring, stopMonitoring, getStoredPredictionsByStation, getPastBusArrival, getStaOrder, stationRouteOrder,busRouteMap,stationMap,logout
};
8 changes: 6 additions & 2 deletions back/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ app.post('/user/login', (req, res) => {

})


app.post('/user/logout', (req, res) => {
const id = req.body.id
const cookie = req.body.cookie
Expand Down Expand Up @@ -124,6 +125,8 @@ app.post('/user/logout', (req, res) => {
});
});
});


app.get('/user/status', (req, res) => {
const id = req.query.id; // id는 쿼리로 받고
const cookie = req.headers.authorization; // 쿠키는 헤더로 받음
Expand Down Expand Up @@ -167,8 +170,6 @@ app.get('/user/status', (req, res) => {
});




app.get('/bus/:routeId/eta', (req, res) => {
const routeId = req.params.routeId || '233000031'; // busId -> routeId로 수정
console.log('버스 도착 정보 요청:', { routeId: req.params.routeId });
Expand Down Expand Up @@ -216,6 +217,7 @@ app.get('/stop/:stationId/eta', (req, res) => {
);
});


app.get('/complain/:stationId/passedby', (req, res) => {
const stationId = req.params.stationId;
const predictions = database.getStoredPredictionsByStation(stationId);
Expand All @@ -236,6 +238,7 @@ app.get('/complain/:stationId/passedby', (req, res) => {
});
});


app.get('/bus/history/byBus', async (req, res) => {
try {
const { routeId, stationId, date } = req.query;
Expand Down Expand Up @@ -286,6 +289,7 @@ app.get('/bus/history/byBus', async (req, res) => {
}
});


app.get('/bus/history/byTime', async (req, res) => {
try {
const { stationId, date } = req.query;
Expand Down

0 comments on commit 850b728

Please sign in to comment.