2016-03-20 00:31:42 +08:00
|
|
|
///<reference path="../../typings/main.d.ts"/>
|
|
|
|
|
|
|
|
import {AuthenticationMWs} from "../middlewares/AuthenticationMWs";
|
|
|
|
import {UserRoles} from "../../common/entities/User";
|
|
|
|
|
|
|
|
export class AdminRouter{
|
|
|
|
constructor(private app) {
|
|
|
|
|
|
|
|
this.addResetDB();
|
2016-03-20 02:59:19 +08:00
|
|
|
this.addIndexGallery();
|
2016-03-20 00:31:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private addResetDB() {
|
|
|
|
this.app.post("/api/admin/db/reset",
|
|
|
|
AuthenticationMWs.authenticate,
|
|
|
|
AuthenticationMWs.authorise(UserRoles.Admin)
|
|
|
|
//TODO: implement
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2016-03-20 02:59:19 +08:00
|
|
|
private addIndexGallery() {
|
2016-03-20 00:31:42 +08:00
|
|
|
this.app.post("/api/admin/gallery/index",
|
|
|
|
AuthenticationMWs.authenticate,
|
|
|
|
AuthenticationMWs.authorise(UserRoles.Admin)
|
|
|
|
//TODO: implement
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|