Skip to content

Commit

Permalink
Merge branch 'dev' into #156-move-rooms-to-the-past-room-list-and-cha…
Browse files Browse the repository at this point in the history
…nge-settlestatus-automatically-when-the-participant-is-one
  • Loading branch information
cokia authored Sep 3, 2024
2 parents e0c6415 + e541fc0 commit 534bdd3
Show file tree
Hide file tree
Showing 60 changed files with 1,885 additions and 910 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
4 changes: 4 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ app.use("/chats", require("./src/routes/chats"));
app.use("/locations", require("./src/routes/locations"));
app.use("/reports", require("./src/routes/reports"));
app.use("/notifications", require("./src/routes/notifications"));
app.use("/fare", require("./src/routes/fare"));

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

// [Schedule] 스케줄러 시작
require("./src/schedules")(app);

// [Module] 택시 예상 비용 db 초기화
require("./src/modules/fare").initializeDatabase();
17 changes: 16 additions & 1 deletion loadenv.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,20 @@ module.exports = {
slackWebhookUrl: {
report: process.env.SLACK_REPORT_WEBHOOK_URL || "", // optional
},
eventConfig: process.env.EVENT_CONFIG && JSON.parse(process.env.EVENT_CONFIG), // optional
eventConfig: (process.env.EVENT_CONFIG &&
JSON.parse(process.env.EVENT_CONFIG)) || {
mode: "2024fall",
credit: {
name: "송편코인",
initialAmount: 0,
},
period: {
startAt: new Date("2024-09-07T00:00:00+09:00"),
endAt: new Date("2024-09-24T00:00:00+09:00"),
},
}, // optional
naverMap: {
apiId: process.env.NAVER_MAP_API_ID, // optional
apiKey: process.env.NAVER_MAP_API_KEY, //optional
},
};
6 changes: 3 additions & 3 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!");
});
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 534bdd3

Please sign in to comment.