Node/modules/follows/middlewares/process.js
2025-03-01 16:49:04 +03:00

38 lines
803 B
JavaScript

const { Follow } = require("../models")
exports.postFollow = async function({user, targetUser, statu}){
return await Follow.create({
user: user,
target_user: targetUser,
statu: statu
});
};
exports.updateFollow = async function({user, targetUser}){
return await Follow.update(
{statu: true},
{
where: {
user: user,
target_user: targetUser,
statu: false
}
}
);
};
exports.destroyFollow = async function({followId}){
return await Follow.destroy({
where:{
id: followId
}
});
};
exports.destroyFriend = async function({friendIds}){
return await Follow.destroy({
where:{
id: friendIds
}
})
};