mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 15:54:03 +00:00
feat(bot): add multi-household setup flow
This commit is contained in:
52
packages/ports/src/household-config.ts
Normal file
52
packages/ports/src/household-config.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
export const HOUSEHOLD_TOPIC_ROLES = ['purchase', 'feedback', 'reminders'] as const
|
||||
|
||||
export type HouseholdTopicRole = (typeof HOUSEHOLD_TOPIC_ROLES)[number]
|
||||
|
||||
export interface HouseholdTelegramChatRecord {
|
||||
householdId: string
|
||||
householdName: string
|
||||
telegramChatId: string
|
||||
telegramChatType: string
|
||||
title: string | null
|
||||
}
|
||||
|
||||
export interface HouseholdTopicBindingRecord {
|
||||
householdId: string
|
||||
role: HouseholdTopicRole
|
||||
telegramThreadId: string
|
||||
topicName: string | null
|
||||
}
|
||||
|
||||
export interface RegisterTelegramHouseholdChatInput {
|
||||
householdName: string
|
||||
telegramChatId: string
|
||||
telegramChatType: string
|
||||
title?: string
|
||||
}
|
||||
|
||||
export interface RegisterTelegramHouseholdChatResult {
|
||||
status: 'created' | 'existing'
|
||||
household: HouseholdTelegramChatRecord
|
||||
}
|
||||
|
||||
export interface HouseholdConfigurationRepository {
|
||||
registerTelegramHouseholdChat(
|
||||
input: RegisterTelegramHouseholdChatInput
|
||||
): Promise<RegisterTelegramHouseholdChatResult>
|
||||
getTelegramHouseholdChat(telegramChatId: string): Promise<HouseholdTelegramChatRecord | null>
|
||||
bindHouseholdTopic(input: {
|
||||
householdId: string
|
||||
role: HouseholdTopicRole
|
||||
telegramThreadId: string
|
||||
topicName?: string
|
||||
}): Promise<HouseholdTopicBindingRecord>
|
||||
getHouseholdTopicBinding(
|
||||
householdId: string,
|
||||
role: HouseholdTopicRole
|
||||
): Promise<HouseholdTopicBindingRecord | null>
|
||||
findHouseholdTopicByTelegramContext(input: {
|
||||
telegramChatId: string
|
||||
telegramThreadId: string
|
||||
}): Promise<HouseholdTopicBindingRecord | null>
|
||||
listHouseholdTopicBindings(householdId: string): Promise<readonly HouseholdTopicBindingRecord[]>
|
||||
}
|
||||
Reference in New Issue
Block a user