mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 21:04:03 +00:00
refactor(time): migrate runtime time handling to Temporal
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { Instant } from '@household/domain'
|
||||
|
||||
export type AnonymousFeedbackModerationStatus = 'accepted' | 'posted' | 'rejected' | 'failed'
|
||||
|
||||
export type AnonymousFeedbackRejectionReason =
|
||||
@@ -16,7 +18,8 @@ export interface AnonymousFeedbackMemberRecord {
|
||||
|
||||
export interface AnonymousFeedbackRateLimitSnapshot {
|
||||
acceptedCountSince: number
|
||||
lastAcceptedAt: Date | null
|
||||
earliestAcceptedAtSince: Instant | null
|
||||
lastAcceptedAt: Instant | null
|
||||
}
|
||||
|
||||
export interface AnonymousFeedbackSubmissionRecord {
|
||||
@@ -28,7 +31,7 @@ export interface AnonymousFeedbackRepository {
|
||||
getMemberByTelegramUserId(telegramUserId: string): Promise<AnonymousFeedbackMemberRecord | null>
|
||||
getRateLimitSnapshot(
|
||||
memberId: string,
|
||||
acceptedSince: Date
|
||||
acceptedSince: Instant
|
||||
): Promise<AnonymousFeedbackRateLimitSnapshot>
|
||||
createSubmission(input: {
|
||||
submittedByMemberId: string
|
||||
@@ -45,7 +48,7 @@ export interface AnonymousFeedbackRepository {
|
||||
postedChatId: string
|
||||
postedThreadId: string
|
||||
postedMessageId: string
|
||||
postedAt: Date
|
||||
postedAt: Instant
|
||||
}): Promise<void>
|
||||
markFailed(submissionId: string, failureReason: string): Promise<void>
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CurrencyCode } from '@household/domain'
|
||||
import type { CurrencyCode, Instant } from '@household/domain'
|
||||
|
||||
export interface FinanceMemberRecord {
|
||||
id: string
|
||||
@@ -23,7 +23,7 @@ export interface FinanceParsedPurchaseRecord {
|
||||
payerMemberId: string
|
||||
amountMinor: bigint
|
||||
description: string | null
|
||||
occurredAt: Date | null
|
||||
occurredAt: Instant | null
|
||||
}
|
||||
|
||||
export interface FinanceUtilityBillRecord {
|
||||
@@ -32,7 +32,7 @@ export interface FinanceUtilityBillRecord {
|
||||
amountMinor: bigint
|
||||
currency: CurrencyCode
|
||||
createdByMemberId: string | null
|
||||
createdAt: Date
|
||||
createdAt: Instant
|
||||
}
|
||||
|
||||
export interface SettlementSnapshotLineRecord {
|
||||
@@ -60,7 +60,7 @@ export interface FinanceRepository {
|
||||
getCycleByPeriod(period: string): Promise<FinanceCycleRecord | null>
|
||||
getLatestCycle(): Promise<FinanceCycleRecord | null>
|
||||
openCycle(period: string, currency: CurrencyCode): Promise<void>
|
||||
closeCycle(cycleId: string, closedAt: Date): Promise<void>
|
||||
closeCycle(cycleId: string, closedAt: Instant): Promise<void>
|
||||
saveRentRule(period: string, amountMinor: bigint, currency: CurrencyCode): Promise<void>
|
||||
addUtilityBill(input: {
|
||||
cycleId: string
|
||||
@@ -73,8 +73,8 @@ export interface FinanceRepository {
|
||||
getUtilityTotalForCycle(cycleId: string): Promise<bigint>
|
||||
listUtilityBillsForCycle(cycleId: string): Promise<readonly FinanceUtilityBillRecord[]>
|
||||
listParsedPurchasesForRange(
|
||||
start: Date,
|
||||
end: Date
|
||||
start: Instant,
|
||||
end: Instant
|
||||
): Promise<readonly FinanceParsedPurchaseRecord[]>
|
||||
replaceSettlementSnapshot(snapshot: SettlementSnapshotRecord): Promise<void>
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import type { Instant } from '@household/domain'
|
||||
|
||||
export const TELEGRAM_PENDING_ACTION_TYPES = ['anonymous_feedback'] as const
|
||||
|
||||
export type TelegramPendingActionType = (typeof TELEGRAM_PENDING_ACTION_TYPES)[number]
|
||||
@@ -7,7 +9,7 @@ export interface TelegramPendingActionRecord {
|
||||
telegramChatId: string
|
||||
action: TelegramPendingActionType
|
||||
payload: Record<string, unknown>
|
||||
expiresAt: Date | null
|
||||
expiresAt: Instant | null
|
||||
}
|
||||
|
||||
export interface TelegramPendingActionRepository {
|
||||
|
||||
Reference in New Issue
Block a user