-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery.js
34 lines (22 loc) · 990 Bytes
/
query.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { user, restSpace, reviews, category, photos } = require("./models");
//const User = require("./models").user;
async function getUsersfavorite() {
const allUsers = await user.findAll({ include: { model: restSpace } });
return allUsers.map((list) => list.get({ plain: true }));
}
//getUsersfavorite().then((lists) => console.log(lists));
async function getUsers() {
const list = await user.findAll({ include: { model: photos } });
return list.map((list) => list.get({ plain: true }));
}
//getUsers().then((lists) => console.log(lists));
async function restSpaces() {
const rest = await restSpace.findAll({ include: { model: category } });
return rest.map((list) => list.get({ plain: true }));
}
//restSpaces().then((lists) => console.log(lists));
async function restSpacesP() {
const rest = await restSpace.findAll({ include: { model: photos } });
return rest.map((list) => list.get({ plain: true }));
}
//restSpacesP().then((lists) => console.log(lists));