| Server IP : 167.235.67.158 / Your IP : 216.73.216.95 Web Server : Apache System : Linux ubuntu-8gb-nbg1-1 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : upstairsbar.co.uk ( 982) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/api.pda.the-word.com/trackRecord/ |
Upload File : |
const helpers = require('../common/helpers');
const service = require('./service');
async function handle(event) {
const method = helpers.getMethod(event);
const path = helpers.normalizePath(event);
if (method === 'GET' && path === '/track-record') {
const afterCursor = event.queryStringParameters?.afterCursor || null;
const pageSize = helpers.parseInteger(event.queryStringParameters?.pageSize, 2000, { min: 1, max: 5000 });
const pageAfterId = helpers.parseInteger(event.queryStringParameters?.pageAfterId, 0, { min: 0 });
const cursorSnapshot = helpers.parseInteger(event.queryStringParameters?.cursorSnapshot, 0, { min: 0 });
const result = await service.listTrackRecords(event.user.id, afterCursor, { pageSize, pageAfterId, cursorSnapshot });
return helpers.formatResponse({ statusCode: 200, body: result });
}
const match = path.match(/^\/track-record\/(\d+)\/(\d+)$/);
if (match && method === 'PUT') {
const body = helpers.parseJsonBody(event);
const result = await service.upsertTrackRecord(event.user.id, Number(match[1]), Number(match[2]), body);
return helpers.formatResponse({ statusCode: 200, body: result });
}
return helpers.formatResponse({ statusCode: 404, body: { message: 'Not Found' } });
}
module.exports = {
handle
};