Some checks failed
CI / verify (push) Has been cancelled
Add the tenant-ready dashboard, freshness and pricing analytics, mock integration adapters, persistence schema, and verification tooling needed for the initial pilot. Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import {
|
|
branches,
|
|
inventoryBatches,
|
|
products,
|
|
sales,
|
|
salespeople,
|
|
} from "@/lib/demo-data";
|
|
import type { IntegrationProvider } from "@/lib/types";
|
|
import type { IntegrationAdapter, SyncPage } from "@/integrations/types";
|
|
|
|
function page<T>(records: T[]): SyncPage<T> {
|
|
return { records, nextCursor: null };
|
|
}
|
|
|
|
export class MockIntegrationAdapter implements IntegrationAdapter {
|
|
constructor(readonly provider: IntegrationProvider) {}
|
|
|
|
async testConnection() {
|
|
return {
|
|
ok: true,
|
|
message: `${this.provider === "odoo" ? "Odoo" : "Salesforce"} demo source is ready`,
|
|
};
|
|
}
|
|
|
|
async fetchProducts() {
|
|
return page(this.provider === "odoo" ? products : []);
|
|
}
|
|
|
|
async fetchBranches() {
|
|
return page(branches);
|
|
}
|
|
|
|
async fetchInventory() {
|
|
return page(this.provider === "odoo" ? inventoryBatches : []);
|
|
}
|
|
|
|
async fetchSalespeople() {
|
|
return page(this.provider === "salesforce" ? salespeople : []);
|
|
}
|
|
|
|
async fetchSales() {
|
|
return page(this.provider === "salesforce" ? sales : []);
|
|
}
|
|
}
|