feat(miniapp): add member rent weight controls

This commit is contained in:
2026-03-10 02:48:12 +04:00
parent 6a04b9d7f5
commit 4b4f7d46e5
10 changed files with 377 additions and 1 deletions

View File

@@ -108,6 +108,21 @@ export interface MiniAppAdminService {
reason: 'not_admin' | 'member_not_found'
}
>
updateMemberRentShareWeight(input: {
householdId: string
actorIsAdmin: boolean
memberId: string
rentShareWeight: number
}): Promise<
| {
status: 'ok'
member: HouseholdMemberRecord
}
| {
status: 'rejected'
reason: 'not_admin' | 'invalid_weight' | 'member_not_found'
}
>
}
export function createMiniAppAdminService(
@@ -288,6 +303,39 @@ export function createMiniAppAdminService(
}
}
return {
status: 'ok',
member
}
},
async updateMemberRentShareWeight(input) {
if (!input.actorIsAdmin) {
return {
status: 'rejected',
reason: 'not_admin'
}
}
if (!Number.isInteger(input.rentShareWeight) || input.rentShareWeight <= 0) {
return {
status: 'rejected',
reason: 'invalid_weight'
}
}
const member = await repository.updateHouseholdMemberRentShareWeight(
input.householdId,
input.memberId,
input.rentShareWeight
)
if (!member) {
return {
status: 'rejected',
reason: 'member_not_found'
}
}
return {
status: 'ok',
member