uam-models
v1.0.2
Published
User And Access Management Model package for CRUD operation
Downloads
1
Readme
models
Instalation
npm i --save uam-models
Content
This package contains functionality for the following services:
- Accounts
The code use mongoose for connecting the database. Mongo Connection string is stored in environment variables for example: MONGO_ATLAS_URI_ACCOUNTS=''
Usage
Users
import { User } from 'uam-models';
import { Mongoose } from 'mongoose';
const userConnection = new Connection(
process.env.MONGO_ATLAS_URI_ACCOUNTS as string,
{
useNewUrlParser: true,
useFindAndModify: false,
useCreateIndex: true
},
new Mongoose()
);
const user = new User(userConnection.createConnection());
If we want to use mongoose functionality in everywhere, just use as those examples:
user.model().find()
user.model().findById()
user.model().create()