|
|
@@ -64,6 +64,14 @@ export class UserEntity {
|
|
|
constructor(partial?: Partial<UserEntity>) {
|
|
|
Object.assign(this, partial);
|
|
|
}
|
|
|
+
|
|
|
+ get followerCount(): number {
|
|
|
+ return this.followers?.length || 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ get followingCount(): number {
|
|
|
+ return this.following?.length || 0;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export const UserSchema = z.object({
|
|
|
@@ -122,6 +130,14 @@ export const UserSchema = z.object({
|
|
|
],
|
|
|
description: '用户角色列表'
|
|
|
}),
|
|
|
+ followerCount: z.number().int().nonnegative().openapi({
|
|
|
+ description: '关注者数量',
|
|
|
+ example: 100
|
|
|
+ }),
|
|
|
+ followingCount: z.number().int().nonnegative().openapi({
|
|
|
+ description: '关注的用户数量',
|
|
|
+ example: 50
|
|
|
+ }),
|
|
|
createdAt: z.date().openapi({ description: '创建时间' }),
|
|
|
updatedAt: z.date().openapi({ description: '更新时间' })
|
|
|
});
|