Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions controllers/comment.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const getAll = require('../services/comment');

const getAllComments = async (req, res) => {

const comments = await getAll();

res.status(201).json(comments);

}

module.exports = getAllComments;
Comment on lines +1 to +11

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pertenece a otro ticket.

27 changes: 27 additions & 0 deletions controllers/users.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const update = require('../services/user').update;


const updateUser = async (req, res) => {
let id = req.params.id;
let userData = req.body;

try {

const userUpd = await update(userData, id);

return res.status(userUpd.id ? 200 : 400).json(userUpd)

} catch (error) {

return res.status(500).json({
message: "An error has ocurred",
error
})

}

}

module.exports = {
updateUser
}
2 changes: 1 addition & 1 deletion migrations/20220521171147-create-activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
},
Comment thread
ldato marked this conversation as resolved.
},
{
paranoid: true,
Expand Down
2 changes: 1 addition & 1 deletion models/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = (sequelize, DataTypes) => {
}
};
Activity.init({
id: DataTypes.INTEGER,
id: {type: DataTypes.INTEGER, primaryKey: true},
name: DataTypes.STRING,
content: DataTypes.TEXT,
image: DataTypes.STRING
Expand Down
Loading