Heavy changes: refactoring the pusher to always send the textures (and the front to accept them)

This commit is contained in:
David Négrier
2022-02-23 21:08:21 +01:00
parent d65fe0ee26
commit 378a95962a
31 changed files with 290 additions and 270 deletions
+5 -16
View File
@@ -1,24 +1,13 @@
import { hasToken } from "../Middleware/HasToken";
import { BaseHttpController } from "./BaseHttpController";
import { ADMIN_API_URL } from "../Enum/EnvironmentVariable";
import { adminWokaService } from "..//Services/AdminWokaService";
import { localWokaService } from "..//Services/LocalWokaService";
import { WokaServiceInterface } from "src/Services/WokaServiceInterface";
import { Server } from "hyper-express";
import { wokaService } from "../Services/WokaService";
export class WokaListController extends BaseHttpController {
private wokaService: WokaServiceInterface;
constructor(app: Server) {
super(app);
this.wokaService = ADMIN_API_URL ? adminWokaService : localWokaService;
}
routes() {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
this.app.get("/woka-list", {}, async (req, res) => {
const token = req.header("Authorization");
const wokaList = await this.wokaService.getWokaList(token);
const wokaList = await wokaService.getWokaList(token);
if (!wokaList) {
return res.status(500).send("Error on getting woka list");
@@ -28,20 +17,20 @@ export class WokaListController extends BaseHttpController {
});
// eslint-disable-next-line @typescript-eslint/no-misused-promises
this.app.post("/woka-details", async (req, res) => {
/*this.app.post("/woka-details", async (req, res) => {
const body = await req.json();
if (!body || !body.textureIds) {
return res.status(400);
}
const textureIds = body.textureIds;
const wokaDetails = await this.wokaService.fetchWokaDetails(textureIds);
const wokaDetails = await wokaService.fetchWokaDetails(textureIds);
if (!wokaDetails) {
return res.json({ details: [] });
}
return res.json(wokaDetails);
});
});*/
}
}