Skip to content

Commit

Permalink
pushing
Browse files Browse the repository at this point in the history
  • Loading branch information
bnonni committed May 7, 2022
1 parent 41b6365 commit 302bd3b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const debug = require('../../utils/debug');
const nodeService = require('./nodeService');
const accountService = require('./accountService');

const getNodeAllowance = async (req, res) => {
const getAccountBalance = async (req, res) => {
try {
const username = req._parsedUrl.query.split('=')[1];
username, passphrase, alias, start
const response = await nodeService.getNodeAllowance(username);
const response = await accountService.getAccountBalance(username);

debug.info(`Invoice Creation Response: ${JSON.stringify(response)}`);

Expand All @@ -17,4 +17,4 @@ const getNodeAllowance = async (req, res) => {
}
};

module.exports = { getNodeAllowance };
module.exports = { getAccountBalance };
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const debug = require('../../utils/debug');
const senseiAdmin = require('../../sensei/admin');

const getNodeAllowance = async (username) => {
const getAccountBalance = async (username) => {
try {
// get allowance from firestore
return { success: true, message: charge };
Expand All @@ -11,4 +11,4 @@ const getNodeAllowance = async (username) => {
}
};

module.exports = { getNodeAllowance };
module.exports = { getAccountBalance };
8 changes: 8 additions & 0 deletions backend/api/account/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const express = require('express');
const router = express();

const { getAccountBalance } = require('./accountController');

router.get('/allowance', getAccountBalance);

module.exports = router;
8 changes: 4 additions & 4 deletions backend/api/admin/adminController.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const debug = require('../../utils/debug');
const spotService = require('./adminService');
const adminService = require('./adminService');

const getParkingSpotDetails = async (req, res) => {
try {
const uuid = req._parsedUrl.query.split('=')[1];
const response = await spotService.getParkingSpotDetails(uuid);
const response = await adminService.getParkingSpotDetails(uuid);

debug.info(`Spot Details Response: ${JSON.stringify(response)}`);

Expand All @@ -23,7 +23,7 @@ const reserveParkingSpot = async (req, res) => {
const licensePlate = req.body.licensePlate;
const duration = req.body.duration;

const response = await spotService.reserveParkingSpot(
const response = await adminService.reserveParkingSpot(
uuid,
licensePlate,
duration
Expand All @@ -42,7 +42,7 @@ const reserveParkingSpot = async (req, res) => {

const shouldBeEmpty = async (req, res) => {
try {
const response = await spotService.shouldBeEmpty();
const response = await adminService.shouldBeEmpty();

debug.info(`Spot Details Response: ${JSON.stringify(response)}`);

Expand Down
4 changes: 4 additions & 0 deletions backend/api/admin/adminService.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const debug = require('../../utils/debug');

// replace spots with accounts
const spots = require('../../db/collection');


// replace all functions
const getParkingSpotDetails = async (uuid) => {
try {
return { success: true, message: (await spots.doc(uuid).get()).data() };
Expand Down
9 changes: 0 additions & 9 deletions backend/api/node/index.js

This file was deleted.

0 comments on commit 302bd3b

Please sign in to comment.