29 lines
700 B
TypeScript
29 lines
700 B
TypeScript
import { Request, Response } from '@types/express/index.d.ts';
|
|
import Status from './status.ts';
|
|
|
|
export default class Transaction {
|
|
/* private */
|
|
private _req: Request;
|
|
private _res: Response;
|
|
private _status: Status;
|
|
|
|
/* properties */
|
|
public get req (): Request { return this._req; }
|
|
public get res (): Response { return this._res; }
|
|
public get status (): Status { return this._status; }
|
|
|
|
/* constructor */
|
|
public constructor (req: Request, res: Response) {
|
|
this._req = req;
|
|
this._res = res;
|
|
this._status = new Status;
|
|
}
|
|
|
|
/* methods */
|
|
public end (data): void {
|
|
if (this.status !== -1)
|
|
this._res.status (this.status);
|
|
this._res.end (data);
|
|
}
|
|
}
|