Persist versioned document text reviews against source file hashes

This commit is contained in:
2026-09-06 09:47:12 +03:00
parent f073438922
commit 559a2feeda
7 changed files with 120 additions and 2 deletions
+12
View File
@@ -1,3 +1,4 @@
import {documentReview,saveDocumentReview} from './document-review.mjs';
import { documentMetadataPatch, decodeDocumentUpload } from './document-metadata.mjs';
import { deadlineInfo } from '../src/services/tenderCalendar.js';
import { exchangeRates } from './exchange-rates.mjs';
@@ -1064,6 +1065,17 @@ const server = http.createServer(async (req, res) => {
return json(res, 200, { success: true, belgeler: store.listDocuments(user.email) });
} catch (e) { return json(res, 400, { success: false, error: e.message }); }
}
if (url.pathname === '/api/me/documents/text-review') {
const user=userFromAuthHeader(req.headers['authorization']);
if(!user) return json(res,401,{success:false,error:'oturum yok'});
try {
if(req.method === 'GET') return json(res,200,{success:true,...documentReview(user.email,url.searchParams.get('id'))});
if(req.method !== 'POST') return json(res,405,{success:false,error:'desteklenmeyen metot'});
const body=await readBody(req,1100*1024);
if(typeof body.id !== 'string') return json(res,400,{success:false,error:'belge id gerekli'});
return json(res,200,{success:true,...saveDocumentReview(user.email,body.id,body)});
} catch(error) {return json(res,error.status || 500,{success:false,error:error.message});}
}
if (url.pathname === '/api/me/documents/read-error' && req.method === 'POST') {
const user = userFromAuthHeader(req.headers['authorization']);
if (!user) return json(res,401,{success:false,error:'oturum yok'});