-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated logging module and code cleanup with minor bug fixes
- Loading branch information
Showing
10 changed files
with
957 additions
and
1,819 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import { ITask } from "./task"; | |
import { IDatabase } from "../../database"; | ||
import { IServerConfigurations } from "../../configurations"; | ||
import { IRequest } from "../../interfaces/request"; | ||
import { ILogs } from "../logs/logs"; | ||
import { ILogging } from "../../plugins/logging/logging"; | ||
|
||
//Custom helper module | ||
import * as Helper from "../../utils/helper"; | ||
|
@@ -18,21 +18,6 @@ export default class TaskController { | |
this.database = database; | ||
} | ||
|
||
public async testing(request: IRequest, h: Hapi.ResponseToolkit) { | ||
let profile: any = { | ||
_id: "AnkitJain" | ||
}; | ||
|
||
//Logging user request | ||
Helper.dbLogger("UserID", `Validate email payload ${JSON.stringify(profile)}`, "This is a request"); | ||
let res: any = await Helper.validateEmailDomain("[email protected]"); | ||
|
||
//Logging user request response | ||
Helper.dbLogger("UserID", `Validate email payload reponse ${JSON.stringify(res)}`, "This is a response"); | ||
|
||
return h.response(res).code(200); | ||
} | ||
|
||
public async createTask(request: IRequest, h: Hapi.ResponseToolkit) { | ||
var newTask: ITask = <ITask>request.payload; | ||
newTask.userId = request.auth.credentials.id; | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as Hapi from "hapi"; | ||
import { IDatabase } from "../../database"; | ||
import { IServerConfigurations } from "../../configurations"; | ||
|
||
export function init( | ||
server: Hapi.Server, | ||
configs: IServerConfigurations, | ||
database: IDatabase | ||
) {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as Mongoose from "mongoose"; | ||
|
||
export interface ILogging extends Mongoose.Document { | ||
userId: string; //User id for finding the operating user | ||
//userType: string; //User type to finding user role - Decide in future - currently disabled | ||
payload: String; //response or request payload to capture details | ||
response: String; //Status message to capture the reponse | ||
} | ||
|
||
export const LoggingSchema = new Mongoose.Schema( | ||
{ | ||
userId: { type: String, required: true }, | ||
payload: { type: String, required: true }, | ||
response: { type: String, required: true } | ||
}, | ||
{ | ||
timestamps: true | ||
} | ||
); | ||
|
||
export const LoggingModel = Mongoose.model<ILogging>("logging", LoggingSchema); |
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
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