import Model from "./model.js"; // Create export const createInvoice = async (data) => { return await Model.create(data); }; // Read (Get by ID) export const getInvoiceById = async (id) => { return await Model.findById(id); }; // Read (Get by Query) export const getInvoiceByQuery = async (query) => { return await Model.findOne(query); } // Read (Get all) export const getAllInvoices = async () => { return await Model.find(); }; // Update export const updateInvoice = async (id, data) => { return await Model.findByIdAndUpdate(id, data, { new: true }); }; // Aggregate export const aggregateInvoice = async (pipeline) => { return await Model.aggregate(pipeline); };