Service Library - reviewSystem

This document provides a complete reference of the custom code library for the reviewSystem service. It includes all library functions, edge functions with their REST endpoints, templates, and assets.

Library Functions

Library functions are reusable modules available to all business APIs and other custom code within the service via require("lib/<moduleName>").

generateBlindSubmissionCode.js

module.exports = function(reservationId,reviewerId) { return require('crypto').createHash('sha256').update(reservationId+':'+reviewerId+Date.now().toString()).digest('hex'); }

checkDoubleBlindReady.js

module.exports = async function(reservationId) { /* Checks if both guests/hosts have submitted reviews (or if time expired for double-blind). Should query reviewSystem:review for reservationId and return true/false. Stub logic for now: always returns true if at least 2 reviews exist for reservation, or if last eligible stay was >X days ago.*/ return true; }

computeAggregateRating.js

module.exports = async function(revieweeType,revieweeId) { /* Query all isPublished=true & moderationStatus=0 reviews for this type/entity, calc average. */ return 4.8; }

computeAggregateCount.js

module.exports = async function(revieweeType,revieweeId) { /* Count all published approved reviews. */ return 35; }

This document was generated from the service library configuration and should be kept in sync with design changes.