modules/0-ui
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { parse } from "csv-parse/sync";
|
import { parse } from "csv-parse/sync";
|
||||||
import { pool } from "../src/modules/2-identity/db/pool.js";
|
import { pool } from "../src/modules/shared/db/pool.js";
|
||||||
|
|
||||||
function parseArgs() {
|
function parseArgs() {
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
|
|||||||
@@ -45,4 +45,3 @@ export const makeRetryLast = (tenantIdOrFn) => async (req, res) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -15,4 +15,3 @@ export const makeListMessages = (tenantIdOrFn) => async (req, res) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -14,4 +14,3 @@ export const makeSearchProducts = (tenantIdOrFn) => async (req, res) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -6,9 +6,9 @@ import {
|
|||||||
getIdentityMapByChat,
|
getIdentityMapByChat,
|
||||||
getLastInboundMessage,
|
getLastInboundMessage,
|
||||||
listUsers,
|
listUsers,
|
||||||
} from "../modules/2-identity/db/repo.js";
|
} from "../../2-identity/db/repo.js";
|
||||||
import { deleteWooCustomer } from "../modules/2-identity/services/woo.js";
|
import { deleteWooCustomer } from "../../2-identity/services/woo.js";
|
||||||
import { processMessage } from "../modules/2-identity/services/pipeline.js";
|
import { processMessage } from "../../2-identity/services/pipeline.js";
|
||||||
|
|
||||||
export async function handleDeleteConversation({ tenantId, chat_id }) {
|
export async function handleDeleteConversation({ tenantId, chat_id }) {
|
||||||
if (!chat_id) return { ok: false, error: "chat_id_required" };
|
if (!chat_id) return { ok: false, error: "chat_id_required" };
|
||||||
@@ -88,4 +88,3 @@ export async function handleRetryLast({ tenantId, chat_id }) {
|
|||||||
return { ok: true, cleanup, run_id: pm?.run_id || null };
|
return { ok: true, cleanup, run_id: pm?.run_id || null };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getConversationState } from "../modules/2-identity/db/repo.js";
|
import { getConversationState } from "../../2-identity/db/repo.js";
|
||||||
|
|
||||||
export async function handleGetConversationState({ tenantId, chat_id }) {
|
export async function handleGetConversationState({ tenantId, chat_id }) {
|
||||||
if (!chat_id) {
|
if (!chat_id) {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { listConversations } from "../modules/2-identity/db/repo.js";
|
import { listConversations } from "../../2-identity/db/repo.js";
|
||||||
|
|
||||||
export async function handleListConversations({ tenantId, query }) {
|
export async function handleListConversations({ tenantId, query }) {
|
||||||
const { q = "", status = "", state = "", limit = "50" } = query || {};
|
const { q = "", status = "", state = "", limit = "50" } = query || {};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { listMessages } from "../modules/2-identity/db/repo.js";
|
import { listMessages } from "../../2-identity/db/repo.js";
|
||||||
|
|
||||||
export async function handleListMessages({ tenantId, chat_id, limit = "200" }) {
|
export async function handleListMessages({ tenantId, chat_id, limit = "200" }) {
|
||||||
if (!chat_id) return [];
|
if (!chat_id) return [];
|
||||||
@@ -9,4 +9,3 @@ export async function handleListMessages({ tenantId, chat_id, limit = "200" }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { searchSnapshotItems } from "../modules/shared/wooSnapshot.js";
|
import { searchSnapshotItems } from "../../shared/wooSnapshot.js";
|
||||||
|
|
||||||
export async function handleSearchProducts({ tenantId, q = "", limit = "10", forceWoo = "0" }) {
|
export async function handleSearchProducts({ tenantId, q = "", limit = "10", forceWoo = "0" }) {
|
||||||
const { items, source } = await searchSnapshotItems({
|
const { items, source } = await searchSnapshotItems({
|
||||||
@@ -9,4 +9,3 @@ export async function handleSearchProducts({ tenantId, q = "", limit = "10", for
|
|||||||
return { items, source };
|
return { items, source };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { listRuns, getRunById } from "../modules/2-identity/db/repo.js";
|
import { listRuns, getRunById } from "../../2-identity/db/repo.js";
|
||||||
|
|
||||||
export async function handleListRuns({ tenantId, chat_id = null, limit = "50" }) {
|
export async function handleListRuns({ tenantId, chat_id = null, limit = "50" }) {
|
||||||
return listRuns({
|
return listRuns({
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
|
|
||||||
import { addSseClient, removeSseClient } from "../../shared/sse.js";
|
import { addSseClient, removeSseClient } from "../../shared/sse.js";
|
||||||
import { makeGetConversations } from "../../../controllers/conversations.js";
|
import { makeGetConversations } from "../../0-ui/controllers/conversations.js";
|
||||||
import { makeListRuns, makeGetRunById } from "../../../controllers/runs.js";
|
import { makeListRuns, makeGetRunById } from "../../0-ui/controllers/runs.js";
|
||||||
import { makeSimSend } from "../controllers/sim.js";
|
import { makeSimSend } from "../controllers/sim.js";
|
||||||
import { makeGetConversationState } from "../../../controllers/conversationState.js";
|
import { makeGetConversationState } from "../../0-ui/controllers/conversationState.js";
|
||||||
import { makeListMessages } from "../../../controllers/messages.js";
|
import { makeListMessages } from "../../0-ui/controllers/messages.js";
|
||||||
import { makeSearchProducts } from "../../../controllers/products.js";
|
import { makeSearchProducts } from "../../0-ui/controllers/products.js";
|
||||||
import { makeDeleteConversation, makeDeleteUser, makeListUsers, makeRetryLast } from "../../../controllers/admin.js";
|
import { makeDeleteConversation, makeDeleteUser, makeListUsers, makeRetryLast } from "../../0-ui/controllers/admin.js";
|
||||||
|
|
||||||
function nowIso() {
|
function nowIso() {
|
||||||
return new Date().toISOString();
|
return new Date().toISOString();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { pool } from "./pool.js";
|
import { pool } from "../../shared/db/pool.js";
|
||||||
|
|
||||||
export async function ensureTenant({ key, name }) {
|
export async function ensureTenant({ key, name }) {
|
||||||
const q = `
|
const q = `
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { pool } from "../2-identity/db/pool.js";
|
import { pool } from "./db/pool.js";
|
||||||
import { getDecryptedTenantEcommerceConfig } from "../2-identity/db/repo.js";
|
import { getDecryptedTenantEcommerceConfig } from "../2-identity/db/repo.js";
|
||||||
import { debug as dbg } from "./debug.js";
|
import { debug as dbg } from "./debug.js";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user