-
Notifications
You must be signed in to change notification settings - Fork 30
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 #714 from OneCommunityGlobal/development
Backend Release to Main [1.35]
- Loading branch information
Showing
10 changed files
with
404 additions
and
5 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,122 @@ | ||
[ | ||
{ | ||
"unit":"Micrograms", | ||
"category":"Material" | ||
}, | ||
{ | ||
"unit": "Milligrams (mg)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Centigrams (cg)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Decigrams (dg)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Grams (g)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Dekagram (dag)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Hectogram (hg)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Kilograms", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Cubic Centimeter (cm³)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Cubic Millimeter (mm³)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Cubic Yard (yd³)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Square Meter (m²)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Metric ton (t)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Pounds", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Ounces", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Carats", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Stone", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Bags", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Numbers", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Board Feet (BDFT)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Cords", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Pieces", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Roll (for rolled insulation)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Bundle (for shingles)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Meter (for wiring,pipes)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Tubes (for caulking)", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Tons", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Cubic Meter", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "Sand", | ||
"category": "Material" | ||
}, | ||
{ | ||
"unit": "FakeUnitForTesting", | ||
"category": "Material" | ||
} | ||
] |
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
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
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,30 @@ | ||
const UserProfile = require('../models/userProfile'); | ||
|
||
const permissionChangeLogController = function (PermissionChangeLog) { | ||
|
||
const getPermissionChangeLogs = async function (req, res) { | ||
|
||
try { | ||
const userProfile = await UserProfile.findOne({ _id: req.params.userId }).exec() | ||
|
||
if (userProfile) { | ||
if (userProfile.role !== 'Owner') { | ||
res.status(204).send([]) | ||
} else { | ||
const changeLogs = await PermissionChangeLog.find({}) | ||
res.status(200).send(changeLogs) | ||
} | ||
} else { | ||
res.status(403).send(`User (${req.params.userId}) not found.`) | ||
} | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
} | ||
|
||
return { | ||
getPermissionChangeLogs | ||
} | ||
} | ||
|
||
module.exports = permissionChangeLogController |
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,26 @@ | ||
const mongoose = require('mongoose'); | ||
const { Schema } = mongoose; | ||
|
||
const User = require('./userProfile'); | ||
const rolesMergedPermissions = require('./role') | ||
|
||
const PermissionChangeLog = new Schema({ | ||
logDateTime: { type: String, required: true }, | ||
roleId: { | ||
type: mongoose.Types.ObjectId, | ||
ref: rolesMergedPermissions, | ||
required: true | ||
}, | ||
roleName: { type: String }, | ||
permissions: { type: [String], required: true }, | ||
permissionsAdded: { type: [String], required: true }, | ||
permissionsRemoved: { type: [String], required: true }, | ||
requestorId: { | ||
type: mongoose.Types.ObjectId, | ||
ref: User | ||
}, | ||
requestorRole: { type: String }, | ||
requestorEmail: { type: String, required: true}, | ||
}); | ||
|
||
module.exports = mongoose.model('permissionChangeLog', PermissionChangeLog, 'permissionChangeLogs'); |
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
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,14 @@ | ||
const express = require('express'); | ||
|
||
const routes = function (permissionChangeLog) { | ||
const controller = require('../controllers/permissionChangeLogsController')(permissionChangeLog) | ||
|
||
const permissionChangeLogRouter = express.Router() | ||
|
||
permissionChangeLogRouter.route("/permissionChangeLogs/:userId") | ||
.get(controller.getPermissionChangeLogs) | ||
|
||
return permissionChangeLogRouter | ||
} | ||
|
||
module.exports = routes |
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
Oops, something went wrong.