import { Attributes, FindOptions } from "sequelize"; import { injectable } from "tsyringe"; import { WifiLocation } from "../models/wifiLocation"; @injectable() export class WifiLocationRepository { public async findAll(options?: FindOptions>) { return await WifiLocation.findAll(options); } public async findById(id: string) { return await WifiLocation.findByPk(id); } public async create(data: Partial) { return await WifiLocation.create(data); } public async createMany(data: Partial[]) { return await WifiLocation.bulkCreate(data); } public async update(id: string, data: Partial) { const wifiScan = await this.findById(id); if (wifiScan) { return await wifiScan.update(data); } return null; } public async delete(id: string) { const wifiScan = await this.findById(id); if (wifiScan) { await wifiScan.destroy(); return true; } return false; } }