Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
343a4f8275 | ||
|
|
0129315523 | ||
|
|
d82bfd5b56
|
No files matched your search
@@ -73,7 +73,7 @@ module.exports = (users) => {
|
||||
router.post("/signup", async (req, res) => {
|
||||
const userSchema = joi.object({
|
||||
email: joi.string().email({ minDomainSegments: 2, tlds: { allow: true } }).required(),
|
||||
name: joi.string().pattern(new RegExp('^[a-zA-Z]+$')).max(20).required(),
|
||||
name: joi.string().pattern(new RegExp('^[a-zA-Z0-9_ ]*$')).max(20).required(),
|
||||
password: joi.string().max(20).min(8).required(),
|
||||
repassword: joi.string().max(20).min(8).required(),
|
||||
});
|
||||
|
||||
+1
-1
@@ -477,7 +477,7 @@ module.exports = (middleware, users, plans, assets) => {
|
||||
router.post("/updateAccount", async (req, res) => {
|
||||
const accountSchema = joi.object({
|
||||
email: joi.string().email({ minDomainSegments: 2, tlds: { allow: true } }),
|
||||
name: joi.string().pattern(new RegExp('^[a-zA-Z]+$')).max(20),
|
||||
name: joi.string().pattern(new RegExp('^[a-zA-Z0-9_ ]*$')).max(20),
|
||||
password: joi.string().max(20).min(8),
|
||||
repassword: joi.string().max(20).min(8),
|
||||
});
|
||||
|
||||
@@ -56,9 +56,15 @@ async function calculateTotalAssetValue(assets) {
|
||||
if (asset.value < 1000) {
|
||||
totalAssetValue += asset.value;
|
||||
} else {
|
||||
const assetYear = new Date(asset.year).getFullYear();
|
||||
const assetYear = asset.year;
|
||||
const age = today.getFullYear() - assetYear;
|
||||
let depreciatedValue = asset.value * Math.pow(0.85, age);
|
||||
let depreciatedValue;
|
||||
|
||||
if (age < 1){
|
||||
depreciatedValue = asset.value * 0.9;
|
||||
}else{
|
||||
depreciatedValue = asset.value * Math.pow(0.90, age);
|
||||
}
|
||||
|
||||
if (depreciatedValue < 1000) {
|
||||
totalAssetValue += 1000;
|
||||
|
||||
Reference in new issue
Block a user