refactor(Post, PostMapper, PostRepository, CreatePostScreen, HomeScreen): update communityId to channelId for improved clarity
- 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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user