1
0
Fork 0

[node] Big Ships lib refactoring

This commit is contained in:
Julien Dessaux 2024-04-05 00:42:30 +02:00
parent a58394230d
commit 234770b611
Signed by: adyxax
GPG key ID: F92E51B86E07177E
27 changed files with 500 additions and 589 deletions

View file

@ -1,16 +1,16 @@
import * as dbAgents from '../database/agents.ts';
import * as db from '../database/db.ts';
import * as dbContracts from '../database/contracts.ts';
import * as dbShips from '../database/ships.ts';
import * as dbTokens from '../database/tokens.ts';
import { Agent } from '../model/agent.ts';
import { Response } from '../model/api.ts';
import { Contract } from '../model/contract.ts';
import { Ship } from '../model/ship.ts';
import * as api from '../lib/api.ts';
//import * as agents from '../lib/angent.ts';
import {
Response,
} from '../lib/api.ts';
import {
Agent,
Contract,
} from '../lib/types.ts';
import { Ship } from '../lib/ships.ts';
import * as libContracts from '../lib/contracts.ts';
import * as libShips from '../lib/ships.ts';
const symbol = process.env.NODE_ENV === 'test' ? 'ADYXAX-0' : 'ADYXAX-JS';
@ -32,7 +32,6 @@ export async function init(): Promise<void> {
case 4111: // 4111 means the agent symbol has already been claimed so no server reset happened
// TODO await agents.agents();
await libContracts.getContracts();
await libShips.getShips();
return;
default:
throw json;
@ -42,7 +41,4 @@ export async function init(): Promise<void> {
dbTokens.addToken(json.data.token);
dbAgents.addAgent(json.data.agent);
dbContracts.setContract(json.data.contract);
dbShips.setShip(json.data.ship);
// Temporary fix to fetch the data on the startup probe
await libShips.getShips();
}