Skip to content

Commit 67bbca3

Browse files
authored
Merge pull request #199 from vuejs-jp/enhance/ticket-name-to-role
feat: ticketName to role
2 parents 7ae1709 + 98f9a5b commit 67bbca3

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

apps/peatix-adapter/src/constnats.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
export const Constants = {
22
PEATIX_LOGIN_URL: 'https://peatix.com/signin',
33
PEATIX_DASHBOARD_URL: 'https://peatix.com/event/',
4-
}
4+
PEATIX_GENERAL_TICKET: '一般チケット',
5+
PEATIX_WITH_PARTY_TICKET: '一般+アフターパーティーチケット',
6+
PEATIX_GENERAL_ROLE: 'attendee',
7+
PEATIX_WITH_PARTY_ROLE: 'attendee + party',
8+
} as const
9+
10+
export type TicketRole = Extract<typeof Constants[keyof typeof Constants], 'attendee' | 'attendee + party'>

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,14 @@ export class PeatixOrderService extends ScraperPage {
174174
const ticketName = attendee[Object.keys(attendee)[4]]
175175

176176
// チケット名から参加者の種別を特定する
177-
178-
return { role: 'attendee', receipt_id: receiptId }
177+
if (ticketName.includes(Constants.PEATIX_GENERAL_TICKET)) {
178+
return { role: Constants.PEATIX_GENERAL_ROLE, receipt_id: receiptId }
179+
}
180+
if (ticketName.includes(Constants.PEATIX_WITH_PARTY_TICKET)) {
181+
return { role: Constants.PEATIX_WITH_PARTY_ROLE, receipt_id: receiptId }
182+
}
183+
184+
// return { role: 'attendee', receipt_id: receiptId }
179185
})
180186
this.logger.log(receipts)
181187

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Role } from '@vuejs-jp/model'
2+
import { TicketRole } from '../constnats'
23

34
export type { Database } from './generated/supabase'
45

@@ -7,6 +8,6 @@ export type FormAttendee = Database['public']['Tables']['attendees']['Insert']
78
export type FormAdminUser = Database['public']['Tables']['admin_users']['Insert']
89

910
export type AttendeeReceipt = {
10-
role: Extract<Role, 'attendee' | 'attendee + party'>
11+
role: Extract<Role, TicketRole>
1112
receipt_id: string
1213
}

0 commit comments

Comments
 (0)