add shared

This commit is contained in:
Jurgis Sakalauskas
2025-10-14 09:14:01 +03:00
parent 3ac7e9183f
commit b20ab30ece
19 changed files with 134 additions and 211 deletions
+8 -29
View File
@@ -1,35 +1,14 @@
import type { PaginatedResponse } from '@shared/models/pagination';
import type {
ItemPrice,
PriceCondition,
PriceSourceType
} from '@shared/models/item-price';
import { apiFetch } from './http-client';
export type PriceCondition = 'new' | 'used';
export type PriceSourceType = 'url' | 'manual';
export type { PriceCondition, PriceSourceType };
export interface ItemPrice {
id: string;
itemId: string;
condition: PriceCondition;
amount: number;
currency: string;
sourceType: PriceSourceType;
sourceUrlId: string | null;
sourceUrl: string | null;
sourceNote: string | null;
note: string | null;
observedAt: string;
isPrimary: boolean;
createdAt: string;
updatedAt: string;
}
interface ListResponseMeta {
limit: number;
offset: number;
count: number;
}
export interface ItemPricesResponse {
data: ItemPrice[];
meta: ListResponseMeta;
}
export type ItemPricesResponse = PaginatedResponse<ItemPrice>;
export interface FetchItemPricesParams {
limit?: number;
+3 -43
View File
@@ -1,48 +1,8 @@
import type { PaginatedResponse } from '@shared/models/pagination';
import type { Item, ItemStatus } from '@shared/models/item';
import { apiFetch } from './http-client';
export type ItemStatus = 'active' | 'rejected';
export interface Item {
id: string;
projectId: string;
manufacturer: string | null;
model: string;
sourceUrlId: string | null;
sourceUrl: string | null;
status: ItemStatus;
note: string | null;
attributes: Record<string, unknown>;
createdAt: string;
updatedAt: string;
priceSummary: ItemPriceSummary | null;
}
export interface ItemPriceSummary {
minAmount: number;
maxAmount: number;
currency: string | null;
priceCount: number;
hasMixedCurrency: boolean;
newMinAmount: number | null;
newCount: number;
newCurrency: string | null;
newHasMixedCurrency: boolean;
usedMinAmount: number | null;
usedCount: number;
usedCurrency: string | null;
usedHasMixedCurrency: boolean;
}
interface ListResponseMeta {
limit: number;
offset: number;
count: number;
}
export interface ProjectItemsResponse {
data: Item[];
meta: ListResponseMeta;
}
export type ProjectItemsResponse = PaginatedResponse<Item>;
export interface FetchProjectItemsParams {
limit?: number;
+3 -23
View File
@@ -1,28 +1,8 @@
import type { PaginatedResponse } from '@shared/models/pagination';
import type { Project, ProjectStatus } from '@shared/models/project';
import { apiFetch } from './http-client';
export type ProjectStatus = 'active' | 'archived';
export interface Project {
id: string;
name: string;
description: string | null;
status: ProjectStatus;
attributes: string[];
priorityRules: unknown;
createdAt: string;
updatedAt: string;
}
interface ListResponseMeta {
limit: number;
offset: number;
count: number;
}
export interface ProjectsListResponse {
data: Project[];
meta: ListResponseMeta;
}
export type ProjectsListResponse = PaginatedResponse<Project>;
export interface FetchProjectsParams {
limit?: number;