Reorganize web folder structurally

This commit is contained in:
Халимов Рустам
2026-03-19 22:24:21 +03:00
parent 11ebbc853b
commit 4384233aa5
62 changed files with 0 additions and 0 deletions
@@ -0,0 +1,66 @@
import { httpClient } from '../../../core/infrastructure/httpClient';
import type { StoryGroup } from '../../../core/domain/types';
export class StoryApi {
static async getStories() {
return httpClient.request<StoryGroup[]>('/stories');
}
static async getUserStories(userId: string) {
return httpClient.request<StoryGroup>(`/stories/user/${userId}`);
}
static async createStory(data: { type: string; mediaUrl?: string; content?: string; bgColor?: string }) {
return httpClient.request<{ id: string }>('/stories', {
method: 'POST',
body: JSON.stringify(data),
});
}
static async uploadVideoToStory(file: File) {
const formData = new FormData();
formData.append('file', file);
return httpClient.request<{ url: string }>('/stories/video', {
method: 'POST',
body: formData,
timeout: 120_000,
});
}
static async viewStory(storyId: string) {
return httpClient.request<{ message: string }>(`/stories/${storyId}/view`, { method: 'POST' });
}
static async deleteStory(storyId: string) {
return httpClient.request<{ message: string }>(`/stories/${storyId}`, { method: 'DELETE' });
}
static async getStoryViewers(storyId: string) {
return httpClient.request<Array<{ userId: string; username: string; displayName: string; avatar: string | null; viewedAt: string }>>(`/stories/${storyId}/viewers`);
}
static async addStoryReaction(storyId: string, emoji: string) {
return httpClient.request<{ message: string }>(`/stories/${storyId}/reaction`, {
method: 'POST',
body: JSON.stringify({ emoji }),
});
}
static async removeStoryReaction(storyId: string, emoji: string) {
return httpClient.request<{ message: string }>(`/stories/${storyId}/reaction`, {
method: 'DELETE',
body: JSON.stringify({ emoji }),
});
}
static async addStoryReply(storyId: string, content: string) {
return httpClient.request<{ message: string }>(`/stories/${storyId}/reply`, {
method: 'POST',
body: JSON.stringify({ content }),
});
}
static async getStoryReplies(storyId: string) {
return httpClient.request<Array<{ id: string; userId: string; username: string; displayName: string; avatar: string | null; content: string; createdAt: string }>>(`/stories/${storyId}/replies`);
}
}