-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructuring/building Controllers and Routes within Server/api/
- Loading branch information
1 parent
0ae880f
commit 66bfc8b
Showing
221 changed files
with
390 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (c) 2023 Edmund Berkmann | ||
pragma solidity ^0.8.10; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
File renamed without changes.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const express = require('express'); | ||
const { protect } = require('../middleware/authMiddleware'); | ||
const { | ||
addLiquidity, | ||
createPool, | ||
swapTokens, | ||
initiateAuction, | ||
placeBid, | ||
fetchLeaderboard, | ||
stakeTokens, | ||
calculateYield, | ||
distributeRewards, | ||
} = require('../controllers/bazaarController'); | ||
|
||
const router = express.Router(); | ||
|
||
|
||
exports.getSummary = async (req, res) => { | ||
// Code to retrieve market metrics or summary | ||
}; | ||
|
||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const AuctionsService = require('../services/auctionsService'); | ||
|
||
// Auction Management | ||
router.post('/initiateAuction', protect, initiateAuction); | ||
router.post('/placeBid', protect, placeBid); | ||
router.get('/fetchLeaderboard', protect, fetchLeaderboard); | ||
|
||
exports.startAuction = async (req, res) => { | ||
try { | ||
const auction = await AuctionsService.startNewAuction(req.body); | ||
res.status(201).json(auction); | ||
} catch (error) { | ||
res.status(500).send(error.message); | ||
} | ||
}; | ||
|
||
exports.placeBid = async (req, res) => { | ||
try { | ||
const auction = await AuctionsService.placeBid(req.params.auctionId, req.body); | ||
res.json(auction); | ||
} catch (error) { | ||
res.status(500).send(error.message); | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
exports.getAllBlogs = async (req, res) => { | ||
// Code to retrieve all blog posts or articles | ||
}; | ||
|
||
exports.getBlogDetails = async (req, res) => { | ||
// Code to retrieve details of a particular blog post or article | ||
}; | ||
|
||
exports.createBlog = async (req, res) => { | ||
// Code to create a new blog post or article | ||
}; | ||
|
||
exports.updateBlog = async (req, res) => { | ||
// Code to update a particular blog post or article | ||
}; | ||
|
||
exports.deleteBlog = async (req, res) => { | ||
// Code to delete a particular blog post or article | ||
}; |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
exports.getTopCreators = async (req, res) => { | ||
// Code to retrieve a list of top creators | ||
}; | ||
|
||
exports.getCreatorDetails = async (req, res) => { | ||
// Code to retrieve details of a particular creator | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Liquidity Management | ||
router.post('/createPool', protect, createPool); | ||
router.post('/addLiquidity', protect, addLiquidity); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
exports.createListing = async (req, res) => { | ||
try { | ||
const listing = await ListingsService.createListing(req.body); | ||
res.status(201).json(listing); | ||
} catch (error) { | ||
res.status(500).send(error.message); | ||
} | ||
}; | ||
|
||
exports.getListings = async (req, res) => { | ||
try { | ||
const listings = await ListingsService.fetchAllListings(); | ||
res.json(listings); | ||
} catch (error) { | ||
res.status(500).send(error.message); | ||
} | ||
}; | ||
|
||
exports.updateListing = async (req, res) => { | ||
// Code to update details of a listing | ||
}; | ||
|
||
exports.deleteListing = async (req, res) => { | ||
// Code to delete a listing | ||
}; | ||
|
||
exports.getAllListings = async (req, res) => { | ||
// Code to retrieve all listings in the marketplace | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
exports.getOrderBook = async (req, res) => { | ||
// Code to retrieve the current state of the order book | ||
}; | ||
|
||
exports.getTopOrders = async (req, res) => { | ||
// Code to retrieve the top 'n' buy and sell orders | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
exports.createPurchase = async (req, res) => { | ||
// Code to create a new purchase order | ||
}; | ||
|
||
exports.getPurchaseDetails = async (req, res) => { | ||
// Code to retrieve details of a purchase | ||
}; | ||
|
||
exports.updatePurchaseStatus = async (req, res) => { | ||
// Code to update the status of a purchase | ||
}; | ||
|
||
exports.getAllPurchases = async (req, res) => { | ||
// Code to retrieve all purchases for a user or seller | ||
}; | ||
|
||
|
||
// Token Trading | ||
router.post('/swapTokens', protect, swapTokens); |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
exports.calculateFees = async (req, res) => { | ||
// Code to calculate fees for a particular transaction or listing | ||
}; | ||
|
||
exports.updateFeeStructure = async (req, res) => { | ||
// Code to update the marketplace's fee structure | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
exports.searchListings = async (req, res) => { | ||
// Code to search through listings based on provided criteria | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
exports.getFeaturedTokens = async (req, res) => { | ||
// Code to retrieve a list of featured tokens | ||
}; | ||
|
||
exports.getFeaturedTokenDetails = async (req, res) => { | ||
// Code to retrieve details of a particular featured token | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
exports.placeOrder = async (req, res) => { | ||
// Code to place a new limit order | ||
}; | ||
|
||
exports.updateOrder = async (req, res) => { | ||
// Code to modify an existing limit order | ||
}; | ||
|
||
exports.cancelOrder = async (req, res) => { | ||
// Code to cancel an existing limit order | ||
}; | ||
|
||
exports.getMyOrders = async (req, res) => { | ||
// Code for a user to view their active and past orders | ||
}; | ||
|
||
exports.processTransaction = async (req, res) => { | ||
try { | ||
const transaction = await TransactionsService.processTransaction(req.body); | ||
res.json(transaction); | ||
} catch (error) { | ||
res.status(500).send(error.message); | ||
} | ||
}; |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const firebaseAuth = require('../../services/firebaseAuth'); | ||
const web3Service = require('../../services/web3Service'); | ||
const jwt = require('jsonwebtoken'); | ||
|
||
// Middleware to validate web3 token | ||
const { validateWeb3Token } = require('../../middleware/authMiddleware'); | ||
|
||
// Route to handle user registration via Firebase and blockchain account linking | ||
router.post('/register', async (req, res) => { | ||
try { | ||
const { email, password, blockchainAddress } = req.body; | ||
const userCredential = await firebaseAuth.register(email, password); | ||
const token = jwt.sign({ uid: userCredential.user.uid }, process.env.JWT_SECRET, { expiresIn: '1h' }); | ||
|
||
// Link blockchain address with Firebase user | ||
await web3Service.linkBlockchainAddress(userCredential.user.uid, blockchainAddress); | ||
|
||
res.status(201).json({ token, uid: userCredential.user.uid, blockchainAddress }); | ||
} catch (error) { | ||
res.status(400).json({ error: error.message }); | ||
} | ||
}); | ||
|
||
// Route to handle user login and token generation | ||
router.post('/login', async (req, res) => { | ||
try { | ||
const { email, password } = req.body; | ||
const userCredential = await firebaseAuth.login(email, password); | ||
const token = jwt.sign({ uid: userCredential.user.uid }, process.env.JWT_SECRET, { expiresIn: '1h' }); | ||
|
||
res.status(200).json({ token, uid: userCredential.user.uid }); | ||
} catch (error) { | ||
res.status(400).json({ error: error.message }); | ||
} | ||
}); | ||
|
||
// Route to validate and refresh JWT tokens | ||
router.post('/token', validateWeb3Token, (req, res) => { | ||
// Assuming validateWeb3Token middleware validates the existing token and injects user info into req.user | ||
const newToken = jwt.sign({ uid: req.user.uid }, process.env.JWT_SECRET, { expiresIn: '1h' }); | ||
res.status(200).json({ token: newToken }); | ||
}); | ||
|
||
module.exports = router; |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
11 changes: 11 additions & 0 deletions
11
server/api/routes/gallery/stakingRewards/stakeManagementRoutes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
exports.stakeTokens = async (req, res) => { | ||
// Code to stake tokens | ||
}; | ||
|
||
exports.unstakeTokens = async (req, res) => { | ||
// Code to unstake tokens | ||
}; | ||
|
||
exports.getStakedAmount = async (req, res) => { | ||
// Code to retrieve the staked amount of tokens | ||
}; |
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions
15
server/api/routes/gallery/steezInteraction/steezManagementRoutes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
exports.createUserWallet = async (req, res) => { | ||
// Code to create a user's wallet | ||
}; | ||
|
||
exports.getUserWalletDetails = async (req, res) => { | ||
// Code to retrieve a user's wallet details | ||
}; | ||
|
||
exports.updateUserWallet = async (req, res) => { | ||
// Code to update a user's wallet details | ||
}; | ||
|
||
exports.deleteUserWallet = async (req, res) => { | ||
// Code to delete a user's wallet | ||
}; |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
exports.initiateDeposit = async (req, res) => { | ||
// Code to initiate a deposit | ||
}; | ||
|
||
exports.confirmDeposit = async (req, res) => { | ||
// Code to confirm a deposit | ||
}; | ||
|
||
exports.getDepositHistory = async (req, res) => { | ||
// Code to retrieve deposit history | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
exports.sendGift = async (req, res) => { | ||
// Code to send a gift | ||
}; | ||
|
||
exports.receiveGift = async (req, res) => { | ||
// Code to confirm receipt of a gift | ||
}; | ||
|
||
exports.getGiftHistory = async (req, res) => { | ||
// Code to retrieve gift history | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
exports.calculateFees = async (req, res) => { | ||
// Code to calculate fees for a given transaction | ||
}; | ||
|
||
exports.getFeesHistory = async (req, res) => { | ||
// Code to retrieve history of fees collected | ||
}; |
Oops, something went wrong.