|
@@ -812,8 +812,11 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
try {
|
|
try {
|
|
|
const { shopId } = req.params;
|
|
const { shopId } = req.params;
|
|
|
|
|
|
|
|
- // Get shop from database
|
|
|
|
|
- const shop = this.db.getShopByCustomId(shopId);
|
|
|
|
|
|
|
+ // Get shop from database - try both internal ID and custom ID
|
|
|
|
|
+ let shop = this.db.getShopById(shopId);
|
|
|
|
|
+ if (!shop) {
|
|
|
|
|
+ shop = this.db.getShopByCustomId(shopId);
|
|
|
|
|
+ }
|
|
|
if (!shop) {
|
|
if (!shop) {
|
|
|
res.status(404).json({ error: 'Shop not found' });
|
|
res.status(404).json({ error: 'Shop not found' });
|
|
|
return;
|
|
return;
|
|
@@ -845,8 +848,11 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
try {
|
|
try {
|
|
|
const { shopId } = req.params;
|
|
const { shopId } = req.params;
|
|
|
|
|
|
|
|
- // Get shop from database
|
|
|
|
|
- const shop = this.db.getShopByCustomId(shopId);
|
|
|
|
|
|
|
+ // Get shop from database - try both internal ID and custom ID
|
|
|
|
|
+ let shop = this.db.getShopById(shopId);
|
|
|
|
|
+ if (!shop) {
|
|
|
|
|
+ shop = this.db.getShopByCustomId(shopId);
|
|
|
|
|
+ }
|
|
|
if (!shop) {
|
|
if (!shop) {
|
|
|
res.status(404).json({ error: 'Shop not found' });
|
|
res.status(404).json({ error: 'Shop not found' });
|
|
|
return;
|
|
return;
|
|
@@ -860,7 +866,7 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
embeddings: embeddings.map(embedding => ({
|
|
embeddings: embeddings.map(embedding => ({
|
|
|
id: `emb-${embedding.id}`,
|
|
id: `emb-${embedding.id}`,
|
|
|
shop_content_id: `content-${embedding.id}`,
|
|
shop_content_id: `content-${embedding.id}`,
|
|
|
- collection_name: `${shopId}-${embedding.content_type}_1`,
|
|
|
|
|
|
|
+ collection_name: shop.custom_id ? `${shop.custom_id}-${embedding.content_type}_1` : null,
|
|
|
point_id: embedding.qdrant_point_id || null,
|
|
point_id: embedding.qdrant_point_id || null,
|
|
|
embedding_status: embedding.embedding_status || 'pending',
|
|
embedding_status: embedding.embedding_status || 'pending',
|
|
|
created_at: embedding.created_at,
|
|
created_at: embedding.created_at,
|
|
@@ -879,8 +885,11 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
try {
|
|
try {
|
|
|
const { shopId } = req.params;
|
|
const { shopId } = req.params;
|
|
|
|
|
|
|
|
- // Get shop from database
|
|
|
|
|
- const shop = this.db.getShopByCustomId(shopId);
|
|
|
|
|
|
|
+ // Get shop from database - try both internal ID and custom ID
|
|
|
|
|
+ let shop = this.db.getShopById(shopId);
|
|
|
|
|
+ if (!shop) {
|
|
|
|
|
+ shop = this.db.getShopByCustomId(shopId);
|
|
|
|
|
+ }
|
|
|
if (!shop) {
|
|
if (!shop) {
|
|
|
res.status(404).json({ error: 'Shop not found' });
|
|
res.status(404).json({ error: 'Shop not found' });
|
|
|
return;
|
|
return;
|
|
@@ -928,8 +937,11 @@ export class QdrantEndpoint extends BaseEndpointComponent {
|
|
|
try {
|
|
try {
|
|
|
const { shopId } = req.params;
|
|
const { shopId } = req.params;
|
|
|
|
|
|
|
|
- // Get shop from database
|
|
|
|
|
- const shop = this.db.getShopByCustomId(shopId);
|
|
|
|
|
|
|
+ // Get shop from database - try both internal ID and custom ID
|
|
|
|
|
+ let shop = this.db.getShopById(shopId);
|
|
|
|
|
+ if (!shop) {
|
|
|
|
|
+ shop = this.db.getShopByCustomId(shopId);
|
|
|
|
|
+ }
|
|
|
if (!shop) {
|
|
if (!shop) {
|
|
|
res.status(404).json({ error: 'Shop not found' });
|
|
res.status(404).json({ error: 'Shop not found' });
|
|
|
return;
|
|
return;
|