Created
March 12, 2024 08:46
-
-
Save flancer64/fa711ef77324338261a11e6d3aaa633f to your computer and use it in GitHub Desktop.
The template for a Data Transfer Object (DTO) code used in the TeqFW framework.
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
/** | |
* The format in which the exported/imported information is organized. | |
*/ | |
// MODULE'S VARIABLES | |
const NS = 'TeqFw_Db_Back_Dto_Export'; | |
// MODULE'S CLASSES | |
/** | |
* @memberOf TeqFw_Db_Back_Dto_Export | |
*/ | |
class Dto { | |
static namespace = NS; | |
/** | |
* Contains all tables with data. | |
* @type {Object} | |
*/ | |
rows; | |
/** | |
* Contains all serials (for PostgreSQL DBs). | |
* @type {Object} | |
*/ | |
serials; | |
} | |
/** | |
* @implements TeqFw_Core_Shared_Api_Factory_Dto | |
*/ | |
export default class TeqFw_Db_Back_Dto_Export { | |
/** | |
* @param {TeqFw_Core_Shared_Util_Cast} cast | |
*/ | |
constructor( | |
{ | |
TeqFw_Core_Shared_Util_Cast$: cast, | |
} | |
) { | |
/** | |
* @param {TeqFw_Db_Back_Dto_Export.Dto} [data] | |
* @return {TeqFw_Db_Back_Dto_Export.Dto} | |
*/ | |
this.createDto = function (data) { | |
// create a new DTO | |
const res = new Dto(); | |
// cast known attributes | |
res.rows = cast.object(data?.rows); | |
res.serials = cast.object(data?.serials); | |
return res; | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment