mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 12:04:02 +00:00
feat(member): add household lifecycle states
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type {
|
||||
HouseholdBillingSettingsRecord,
|
||||
HouseholdConfigurationRepository,
|
||||
HouseholdMemberLifecycleStatus,
|
||||
HouseholdMemberRecord,
|
||||
HouseholdPendingMemberRecord,
|
||||
HouseholdTopicBindingRecord,
|
||||
@@ -126,6 +127,21 @@ export interface MiniAppAdminService {
|
||||
reason: 'not_admin' | 'invalid_weight' | 'member_not_found'
|
||||
}
|
||||
>
|
||||
updateMemberStatus(input: {
|
||||
householdId: string
|
||||
actorIsAdmin: boolean
|
||||
memberId: string
|
||||
status: HouseholdMemberLifecycleStatus
|
||||
}): Promise<
|
||||
| {
|
||||
status: 'ok'
|
||||
member: HouseholdMemberRecord
|
||||
}
|
||||
| {
|
||||
status: 'rejected'
|
||||
reason: 'not_admin' | 'member_not_found'
|
||||
}
|
||||
>
|
||||
}
|
||||
|
||||
export function createMiniAppAdminService(
|
||||
@@ -349,6 +365,32 @@ export function createMiniAppAdminService(
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
status: 'ok',
|
||||
member
|
||||
}
|
||||
},
|
||||
|
||||
async updateMemberStatus(input) {
|
||||
if (!input.actorIsAdmin) {
|
||||
return {
|
||||
status: 'rejected',
|
||||
reason: 'not_admin'
|
||||
}
|
||||
}
|
||||
|
||||
const member = await repository.updateHouseholdMemberStatus(
|
||||
input.householdId,
|
||||
input.memberId,
|
||||
input.status
|
||||
)
|
||||
if (!member) {
|
||||
return {
|
||||
status: 'rejected',
|
||||
reason: 'member_not_found'
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
status: 'ok',
|
||||
member
|
||||
|
||||
Reference in New Issue
Block a user