Showing
2 changed files
with
15 additions
and
0 deletions
... | @@ -72,3 +72,17 @@ database.getKeywordsByUserId = async function(userId) { | ... | @@ -72,3 +72,17 @@ database.getKeywordsByUserId = async function(userId) { |
72 | 72 | ||
73 | return result | 73 | return result |
74 | } | 74 | } |
75 | + | ||
76 | +database.getAllUsers = async function() { | ||
77 | + | ||
78 | + const users = await User.findAll({ | ||
79 | + raw: true | ||
80 | + }) | ||
81 | + | ||
82 | + let result = [] | ||
83 | + for (let i = 0; i < users.length; i++) { | ||
84 | + result.push(users[i].userId) | ||
85 | + } | ||
86 | + | ||
87 | + return result | ||
88 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -13,6 +13,7 @@ sequelize.sync({ force: false }) | ... | @@ -13,6 +13,7 @@ sequelize.sync({ force: false }) |
13 | database.addKeyword("rtx3060", "junseok") | 13 | database.addKeyword("rtx3060", "junseok") |
14 | database.getKeywordsByUserId("junseok") | 14 | database.getKeywordsByUserId("junseok") |
15 | database.deleteKeyword("phobyjun", "rtx3080") | 15 | database.deleteKeyword("phobyjun", "rtx3080") |
16 | + database.getAllUsers() | ||
16 | }) | 17 | }) |
17 | .catch((err) => { | 18 | .catch((err) => { |
18 | console.log('database connection failed'); | 19 | console.log('database connection failed'); | ... | ... |
-
Please register or login to post a comment