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