pl-api: embed relationship for pixelfed groups

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2024-12-27 23:47:04 +01:00
parent 65fb91a0f0
commit 69be683141
2 changed files with 50 additions and 32 deletions

View File

@ -13,6 +13,15 @@ const groupSchema = v.pipe(v.any(), v.transform((group: any) => {
display_name: group.name,
members_count: group.member_count,
note: group.short_description,
relationship: group.self ? {
...group.self,
member: group.self.is_member,
role: {
founder: 'owner',
admin: 'admin',
}[group.self.role as string] || 'user',
id: group.id,
} : null,
...group,
};
}