ddicorpo / RecruitInc

2018 - 2019 Capstone Project for Team RecruitInc
Other
1 stars 0 forks source link

Persistant storage #21

Closed BenjaminTanguay closed 5 years ago

BenjaminTanguay commented 6 years ago

Description

As a HR employee at IBM Consulting, I want to have access to a persistent list of potential candidates so that I can retrieve them at any given time

Risk

Low

Value

Medium

Story points

8

General Description

Explore database options, implements .env variable. Explore ORMs.

We need to include an ORM to streamline the database creation process. Once the database schema has been created, put it in a docker container.

Dev. shall be able to use the microservices architecture in its environment.

How

Acceptance Criteria

Acceptance Tests

(Initial) Data Model Document

Winterhart commented 5 years ago

We may be able to use our typescript classes with https://libraries.io/npm/typegoose

Winterhart commented 5 years ago

A great mongo video to start: https://www.youtube.com/watch?v=WDrU305J1yw

Winterhart commented 5 years ago

Hi, before going further into a specific technology. We must read/acknowledge strengths of each technology.

Please have a look at: https://www.quora.com/Which-database-you-recommend-for-web-based-big-data-reporting-with-high-speed-processing

philbeaudry commented 5 years ago

It seems like since MongoDB is a NoSQL, the transaction cost may be high if we have a lot of information to go through.

philbeaudry commented 5 years ago

Also found this: https://tutorialedge.net/typescript/typescript-mongodb-beginners-tutorial/ A good way to get started using Docker.

Winterhart commented 5 years ago

Watch out before creating container or files we have to agree on a tech. to use

philbeaudry commented 5 years ago

A free cloud MongoDB can be used, atlas: https://www.mongodb.com/cloud/atlas

Winterhart commented 5 years ago

Alright, we now have a connection factory that doesn't need .env variable (connection URL configurable on the go).

@ddicorpo and @philbeaudry You are assigned to the next task schema

Why you always want to use testingContext -> true when not running node. https://www.quora.com/Is-it-necessary-to-close-the-mongoose-connection

Winterhart commented 5 years ago

Database final push

In order to facilitate the completion of the story I've made a sample case with the data User. As in the data model on draw.io the schema has all field needed.

I've also design a architecture wich will allow us to be independent from the ORM technologies. The User persistant storage is made of:

We have 8 other tables todo. I will not be able to it all. You should choose a table and start doing it.

Test your code

You should test your code with npm run test. You can also check the database for your data you can simply use the Mongo plugin in Intellij Ultimate (I've made a tutorial on it in README)

Reset Database

We still have to build the reset database command/util tool.

Remaining Table TODO

(assigned: @MewtR , @23jams , @ddicorpo , @Winterhart , @rena-21, @philbeaudry )

Write your name in front of at least two tables, then you can copy/paste from the User example.

Winterhart commented 5 years ago

Handling Business Logic

In order to make our data independent from our business logic. We will add our method/business logic in a mapper folder in domain

e.g. We will have a UserMapper with methods register login , hashPassword

src/domain/mapper/UserMapper.ts

Example of registration function

public Register(newUser: IUserModel) : Promise<boolean> {
...
// If user already created
let userExists: boolean = userFinder.findByUsername(newUser);

// Hash Password
...

// User Register

userTDG.create(newUser);

...
} 

Conclusion: Our front-end, will be able to call .../register as a POST with username, password, firstName, LastName...

Winterhart commented 5 years ago

The delete method in baseTDG is not done yet

Winterhart commented 5 years ago

baseTDG , update and delete are completed...

Winterhart commented 5 years ago

We having a problem with using the ref option in the mongoose...

Winterhart commented 5 years ago

The problem with ref has been resolved

Winterhart commented 5 years ago

Remaining Task

We have a few remaining tasks:

Remaining Questions