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.
gitgram-ai/gitgram/mobile/services/storeService.ts
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

88 lines
2.1 KiB
TypeScript

import api from './api';
export interface StoreItem {
id: string;
name: string;
description?: string;
price: number;
category?: string;
images?: string[];
rating?: number;
purchaseCount?: number;
isActive?: boolean;
createdAt?: string;
seller?: {
id: string;
username: string;
avatarUrl?: string;
};
}
export const storeService = {
getItems: async (category?: string, page = 1, limit = 20, searchQuery?: string) => {
const params: Record<string, string | number> = { page, limit };
if (category) params.category = category;
if (searchQuery) {
params.q = searchQuery;
}
const response = await api.get('/store/items', { params });
return response.data;
},
getItem: async (itemId: string) => {
const response = await api.get(`/store/items/${itemId}`);
return response.data;
},
createItem: async (data: FormData | {
title: string;
description: string;
price: number;
category: string;
images: string[];
}) => {
const headers = data instanceof FormData
? { 'Content-Type': 'multipart/form-data' }
: {};
const response = await api.post('/store/items', data, { headers });
return response.data;
},
purchaseItem: async (itemId: string) => {
const response = await api.post(`/store/items/${itemId}/purchase`);
return response.data;
},
getMyItems: async () => {
const response = await api.get('/store/my/items');
return response.data;
},
getPurchaseHistory: async () => {
const response = await api.get('/store/my/purchases');
return response.data;
},
updateItem: async (itemId: string, data: {
title?: string;
description?: string;
price?: number;
category?: string;
isActive?: boolean;
}) => {
const response = await api.put(`/store/${itemId}`, data);
return response.data;
},
deleteItem: async (itemId: string) => {
const response = await api.delete(`/store/${itemId}`);
return response.data;
},
getCategoryCounts: async () => {
const response = await api.get('/store/categories');
return response.data;
},
};