fix: persist tender preparation and correct calendar export

This commit is contained in:
2026-09-06 08:30:32 +03:00
parent 909ebae7c2
commit c91631d99f
19 changed files with 569 additions and 182 deletions
+14
View File
@@ -1061,6 +1061,20 @@ const server = http.createServer(async (req, res) => {
}
}
if (url.pathname === '/api/me/tender-state') {
const user = userFromAuthHeader(req.headers['authorization']);
if (!user) return json(res, 401, { success: false, error: 'oturum yok' });
if (req.method === 'GET') return json(res, 200, {success:true, records:store.getTenderStates(user.email)});
if (req.method !== 'PUT') return json(res, 405, {success:false,error:'desteklenmeyen metot'});
try {
const body = await readBody(req, 512 * 1024);
const record = store.saveTenderState(user.email, body.key, body.patch, body.snapshot, body.version);
return json(res, 200, {success:true, record});
} catch (e) {
return json(res, e.kod === 'VERSION_CONFLICT' ? 409 : 400, {success:false,error:e.message,kod:e.kod});
}
}
// --- Kullanıcı verisi (localStorage yerine sunucu tarafı) ---
if (url.pathname.startsWith('/api/me/data')) {
const user = userFromAuthHeader(req.headers['authorization']);