@@ -19,6 +19,15 @@ import {
1919} from "./establishRelations.types" ;
2020
2121namespace Helpers {
22+ /**
23+ * Establishes a relation between two nodes in the database.
24+ *
25+ * @param {IDB } db - The database instance.
26+ * @param {string } sourceID - The ID of the source node.
27+ * @param {string } targetID - The ID of the target node.
28+ * @param {string } relation - The type of relation to establish between the nodes.
29+ * @returns {Promise<void> } - A promise that resolves when the relation is successfully established.
30+ */
2231 async function establishRelation (
2332 db : IDB ,
2433 sourceID : string ,
@@ -37,6 +46,13 @@ namespace Helpers {
3746 }
3847 }
3948
49+ /**
50+ * Establishes relations between entities in the database.
51+ *
52+ * @param {IDB } db - The database instance.
53+ * @param {EstablishRelationsEndpointRelations[] } relations - An array of objects representing the relations to be established.
54+ * @returns {Promise<void> } - A promise that resolves when all relations have been established.
55+ */
4056 export async function establishRelations (
4157 db : IDB ,
4258 relations : EstablishRelationsEndpointRelations [ ]
@@ -58,6 +74,12 @@ namespace Helpers {
5874export class EstablishRelationsEndpoint extends ApiEndpoint {
5975 public path = "establishRelations" ;
6076
77+ /**
78+ * Generates the request and response bodies for the EstablishRelationsEndpoint.
79+ *
80+ * @param content - The content to be used for generating the request and response bodies.
81+ * @returns An array containing the generated request body and response body.
82+ */
6183 makeBodies (
6284 content : any
6385 ) : [
@@ -72,6 +94,14 @@ export class EstablishRelationsEndpoint extends ApiEndpoint {
7294 return [ requestBody , responseBody ] ;
7395 }
7496
97+ /**
98+ * Commits the progress of the database transaction.
99+ *
100+ * @param {IDB } db - The database instance.
101+ * @returns {Promise<number> } - A promise that resolves to the status code indicating the success or failure of the commit operation.
102+ * - Returns 200 if the commit is successful.
103+ * - Returns 500 if an error occurs during the commit or rollback operation.
104+ */
75105 async commitProgress (
76106 db : IDB
77107 ) : Promise < EstablishRelationsEndpointResponseBody [ "status" ] > {
0 commit comments