// import {Path, Server, GET, POST, PathParam, HeaderParam // , QueryParam, FormParam, PUT, DELETE, PATCH } from "typescript-rest"; // import { SimpleApiResponse, ObjectApiResponse } from '@birbal/api-utilities/dist/api-response'; // import { SystemResource } from '../../Resource/System/system-identity'; // import { MongoTxn } from '@birbal/mongo-utilities/dist/mongo-txn'; // import { MongoTxnRegistry } from '@birbal/mongo-utilities/dist/mongo-txn-registry'; // const MONGO_DB_NAME = process.env["BIRBAL_MAIN_DATABASE"] // const MONGO_HOST_NAME = process.env["BIRBAL_MONGO_HOST"] // const MONGO_PORT = process.env["BIRBAL_MONGO_PORT"] // const SUPER_SECRET = process.env["BIRBAL_SUPER_SECRET"]; // /** // * @class All Notification related api endpoints // */ // @Path("/profile") // export class SystemEndpoints { // @Path("/system") // @POST // async addIdentity( // @QueryParam('userId') userId: string // , @QueryParam('userType') userType: string // , @QueryParam('idType') idType: string // , @QueryParam('idValue') idValue: string // ) { // if (!userId || !userType || !idType || !idValue) { // let res = new SimpleApiResponse(false, "Invalid input"); // return res.toJSON(); // } // let txn: MongoTxn; // try { // txn = await MongoTxnRegistry.getSingleton().registerNewTxn(MONGO_DB_NAME); // await txn.beginTxn(); // let reqRes = new SystemResource(MONGO_DB_NAME, SUPER_SECRET); // let id = await reqRes.addIdentity( // userId, userType // , idValue, idType // , txn.id // ); // await txn.commitTxn(); // let res = new ObjectApiResponse(true, "Success", undefined, {id}); // return res.toJSON(); // } catch (e) { // let res = new SimpleApiResponse(false, e.message); // return res.toJSON(); // } // } // @Path("/system") // @DELETE // async removeIdentity( // @QueryParam('userType') userType: string // , @QueryParam('idType') idType: string // , @QueryParam('idValue') idValue: string // ) { // if (!userType || !idType || !idValue) { // let res = new SimpleApiResponse(false, "Invalid input"); // return res.toJSON(); // } // let txn: MongoTxn; // try { // txn = await MongoTxnRegistry.getSingleton().registerNewTxn(MONGO_DB_NAME); // await txn.beginTxn(); // let reqRes = new SystemResource(MONGO_DB_NAME, SUPER_SECRET); // await reqRes.removeIdentity( // userType // , idValue, idType // , txn.id // ); // await txn.commitTxn(); // let res = new ObjectApiResponse(true, "Success", undefined); // return res.toJSON(); // } catch (e) { // let res = new SimpleApiResponse(false, e.message); // return res.toJSON(); // } // } // @Path("/system") // @GET // async advancedSearch( // @QueryParam('userId') userId: string // , @QueryParam('userType') userType: string // , @QueryParam('idType') idType: string // , @QueryParam('idValue') idValue: string // , @QueryParam('limit') limit: number // , @QueryParam('skip') skip: number // ) { // let txn: MongoTxn; // try { // txn = await MongoTxnRegistry.getSingleton().registerNewTxn(MONGO_DB_NAME); // await txn.beginTxn(); // let reqRes = new SystemResource(MONGO_DB_NAME, SUPER_SECRET); // let [count, results] = await reqRes.advancedSearch( // MONGO_DB_NAME // , limit, skip // , userId, userType, idValue, idType // ); // await txn.commitTxn(); // let res = new ObjectApiResponse(true, "Success", undefined, {count: count, rows: results}); // return res.toJSON(); // } catch (e) { // let res = new SimpleApiResponse(false, e.message); // return res.toJSON(); // } // } // }