feat: account page content

This commit is contained in:
Takeshi Kimata
2024-06-03 21:53:52 +09:00
parent 24fe7bebb3
commit e4db79047a
9 changed files with 151 additions and 40 deletions

View File

@@ -9,11 +9,20 @@ module.exports = function (sequelize) {
router.get('/', verifySignedIn, async (req, res) => {
try {
const projects = await Project.findAll({
where: {
[Op.or]: [{ isPublic: true }, { userId: req.userId }],
},
});
let projects;
if (req.query.onlyUserProjects === 'true') {
projects = await Project.findAll({
where: {
userId: req.userId,
},
});
} else {
projects = await Project.findAll({
where: {
[Op.or]: [{ isPublic: true }, { userId: req.userId }],
},
});
}
res.json(projects);
} catch (error) {
console.error(error);