mirror of
https://github.com/moghtech/komodo.git
synced 2026-07-18 16:42:20 -05:00
initialize server action states
This commit is contained in:
@@ -13,6 +13,7 @@ async function addServer(app: FastifyInstance, user: User, { server }: { server:
|
||||
}
|
||||
server.owners = [user.username];
|
||||
const created = await app.servers.create(server);
|
||||
app.serverActionStates.add(server._id!);
|
||||
addServerUpdate(
|
||||
app,
|
||||
created._id!,
|
||||
|
||||
@@ -128,15 +128,6 @@ const actionStates = fp((app: FastifyInstance, _: {}, done: () => void) => {
|
||||
},
|
||||
});
|
||||
|
||||
app.builds.find({}, { _id: true }).then((builds) => {
|
||||
builds.forEach((build) => app.buildActionStates.add(build._id!));
|
||||
});
|
||||
app.deployments.find({}, { _id: true }).then((deployments) => {
|
||||
deployments.forEach((deployment) =>
|
||||
app.deployActionStates.add(deployment._id!)
|
||||
);
|
||||
});
|
||||
|
||||
app.decorate("serverActionStates", {
|
||||
getJSON: (serverID: string) => {
|
||||
return serverActionStates[serverID];
|
||||
@@ -171,6 +162,18 @@ const actionStates = fp((app: FastifyInstance, _: {}, done: () => void) => {
|
||||
},
|
||||
});
|
||||
|
||||
app.builds.find({}, { _id: true }).then((builds) => {
|
||||
builds.forEach((build) => app.buildActionStates.add(build._id!));
|
||||
});
|
||||
app.deployments.find({}, { _id: true }).then((deployments) => {
|
||||
deployments.forEach((deployment) =>
|
||||
app.deployActionStates.add(deployment._id!)
|
||||
);
|
||||
});
|
||||
app.servers.find({}, { _id: true }).then((servers) => {
|
||||
servers.forEach((server) => app.serverActionStates.add(server._id!));
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user