import fuelPricesModel from "./fuelPrices.model";

export class FuelPriceService {

    async getAll(){
        return await fuelPricesModel
        .find()
        .populate("fuelTypeId");
    }

    async getById (
        id:string
    ) {
        return await fuelPricesModel
        .findById()
        .populate("fuelTypeId");
    }

    async create (
        data:any
    ){

        return await fuelPricesModel.create(
            data
        );
    }

    async update (
        id:string,
        data:any

    ){
        return await fuelPricesModel.findByIdAndUpdate(
            id,
            data,
            {
                new:true
            } 
        );
    }

    async delete (
        id:string
    ){
        return await fuelPricesModel.findByIdAndDelete(
            id
        );
    }
}