diff --git a/models/settings.model.ts b/models/settings.model.ts new file mode 100644 index 0000000..dccc497 --- /dev/null +++ b/models/settings.model.ts @@ -0,0 +1,22 @@ +const mongoose = require("mongoose"); +const paginate = require("mongoose-paginate-v2"); + +const SettingsScehma = mongoose.Schema({ + directConnect: { + client: { + name: String, + version: String, + hostname: String, + port: Number, + https: Boolean, + username: String, + password: String, + hubs: [{ + + }] + } + } +}) + +const Settings = mongoose.model("Settings", SettingsScehma); +export default Settings; \ No newline at end of file diff --git a/services/import.service.ts b/services/import.service.ts index e8fdeac..8ff4cf5 100644 --- a/services/import.service.ts +++ b/services/import.service.ts @@ -25,7 +25,6 @@ import { import {scrapeIssuesFromDOM} from "../utils/scraping.utils"; const ObjectId = require("mongoose").Types.ObjectId; -console.log("HEYOOOOO", process.env.COMICVINE_API_KEY); export default class ImportService extends Service { public constructor( public broker: ServiceBroker, diff --git a/services/settings.service.ts b/services/settings.service.ts new file mode 100644 index 0000000..98a7cf3 --- /dev/null +++ b/services/settings.service.ts @@ -0,0 +1,52 @@ +"use strict"; +import { + Context, + Service, + ServiceBroker, + ServiceSchema, + Errors, +} from "moleculer"; +import { DbMixin } from "../mixins/db.mixin"; +import Settings from "../models/settings.model"; + +export default class SettingsService extends Service { + // @ts-ignore + public constructor( + public broker: ServiceBroker, + schema: ServiceSchema<{}> = { name: "settings" } + ) { + super(broker); + this.parseServiceSchema( + Service.mergeSchemas( + { + name: "settings", + mixins: [DbMixin("settings", Settings)], + settings: { + + }, + hooks: {}, + actions: { + getSettings: { + rest: "GET /getAllSettings", + params: {}, + async handler(ctx: Context<{}>) { + + } + }, + + saveSettings: { + rest: "POST /saveSettings", + params: {}, + async handler(ctx: Context<{}>) { + + } + } + + }, + methods: {}, + }, + schema + ) + ); + } +}