Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database Seeding Enhancement: Improving REST API Initialization #108

Open
muttaqin1 opened this issue Aug 28, 2023 · 7 comments
Open

Database Seeding Enhancement: Improving REST API Initialization #108

muttaqin1 opened this issue Aug 28, 2023 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@muttaqin1
Copy link
Collaborator

We propose an enhanced approach to seeding the database, ensuring the creation of essential seed data within our REST API's database. This would encompass tasks such as populating default user accounts, sample content, and configuration settings that are pivotal for a seamless application setup.

@muttaqin1 muttaqin1 added enhancement New feature or request good first issue Good for newcomers labels Aug 28, 2023
@bellaabdelouahab bellaabdelouahab moved this from 🆕 New to 📋 Backlog in Student-Workflow-Organizer Aug 28, 2023
@bellaabdelouahab
Copy link
Member

bellaabdelouahab commented Aug 28, 2023

I agree on that because we already made two modules

it would be much better i we have a seed data

@muttaqin1
Copy link
Collaborator Author

1)We can create a seed dir. Then we will add random json data files like userData.json, roleData.json. After that we will create function which will create records using those json data.

2)We have the functionality to create default users and roles.so we can create a function which will call those functions.

We have to delete those records after our job is done.

What do you think?
@bellaabdelouahab

@bellaabdelouahab
Copy link
Member

Sure i will get going with that
@muttaqin1

@bellaabdelouahab
Copy link
Member

hey, I'm facing a little problem

the default users credential are in .env file how should we solve that

@muttaqin1

@muttaqin1
Copy link
Collaborator Author

hey, I'm facing a little problem

the default users credential are in .env file how should we solve that

@muttaqin1

The default user and default roles will be kept as it is. But we will add additional random datasets for every model. So all the developers can work using the same data.

@muttaqin1
Copy link
Collaborator Author

@bellaabdelouahab

@bellaabdelouahab
Copy link
Member

okay 👌
@muttaqin1

@bellaabdelouahab bellaabdelouahab moved this from 📋 Backlog to 🏗 In progress in Student-Workflow-Organizer Aug 29, 2023
bellaabdelouahab added a commit to bellaabdelouahab/S-W-O that referenced this issue Sep 20, 2023
Fix - app error ISIL-ESTE#103
Database Seeding Enhancement: Improving REST API Initialization ISIL-ESTE#108
 Suggestion - Organizing Interfaces in an "Interfaces" Folder ISIL-ESTE#129
bellaabdelouahab added a commit that referenced this issue Oct 8, 2023
* enhance - use tsconfig-paths

* fix - do tsconfig-path registeration

* inhence - add dependent bot auto merge

* inhen - call the paths registeration from server.ts

* inhence - update logger

* fix - convert base_controller to ts

* fix - type validation

* inhence - complete 3 files in #130
- auth_controller
- github_controller
- create_default_user

* inhence - complete 5 files in
TypeScript Migration Tasks #130
- user_controller
- role_model
- user_model
- create_roles
- role

* inhence convert files to ts
TypeScript Migration Tasks #130

* inhence - convert files to ts
TypeScript Migration Tasks #130

* inhence - convert utils dir to ts  #130

* fix - logger not defined
inhence - TypeScript Migration Tasks #130

* fix - update apperror Fix app error #103

* fix - app error & use module paths
Fix - app error #103
Database Seeding Enhancement: Improving REST API Initialization #108
 Suggestion - Organizing Interfaces in an "Interfaces" Folder #129

* fix -
- create interfaces for models, vendors and github repo
- change testing framwork

* enhnace - code optimixation AppError

* enchance - convert swagger to ts 1st try

* fix - convert to swagger-jsdoc

* enhance - complete other routes

* fix - create typings folder to manage .d.ts

* fix some ts-ignore errors

* fix - 2 ts ignore errors

* fix - 3 ts ignore errors

* fix - ts convert files #130

* testing tsoa

* fix - github env

* fix - use npm ci

* fix - add env config for tests

* test github variable

* fix - run workflow when review approved

* fix - server tsoa swagger docs

* fix - remove dummy error handler

* fix - github env vars & secrets
bellaabdelouahab added a commit that referenced this issue Jan 8, 2024
* enhance - use tsconfig-paths

* fix - do tsconfig-path registeration

* inhence - add dependent bot auto merge

* inhen - call the paths registeration from server.ts

* inhence - update logger

* fix - convert base_controller to ts

* fix - type validation

* inhence - complete 3 files in #130
- auth_controller
- github_controller
- create_default_user

* inhence - complete 5 files in
TypeScript Migration Tasks #130
- user_controller
- role_model
- user_model
- create_roles
- role

* inhence convert files to ts
TypeScript Migration Tasks #130

* inhence - convert files to ts
TypeScript Migration Tasks #130

