Skip to content

Commit

Permalink
refactor: fixed a mess up
Browse files Browse the repository at this point in the history
  • Loading branch information
brecke committed Dec 14, 2021
1 parent 6d85561 commit 53c84e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions packages/oae-lti/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* permissions and limitations under the License.
*/

import { format } from 'node:util';
import * as VersionAPI from 'oae-version';
import { callbackify, format } from 'node:util';
import { getVersion } from 'oae-version';

import oauth from 'oauth-sign';
import ShortId from 'shortid';
Expand All @@ -35,7 +35,7 @@ const log = logger('oae-lti');
/**
* Get the parameters required to launch an LTI tool
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} id The id of the LTI tool to be launched
* @param {String} groupId The group linked to the LTI tool to be launched
* @param {Function} callback Standard callback function
Expand All @@ -57,7 +57,7 @@ const getLtiTool = function (ctx, id, groupId, callback) {
return callback(error);
}

VersionAPI.getVersionCB((error, gitRepoInformation) => {
callbackify(getVersion)((error, gitRepoInformation) => {
if (error) {
log().warn('Failed to fetch OAE version');
version = '';
Expand Down Expand Up @@ -109,7 +109,7 @@ const getLtiTool = function (ctx, id, groupId, callback) {
/**
* Create a new LTI tool linked to a group
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} groupId The id of the group the LTI tool will be linked to
* @param {String} launchUrl The URL from which the LTI tool will launch
* @param {String} secret The OAUTH secret for the LTI tool
Expand Down Expand Up @@ -209,7 +209,7 @@ const addLtiTool = function (ctx, groupId, launchUrl, secret, consumerKey, optio
/**
* Get a list of LTI tools belonging to a group.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} groupId The id of the group the LTI tool will be linked to
* @param {Function} callback Standard callback function
* @param {Object} callback.err An error that occurred, if any
Expand Down Expand Up @@ -245,7 +245,7 @@ const getLtiTools = function (ctx, groupId, callback) {
/**
* Delete an LTI tool from storage.
*
* @param {Context} ctx Standard context object containing the current user and the current tenant
* @param {Context} ctx Current execution context
* @param {String} id The id of the LTI tool to be deleted
* @param {String} groupId The id of the group the LTI tool will be linked to
* @param {Function} callback Standard callback function
Expand Down
3 changes: 2 additions & 1 deletion packages/oae-version/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { fileURLToPath } from 'node:url';
import { Map } from 'immutable';
import * as git from 'isomorphic-git';
import { nth, reduce, gt as greaterThan, head, last } from 'ramda';
import { callbackify } from 'node:util';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand All @@ -37,7 +38,7 @@ const hilaryDirectory = path.resolve(__dirname, '..', '..', '..');
* @param {String} callback.version.3akai-ux The version information for the UI
*/
const getVersionCB = function (callback) {
getVersion().then((version) => callback(null, version));
return callbackify(getVersion, callback);
};

const getVersion = async function (repoPath = hilaryDirectory, repoInformation = new Map()) {
Expand Down

0 comments on commit 53c84e3

Please sign in to comment.