├── .gitignore
├── mongod
├── public
└── stylesheets
│ └── main.css
├── readme.md
├── views
├── landing.ejs
├── login.ejs
├── register.ejs
├── partials
│ ├── footer.ejs
│ └── header.ejs
├── comments
│ ├── edit.ejs
│ └── new.ejs
└── assets
│ ├── newAsset.ejs
│ ├── edit.ejs
│ ├── index.ejs
│ └── show.ejs
├── models
├── comment.js
├── user.js
└── asset.js
├── package.json
├── routes
├── index.js
├── assets.js
└── comments.js
├── middleware
└── index.js
├── index.js
└── seeds.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
--------------------------------------------------------------------------------
/mongod:
--------------------------------------------------------------------------------
1 | mongod --nojournal
2 |
--------------------------------------------------------------------------------
/public/stylesheets/main.css:
--------------------------------------------------------------------------------
1 | .delete-form {
2 | display: inline;
3 | }
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | RESTFUL ROUTES
2 |
3 | NAME URL VERB DESCRIPTION
4 | ===============================================================
5 | INDEX /assets GET Displays a list of all assets
6 | NEW /assets/new GET Displays form to make a new asset
7 | CREATE /assets POST Add a new asset to DB
8 | SHOW /assets/:id GET Shows info about one asset
--------------------------------------------------------------------------------
/views/landing.ejs:
--------------------------------------------------------------------------------
1 | <%- include ("partials/header") %>
2 |
3 |
4 | CMMS Landing Page
5 |
6 |
7 |
8 | View the assets page
9 |
10 |
11 | Placeholder for customized dashboards.
12 |
13 |
14 | - To-do list
15 | - performance metrics
16 |
17 |
18 | <%- include ("partials/footer") %>
--------------------------------------------------------------------------------
/views/login.ejs:
--------------------------------------------------------------------------------
1 | <%- include ("partials/header") %>
2 |
3 |
4 | Login
5 |
6 |
7 |
12 |
13 | <%- include ("partials/footer") %>
--------------------------------------------------------------------------------
/views/register.ejs:
--------------------------------------------------------------------------------
1 | <%- include ("partials/header") %>
2 |
3 | Sign Up!
4 |
5 |
6 |
13 |
14 | <%- include ("partials/footer") %>
--------------------------------------------------------------------------------
/models/comment.js:
--------------------------------------------------------------------------------
1 | const mongoose = require("mongoose");
2 |
3 | //SHEMA Setup
4 | const commentSchema = new mongoose.Schema({
5 | text: String,
6 | user: {
7 | id: {
8 | type: mongoose.Schema.Types.ObjectId,
9 | ref: "User"
10 | },
11 | username: String
12 | },
13 | created: {type: Date, default: Date.now}
14 | });
15 |
16 | module.exports = mongoose.model("Comment", commentSchema);
--------------------------------------------------------------------------------
/models/user.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose'),
2 | passportLocalMongoose = require('passport-local-mongoose');
3 |
4 | //SHEMA Setup
5 | const UserSchema = new mongoose.Schema({
6 | username: String,
7 | password: String,
8 | created: {type: Date, default: Date.now}
9 | });
10 |
11 | UserSchema.plugin(passportLocalMongoose);
12 |
13 | module.exports = mongoose.model('User', UserSchema);
--------------------------------------------------------------------------------
/models/asset.js:
--------------------------------------------------------------------------------
1 | const mongoose = require("mongoose");
2 |
3 | //SHEMA Setup
4 | const assetSchema = new mongoose.Schema({
5 | fc: String,
6 | img: String,
7 | description: String,
8 | user: {
9 | id: {
10 | type: mongoose.Schema.Types.ObjectId,
11 | ref: "User"
12 | },
13 | username: String
14 | },
15 | comments: [
16 | {
17 | type: mongoose.Schema.Types.ObjectId,
18 | ref: "Comment"
19 | }
20 | ]
21 | });
22 |
23 | module.exports = mongoose.model("Asset", assetSchema);
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cmms",
3 | "version": "1.0.0",
4 | "description": "Web-based CMMS software",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "start": "node index.js"
9 | },
10 | "author": "Marc Burnie",
11 | "license": "ISC",
12 | "dependencies": {
13 | "body-parser": "^1.19.0",
14 | "connect-flash": "^0.1.1",
15 | "ejs": "^3.1.3",
16 | "express": "^4.17.1",
17 | "express-session": "^1.17.1",
18 | "method-override": "^3.0.0",
19 | "mongoose": "^5.9.16",
20 | "passport": "^0.4.1",
21 | "passport-local": "^1.0.0",
22 | "passport-local-mongoose": "^6.0.1"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/views/partials/footer.ejs:
--------------------------------------------------------------------------------
1 |
2 | Footer goes here
3 |
4 |
5 |
6 |
7 |
8 |
9 |