myavana-bot-test-core 1.0.2 → 1.0.3
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/.env +19 -0
- package/index.js +3 -0
- package/package.json +1 -1
- package/src/utils.js +39 -5
package/.env
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# PostgreSQL
|
|
2
|
+
DB_HOST=34.55.140.120
|
|
3
|
+
DB_USER=myavana
|
|
4
|
+
DB_PASSWORD=higibertigibet
|
|
5
|
+
DB_NAME=sienna-naturals-custom-bot
|
|
6
|
+
DB_PORT=5432
|
|
7
|
+
|
|
8
|
+
# Redis
|
|
9
|
+
REDIS_HOST=redis-15330.c1.us-central1-2.gce.redns.redis-cloud.com
|
|
10
|
+
REDIS_PORT=15330
|
|
11
|
+
REDIS_PASSWORD=OyLRjkTPuCGzQ2mNzA3Uhx5HIqWza8QC
|
|
12
|
+
REDIS_USERNAME=default
|
|
13
|
+
|
|
14
|
+
#GENKIT
|
|
15
|
+
GENKIT_API_KEY=AIzaSyBB5ZYwktOFI3R3j_vs8U7CxwKgS3XNgM0
|
|
16
|
+
|
|
17
|
+
#OpenAI
|
|
18
|
+
OPENAI_API_KEY=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
|
|
19
|
+
|
package/index.js
CHANGED
|
@@ -25,4 +25,7 @@ module.exports = {
|
|
|
25
25
|
// Utilities
|
|
26
26
|
getAllProducts: require('./src/utils').getAllProducts,
|
|
27
27
|
getAllFaqs: require('./src/utils').getAllFaqs,
|
|
28
|
+
getAllYoutubeVideos: require('./src/utils').getAllYoutubeVideos,
|
|
29
|
+
getAllTestimonials: require('./src/utils').getAllTestimonials,
|
|
30
|
+
getAdditionalInstructions: require('./src/utils').getAdditionalInstructions
|
|
28
31
|
};
|
package/package.json
CHANGED
package/src/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// app/api/utils.js
|
|
2
|
+
const { pgClient } = require('./database'); // Or your DB connection
|
|
2
3
|
|
|
3
4
|
async function getAllProducts() {
|
|
4
5
|
try {
|
|
@@ -20,13 +21,46 @@ async function getAllFaqs() {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
async function
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
async function getAllYoutubeVideos() { // New function to get ALL YouTube Videos
|
|
25
|
+
try {
|
|
26
|
+
const result = await pgClient.query('SELECT * FROM youtube_videos');
|
|
27
|
+
return result.rows;
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error("Error fetching all YouTube videos:", error);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
26
32
|
}
|
|
27
33
|
|
|
34
|
+
async function getAllTestimonials() { // New function to get ALL Testimonials
|
|
35
|
+
try {
|
|
36
|
+
const result = await pgClient.query('SELECT * FROM testimonials');
|
|
37
|
+
return result.rows;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error("Error fetching all testimonials:", error);
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function getAdditionalInstructions() { // New function to get ALL Bot Instructions
|
|
45
|
+
try {
|
|
46
|
+
const result = await pgClient.query('SELECT * FROM bot_instructions');
|
|
47
|
+
return result.rows;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error("Error fetching bot instructions:", error);
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function getHairIssuesForUser(userId){
|
|
54
|
+
//return empty for now
|
|
55
|
+
return []
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
28
59
|
module.exports = {
|
|
29
60
|
getAllProducts,
|
|
30
61
|
getAllFaqs,
|
|
31
|
-
|
|
62
|
+
getAllYoutubeVideos,
|
|
63
|
+
getAllTestimonials,
|
|
64
|
+
getAdditionalInstructions,
|
|
65
|
+
getHairIssuesForUser
|
|
32
66
|
};
|