21 lines
555 B
TypeScript
21 lines
555 B
TypeScript
import { db } from '../db/schema';
|
|
import type { CuadreCaja } from '@toldo/core';
|
|
|
|
export class CuadreRepository {
|
|
async create(cuadre: CuadreCaja): Promise<string> {
|
|
return db.cuadres.add(cuadre);
|
|
}
|
|
|
|
async getByFecha(fecha: Date): Promise<CuadreCaja[]> {
|
|
const start = new Date(fecha);
|
|
start.setHours(0, 0, 0, 0);
|
|
const end = new Date(fecha);
|
|
end.setHours(23, 59, 59, 999);
|
|
return db.cuadres.where('fecha').between(start, end).toArray();
|
|
}
|
|
|
|
async getAll(): Promise<CuadreCaja[]> {
|
|
return db.cuadres.toArray();
|
|
}
|
|
}
|