Default Adapter
The default adapter implements reviews of organizations and users using MongoDB as a data store
Features
- Organization->User review creation, updating, deletion
- Organizations can review users and see their performance
- User->Organization review creation, updating, deletion
- Users can review organizations and see their performance
- Review listing
- Users and Organizations can see all reviews for themselves or another specific user/organization.
Installation
- Prerequisites
Dependency | Version |
---|---|
node | 18+ |
MongoDB | 5+ |
Nodeblocks User Service | 1.7.0+ |
Nodeblocks Organization Service | 1.7.0+ |
Nodeblocks Catalog Service | 1.6.0+ |
Nodeblocks Order Service | 1.4.1+ |
- Install Package
Create your repository and add this package as a dependency
mkdir my-review-service
npx gts init -y
npm install --save @basaldev/blocks-review-service
You will need to also set up your environment variables. Look at Quick Start Guide for a sample.
- Initial code
Place the following into src/index.ts:
import {
defaultAdapter,
createNodeblocksReviewApp,
} from '@basaldev/blocks-review-service';
import { getEnvString } from '../helper/utilities';
async function main() {
const adapter = defaultAdapter.createReviewDefaultAdapter(
{
authEncSecret: getEnvString('AUTH_ENC_SECRET', ''),
authSignSecret: getEnvString('AUTH_SIGN_SECRET', ''),
serviceEndpoints: {
catalog: getEnvString('CATALOG_ENDPOINT', ''),
order: getEnvString('ORDER_ENDPOINT', ''),
organization: getEnvString('ORGANIZATION_ENDPOINT', ''),
review: getEnvString('REVIEW_ENDPOINT', ''),
user: getEnvString('USER_ENDPOINT', ''),
},
},
{
catalogAPI: getEnvString('CATALOG_ENDPOINT', ''),
db: getEnvString('DATABASE_URL', ''),
orderAPI: getEnvString('ORDER_ENDPOINT', ''),
organizationAPI: getEnvString('ORGANIZATION_ENDPOINT', ''),
userAPI: getEnvString('USER_ENDPOINT', ''),
}
);
await createNodeblocksReviewApp({
corsOrigin: [/.*/],
}).startService({
PORT: Number(getEnvString('REVIEW_PORT', '8089')),
adapter,
env: 'development',
});
}
void main();