Created the "bought item" controller
This commit is contained in:
parent
26537cd6c5
commit
9f069f6ea1
9
controller/boughtItem.js
Normal file
9
controller/boughtItem.js
Normal file
@ -0,0 +1,9 @@
|
||||
const {mongo} = require('mongoose');
|
||||
const BoughtItem = require('../models/BoughtItem');
|
||||
|
||||
// Checks if the user owns a specific addon
|
||||
module.exports.ownsItem = async (user_id, addon_id) => {
|
||||
if (!mongo.ObjectId.isValid(user_id)) return;
|
||||
if (!mongo.ObjectId.isValid(addon_id)) return;
|
||||
return await BoughtItem.findOne({user_id, addon_id}).exec() !== null;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user