Provide controller resources at construction time

Load hosts, instances, mod packs, mods and users before constructing the
Controller instances.  This allows these resources to be correctly typed
as always available and prevents any possibility of save being initiated
on these resources before they are loaded.
This commit is contained in:
Hornwitser committed 2023-11-30 18:31:42 +01:00
1 parent a0b02ee68b
commit ab52cc35bf
11 files changed
+91 -77

No files matched your search

+2 -2
View File
@@ -50,7 +50,7 @@ export default class BaseConnection extends lib.Link {
async handleModPackGetRequest(request: lib.ModPackGetRequest): Promise<lib.ModPack> {
let { id } = request;
let modPack = this._controller.modPacks!.get(id);
let modPack = this._controller.modPacks.get(id);
if (!modPack) {
throw new lib.RequestError(`Mod pack with ID ${id} does not exist`);
}
@@ -62,7 +62,7 @@ export default class BaseConnection extends lib.Link {
if (id === null) {
throw new lib.RequestError("Default mod pack not set on controller");
}
let modPack = this._controller.modPacks!.get(id);
let modPack = this._controller.modPacks.get(id);
if (!modPack) {
throw new lib.RequestError(`Default mod pack configured (${id}) does not exist`);
}