1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- const moduleManager = require("../../../index");
- const accountModule = moduleManager.modules["account"];
- const mongoModule = moduleManager.modules["mongo"];
- const utilModule = moduleManager.modules["util"];
- module.exports = {
- "getAll": async cb => {
- accountModule.getAll().then(accounts => {
- cb({
- status: "success",
- accounts
- });
- }).catch(err => {
- cb({
- status: "failure"
- });
- });
- },
- "getById": (cb, accountId) => {
- accountModule.getById(accountId).then(account => {
- cb({
- status: "success",
- account
- });
- }).catch(err => {
- cb({
- status: "failure"
- });
- });
- },
- "add": (cb, account) => {
- accountModule.add(account).then(() => {
- console.log("Added account!");
- cb({
- status: "success"
- });
- }).catch(err => {
- cb({
- status: "failure"
- });
- });
- },
- "editById": (cb, accountId, account) => {
- accountModule.editById(accountId, account).then(() => {
- console.log("Edited account!");
- cb({
- status: "success"
- });
- }).catch(err => {
- cb({
- status: "failure"
- });
- });
- }
- }
|