@ideal-photography/shared
Version:
Shared MongoDB and utility logic for Ideal Photography PWAs: users, products, services, bookings, orders/cart, galleries, reviews, notifications, campaigns, settings, audit logs, minimart items/orders, and push notification subscriptions.
5 lines • 390 B
JavaScript
exports.createOne = Model => async data => await new Model(data).save();
exports.getAll = Model => async filter => await Model.find(filter);
exports.getOne = Model => async id => await Model.findById(id);
exports.updateOne = Model => async (id, data) => await Model.findByIdAndUpdate(id, data, { new: true });
exports.deleteOne = Model => async id => await Model.findByIdAndDelete(id);