-
To Create Role
Function Name: createRoleFunction
Arguments : Objectlet payload = { name: "Function Test", createdBy: "cs", }; const role = await createRoleFunction(payload);
{ "name": 'Function Test', "id": '4ed05209-710b-4a8d-bdc9-1eae6949245c', "createdBy": 'cs', "status": true, "_id": new ObjectId('65bb22adf2f9e5cb3efa2029'), "createdAt": 2024-02-01T04: 48: 45.945Z, "updatedAt": 2024-02-01T04: 48: 45.945Z, "__v": 0 }
-
Get Role By Id
Function Name: getRoleByIdFunction
Arguments : roleIdlet roleId = "4ed05209-710b-4a8d-bdc9-1eae6949245c" const role = await getRoleByIdFunction(roleId);
{ "name": 'Function Test', "id": '4ed05209-710b-4a8d-bdc9-1eae6949245c', "createdBy": 'cs', "status": true, "_id": new ObjectId('65bb22adf2f9e5cb3efa2029'), "createdAt": 2024-02-01T04: 48: 45.945Z, "updatedAt": 2024-02-01T04: 48: 45.945Z, "__v": 0 }
-
Update Role By Id
Function Name: updateRoleByIdFunction
Arguments : roleId,Objectlet roleId = "4ed05209-710b-4a8d-bdc9-1eae6949245c" let payload = { name: "update role" } const role = await getRoleByIdFunction(roleId,payload);
{ "name": 'update role', "id": '4ed05209-710b-4a8d-bdc9-1eae6949245c', "createdBy": 'cs', "status": true, "_id": new ObjectId('65bb22adf2f9e5cb3efa2029'), "createdAt": 2024-02-01T04: 48: 45.945Z, "updatedAt": 2024-02-01T04: 48: 45.945Z, "__v": 0 }
-
Delete Role By Id
Function Name: deleteRoleByIdFunction
Arguments : roleIdlet roleId = "4ed05209-710b-4a8d-bdc9-1eae6949245c" const role = await deleteRoleByIdFunction(roleId);
{ "name": 'deleted role', "id": '4ed05209-710b-4a8d-bdc9-1eae6949245c', "createdBy": 'cs', "status": true, "_id": new ObjectId('65bb22adf2f9e5cb3efa2029'), "createdAt": 2024-02-01T04: 48: 45.945Z, "updatedAt": 2024-02-01T04: 48: 45.945Z, "__v": 0 }
-
To Create Permissions
Function Name: createPermissionFunction
Arguments : Objectlet payload = { name: "Permission Name" }; const permission = await createPermissionFunction(payload);
{ "name": 'Permission Name', "id": '5e210a60-bfaa-4a89-af1b-789b975b61cd', "status": true, "_id": new ObjectId('65bb2f91954dc5eb4bb641c6'), "createdAt": 2024-02-01T05:43:45.079Z, "updatedAt": 2024-02-01T05:43:45.079Z, "__v": 0 }
-
To Update Permissions
Function Name: updatePermissionFunction
Arguments : Objectlet permissionId = "5e210a60-bfaa-4a89-af1b-789b975b61cd" let payload = { name: "Permission Name" }; let permission = await updatePermissionFunction(permissionId,payload);
{ "name": 'Permission Name', "id": '5e210a60-bfaa-4a89-af1b-789b975b61cd', "status": true, "_id": new ObjectId('65bb2f91954dc5eb4bb641c6'), "createdAt": 2024-02-01T05:43:45.079Z, "updatedAt": 2024-02-01T05:43:45.079Z, "__v": 0 }
-
To Delete Permissions
Function Name: deletePermissionFunction
Arguments : Objectlet permissionId = "5e210a60-bfaa-4a89-af1b-789b975b61cd" let permission = await deletePermissionFunction(permissionId);
{ "name": 'Deleted', "id": '5e210a60-bfaa-4a89-af1b-789b975b61cd', "status": true, "_id": new ObjectId('65bb2f91954dc5eb4bb641c6'), "createdAt": 2024-02-01T05:43:45.079Z, "updatedAt": 2024-02-01T05:43:45.079Z, "__v": 0 }
-
Function To Create Permission Modules
Function Name: createPermissionToModuleFunction
Arguments : Objectlet payload = { moduleId: "123", moduleName: "testModule", permissions: [ { name: "test1", permissionId: "123", assignedBy: "vj", }, ], }; const permissionToModule = await createPermissionToModuleFunction(payload);
{ "id": '795233b2-a8a0-449b-beb9-c3d64e21482d', "moduleName": "test1", "moduleId": "1234", "permissions": [ { "name": "test2", "permissionId": 11, "assignedBy": "vj" } ], "status": true, "_id": new ObjectId("65ba1b2f2fab145140390803"), "createdAt": 2024-01-31T10: 04: 31.088Z, "updatedAt": 2024-01-31T10: 04: 31.088Z, "__v": 0 }
-
Function To Create New permissions
Function Name: addPermissionsToModuleFunction
Arguments : moduleId,ArrayOfObjectlet payload = [ { name: "test", permissionId: "123", assignedBy: "vj", }, ]; let moduleId = "1234;"; const permissions = await addPermissionsToModuleFunction(moduleId, payload);
{ "id": '795233b2-a8a0-449b-beb9-c3d64e21482d', "moduleName": "Vj", "moduleId": "1234", "permissions": [ { "name": "test1", "permissionId": 11, "assignedBy": "vj" }, { "name": "test2", "permissionId": 12, "assignedBy": "vj" } ], "status": true, "_id": new ObjectId("65ba1b2f2fab145140390803"), "createdAt": 2024-01-31T10: 04: 31.088Z, "updatedAt": 2024-01-31T10: 04: 31.088Z, "__v": 0 }
-
Function remove permissions
Function Name: removePermissionToModuleFunction
Arguments : moduleId,permissionIdlet moduleId = "1234"; let permissionId = "12"; const permissions = await addPermissionsToModuleFunction(moduleId, permissionId);
{ "id": '795233b2-a8a0-449b-beb9-c3d64e21482d', "moduleName": "Vj", "moduleId": "1234", "permissions": [ { "name": "test1", "permissionId": 11, "assignedBy": "vj" } ], "status": true, "_id": new ObjectId("65ba1b2f2fab145140390803"), "createdAt": 2024-01-31T10: 04: 31.088Z, "updatedAt": 2024-01-31T10: 04: 31.088Z, "__v": 0 }
-
Function update permissions
Function Name: updatePermissionToModuleFunction
Arguments : moduleId,permissionIdlet moduleId = "1234"; const modifiedPermission = { name: "test121", permissionId: "123", assignedBy: "user123", }; const permissions = await addPermissionsToModuleFunction(moduleId, modifiedPermission);
{ "id": '795233b2-a8a0-449b-beb9-c3d64e21482d', "moduleName": "Vj", "moduleId": "1234", "permissions": [ { "name": "test121", "permissionId": "123", "assignedBy": "user123" } ], "status": true, "_id": new ObjectId("65ba1b2f2fab145140390803"), "createdAt": 2024-01-31T10: 04: 31.088Z, "updatedAt": 2024-01-31T10: 04: 31.088Z, "__v": 0 }