fix: confirm and version favorite institution updates

This commit is contained in:
2026-09-06 14:09:31 +03:00
parent 525b673e25
commit 463fd06d30
6 changed files with 39 additions and 10 deletions
+3 -1
View File
@@ -1207,7 +1207,9 @@ const server = http.createServer(async (req, res) => {
validateTeam(body.deger);
kotaKontrol(user.email, 'ekip', 0, body.deger.length, { isAdmin: user.isAdmin });
}
const protectedKey=['firma_profil','saved_filters','ekip'].includes(k);
if(k==='favori_kurumlar' && (!Array.isArray(body.deger) || body.deger.some(name=>typeof name!=='string'||!name.trim()||name.length>1000) || new Set(body.deger.map(name=>name.trim())).size!==body.deger.length))
return json(res,400,{success:false,error:'Favori kurum listesi geçersiz veya yinelenen kurum içeriyor.'});
const protectedKey=['firma_profil','saved_filters','ekip','favori_kurumlar'].includes(k);
if(protectedKey && (!Object.hasOwn(body,'revision') || (body.revision!==null && (typeof body.revision!=='string' || !/^[a-f0-9]{64}$/.test(body.revision)))))
return json(res,428,{success:false,kod:'VERSION_REQUIRED',error:'Güncel kayıt sürümü gerekli. Sayfayı yenileyip tekrar deneyin.'});
const revision=store.setData(user.email, k, body.deger, protectedKey ? body.revision : undefined);