@zodic/shared 0.0.224 → 0.0.225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/services/ConceptService.ts +24 -19
- package/package.json +1 -1
|
@@ -1043,27 +1043,32 @@ export class ConceptService {
|
|
|
1043
1043
|
console.log(`📡 Fetching duplicate entries for concept: ${conceptSlug}...`);
|
|
1044
1044
|
|
|
1045
1045
|
const duplicateEntries = await db
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1046
|
+
.select({
|
|
1047
|
+
id: conceptsData.id,
|
|
1048
|
+
name: conceptsData.name,
|
|
1049
|
+
description: conceptsData.description,
|
|
1050
|
+
combination: conceptsData.combination,
|
|
1051
|
+
})
|
|
1052
|
+
.from(conceptsData)
|
|
1053
|
+
.where(
|
|
1054
|
+
and(
|
|
1055
|
+
eq(conceptsData.language, 'en-us'), // ✅ English only
|
|
1056
|
+
eq(conceptsData.conceptSlug, conceptSlug), // ✅ Filter by concept
|
|
1057
|
+
sql`
|
|
1058
|
+
name IN (
|
|
1059
|
+
SELECT name
|
|
1060
|
+
FROM concepts_data
|
|
1059
1061
|
WHERE language = 'en-us' AND concept_slug = ${conceptSlug}
|
|
1060
|
-
GROUP BY name
|
|
1061
|
-
|
|
1062
|
-
|
|
1062
|
+
GROUP BY name
|
|
1063
|
+
HAVING COUNT(*) > 1
|
|
1064
|
+
)
|
|
1065
|
+
`
|
|
1063
1066
|
)
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
+
)
|
|
1068
|
+
.orderBy(conceptsData.name) // ✅ Order by name for better grouping
|
|
1069
|
+
.limit(maxEntries || 50) // ✅ Apply optional limit
|
|
1070
|
+
.execute();
|
|
1071
|
+
|
|
1067
1072
|
if (!duplicateEntries.length) {
|
|
1068
1073
|
console.log(`🎉 No duplicates found for ${conceptSlug}.`);
|
|
1069
1074
|
return { message: `No duplicates detected for ${conceptSlug}.` };
|