mirror of
https://github.com/cnodejs/nodeclub.git
synced 2025-12-08 19:55:55 +00:00
22 lines
625 B
JavaScript
22 lines
625 B
JavaScript
var models = require('../models');
|
|
var Relation = models.Relation;
|
|
|
|
exports.getRelation = function (userId, followId, callback) {
|
|
Relation.findOne({user_id: userId, follow_id: followId}, callback);
|
|
};
|
|
|
|
exports.getRelationsByUserId = function (id, callback) {
|
|
Relation.find({follow_id: id}, callback);
|
|
};
|
|
|
|
exports.newAndSave = function (userId, followId, callback) {
|
|
var relation = new Relation();
|
|
relation.user_id = userId;
|
|
relation.follow_id = followId;
|
|
relation.save(callback);
|
|
};
|
|
|
|
exports.remove = function (userId, followId, callback) {
|
|
Relation.remove({user_id: userId, follow_id: followId}, callback);
|
|
};
|