LocationHub/server/src/services/ttnGatewayReceptionService.ts

39 lines
1.0 KiB
TypeScript

import { inject, injectable } from "tsyringe";
import { TtnGatewayReception } from "../models/ttnGatewayReception";
import { TtnGatewayReceptionRepository } from "../repositories/ttnGatewayReceptionRepository";
@injectable()
export class TtnGatewayReceptionService {
constructor(
@inject(TtnGatewayReceptionRepository)
private repository: TtnGatewayReceptionRepository
) {}
public async getAllGatewayReceptions() {
return this.repository.findAll();
}
public async getGatewayReceptionById(id: string) {
return this.repository.findById(id);
}
public async createGatewayReception(data: Partial<TtnGatewayReception>) {
return this.repository.create(data);
}
public async createGatewayReceptions(data: Partial<TtnGatewayReception>[]) {
return this.repository.createMany(data);
}
public async updateGatewayReception(
id: string,
data: Partial<TtnGatewayReception>
) {
return this.repository.update(id, data);
}
public async deleteGatewayReception(id: string) {
return this.repository.delete(id);
}
}