Skip to content

Commit

Permalink
Tsoa migration branch merge (#164)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
bellaabdelouahab and muttaqin1 authored Jan 31, 2024
1 parent 00719dd commit eb480dc
Show file tree
Hide file tree
Showing 40 changed files with 1,590 additions and 1,315 deletions.
4 changes: 2 additions & 2 deletions backend-app/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NODE_ENV = "development"
API_VERSION = "1.0.0"
MONGO_URI = "mongodb://localhost:27017/S-W-O"
MONGO_URI_TEST = "mongodb://localhost:27017/S-W-O-TEST"
MONGO_URI = "mongodb://mongodb:27017/S-W-O"
MONGO_URI_TEST = "mongodb://mongodb:27017/S-W-O-TEST"
PORT = 5000
ADMIN_EMAIL = "[email protected]"
ADMIN_PASSWORD = "password123418746"
Expand Down
3 changes: 3 additions & 0 deletions backend-app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ coverage
# Compiled binary addons (http://nodejs.org/api/addons.html)
build

# TSOA generated routes
routes.ts

# Dependency directories
node_modules/
jspm_packages/
Expand Down
18 changes: 9 additions & 9 deletions backend-app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import swaggerDocs from './utils/swagger/index';
import handleAPIVersion from './middlewares/api_version_controll';
import { COOKIE_SECRET, CURRENT_ENV } from './config/app_config';
import cookieParser from 'cookie-parser';
import routesVersioning from 'express-routes-versioning';
import indexRouter from './routes/index';
import { RegisterRoutes } from './routes/routes';
// import routesVersioning from 'express-routes-versioning';
// import indexRouter from './routes/index';
import { RegisterRoutes } from './routes';

const app = express();

Expand Down Expand Up @@ -78,12 +78,12 @@ app.get('/', (_req: Request, res: Response) => {
});

// routes
app.use(
`/api`,
routesVersioning()({
'1.0.0': indexRouter,
})
);
// app.use(
// `/api`,
// routesVersioning()({
// '1.0.0': indexRouter,
// })
// );

// register routes
RegisterRoutes(app);
Expand Down
2 changes: 1 addition & 1 deletion backend-app/config/logger_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const formatLogMessage = format.printf(
* when the log level is debug, debug and all the levels above it will be logged.
* when the log level is warn, warn and all the levels above it will be logged.
*/
const logLevel = CURRENT_ENV === 'development' ? 'debug' : 'warn';
const logLevel = CURRENT_ENV === 'development' ? 'debug' : 'info';

/**
* @description - This is the configuration for the logger
Expand Down
10 changes: 10 additions & 0 deletions backend-app/config/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"watch": ["."],
"ignore": [
"docs/api_docs/swagger.json",
"routes/routes.ts",
"controllers/"
],
"ext": "js ts json",
"exec": "ts-node server.ts"
}
9 changes: 9 additions & 0 deletions backend-app/config/nodemon.tsoa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"watch": ["controllers/"],
"ignore": ["docs/api_docs/swagger.json", "routes/routes.ts"],
"ext": "js ts json",
"exec": "npm run generate ",
"events": {
"restart": "echo Controller changed, regenerating swagger docs..."
}
}
Loading

0 comments on commit eb480dc

Please sign in to comment.