29 lines
596 B
TypeScript
29 lines
596 B
TypeScript
|
import consts from '@scode/consts';
|
||
|
import {Request,Response} from 'express';
|
||
|
|
||
|
class Transaction {
|
||
|
/* private */
|
||
|
private _req: Request;
|
||
|
private _res: Response;
|
||
|
|
||
|
/* public */
|
||
|
public status: number = -1;
|
||
|
|
||
|
/* properties */
|
||
|
public get has_status(): boolean => this.status !== -1;
|
||
|
public get req(): Request => this._req;
|
||
|
public get res(): Response => this._res;
|
||
|
|
||
|
/* constructor */
|
||
|
public Request(req: Request,res: Response) {
|
||
|
this._req = req;
|
||
|
this._res = res;
|
||
|
}
|
||
|
|
||
|
/* methods */
|
||
|
public end() {
|
||
|
if (this.status !== -1)
|
||
|
this.res.setHeader(this.status);
|
||
|
}
|
||
|
}
|