import Model from "./model.js"; // Create export const createAccess = async (data) => { return await Model.create(data); }; // Read (Get by ID) export const getAccessById = async (id) => { return await Model.findById(id); }; // Read (Get by Query) export const getAccessByQuery = async (query) => { return await Model.findOne(query); }; // Read (Get all) export const getAllAccesss = async () => { return await Model.find(); }; // Update export const updateAccess = async (id, data, options) => { return await Model.findByIdAndUpdate(id, data, { ...options, new: true }); }; // Aggregate export const aggregateAccess = async (pipeline) => { return await Model.aggregate(pipeline); };