modules/0-ui
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
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() {
|
||||
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,
|
||||
getLastInboundMessage,
|
||||
listUsers,
|
||||
} from "../modules/2-identity/db/repo.js";
|
||||
import { deleteWooCustomer } from "../modules/2-identity/services/woo.js";
|
||||
import { processMessage } from "../modules/2-identity/services/pipeline.js";
|
||||
} from "../../2-identity/db/repo.js";
|
||||
import { deleteWooCustomer } from "../../2-identity/services/woo.js";
|
||||
import { processMessage } from "../../2-identity/services/pipeline.js";
|
||||
|
||||
export async function handleDeleteConversation({ tenantId, chat_id }) {
|
||||
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 };
|
||||
}
|
||||
|
||||
|
||||
@@ -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 }) {
|
||||
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 }) {
|
||||
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" }) {
|
||||
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" }) {
|
||||
const { items, source } = await searchSnapshotItems({
|
||||
@@ -9,4 +9,3 @@ export async function handleSearchProducts({ tenantId, q = "", limit = "10", for
|
||||
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" }) {
|
||||
return listRuns({
|
||||
@@ -1,13 +1,13 @@
|
||||
import express from "express";
|
||||
|
||||
import { addSseClient, removeSseClient } from "../../shared/sse.js";
|
||||
import { makeGetConversations } from "../../../controllers/conversations.js";
|
||||
import { makeListRuns, makeGetRunById } from "../../../controllers/runs.js";
|
||||
import { makeGetConversations } from "../../0-ui/controllers/conversations.js";
|
||||
import { makeListRuns, makeGetRunById } from "../../0-ui/controllers/runs.js";
|
||||
import { makeSimSend } from "../controllers/sim.js";
|
||||
import { makeGetConversationState } from "../../../controllers/conversationState.js";
|
||||
import { makeListMessages } from "../../../controllers/messages.js";
|
||||
import { makeSearchProducts } from "../../../controllers/products.js";
|
||||
import { makeDeleteConversation, makeDeleteUser, makeListUsers, makeRetryLast } from "../../../controllers/admin.js";
|
||||
import { makeGetConversationState } from "../../0-ui/controllers/conversationState.js";
|
||||
import { makeListMessages } from "../../0-ui/controllers/messages.js";
|
||||
import { makeSearchProducts } from "../../0-ui/controllers/products.js";
|
||||
import { makeDeleteConversation, makeDeleteUser, makeListUsers, makeRetryLast } from "../../0-ui/controllers/admin.js";
|
||||
|
||||
function nowIso() {
|
||||
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 }) {
|
||||
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 { debug as dbg } from "./debug.js";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user