Last active
February 8, 2022 13:36
-
-
Save flancer64/082e6b0279f5f792e3aeacbeea09d14a to your computer and use it in GitHub Desktop.
TeqFW action code template (./src/Back/Act/Name.mjs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Action description. | |
* | |
* @namespace Vnd_Prj_Back_Act_Name | |
*/ | |
// MODULE'S IMPORT | |
import {join} from 'path'; | |
// MODULE'S VARS | |
const NS = 'Vnd_Prj_Back_Act_Name'; | |
// MODULE'S CLASSES | |
/** | |
* Enumeration for result codes. | |
* @memberOf Vnd_Prj_Back_Act_Name | |
*/ | |
const RESULT = { | |
FAIL: 'fail', | |
SUCCESS: 'success', | |
} | |
Object.freeze(RESULT); | |
// MODULE'S FUNCTIONS | |
export default function (spec) { | |
// DEPS | |
/** @type {Vnd_Prj_Back_Defaults} */ | |
const DEF = spec['Vnd_Prj_Back_Defaults$']; | |
// ENCLOSED VARS | |
// ENCLOSED FUNCS | |
/** | |
* @param {string} title | |
* @param {string} body | |
* @return {Promise<{msgId, code}>} | |
* @memberOf Vnd_Prj_Back_Act_Name | |
*/ | |
async function act({title, body}) { | |
// ENCLOSED FUNCS | |
// MAIN | |
const msgId = 1; | |
const code = RESULT.SUCCESS; | |
return {msgId, code}; | |
} | |
// MAIN FUNCTIONALITY | |
Object.defineProperty(act, 'namespace', {value: `${NS}.act`}); | |
act.RESULT = RESULT; | |
return act; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment