Skip to content

Commit 1370070

Browse files
committed
Merge branch 'main' into fix/style
2 parents cc29cdc + 5f27dbe commit 1370070

File tree

123 files changed

+3203
-794
lines changed

Some content is hidden

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

123 files changed

+3203
-794
lines changed

.github/workflows/after-purchase.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ jobs:
3434
PEATIX_BASIC_PASSWORD: ${{ secrets.PEATIX_BASIC_PASSWORD }}
3535
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
3636
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
37+
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
38+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}

.github/workflows/sales-daily.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ jobs:
3434
PEATIX_BASIC_PASSWORD: ${{ secrets.PEATIX_BASIC_PASSWORD }}
3535
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
3636
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
37+
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
38+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}

apps/peatix-adapter/src/after-purchase/after-purchase.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { SupabaseModule } from 'src/supabase/supabase.module'
1616
import { SupabaseService } from 'src/supabase/supabase.service'
1717
import { DiscordModule } from 'src/discord/discord.module'
1818
import { DiscordService } from 'src/discord/discord.service'
19-
import { UnactivatedCheckCommand } from 'src/unactivated-check/unactivated-check.command'
2019
import { SalesDailyCommand } from 'src/sales-daily/sales-daily.command'
2120
import { UnactivatedCheckService } from 'src/unactivated-check/unactivated-check.service'
2221
import { SalesDailyService } from 'src/sales-daily/sales-daily.service'
@@ -42,7 +41,6 @@ import { SalesDailyService } from 'src/sales-daily/sales-daily.service'
4241
useClass: PuppeteerService,
4342
},
4443
AfterPurchaseCommand,
45-
UnactivatedCheckCommand,
4644
SalesDailyCommand,
4745
AfterPurchaseService,
4846
UnactivatedCheckService,

