38 lines
803 B
JavaScript
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
|
|
}
|
|
})
|
|
}; |