The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Rocket.Chat/packages/rocketchat-lib/server/models/UserDataFiles.js

40 lines
677 B

import _ from 'underscore';
RocketChat.models.UserDataFiles = new class ModelUserDataFiles extends RocketChat.models._Base {
constructor() {
super('user_data_files');
this.tryEnsureIndex({ userId: 1 });
}
// FIND
findById(id) {
const query = { _id: id };
return this.find(query);
}
findLastFileByUser(userId, options = {}) {
const query = {
userId,
};
options.sort = { _updatedAt : -1 };
return this.findOne(query, options);
}
// INSERT
create(data) {
const userDataFile = {
createdAt: new Date,
};
_.extend(userDataFile, data);
return this.insert(userDataFile);
}
// REMOVE
removeById(_id) {
return this.remove(_id);
}
};