Skip to content

Commit

Permalink
Merge branch 'dev' into #159-add-typescript-support
Browse files Browse the repository at this point in the history
Compile errors will be fixed later
  • Loading branch information
kmc7468 committed Nov 12, 2024
1 parent a6db7d9 commit 0a2fe36
Show file tree
Hide file tree
Showing 66 changed files with 2,024 additions and 940 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ CORS_WHITELIST=[CORS 정책에서 허용하는 도메인의 목록(e.g. ["http:/
GOOGLE_APPLICATION_CREDENTIALS=[GOOGLE_APPLICATION_CREDENTIALS JSON]
TEST_ACCOUNTS=[스팍스SSO로 로그인시 무조건 테스트로 로그인이 가능한 허용 아이디 목록]
SLACK_REPORT_WEBHOOK_URL=[Slack 웹훅 URL들이 담긴 JSON]
NAVER_MAP_API_ID=[네이버 지도 API ID]
NAVER_MAP_API_KEY=[네이버 지도 API KEY]

# optional environment variables for taxiSampleGenerator
SAMPLE_NUM_OF_ROOMS=[방의 개수]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"express-rate-limit": "^7.1.0",
"express-session": "^1.17.3",
"express-validator": "^6.14.0",
"firebase-admin": "^11.4.1",
"firebase-admin": "^11.11.1",
"jsonwebtoken": "^9.0.2",
"mongoose": "^6.12.0",
"node-cron": "3.0.2",
Expand Down
10 changes: 6 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions scripts/chatPaymentSettlementUpdater.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Issue #449-1을 해결하기 위한 DB 마이그레이션 스크립트입니다.
// chat type 중 settlement와 payment를 서로 교체합니다.
// https://github.com/sparcs-kaist/taxi-back/issues/449

const { MongoClient } = require("mongodb");
const { mongo: mongoUrl } = require("../loadenv");

const client = new MongoClient(mongoUrl);
const db = client.db("taxi");
const chats = db.collection("chats");

async function run() {
try {
for await (const doc of chats.find()) {
if (doc.type === "settlement" || doc.type === "payment") {
await chats.findOneAndUpdate(
{ _id: doc._id },
{
$set: {
type: doc.type === "settlement" ? "payment" : "settlement",
},
}
);
}
}
} catch (err) {
console.log(err);
} finally {
await client.close();
}
}
run().then(() => {
console.log("Done!");
});
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import {
notificationRouter,
adminRouter,
docsRouter,
fareRouter,
} from "@/routes";
import { initializeApp } from "@/modules/fcm";
import { initializeDatabase as initializeFareDatabase } from "@/modules/fare";
import logger from "@/modules/logger";
import { connectDatabase } from "@/modules/stores/mongo";
import { startSocketServer } from "@/modules/socket";
Expand Down Expand Up @@ -85,6 +87,7 @@ app.use("/chats", chatRouter);
app.use("/locations", locationRouter);
app.use("/reports", reportRouter);
app.use("/notifications", notificationRouter);
app.use("/fare", fareRouter);

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

// [Schedule] 스케줄러 시작
registerSchedules(app);

// [Module] 택시 예상 비용 db 초기화
initializeFareDatabase();
4 changes: 4 additions & 0 deletions src/loadenv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ export const slackWebhookUrl = {
};
// export const eventConfig =
// process.env.EVENT_CONFIG && JSON.parse(process.env.EVENT_CONFIG); // optional
export const naverMap = {
apiId: process.env.NAVER_MAP_API_ID || "", // optional
apiKey: process.env.NAVER_MAP_API_KEY || "", // optional
};
4 changes: 2 additions & 2 deletions src/lottery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ lotteryRouter.use(require("../middlewares/originValidator"));

// [Router] APIs
lotteryRouter.use("/globalState", require("./routes/globalState"));
lotteryRouter.use("/invite", require("./routes/invite"));
lotteryRouter.use("/invites", require("./routes/invites"));
lotteryRouter.use("/transactions", require("./routes/transactions"));
lotteryRouter.use("/items", require("./routes/items"));
lotteryRouter.use("/publicNotice", require("./routes/publicNotice"));
// lotteryRouter.use("/publicNotice", require("./routes/publicNotice"));
lotteryRouter.use("/quests", require("./routes/quests"));

// [AdminJS] AdminJS에 표시할 Resource 생성
Expand Down
Loading

0 comments on commit 0a2fe36

Please sign in to comment.