-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from KOSASIH/deepsource-transform-b6cf9047
style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf
- Loading branch information
Showing
1 changed file
with
18 additions
and
14 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 |
---|---|---|
@@ -1,20 +1,24 @@ | ||
const express = require("express"); | ||
const router = express.Router(); | ||
const express = require('express') | ||
const router = express.Router() | ||
|
||
const TransferController = require("../controllers/transfers"); | ||
const authenticate = require("../middleware/auth"); | ||
const createTransaction = require("../middleware/network"); | ||
const TransferController = require('../controllers/transfers') | ||
const authenticate = require('../middleware/auth') | ||
const createTransaction = require('../middleware/network') | ||
|
||
router.post("/", authenticate, async (req, res) => { | ||
router.post('/', authenticate, async (req, res) => { | ||
try { | ||
const transfer = await TransferController.create(req, res); | ||
const transactionHash = await createTransaction(req.user.wallet_address, req.body.receiver_account_id, req.body.amount); | ||
transfer.transaction_hash = transactionHash; | ||
await transfer.save(); | ||
res.json({ message: "Transfer successful", transfer }); | ||
const transfer = await TransferController.create(req, res) | ||
const transactionHash = await createTransaction( | ||
req.user.wallet_address, | ||
req.body.receiver_account_id, | ||
req.body.amount | ||
) | ||
transfer.transaction_hash = transactionHash | ||
await transfer.save() | ||
res.json({ message: 'Transfer successful', transfer }) | ||
} catch (error) { | ||
res.status(400).json({ message: error.message }); | ||
res.status(400).json({ message: error.message }) | ||
} | ||
}); | ||
}) | ||
|
||
module.exports = router; | ||
module.exports = router |