@igeg/database
The @igeg/database npm package provides a set of classes that can be used as DTOs for database interactions with the MyAdmin and SG applications.
Installation
You can install the @igeg/database package using npm:
npm install @igeg/database
or alternatively by using yarn
yarn add @igeg/database
Usage
To use the @igeg/database package in your application, follow these steps:
-
Import the desired classes into your application using the
import
statement:import { CustomerDto } from '@igeg/database';
-
Use the imported classes as types in your code to define your data structures. For example, to define a user:
const user = new CustomerDto(); user.name = 'John Doe'; user.email = 'john@example.com';
-
You can also use the classes as DTOs to interact with the database. For example, to save a user:
const userEntity = new UserEntity(); userEntity.save(user) .then(() => { console.log('User saved successfully!'); }) .catch((error) => { console.error('Failed to save user:', error); });
Contributing
Contributions are welcome! If you find any issues or want to contribute enhancements, feel free to submit a pull request.
License
This package is licensed under the MIT License.