import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger' /** * 社区简要信息 */ export class CommunityInfo { @ApiProperty({ description: '授权ID' }) authorizationId: string @ApiProperty({ description: '账户序列号' }) accountSequence: number @ApiProperty({ description: '社区名称' }) communityName: string @ApiPropertyOptional({ description: '用户ID' }) userId?: string @ApiProperty({ description: '是否为总部社区' }) isHeadquarters: boolean } /** * 社区层级响应 */ export class CommunityHierarchyResponse { @ApiPropertyOptional({ description: '我的社区授权(如果有)', type: CommunityInfo }) myCommunity: CommunityInfo | null @ApiProperty({ description: '上级社区(最近的,如果没有则为总部社区)', type: CommunityInfo }) parentCommunity: CommunityInfo @ApiProperty({ description: '下级社区列表(最近的,按accountSequence排序)', type: [CommunityInfo] }) childCommunities: CommunityInfo[] @ApiProperty({ description: '是否有上级社区(非总部)' }) hasParentCommunity: boolean @ApiProperty({ description: '下级社区数量' }) childCommunityCount: number } /** * 总部社区常量 */ export const HEADQUARTERS_COMMUNITY: CommunityInfo = { authorizationId: 'headquarters', accountSequence: 0, communityName: '总部社区', userId: undefined, isHeadquarters: true, }