* inhence - convert utils dir to ts  #130

* fix - logger not defined
inhence - TypeScript Migration Tasks #130

* fix - update apperror Fix app error #103

* fix - app error & use module paths
Fix - app error #103
Database Seeding Enhancement: Improving REST API Initialization #108
 Suggestion - Organizing Interfaces in an "Interfaces" Folder #129

* fix -
- create interfaces for models, vendors and github repo
- change testing framwork

* enhnace - code optimixation AppError

* enchance - convert swagger to ts 1st try

* fix - convert to swagger-jsdoc

* enhance - complete other routes

* fix - create typings folder to manage .d.ts

* fix some ts-ignore errors

* fix - 2 ts ignore errors

* fix - 3 ts ignore errors

* fix - ts convert files #130

* testing tsoa

* fix - github env

* fix - use npm ci

* fix - add env config for tests

* test github variable

* fix - run workflow when review approved

* fix - server tsoa swagger docs

* fix - remove dummy error handler

* fix - github env vars & secrets

* fix - return dev depandancies to thier place

* enchance - remove useless tests

* fix nodemon reloading & use RegisterRoutes

* fix - TypeError: Class extends value
undefined is not a constructor or null

* fix - update relative paths
fix swagger live reload

* enhance - create a tsoa authentication middleware

* fix - update relative paths
fix swagger live reload

* fix - multiprocces nodmon for docs reload

using concurrently i managed to create two nodemon proccess

one for reloading the doc and other the app

to reduce time of restarting the server

* fix - delete auto generated routes - gitignore

* help wanted - disabling route versioning
because tsoa dosnt support it

* code cleaning - dead code in auth controller

* enhance - remove old generated routes.ts
in routes folder

* enhance - add an authority decorator

* fix - logout request

* fix - reload swagger web page

* v1 of converting auth controllers

* feat - finish auth controllers v1

* fix - build project unable to exit

* fix logger level for prod env

* Delete unused routes and controllers.

* convert base controller functions
from a request handler type to normal functions

* finish auth controller

* migrate calendar controllers v1

* update routes brfore testing

* validate testing && fix some typo errors

* fix - add new aproach of validation authorities
and restrictions ( use InspectAuthority decorator)

