backend: refactor files into directories

This commit is contained in:
Ladd Hoffman 2024-04-27 12:57:15 -05:00
parent 44821a2556
commit 17e8a559cf
12 changed files with 25 additions and 16 deletions

View File

@ -4,9 +4,9 @@ const crypto = require('crypto');
const objectHash = require('object-hash');
const Promise = require('bluebird');
const verifySignature = require('./verify-signature');
const { authorAddresses, authorPrivKeys, forum } = require('./db');
const { dao } = require('./contracts');
const verifySignature = require('../util/verify-signature');
const { authorAddresses, authorPrivKeys, forum } = require('../util/db');
const { dao } = require('../util/contracts');
// Each post allocates 30% of its reputation to citations
const PPM_TO_CITATIONS = 300000;

View File

@ -1,7 +1,7 @@
const objectHash = require('object-hash');
const verifySignature = require('./verify-signature');
const { forum } = require('./db');
const verifySignature = require('../util/verify-signature');
const { forum } = require('../util/db');
const read = async (hash) => {
// Fetch content

View File

@ -1,7 +1,7 @@
const objectHash = require('object-hash');
const verifySignature = require('./verify-signature');
const { forum } = require('./db');
const verifySignature = require('../util/verify-signature');
const { forum } = require('../util/db');
module.exports = async (req, res) => {
const {

View File

@ -0,0 +1,9 @@
const proposalsListener = require('./proposals');
const start = () => {
proposalsListener.start();
};
module.exports = {
start,
};

View File

@ -1,6 +1,6 @@
const { proposals } = require('./contracts');
const read = require('./read');
const { sendNewProposalEvent } = require('./matrix');
const { proposals } = require('../util/contracts');
const read = require('../api/read');
const { sendNewProposalEvent } = require('../matrix-bot');
// Subscribe to proposal events
const start = () => {

View File

@ -1,5 +1,5 @@
require('dotenv').config();
require('./api').start();
require('./matrix').start();
require('./proposals').start();
require('./matrix-bot').start();
require('./contract-listeners').start();

View File

@ -12,7 +12,7 @@ const {
proposalEventIds,
matrixUserToAuthorAddress,
authorAddressToMatrixUser,
} = require('./db');
} = require('../util/db');
const {
MATRIX_HOMESERVER_URL,

View File

@ -1,4 +1,4 @@
const contractAddresses = require('../contract-addresses.json');
const contractAddresses = require('../../contract-addresses.json');
const networks = {
localhost: '0x539',

View File

@ -1,8 +1,8 @@
const ethers = require('ethers');
const { getContractAddressByNetworkName } = require('./contract-config');
const DAOArtifact = require('../contractArtifacts/DAO.json');
const ProposalsArtifact = require('../contractArtifacts/Proposals.json');
const DAOArtifact = require('../../contractArtifacts/DAO.json');
const ProposalsArtifact = require('../../contractArtifacts/Proposals.json');
const network = process.env.ETH_NETWORK;