Skip to content

Commit 0a2fe36

Browse files
committed
Merge branch 'dev' into #159-add-typescript-support
Compile errors will be fixed later
1 parent a6db7d9 commit 0a2fe36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2024
-940
lines changed

.env.example

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ CORS_WHITELIST=[CORS 정책에서 허용하는 도메인의 목록(e.g. ["http:/
1616
GOOGLE_APPLICATION_CREDENTIALS=[GOOGLE_APPLICATION_CREDENTIALS JSON]
1717
TEST_ACCOUNTS=[스팍스SSO로 로그인시 무조건 테스트로 로그인이 가능한 허용 아이디 목록]
1818
SLACK_REPORT_WEBHOOK_URL=[Slack 웹훅 URL들이 담긴 JSON]
19+
NAVER_MAP_API_ID=[네이버 지도 API ID]
20+
NAVER_MAP_API_KEY=[네이버 지도 API KEY]
1921

2022
# optional environment variables for taxiSampleGenerator
2123
SAMPLE_NUM_OF_ROOMS=[방의 개수]

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"express-rate-limit": "^7.1.0",
4242
"express-session": "^1.17.3",
4343
"express-validator": "^6.14.0",
44-
"firebase-admin": "^11.4.1",
44+
"firebase-admin": "^11.11.1",
4545
"jsonwebtoken": "^9.0.2",
4646
"mongoose": "^6.12.0",
4747
"node-cron": "3.0.2",

pnpm-lock.yaml

+6-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Issue #449-1을 해결하기 위한 DB 마이그레이션 스크립트입니다.
2+
// chat type 중 settlement와 payment를 서로 교체합니다.
3+
// https://github.com/sparcs-kaist/taxi-back/issues/449
4+
5+
const { MongoClient } = require("mongodb");
6+
const { mongo: mongoUrl } = require("../loadenv");
7+
8+
const client = new MongoClient(mongoUrl);
9+
const db = client.db("taxi");
10+
const chats = db.collection("chats");
11+
12+
async function run() {
13+
try {
14+
for await (const doc of chats.find()) {
15+
if (doc.type === "settlement" || doc.type === "payment") {
16+
await chats.findOneAndUpdate(
17+
{ _id: doc._id },
18+
{
19+
$set: {
20+
type: doc.type === "settlement" ? "payment" : "settlement",
21+
},
22+
}
23+
);
24+
}
25+
}
26+
} catch (err) {
27+
console.log(err);
28+
} finally {
29+
await client.close();
30+
}
31+
}
32+
run().then(() => {
33+
console.log("Done!");
34+
});

src/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ import {
2424
notificationRouter,
2525
adminRouter,
2626
docsRouter,
27+
fareRouter,
2728
} from "@/routes";
2829
import { initializeApp } from "@/modules/fcm";
30+
import { initializeDatabase as initializeFareDatabase } from "@/modules/fare";
2931
import logger from "@/modules/logger";
3032
import { connectDatabase } from "@/modules/stores/mongo";
3133
import { startSocketServer } from "@/modules/socket";
@@ -85,6 +87,7 @@ app.use("/chats", chatRouter);
8587
app.use("/locations", locationRouter);
8688
app.use("/reports", reportRouter);
8789
app.use("/notifications", notificationRouter);
90+
app.use("/fare", fareRouter);
8891

8992
// [Middleware] 전역 에러 핸들러. 에러 핸들러는 router들보다 아래에 등록되어야 합니다.
9093
app.use(errorHandler);
@@ -101,3 +104,6 @@ app.set("io", startSocketServer(serverHttp));
101104

102105
// [Schedule] 스케줄러 시작
103106
registerSchedules(app);
107+
108+
// [Module] 택시 예상 비용 db 초기화
109+
initializeFareDatabase();

src/loadenv.ts

+4
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,7 @@ export const slackWebhookUrl = {
6363
};
6464
// export const eventConfig =
6565
// process.env.EVENT_CONFIG && JSON.parse(process.env.EVENT_CONFIG); // optional
66+
export const naverMap = {
67+
apiId: process.env.NAVER_MAP_API_ID || "", // optional
68+
apiKey: process.env.NAVER_MAP_API_KEY || "", // optional
69+
};

src/lottery/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ lotteryRouter.use(require("../middlewares/originValidator"));
2828

2929
// [Router] APIs
3030
lotteryRouter.use("/globalState", require("./routes/globalState"));
31-
lotteryRouter.use("/invite", require("./routes/invite"));
31+
lotteryRouter.use("/invites", require("./routes/invites"));
3232
lotteryRouter.use("/transactions", require("./routes/transactions"));
3333
lotteryRouter.use("/items", require("./routes/items"));
34-
lotteryRouter.use("/publicNotice", require("./routes/publicNotice"));
34+
// lotteryRouter.use("/publicNotice", require("./routes/publicNotice"));
3535
lotteryRouter.use("/quests", require("./routes/quests"));
3636

3737
// [AdminJS] AdminJS에 표시할 Resource 생성

0 commit comments

Comments
 (0)