apps/peatix-adapter/src/after-purchase/after-purchase.service.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,7 @@ export class AfterPurchaseService {
4747
const personalSponsors = [...new Set(_personalSponsors)] // 重複を削除
4848
// this.logger.log(receipts)
4949
const today = new Date()
50-
this.logger.log(
51-
`${today.getFullYear()}/${today.getMonth() + 1}/${today.getDate()}時点の${Constants.PEATIX_GENERAL_TICKET}売上状況: ${receipts.filter(v => v.role === Constants.PEATIX_GENERAL_ROLE).length}枚 (+${receipts.filter(v => v.role === Constants.PEATIX_GENERAL_ROLE).filter(v => v.date.includes(`${today.getFullYear()}/${today.getMonth() + 1}/${today.getDate()}`)).length}枚)`,
52-
)
53-
this.logger.log(
54-
`${today.getFullYear()}/${today.getMonth() + 1}/${today.getDate()}時点の${Constants.PEATIX_WITH_PARTY_TICKET}売上状況: ${receipts.filter(v => v.role === Constants.PEATIX_WITH_PARTY_ROLE).length}枚 (+${receipts.filter(v => v.role === Constants.PEATIX_WITH_PARTY_ROLE).filter(v => v.date.includes(`${today.getFullYear()}/${today.getMonth() + 1}/${today.getDate()}`)).length}枚)`,
55-
)
56-
this.logger.log(
57-
`${Constants.PEATIX_PERSONAL_SPONSOR_TICKET}売上状況: ${personalSponsors.length}枚 ('${personalSponsors.join('\', \'')}')`,
58-
)
50+
5951
this.discordService.send(
6052
'After Purchase Bot',
6153
`${today.getFullYear()}/${today.getMonth() + 1}/${today.getDate()}時点の${Constants.PEATIX_GENERAL_TICKET}売上状況: ${receipts.filter(v => v.role === Constants.PEATIX_GENERAL_ROLE).length}枚 (+${receipts.filter(v => v.role === Constants.PEATIX_GENERAL_ROLE).filter(v => v.date.includes(`${today.getFullYear()}/${today.getMonth() + 1}/${today.getDate()}`)).length}枚)`,

apps/peatix-adapter/src/constnats.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const Constants = {
88
PEATIX_RECEIPT_ID_ROW_INDEX: 0, // レシート ID
99
PEATIX_APPLIED_AT_ROW_INDEX: 3, // 申込日時
1010
PEATIX_RECEIPTS_TICKET_NAME_ROW_INDEX: 4, // チケット名
11-
PEATIX_PERSONAL_SPONSOR_NAME_ROW_INDEX: 15, // 個人スポンサー クレジット名
11+
PEATIX_PERSONAL_SPONSOR_NAME_ROW_INDEX: 16, // 個人スポンサー クレジット名
1212
PEATIX_GENERAL_ROLE: 'attendee',
1313
PEATIX_WITH_PARTY_ROLE: 'attendee + party',
1414
} as const

apps/peatix-adapter/src/discord/discord.service.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,22 @@ export class DiscordService {
1515
}
1616

1717
public async send(user: string, content: string) {
18-
await axios.post(
19-
this.envService.DISCORD_WEBHOOK_URL,
20-
{
21-
username: user,
22-
content: content,
23-
},
24-
{
25-
headers: {
26-
'Accept': 'application/json',
27-
'Content-type': 'application/json',
18+
await axios
19+
.post(
20+
this.envService.DISCORD_WEBHOOK_URL,
21+
{
22+
username: user,
23+
content: content,
2824
},
29-
},
30-
)
25+
{
26+
headers: {
27+
'Accept': 'application/json',
28+
'Content-type': 'application/json',
29+
},
30+
},
31+
)
32+
.catch((error) => {
33+
this.logger.error(error)
34+
})
3135
}
3236
}

apps/peatix-adapter/src/sales-daily/sales-daily.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export class SalesDailyService {
4949
archives[2].push(`${receipts.filter(v => v.role === Constants.PEATIX_WITH_PARTY_ROLE).filter(v => v.date.includes(`${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`)).length}`)
5050
}
5151
for (const archive of archives) {
52-
this.logger.log(`${archive.join(', ')} `)
53-
this.discordService.send('After Purchase Bot', `${archive.join(', ')} `)
52+
this.logger.log(`${archive.join(',')}`)
53+
this.discordService.send('After Purchase Bot', `${archive.join(',')}`)
5454
}
5555
}
5656
}

apps/peatix-adapter/src/supabase/supabase.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ export class SupabaseService {
3939
const targetData = { ...targets }
4040

4141
const { data, error } = await this.client.from('attendees')
42-
.upsert({ role: targetData.role, activated_at: new Date().toISOString(), canceled_at: '' })
42+
.update({ role: targetData.role, activated_at: new Date().toISOString(), canceled_at: null })
4343
.eq('receipt_id', targetData.receipt_id)
44-
.eq('activated_at', '')
44+
.is('activated_at', null)
4545
if (error) return { status: false, data: null }
4646

4747
return { status: true, data }
@@ -51,8 +51,8 @@ export class SupabaseService {
5151
this.getClient()
5252

5353
const { data, error } = await this.client.from('attendees')
54-
.upsert({ canceled_at: new Date().toISOString() })
55-
.eq('activated_at', '')
54+
.update({ canceled_at: new Date().toISOString() })
55+
.is('activated_at', null)
5656
if (error) return { status: false, data: null }
5757

5858
return { status: true, data }

apps/peatix-adapter/src/unactivated-check/unactivated-check.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export class UnactivatedCheckService {
1616
async apply() {
1717
this.supabaseService.updateUnactivatedAttendees()
1818

19-
this.discordService.send('After Purchase Bot', '未反映者 反映済')
19+
// this.discordService.send('After Purchase Bot', '未反映者 反映済')
2020
}
2121
}

apps/web-docs/peatix/csv-usage.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,23 @@ https://www.figma.com/file/mRTYOtFjg3L8ozmjEEhHLh/Vue-Fes-Japan-2024
142142
+
143143
├─ src
144144
│ ├─ after-purchase
145-
| ├- after-purchase.module.ts # 購入後の処理で使用が予定されている依存関係を置く
145+
| ├- after-purchase.module.ts # 購入後に自動反映される予定のユーザーを対象として、使用が予定されている依存関係を置く
146146
| └- after-purchase.service.ts
147147
│ ├─ env
148-
| ├- env.module.ts # 環境変数を読み込む基盤を置く
148+
| ├- env.module.ts # 環境変数を読み込む基盤を置く
149149
| └- env.service.ts
150150
│ ├─ peatix-order
151-
| ├- peatix-order.module.ts # Peatix へのログインを試み、購入情報を取得、Supabase へ整形したデータを挿入する基盤を置く
151+
| ├- peatix-order.module.ts # Peatix へのログインを試み、購入情報を取得、Supabase へ整形したデータを挿入する基盤を置く
152152
| └- peatix-order.service.ts
153153
│ ├─ puppeteer
154-
| └- puppeteer.service.ts # スクレイピング処理の基盤を置く
155-
| └- cmd.ts # 処理の窓口を置く
154+
| └- puppeteer.service.ts # スクレイピング処理の基盤を置く
155+
│ ├─ sales-daily
156+
| ├- sales-daily.module.ts # 各日の購入処理で使用が予定されている依存関係を置く
157+
| └- sales-daily.service.ts
158+
│ ├─ unactivated-check
159+
| ├- unactivated-check.module.ts # 自動反映されなかったユーザーを対象として、処理で使用が予定されている依存関係を置く
160+
| └- unactivated-check.service.ts
161+
| └- cmd.ts # 処理の窓口を置く
156162
├─ nest-cli.json
157163
└- package.json
158164
```
@@ -176,13 +182,13 @@ async function bootstrap() {
176182
bootstrap()
177183
```
178184

179-
### NestJS とはなんぞや
185+
## NestJS とはなんぞや
180186

181187
そもそも NestJS について、深く知りたいという方のためのセクションを設けました。
182188

183189
::: tip
184190

185-
NestJS の構造からたいへん上手くまとまっているため、合わせてこちらをご一読いただくと良いように考えています
191+
NestJS の構造からたいへん上手くまとまっており、合わせてこちらをご一読いただけますと
186192

187193
[NestJS の基礎概念の図解と要約](https://zenn.dev/morinokami/articles/nestjs-overview)
188194

0 commit comments

Comments
 (0)