normalize health portfolio identifiers
This commit is contained in:
+2
-2
@@ -81,9 +81,9 @@ function validateHealthPortfolio(value) {
|
||||
if (!Array.isArray(portfolio) || portfolio.length > 200) throw new Error('Sağlık ürün portföyü geçersiz veya çok uzun.');
|
||||
const ids = new Set();
|
||||
for (const item of portfolio) {
|
||||
if (!item || typeof item !== 'object' || Array.isArray(item) || typeof item.id !== 'string' || !item.id.trim() || ids.has(item.id))
|
||||
if (!item || typeof item !== 'object' || Array.isArray(item) || typeof item.id !== 'string' || !item.id.trim() || item.id.length > 200 || ids.has(item.id.trim()))
|
||||
throw new Error('Sağlık ürün portföyünde geçersiz veya yinelenen kayıt var.');
|
||||
ids.add(item.id);
|
||||
ids.add(item.id.trim());
|
||||
for (const key of ['group','brand','model','utsReference','serviceCapacity'])
|
||||
if (item[key] !== undefined && (typeof item[key] !== 'string' || item[key].length > 1000)) throw new Error('Sağlık ürün portföyü alanı geçersiz.');
|
||||
if (!['consumable','device','staffedService'].includes(item.kind || 'consumable')) throw new Error('Sağlık ürün portföyü kapsamı geçersiz.');
|
||||
|
||||
Reference in New Issue
Block a user