Skip to content

Commit

Permalink
chore: Generalize plug-in for bridgechains
Browse files Browse the repository at this point in the history
  • Loading branch information
deanpress committed Nov 17, 2019
1 parent a68455b commit c751fa2
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 114 deletions.
22 changes: 0 additions & 22 deletions src/entities/Round.ts

This file was deleted.

18 changes: 0 additions & 18 deletions src/entities/Stake.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/entities/index.ts
@@ -1,3 +1 @@
export * from "./Stake";
export * from "./Statistic";
export * from "./Round";
52 changes: 0 additions & 52 deletions src/plugin.ts

This file was deleted.

19 changes: 1 addition & 18 deletions src/server.ts
@@ -1,30 +1,13 @@
import { createServer, mountServer } from "@arkecosystem/core-http-utils";
import { notFound } from "@hapi/boom";
import { Round, Statistic } from "./entities";
import { Statistic } from "./entities";

export const startServer = async config => {
const server = await createServer({
host: config.host,
port: config.port,
});

// Round Data
server.route({
method: "GET",
path: "/round/{id}",
async handler(request, h) {
const id: number = Number(request.params.id);
const round = await Round.findOne({ id });
const response: any = round;
if (round) {
response.topDelegates = round.topDelegates.split(",");
return response;
} else {
return notFound();
}
},
});

// Statistics
server.route({
method: "GET",
Expand Down
4 changes: 2 additions & 2 deletions src/storage.ts
Expand Up @@ -14,7 +14,7 @@ const qp = queue();
qp.concurrency = 1;

// Entities
import { Round, Stake, Statistic } from "./entities";
import { Statistic } from "./entities";

// Core plugins
const logger = app.resolvePlugin<Logger.ILogger>("logger");
Expand All @@ -39,7 +39,7 @@ export const plugin: Container.IPluginDescriptor = {
type: "sqlite",
database: dbPath,
// Import entities to connection
entities: [Stake, Statistic, Round],
entities: [Statistic],
synchronize: true,
});

Expand Down

0 comments on commit c751fa2

Please sign in to comment.