depo-yonetim/models/urun.js

19 lines
371 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Ürün modeli
const store = require('./store');
function dogrula(veri) {
const hatalar = [];
if (!veri.ad || veri.ad.trim() === '') hatalar.push('Ürün adı zorunludur');
return hatalar;
}
function tumu() {
return store.oku('urunler');
}
function bul(id) {
return store.bulKoleksiyonda('urunler', Number(id));
}
module.exports = { dogrula, tumu, bul };