import { inject, injectable } from "tsyringe"; import { Location } from "../models/location"; import { LocationRepository } from "../repositories/locationRepository"; @injectable() export class LocationService { constructor( @inject(LocationRepository) private repository: LocationRepository ) {} public async getAllLocations() { return this.repository.findAll(); } public async getLocationById(id: string) { return this.repository.findById(id); } public async createLocation(data: Partial) { return this.repository.create(data); } public async updateLocation(id: string, data: Partial) { return this.repository.update(id, data); } public async deleteLocation(id: string) { return this.repository.delete(id); } }