From c5e82e5acc419525e6d2d424aee51d1eeda7d81b Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Fri, 7 May 2021 13:28:49 +0000 Subject: [PATCH] Update torrent IPC in the torrent-rest service --- services/torrent-rest/src/services/TorrentIpc.ts | 10 ---------- .../src/services/WebServer/middleware/torrent.ts | 4 ++-- .../torrent-rest/src/services/WebServer/routes/api.ts | 4 ++-- services/torrent-rest/src/services/index.ts | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 services/torrent-rest/src/services/TorrentIpc.ts diff --git a/services/torrent-rest/src/services/TorrentIpc.ts b/services/torrent-rest/src/services/TorrentIpc.ts deleted file mode 100644 index 0348166..0000000 --- a/services/torrent-rest/src/services/TorrentIpc.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IpcClient } from "@autoplex-api/torrent"; -import Application from "../Application"; - -export default class TorrentIpc extends IpcClient -{ - /** - * The service name - */ - public readonly NAME = "Torrent Client"; -} diff --git a/services/torrent-rest/src/services/WebServer/middleware/torrent.ts b/services/torrent-rest/src/services/WebServer/middleware/torrent.ts index 0d38f41..985d103 100644 --- a/services/torrent-rest/src/services/WebServer/middleware/torrent.ts +++ b/services/torrent-rest/src/services/WebServer/middleware/torrent.ts @@ -1,7 +1,7 @@ +import { IpcClient as TorrentIpc } from "@autoplex-api/torrent"; import { IteratorNext, MiddlewareRequest, FastifyReply, Status, respond } from "@autoplex/webserver"; import { ISerializedTorrent } from "@autoplex-api/torrent"; import Application from "../../../Application"; -import TorrentIpc from "../../TorrentIpc"; /** * The parameter types for the auth middleware @@ -14,7 +14,7 @@ export interface ITorrentMiddleware { * Ensure that a valid authentication token is provided */ export async function torrent(request: MiddlewareRequest, reply: FastifyReply, next: IteratorNext) { - let ipc = Application.instance().service("Torrent Client"); + let ipc = Application.instance().service("Torrent"); let torrentId: string|undefined = (request.params)["torrentId"]; if (torrentId === undefined) { return respond(reply, Status.BadRequest); diff --git a/services/torrent-rest/src/services/WebServer/routes/api.ts b/services/torrent-rest/src/services/WebServer/routes/api.ts index c32521c..3c5c1db 100644 --- a/services/torrent-rest/src/services/WebServer/routes/api.ts +++ b/services/torrent-rest/src/services/WebServer/routes/api.ts @@ -1,7 +1,7 @@ +import { IpcClient as TorrentIpc } from "@autoplex-api/torrent"; import { IpcConnectionError } from "@autoplex/ipc"; import { MiddlewareMethod, RouteRegisterFactory, Status, respond, } from "@autoplex/webserver"; import Application from "../../../Application"; -import TorrentIpc from "../../TorrentIpc"; import { torrent } from "../middleware/torrent"; export default function register(factory: RouteRegisterFactory, Application>, @@ -10,7 +10,7 @@ export default function register(factory: RouteRegisterFactory("Torrent Client"); + const ipc = app.service("Torrent"); /** * Register API prefix diff --git a/services/torrent-rest/src/services/index.ts b/services/torrent-rest/src/services/index.ts index 1a2c564..7a8cd8c 100644 --- a/services/torrent-rest/src/services/index.ts +++ b/services/torrent-rest/src/services/index.ts @@ -1,4 +1,4 @@ -import TorrentIpc from "./TorrentIpc"; +import { IpcClient as TorrentIpc } from "@autoplex-api/torrent"; import WebServer from "./WebServer/WebServer"; export {