tinker / lib /types.ts
truegleai's picture
feat: full cloud-ready deployment (SQLite + Ollama cloud + integrated WebSocket)
f31cfe8 verified
export type User = {
id: string;
name: string | null;
email: string;
image: string | null;
subscription: string;
credits: number;
maxDeals: number;
};
export type Deal = {
id: string;
userId: string;
title: string;
sourceUrl: string;
marketplace: string;
buyPrice: number;
estimatedSell: number;
profitMargin: number;
confidence: number;
status: DealStatus;
scrapedAt: string;
analyzedAt: string | null;
negotiatedAt: string | null;
transactedAt: string | null;
sellerContact: string | null;
notes: string | null;
};
export type DealStatus =
| "pending"
| "analyzing"
| "negotiating"
| "approved"
| "rejected"
| "transacting"
| "completed"
| "failed";
export type ScanLog = {
id: string;
userId: string | null;
marketplace: string;
itemsScanned: number;
dealsFound: number;
duration: number;
status: string;
error: string | null;
createdAt: string;
};
export type Negotiation = {
id: string;
dealId: string;
userId: string;
message: string;
response: string | null;
offeredPrice: number | null;
acceptedPrice: number | null;
status: string;
turn: number;
createdAt: string;
updatedAt: string;
};
export type Transaction = {
id: string;
dealId: string;
userId: string;
amount: number;
fee: number;
netProfit: number;
paymentMethod: string;
paymentStatus: string;
shippingAddress: string | null;
trackingNumber: string | null;
status: string;
createdAt: string;
completedAt: string | null;
};
export type QueueItem = {
id: string;
userId: string;
dealId: string | null;
action: string;
priority: number;
status: QueueStatus;
data: string | null;
error: string | null;
retries: number;
maxRetries: number;
scheduled: string | null;
startedAt: string | null;
finishedAt: string | null;
createdAt: string;
updatedAt: string;
};
export type QueueStatus =
| "queued"
| "running"
| "completed"
| "failed"
| "cancelled";
export type AgentStatus = {
isRunning: boolean;
currentPhase: string | null;
activeDeals: number;
completedDeals: number;
totalProfit: number;
uptime: number;
queueLength: number;
lastScan: string | null;
nextScan: string | null;
};
export type ScrapedItem = {
title: string;
price: number;
url: string;
seller: string;
contact: string | null;
description: string;
images: string[];
location: string | null;
postedAt: string | null;
};
export type AnalysisResult = {
dealId: string;
estimatedSell: number;
profitMargin: number;
confidence: number;
risk: "low" | "medium" | "high";
factors: string[];
recommendation: "buy" | "hold" | "skip";
};
export type Marketplace = "facebook" | "offerup" | "alibaba";