diff --git a/lib/classes/Session.ts b/lib/classes/Session.ts index 91e1e4a..f3fc3f0 100644 --- a/lib/classes/Session.ts +++ b/lib/classes/Session.ts @@ -1,5 +1,5 @@ export default class Session { - public user_id: number; - public user_name: string; - public permissions: Array; + public user_id?: number; + public user_name?: string; + public permissions?: Array; } diff --git a/lib/classes/Status.ts b/lib/classes/Status.ts index ffae8cb..b84841b 100644 --- a/lib/classes/Status.ts +++ b/lib/classes/Status.ts @@ -9,7 +9,7 @@ export default class Status { return this._status; } - public set status (value: number): void { + public set status (value: number) { this._status = value; } diff --git a/lib/classes/Transaction.ts b/lib/classes/Transaction.ts index 75e035f..7612f3e 100644 --- a/lib/classes/Transaction.ts +++ b/lib/classes/Transaction.ts @@ -1,4 +1,4 @@ -import { Request, Response } from '@types/express'; +import { Request, Response } from 'express'; import Status from './Status'; import Session from './Session'; @@ -12,7 +12,7 @@ export default class Transaction { public get req (): Request { return this._req; } public get res (): Response { return this._res; } public get status (): Status { return this._status; } - public session: Session; + public session?: Session; /* constructor */ public constructor (req: Request, res: Response) { @@ -22,8 +22,8 @@ export default class Transaction { } /* methods */ - public finalize (): void { - if (this._status.has_status ()) + public finalize (data: any): void { + if (this._status.has_status) this._res.status (this.status.status); this._res.end (data); } diff --git a/lib/index.ts b/lib/index.ts index 7529893..98522a2 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,4 +1,4 @@ -import { App } from '@types/express'; +import { App } from 'express'; import Handler from './classes/Handler'; /** @@ -9,13 +9,13 @@ import Handler from './classes/Handler'; */ export default function load_handlers ( app: App, - handlers: array + handlers: Array ): void { for (const h of handlers) app.use (h.path, h.run_http_handler); } -export * from './classes/Session.ts'; -export * from './classes/Status.ts'; -export * from './classes/Transaction.ts'; -export * from './classes/Handler.ts'; +export * from './classes/Session'; +export * from './classes/Status'; +export * from './classes/Transaction'; +export * from './classes/Handler';