* Add API routes and responses for multiple controllers
bellaabdelouahab added a commit that referenced this issue Jan 31, 2024
* enhance - create a tsoa authentication middleware (#152)

* enhance - create a tsoa authentication middleware

* Feat/migrate tsoa (#155)

* Feat: migrate super admin controller to tsoa.

* Feat: migrate admin controller to tsoa.

* Fix: improve role crud controllers.

* Fix: resolve typescript error in auth controller.

* Test admin controller methods.

* Test the controllers.

* Fixed swagger response annotation string.

* Update codebase with TSOA migration and other enhancements (#157)

* enhance - use tsconfig-paths

* fix - do tsconfig-path registeration

* inhence - add dependent bot auto merge

* inhen - call the paths registeration from server.ts

* inhence - update logger

* fix - convert base_controller to ts

* fix - type validation

* inhence - complete 3 files in #130
- auth_controller
- github_controller
- create_default_user

* inhence - complete 5 files in
TypeScript Migration Tasks #130
- user_controller
- role_model
- user_model
- create_roles
- role

* inhence convert files to ts
TypeScript Migration Tasks #130

* inhence - convert files to ts
TypeScript Migration Tasks #130

* inhence - convert utils dir to ts  #130

* fix - logger not defined
inhence - TypeScript Migration Tasks #130

* fix - update apperror Fix app error #103

* fix - app error & use module paths
Fix - app error #103
Database Seeding Enhancement: Improving REST API Initialization #108
 Suggestion - Organizing Interfaces in an "Interfaces" Folder #129

* fix -
- create interfaces for models, vendors and github repo
- change testing framwork

* enhnace - code optimixation AppError

* enchance - convert swagger to ts 1st try

* fix - convert to swagger-jsdoc

* enhance - complete other routes

* fix - create typings folder to manage .d.ts

* fix some ts-ignore errors

* fix - 2 ts ignore errors

* fix - 3 ts ignore errors

* fix - ts convert files #130

* testing tsoa

* fix - github env

* fix - use npm ci

* fix - add env config for tests

* test github variable

* fix - run workflow when review approved

* fix - server tsoa swagger docs

* fix - remove dummy error handler

* fix - github env vars & secrets

* fix - return dev depandancies to thier place

* enchance - remove useless tests

* fix nodemon reloading & use RegisterRoutes

* fix - TypeError: Class extends value
undefined is not a constructor or null

* fix - update relative paths
fix swagger live reload

* enhance - create a tsoa authentication middleware

* fix - update relative paths
fix swagger live reload

* fix - multiprocces nodmon for docs reload

using concurrently i managed to create two nodemon proccess

one for reloading the doc and other the app

to reduce time of restarting the server

* fix - delete auto generated routes - gitignore

* help wanted - disabling route versioning
because tsoa dosnt support it

* code cleaning - dead code in auth controller

* enhance - remove old generated routes.ts
in routes folder

* enhance - add an authority decorator

* fix - logout request

* fix - reload swagger web page

* v1 of converting auth controllers

* feat - finish auth controllers v1

* fix - build project unable to exit

* fix logger level for prod env

* Delete unused routes and controllers.

* convert base controller functions
from a request handler type to normal functions

* finish auth controller

* migrate calendar controllers v1

* update routes brfore testing

* validate testing && fix some typo errors

* fix - add new aproach of validation authorities
and restrictions ( use InspectAuthority decorator)

* Add API routes and responses for multiple controllers

* create the base for notification model(#162)

* Update MongoDB URI and add MongoDB service to docker-compose.yml

---------

Co-authored-by: Muttaqin <[email protected]>
bellaabdelouahab added a commit that referenced this issue Jun 27, 2024
* enhance - create a tsoa authentication middleware (#152)

* enhance - create a tsoa authentication middleware

* Feat/migrate tsoa (#155)

* Feat: migrate super admin controller to tsoa.

* Feat: migrate admin controller to tsoa.

* Fix: improve role crud controllers.

* Fix: resolve typescript error in auth controller.

* Test admin controller methods.

* Test the controllers.

* Fixed swagger response annotation string.

* Update codebase with TSOA migration and other enhancements (#157)

* enhance - use tsconfig-paths

* fix - do tsconfig-path registeration

* inhence - add dependent bot auto merge

* inhen - call the paths registeration from server.ts

* inhence - update logger

* fix - convert base_controller to ts

* fix - type validation

* inhence - complete 3 files in #130
- auth_controller
- github_controller
- create_default_user

* inhence - complete 5 files in
TypeScript Migration Tasks #130
- user_controller
- role_model
- user_model
- create_roles
- role

* inhence convert files to ts
TypeScript Migration Tasks #130

* inhence - convert files to ts
TypeScript Migration Tasks #130

* inhence - convert utils dir to ts  #130

* fix - logger not defined
inhence - TypeScript Migration Tasks #130

* fix - update apperror Fix app error #103

* fix - app error & use module paths
Fix - app error #103
Database Seeding Enhancement: Improving REST API Initialization #108
 Suggestion - Organizing Interfaces in an "Interfaces" Folder #129

* fix -
- create interfaces for models, vendors and github repo
- change testing framwork

* enhnace - code optimixation AppError

* enchance - convert swagger to ts 1st try

* fix - convert to swagger-jsdoc

* enhance - complete other routes

* fix - create typings folder to manage .d.ts

* fix some ts-ignore errors

* fix - 2 ts ignore errors

* fix - 3 ts ignore errors

* fix - ts convert files #130

* testing tsoa

* fix - github env

* fix - use npm ci

* fix - add env config for tests

* test github variable

* fix - run workflow when review approved

* fix - server tsoa swagger docs

* fix - remove dummy error handler

* fix - github env vars & secrets

* fix - return dev depandancies to thier place

* enchance - remove useless tests

* fix nodemon reloading & use RegisterRoutes

* fix - TypeError: Class extends value
undefined is not a constructor or null

* fix - update relative paths
fix swagger live reload

* enhance - create a tsoa authentication middleware

* fix - update relative paths
fix swagger live reload

* fix - multiprocces nodmon for docs reload

using concurrently i managed to create two nodemon proccess

one for reloading the doc and other the app

to reduce time of restarting the server

* fix - delete auto generated routes - gitignore

* help wanted - disabling route versioning
because tsoa dosnt support it

* code cleaning - dead code in auth controller

* enhance - remove old generated routes.ts
in routes folder

* enhance - add an authority decorator

* fix - logout request

* fix - reload swagger web page

* v1 of converting auth controllers

* feat - finish auth controllers v1

* fix - build project unable to exit

* fix logger level for prod env

* Delete unused routes and controllers.

* convert base controller functions
from a request handler type to normal functions

* finish auth controller

* migrate calendar controllers v1

* update routes brfore testing

* validate testing && fix some typo errors

* fix - add new aproach of validation authorities
and restrictions ( use InspectAuthority decorator)

* Add API routes and responses for multiple controllers

* create the base for notification model(#162)

* Update MongoDB URI and add MongoDB service to docker-compose.yml

* refactor: convert logical operator to optional chainining (#2)

* ci: add .deepsource.toml

* refactor: convert logical operator to optional chainining

The [optional chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) operator can be used to perform null checks before accessing a property, or calling a function.

---------

Co-authored-by: deepsource-io[bot] <42547082+deepsource-io[bot]@users.noreply.github.com>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>

* Update Docker ports and MongoDB URIs

* make sure all tests are passing

---------

Co-authored-by: Muttaqin <[email protected]>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: deepsource-io[bot] <42547082+deepsource-io[bot]@users.noreply.github.com>
bellaabdelouahab added a commit that referenced this issue Jun 28, 2024
* enhance - create a tsoa authentication middleware (#152)

* enhance - create a tsoa authentication middleware

* Feat/migrate tsoa (#155)

* Feat: migrate super admin controller to tsoa.

* Feat: migrate admin controller to tsoa.

* Fix: improve role crud controllers.

* Fix: resolve typescript error in auth controller.

* Test admin controller methods.

* Test the controllers.

* Fixed swagger response annotation string.

* Update codebase with TSOA migration and other enhancements (#157)

* enhance - use tsconfig-paths

* fix - do tsconfig-path registeration

* inhence - add dependent bot auto merge

* inhen - call the paths registeration from server.ts

* inhence - update logger

* fix - convert base_controller to ts

* fix - type validation

* inhence - complete 3 files in #130
- auth_controller
- github_controller
- create_default_user

* inhence - complete 5 files in
TypeScript Migration Tasks #130
- user_controller
- role_model
- user_model
- create_roles
- role

* inhence convert files to ts
TypeScript Migration Tasks #130

* inhence - convert files to ts
TypeScript Migration Tasks #130

* inhence - convert utils dir to ts  #130

* fix - logger not defined
inhence - TypeScript Migration Tasks #130

* fix - update apperror Fix app error #103

* fix - app error & use module paths
Fix - app error #103
Database Seeding Enhancement: Improving REST API Initialization #108
 Suggestion - Organizing Interfaces in an "Interfaces" Folder #129

* fix -
- create interfaces for models, vendors and github repo
- change testing framwork

* enhnace - code optimixation AppError

* enchance - convert swagger to ts 1st try

* fix - convert to swagger-jsdoc

* enhance - complete other routes

* fix - create typings folder to manage .d.ts

* fix some ts-ignore errors

* fix - 2 ts ignore errors

* fix - 3 ts ignore errors

* fix - ts convert files #130

* testing tsoa

* fix - github env

* fix - use npm ci

* fix - add env config for tests

* test github variable

* fix - run workflow when review approved

* fix - server tsoa swagger docs

* fix - remove dummy error handler

* fix - github env vars & secrets

* fix - return dev depandancies to thier place

* enchance - remove useless tests

* fix nodemon reloading & use RegisterRoutes

* fix - TypeError: Class extends value
undefined is not a constructor or null

* fix - update relative paths
fix swagger live reload

* enhance - create a tsoa authentication middleware

* fix - update relative paths
fix swagger live reload

* fix - multiprocces nodmon for docs reload

using concurrently i managed to create two nodemon proccess

one for reloading the doc and other the app

to reduce time of restarting the server

* fix - delete auto generated routes - gitignore

* help wanted - disabling route versioning
because tsoa dosnt support it

* code cleaning - dead code in auth controller

* enhance - remove old generated routes.ts
in routes folder

* enhance - add an authority decorator

* fix - logout request

* fix - reload swagger web page

* v1 of converting auth controllers

* feat - finish auth controllers v1

* fix - build project unable to exit

* fix logger level for prod env

* Delete unused routes and controllers.

* convert base controller functions
from a request handler type to normal functions

* finish auth controller

* migrate calendar controllers v1

* update routes brfore testing

* validate testing && fix some typo errors

* fix - add new aproach of validation authorities
and restrictions ( use InspectAuthority decorator)

* Add API routes and responses for multiple controllers

* create the base for notification model(#162)

* Update MongoDB URI and add MongoDB service to docker-compose.yml

* refactor: convert logical operator to optional chainining (#2)

* ci: add .deepsource.toml

* refactor: convert logical operator to optional chainining

The [optional chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) operator can be used to perform null checks before accessing a property, or calling a function.

---------

Co-authored-by: deepsource-io[bot] <42547082+deepsource-io[bot]@users.noreply.github.com>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>

* Update Docker ports and MongoDB URIs

* make sure all tests are passing

* feat: use v1 instead of 1.0.0 & use api version from env instead of use package.json version, to have more control over changing it
add api-version to repose details

* refactor: Add API version control middleware to handle default and redirect to latest version

Co-authored-by: muttaqin1 <[email protected]>

* update tsoa to latest version and add api version validation

* add api-version to response and add unite tests to api version

---------

Co-authored-by: Muttaqin <[email protected]>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: deepsource-io[bot] <42547082+deepsource-io[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: 🏗 In progress
Development

No branches or pull requests

2 participants