import fuelTypeModel from "./fuelType.model";

export class FuelTypeService {

    //Obtener datos

    async getAll() {
        return await fuelTypeModel.find();
    }

    //Obtener por id

    async getById(
        id:string
    ){
        return fuelTypeModel.findById(
            id
        );
    }

    //Crear

    async create (
        data:any
    ) {
        return await fuelTypeModel.create(
            data
        );
    }

    //Actualizar
    async update(
        id:String,
        data:any
    ) {
        return await fuelTypeModel.findByIdAndUpdate (
            id,
            data,
            {
                new:true
            }
        );
    }

    //Eliminar

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