123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- const moduleManager = require("../../../index");
- const mongoModule = moduleManager.modules["mongo"];
- const convertSchemaModule = moduleManager.modules["convertSchema"];
- module.exports = {
- "getForVersion": (cb, version) => {
- convertSchemaModule.getForVersion(version).then(schema => {
- cb({
- status: "success",
- schema
- });
- }).catch(err => {
- cb({
- status: "failure"
- });
- });
- },
- "getById": (cb, schemaId) => {
- convertSchemaModule.getById(schemaId).then(schema => {
- cb({
- status: "success",
- schema
- });
- }).catch(err => {
- cb({
- status: "failure"
- });
- });
- },
- "removeById": (cb, schemaId) => {
- convertSchemaModule.removeById(schemaId).then(() => {
- cb({
- status: "success"
- });
- }).catch(err => {
- cb({
- status: "failure"
- });
- });
- },
- "getAll": (cb) => {
- convertSchemaModule.getAll().then(schemas => {
- cb({
- status: "success",
- schemas
- });
- }).catch(err => {
- cb({
- status: "failure"
- });
- });
- },
- "listSchemasInDirectory": (cb) => {
- convertSchemaModule.listSchemasInDirectory().then((schemasInDirectory) => {
- cb({
- status: "success",
- schemasInDirectory
- });
- }).catch(err => {
- cb({
- status: "failure",
- error: err.message
- });
- });
- },
- "import": (cb, name) => {
- convertSchemaModule.import(name).then(() => {
- cb({
- status: "success"
- });
- }).catch(err => {
- cb({
- status: "failure",
- error: err.message
- });
- });
- }
- }
|