refactor(Post, PostMapper, PostRepository, CreatePostScreen, HomeScreen): update communityId to channelId for improved clarity
Some checks failed
Frontend CI / build-and-push-web (push) Successful in 2m48s
Frontend CI / ota-android (push) Successful in 11m3s
Frontend CI / build-android-apk (push) Has been cancelled

- Renamed communityId to channelId across Post entity, PostMapper, and PostRepository for consistency and clarity.
- Updated CreatePostScreen to include channel selection functionality, enhancing user experience when creating posts.
- Adjusted HomeScreen to support filtering posts by channel, improving content organization.
- Refactored related interfaces and services to align with the new channelId terminology, ensuring a cohesive codebase.
This commit is contained in:
lafay
2026-03-24 22:27:33 +08:00
parent b49cc0f3bd
commit 126e204592
15 changed files with 439 additions and 260 deletions

View File

@@ -37,7 +37,7 @@ interface PostApiResponse {
is_favorited: boolean;
is_pinned: boolean;
status: string;
community_id?: string;
channel_id?: string;
tags?: string[];
created_at: string;
updated_at: string;
@@ -124,7 +124,7 @@ export class PostRepository implements IPostRepository {
isFavorited: model.isFavorited,
isPinned: model.isTop,
status: model.status,
communityId: model.communityId,
channelId: model.channelId,
tags: model.tags || [],
createdAt: model.createdAt.toISOString(),
updatedAt: model.updatedAt.toISOString(),
@@ -143,7 +143,7 @@ export class PostRepository implements IPostRepository {
created_at: model.createdAt.toISOString(),
updated_at: model.updatedAt.toISOString(),
content_edited_at: response.content_edited_at,
community_id: model.communityId,
channel_id: model.channelId,
};
}
@@ -250,7 +250,7 @@ export class PostRepository implements IPostRepository {
queryParams.cursor = params.cursor;
}
if (params?.post_type) queryParams.tab = params.post_type;
if (params?.communityId) queryParams.community_id = params.communityId;
if (params?.channelId) queryParams.channel_id = params.channelId;
if (params?.authorId) queryParams.author_id = params.authorId;
if (params?.tags && params.tags.length > 0) queryParams.tags = params.tags.join(',');
if (params?.status) queryParams.status = params.status;
@@ -364,7 +364,7 @@ export class PostRepository implements IPostRepository {
if (params.page) queryParams.page = params.page;
if (params.pageSize) queryParams.page_size = params.pageSize;
if (params.scope) queryParams.scope = params.scope;
if (params.communityId) queryParams.community_id = params.communityId;
if (params.channelId) queryParams.channel_id = params.channelId;
const response = await this.api.get<PostsListApiResponse>('/posts/search', queryParams);
@@ -398,7 +398,7 @@ export class PostRepository implements IPostRepository {
data.title,
data.content,
data.images?.map(img => img.url),
data.communityId
data.channelId
);
if (data.tags && data.tags.length > 0) {