This repository has been archived on 2026-11-17. You can view files and clone it, but cannot push or open issues or pull requests.
caelum0x 64fbe9f474 feat: round-3 deep product build-out (69 gaps closed, all 7 products green)
Deep-audit + build-out across all products to fully-usable state; all typecheck clean.

- gitgram-web (99): wire Store feature to real endpoints, close 9 gaps
- gitgram-backend (100): close 8 flow gaps, document infra-provisioning items
- gitgram-mobile (90): fix API base-URL/path mismatch (404s) + copy proximity
  components into components/proximity wired to real screens; 15 gaps, +react-native-svg
- aitm-core (95): wire natural-language CLI flow end-to-end; 11 gaps
- aitm-api (97): fix teams metadata runtime bug; copy a2a-js server/client/grpc
  into src/a2a and wire A2A route; crates.io package search; 8 gaps
- aitm-mcp (100): fix A2A client/server card mismatch; 9 gaps
- aitm-website (95): build missing docs routes; 9 gaps

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 13:54:57 +03:00

157 lines
4.5 KiB
TypeScript

import api from './api';
export const postService = {
getFollowingFeed: async (page = 1, limit = 20) => {
const response = await api.get('/posts/feed', {
params: { page, limit },
});
return response.data;
},
getPosts: async (page = 1, limit = 10, userId?: string) => {
const params: any = { page, limit };
if (userId) {
params.userId = userId;
}
const response = await api.get('/posts', { params });
return response.data;
},
createPost: async (data: FormData) => {
const response = await api.post('/posts', data, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
return response.data;
},
likePost: async (postId: string) => {
const response = await api.post(`/posts/${postId}/like`);
return response.data;
},
getComments: async (postId: string, page = 1, limit = 20) => {
const response = await api.get(`/posts/${postId}/comments`, {
params: { page, limit },
});
return response.data;
},
createComment: async (postId: string, content: string) => {
const response = await api.post(`/posts/${postId}/comments`, { content });
return response.data;
},
deletePost: async (postId: string) => {
const response = await api.delete(`/posts/${postId}`);
return response.data;
},
searchPosts: async (query: string, page = 1, limit = 20) => {
const response = await api.get('/posts/search', {
params: { q: query, page, limit },
});
return response.data;
},
getPost: async (postId: string) => {
const response = await api.get(`/posts/${postId}`);
return response.data;
},
updatePost: async (postId: string, data: { content?: string; hashtags?: string[] }) => {
const response = await api.put(`/posts/${postId}`, data);
return response.data;
},
retweetPost: async (postId: string, comment?: string) => {
const response = await api.post(`/posts/${postId}/retweet`, { comment });
return response.data;
},
savePost: async (postId: string) => {
const response = await api.post(`/posts/${postId}/save`);
return response.data;
},
getSavedPosts: async (page = 1, limit = 20) => {
const response = await api.get('/posts/saved', {
params: { page, limit },
});
return response.data;
},
getPostShares: async (postId: string, page = 1, limit = 20) => {
const response = await api.get(`/posts/${postId}/shares`, {
params: { page, limit },
});
return response.data;
},
getPostLikes: async (postId: string, page = 1, limit = 20) => {
const response = await api.get(`/posts/${postId}/likes`, {
params: { page, limit },
});
return response.data;
},
isPostSaved: async (postId: string) => {
// Check if post is in saved posts
const response = await api.get('/posts/saved', {
params: { postId },
});
return response.data;
},
getTrending: async (timeframe: 'today' | 'week' | 'month' = 'today', page = 1, limit = 20) => {
const response = await api.get('/posts/trending', {
params: { timeframe, page, limit },
});
return response.data;
},
getArchivedPosts: async (page = 1, limit = 20) => {
const response = await api.get('/posts/archived', {
params: { page, limit },
});
return response.data;
},
getTaggedPosts: async (userId: string, page = 1, limit = 20) => {
const response = await api.get(`/posts/tagged/${userId}`, {
params: { page, limit },
});
return response.data;
},
reportPost: async (postId: string, data: { reason: string; details?: string }) => {
const response = await api.post(`/posts/${postId}/report`, data);
return response.data;
},
// Comment actions
likeComment: async (postId: string, commentId: string) => {
const response = await api.post(`/posts/${postId}/comments/${commentId}/like`);
return response.data;
},
deleteComment: async (postId: string, commentId: string) => {
const response = await api.delete(`/posts/${postId}/comments/${commentId}`);
return response.data;
},
updateComment: async (postId: string, commentId: string, content: string) => {
const response = await api.put(`/posts/${postId}/comments/${commentId}`, { content });
return response.data;
},
getCommentLikes: async (postId: string, commentId: string, page = 1, limit = 20) => {
const response = await api.get(`/posts/${postId}/comments/${commentId}/likes`, {
params: { page, limit },
});
return response.data;
},
};