feat(miniapp): carry overdue billing and admin role flows

This commit is contained in:
2026-03-23 15:44:55 +04:00
parent ee8c53d89b
commit 5af14e101e
44 changed files with 2965 additions and 329 deletions

View File

@@ -130,6 +130,11 @@ export interface MiniAppDashboard {
netDueMajor: string
paidMajor: string
remainingMajor: string
overduePayments: readonly {
kind: 'rent' | 'utilities'
amountMajor: string
periods: readonly string[]
}[]
explanations: readonly string[]
}[]
ledger: {
@@ -147,6 +152,13 @@ export interface MiniAppDashboard {
actorDisplayName: string | null
occurredAt: string | null
purchaseSplitMode?: 'equal' | 'custom_amounts'
originPeriod?: string | null
resolutionStatus?: 'unresolved' | 'resolved'
resolvedAt?: string | null
outstandingByMember?: readonly {
memberId: string
amountMajor: string
}[]
purchaseParticipants?: readonly {
memberId: string
included: boolean
@@ -711,6 +723,35 @@ export async function updateMiniAppMemberStatus(
return payload.member
}
export async function demoteMiniAppMember(
initData: string,
memberId: string
): Promise<MiniAppMember> {
const response = await fetch(`${apiBaseUrl()}/api/miniapp/admin/members/demote`, {
method: 'POST',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
initData,
memberId
})
})
const payload = (await response.json()) as {
ok: boolean
authorized?: boolean
member?: MiniAppMember
error?: string
}
if (!response.ok || !payload.member) {
throw new Error(payload.error ?? 'Failed to remove admin access')
}
return payload.member
}
export async function updateMiniAppMemberAbsencePolicy(
initData: string,
memberId: string,
@@ -1085,6 +1126,7 @@ export async function addMiniAppPayment(
kind: 'rent' | 'utilities'
amountMajor: string
currency: 'USD' | 'GEL'
period?: string
}
): Promise<void> {
const response = await fetch(`${apiBaseUrl()}/api/miniapp/admin/payments/add`, {