Skip to content

Commit

Permalink
オーダーストップ情報を出力するスクリプトを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
toririm committed Nov 11, 2024
1 parent d134c62 commit 7a0f312
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
Binary file modified bun.lockb
Binary file not shown.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "cafeore-2024",
"private": true,
"type": "module",
"workspaces": ["pos", "mobile", "common"],
"scripts": {
"sync": "bun install --frozen-lockfile"
},
"devDependencies": {
"@biomejs/biome": "1.9.3",
"typescript": "^5.6.3"
},
"trustedDependencies": ["@biomejs/biome", "workerd"]
"private": true,
"scripts": {
"sync": "bun install --frozen-lockfile"
},
"trustedDependencies": ["@biomejs/biome", "workerd"],
"type": "module",
"workspaces": ["pos", "mobile", "common"]
}
24 changes: 24 additions & 0 deletions scripts/download-master-state.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import fs from "node:fs";
import { masterRepository } from "common/repositories/global";
import dayjs from "dayjs";
import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";

dayjs.extend(utc);
dayjs.extend(timezone);

const masterStateEntity = await masterRepository.get();
const orderStats = masterStateEntity?.orderStats ?? [];

const getJST = (date: Date) => dayjs(date).tz("Asia/Tokyo");

const sohosaiData = orderStats.filter(({ createdAt }) =>
getJST(createdAt).isAfter(dayjs("2024-11-03 10:00").tz()),
);

console.log(
getJST(sohosaiData[0].createdAt),
getJST(sohosaiData[sohosaiData.length - 1].createdAt),
);

fs.writeFileSync("order_stops.json", JSON.stringify(sohosaiData, null, 2));
File renamed without changes.

0 comments on commit 7a0f312

Please sign in to comment.