feat: repositorios, servicios, UI completa con rutas, Capacitor Android sync
This commit is contained in:
20
packages/data/src/repositories/CuadreRepository.ts
Normal file
20
packages/data/src/repositories/CuadreRepository.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user