Numex yayın: models/urun.js
This commit is contained in:
parent
f7fa225600
commit
b9d0c4527b
18
models/urun.js
Normal file
18
models/urun.js
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Ü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 };
|
||||||
Loading…
Reference in New Issue
Block a user