This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class UserRouter { | |
router: Router; | |
userController: UserController; | |
userModel: User; | |
constructor() { | |
this.router = Router(); | |
this.user = new User(); | |
this.userController = new UserController(this.user); | |
this.routes(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class UserController extends BaseController<IUser, User> { | |
userModel: User; | |
constructor(_userModel: User) { | |
super(_userModel); | |
this.userModel = _userModel; | |
} | |
// UserController will have the CRUD from BaseController, no need to write those here. But register() and login() is of different logic. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Document, Model} from 'mongoose'; | |
import {Request, Response} from 'express'; | |
import {MongoError} from '../../../../Desktop/codewithcause/node_modules/@types/mongodb'; | |
export class BaseController<U extends Document, T extends Model<U>> { | |
model: T; | |
constructor(_model: T) { | |
this.model = _model; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Document, Model} from 'mongoose'; | |
import {Request, Response} from 'express'; | |
import {MongoError} from '../../../../Desktop/codewithcause/node_modules/@types/mongodb'; | |
export class BaseController<U extends Document, T extends Model<U>> { | |
model: T; | |
constructor(_model: T) { | |
this.model = _model; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"version": "1.0.0", | |
"title": "HelpDeskTMF", | |
"description": "HelpDeskTMF OpenAPI Documentations" | |
}, | |
"host": "localhost:3000", | |
"basePath": "/", | |
"tags": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: "2.0" | |
info: | |
version: "1.0.0" | |
title: HelpDeskTMF | |
description: HelpDeskTMF OpenAPI Documentations | |
host: localhost:3000 | |
basePath: / | |
tags: | |
- name: Users | |
description: Users Routes |
NewerOlder