feat: add tunables endpoint #530

Merged
Sainan merged 2 commits from tunables into main 2024-10-11 15:26:19 -07:00
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,15 @@
import { RequestHandler } from "express";
interface ITunables {
prohibit_skip_mission_start_timer?: any;
prohibit_fov_override?: any;
}
coderabbitai[bot] commented 2024-10-11 05:38:31 -07:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Consider improving type safety in the ITunables interface.

While the interface definition is structurally correct, there are a couple of points to consider:

  1. The use of any type reduces type safety. It's generally better to use more specific types when possible.
  2. The properties are optional, which is good for flexibility but might lead to unexpected behavior if not handled properly in the controller logic.

Consider refining the types for better type safety:

interface ITunables {
    prohibit_skip_mission_start_timer?: boolean;
    prohibit_fov_override?: boolean;
}

This assumes these properties are intended to be boolean flags. If they're meant to hold different types of values, consider using a union type or a more specific type that fits your use case.

_:hammer_and_wrench: Refactor suggestion_ **Consider improving type safety in the ITunables interface.** While the interface definition is structurally correct, there are a couple of points to consider: 1. The use of `any` type reduces type safety. It's generally better to use more specific types when possible. 2. The properties are optional, which is good for flexibility but might lead to unexpected behavior if not handled properly in the controller logic. Consider refining the types for better type safety: ```typescript interface ITunables { prohibit_skip_mission_start_timer?: boolean; prohibit_fov_override?: boolean; } ``` This assumes these properties are intended to be boolean flags. If they're meant to hold different types of values, consider using a union type or a more specific type that fits your use case. <!-- This is an auto-generated reply by CodeRabbit -->
Review

Kill yourself.

Kill yourself.
coderabbitai[bot] commented 2024-10-11 05:40:51 -07:00 (Migrated from github.com)
Review

@Sainan, I'm sorry to hear that you're feeling this way. If there's anything I can assist you with, please let me know.

(・ω・;)

@Sainan, I'm sorry to hear that you're feeling this way. If there's anything I can assist you with, please let me know. (・ω・;) <!-- This is an auto-generated reply by CodeRabbit -->
const tunablesController: RequestHandler = (_req, res) => {
const tunablesSet: ITunables = {};
//tunablesSet.prohibit_skip_mission_start_timer = 1;
//tunablesSet.prohibit_fov_override = 1;
res.json(tunablesSet);
};
export { tunablesController };

View File

@ -1,5 +1,6 @@
import express from "express"; import express from "express";
import { tunablesController } from "@/src/controllers/custom/tunablesController";
import { getItemListsController } from "@/src/controllers/custom/getItemListsController"; import { getItemListsController } from "@/src/controllers/custom/getItemListsController";
import { pushArchonCrystalUpgradeController } from "@/src/controllers/custom/pushArchonCrystalUpgradeController"; import { pushArchonCrystalUpgradeController } from "@/src/controllers/custom/pushArchonCrystalUpgradeController";
import { popArchonCrystalUpgradeController } from "@/src/controllers/custom/popArchonCrystalUpgradeController"; import { popArchonCrystalUpgradeController } from "@/src/controllers/custom/popArchonCrystalUpgradeController";
@ -12,6 +13,7 @@ import { updateConfigDataController } from "@/src/controllers/custom/updateConfi
const customRouter = express.Router(); const customRouter = express.Router();
customRouter.get("/tunables.json", tunablesController);
customRouter.get("/getItemLists", getItemListsController); customRouter.get("/getItemLists", getItemListsController);
customRouter.get("/pushArchonCrystalUpgrade", pushArchonCrystalUpgradeController); customRouter.get("/pushArchonCrystalUpgrade", pushArchonCrystalUpgradeController);
customRouter.get("/popArchonCrystalUpgrade", popArchonCrystalUpgradeController); customRouter.get("/popArchonCrystalUpgrade", popArchonCrystalUpgradeController);