Showing
2 changed files
with
16 additions
and
0 deletions
... | @@ -108,4 +108,19 @@ database.getAllUsers = async function() { | ... | @@ -108,4 +108,19 @@ database.getAllUsers = async function() { |
108 | } | 108 | } |
109 | 109 | ||
110 | return result | 110 | return result |
111 | +} | ||
112 | + | ||
113 | +database.getAllKeywords = async function() { | ||
114 | + | ||
115 | + const keywords = await Keyword.findAll({ | ||
116 | + raw: true | ||
117 | + }) | ||
118 | + | ||
119 | + let result = [] | ||
120 | + for (let i = 0; i< keywords.length; i++) { | ||
121 | + result.push(keywords[i].keyword) | ||
122 | + } | ||
123 | + | ||
124 | + console.log(result) | ||
125 | + return result | ||
111 | } | 126 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -15,6 +15,7 @@ sequelize.sync({ force: false }) | ... | @@ -15,6 +15,7 @@ sequelize.sync({ force: false }) |
15 | database.deleteKeyword("phobyjun", "rtx3080") | 15 | database.deleteKeyword("phobyjun", "rtx3080") |
16 | database.getAllUsers() | 16 | database.getAllUsers() |
17 | database.getUsersByKeyword("rtx3060") | 17 | database.getUsersByKeyword("rtx3060") |
18 | + database.getAllKeywords() | ||
18 | }) | 19 | }) |
19 | .catch((err) => { | 20 | .catch((err) => { |
20 | console.log('database connection failed'); | 21 | console.log('database connection failed'); | ... | ... |
-
Please register or login to post a comment