Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Jahirrrr authored Jul 20, 2023
1 parent 1d458bf commit 32d738b
Show file tree
Hide file tree
Showing 14 changed files with 582 additions and 38 deletions.
Binary file added .DS_Store
Binary file not shown.
40 changes: 2 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,47 +115,11 @@ npm run dev
Buka browser kamu, lalu masuk ke:
http://localhost:3000/
## Demo Foto Project
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(623).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(624).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(625).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(626).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(627).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(628).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(629).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(630).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(632).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(633).png)
![Image](https://raw.githubusercontent.com/Jahirrrr/Perpusku/main/Screenshot%20(634).png)
## Catatan
Ini adalah Project Open Source, Jika Kalian Ingin Menggunakannya Untuk Kepentingan Pribadi / Komersil, Boleh Saja, Asal Kalian Mencantumkan Kredit!
Ini adalah Project Open Source, Jika Kalian Ingin Menggunakannya Untuk Kepentingan Pribadi / Komersil, Boleh Saja, Asal Kalian Mencantumkan Kredit, jika ingin meminta password file zip nya, hubungi instagram saya @jahirishere.js
## CREDITS
- Zahir Hadi Athallah
## Donate For Support This Project :)
https://saweria.co/zsoft
https://saweria.co/zsoft
27 changes: 27 additions & 0 deletions config/createAdmin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @author CodeArch_Indonesia <[email protected]>
* @license MIT
* @app PerpusKu
*/


const { User } = require("../models/User");
const bcrypt = require("bcrypt");

var createAdmin = async () => {
const users = new User({
name: "adminPerpus",
email: "[email protected]",
password: "perpussmkn21",
category: "ADMIN",
productKey: "PerpusKuKeren"
});

const salt = await bcrypt.genSalt(10);
users.password = await bcrypt.hash(users.password, salt);

await users.save();
console.log("Akun admin berhasil dibuat");
};

module.exports = createAdmin;
26 changes: 26 additions & 0 deletions config/db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @author CodeArch_Indonesia <[email protected]>
* @license MIT
* @app PerpusKu
*/

const mongoose = require("mongoose");
const db = "mongodb+srv://perpusku:[email protected]/?retryWrites=true&w=majority"

const connectDB = async () => {
try {
await mongoose.connect(db, {
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
useUnifiedTopology: true
});
console.log("> MongoDB Connected...");
} catch (err) {
console.log("> Connection to MongoDB failed...");
console.error(err.message);
process.exit(1);
}
};

module.exports = connectDB;
25 changes: 25 additions & 0 deletions middleware/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @author CodeArch_Indonesia <[email protected]>
* @license MIT
* @app PerpusKu
*/


const jwt = require("jsonwebtoken");
const jwtSecret = "PerpusKuKeren"

module.exports = function (req, res, next) {
const token = req.header("x-auth-token");

if (!token) {
return res.status(401).json({ msg: "No token, authorization denied." });
}

try {
const decoded = jwt.verify(token, jwtSecret);
req.user = decoded.user;
next();
} catch (err) {
res.status(401).json({ msg: "Token is not valid." });
}
};
25 changes: 25 additions & 0 deletions models/BookCategory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @author CodeArch_Indonesia <[email protected]>
* @license MIT
* @app PerpusKu
*/


const mongoose = require("mongoose");

const BookCategorySchema = mongoose.Schema({
user: {
type: mongoose.Schema.Types.ObjectId,
ref: "users"
},
name: {
type: String,
required: true
},
date: {
type: Date,
default: Date.now
}
});

module.exports = mongoose.model("bookcategory", BookCategorySchema);
58 changes: 58 additions & 0 deletions models/Books.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* @author CodeArch_Indonesia <[email protected]>
* @license MIT
* @app PerpusKu
*/


const mongoose = require("mongoose");

const BooksSchema = mongoose.Schema({
user: {
type: mongoose.Schema.Types.ObjectId,
ref: "users"
},
publisher: {
type: mongoose.Schema.Types.ObjectId,
ref: "publisher"
},
bookcategory: {
type: mongoose.Schema.Types.ObjectId,
ref: "bookcategory"
},
name: {
type: String,
required: true
},
title: {
type: String,
required: true
},
author: {
type: String,
required: true
},
publicyear: {
type: Number,
required: true
},
isbn: {
type: Number,
required: true
},
goodbooks: {
type: Number,
required: true
},
damagedbooks: {
type: Number,
required: true
},
date: {
type: Date,
default: Date.now
}
});

module.exports = mongoose.model("books", BooksSchema);

49 changes: 49 additions & 0 deletions models/Group.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* @author CodeArch_Indonesia <[email protected]>
* @license MIT
* @app PerpusKu
*/


const mongoose = require("mongoose");

const GroupSchema = mongoose.Schema({
user: {
type: mongoose.Schema.Types.ObjectId,
ref: "users"
},
name: {
type: String,
required: true
},
abrev: {
type: String,
required: true
},
desc: { type: String },
color: { type: String, default: "yellow" },
students: [
{
type: mongoose.Schema.Types.ObjectId,
ref: "student"
}
],
courses: [
{
type: mongoose.Schema.Types.ObjectId,
ref: "course"
}
],
exams: [
{
type: mongoose.Schema.Types.ObjectId,
ref: "exam"
}
],
date: {
type: Date,
default: Date.now
},
});

module.exports = mongoose.model("group", GroupSchema);
29 changes: 29 additions & 0 deletions models/Publisher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @author CodeArch_Indonesia <[email protected]>
* @license MIT
* @app PerpusKu
*/


const mongoose = require("mongoose");

const PublisherSchema = mongoose.Schema({
user: {
type: mongoose.Schema.Types.ObjectId,
ref: "users"
},
name: {
type: String,
required: true
},
status: {
type: String,
required: true
},
date: {
type: Date,
default: Date.now
}
});

module.exports = mongoose.model("publisher", PublisherSchema);
36 changes: 36 additions & 0 deletions models/School.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @author CodeArch_Indonesia <[email protected]>
* @license MIT
* @app PerpusKu
*/


const mongoose = require("mongoose");

const SchoolSchema = mongoose.Schema({
user: {
type: mongoose.Schema.Types.ObjectId,
ref: "users"
},
logo: {
fileName: { type: String },
filePath: { type: String }
},
name: {
type: String,
required: true
},
abrev: { type: String },
desc: { type: String },
period: { type: String },
address: { type: String },
email: { type: String },
phone1: { type: String },
phone2: { type: String },
date: {
type: Date,
default: Date.now
}
});

module.exports = mongoose.model("school", SchoolSchema);
37 changes: 37 additions & 0 deletions models/Student.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* @author CodeArch_Indonesia <[email protected]>
* @license MIT
* @app PerpusKu
*/


const mongoose = require("mongoose");

const StudentSchema = mongoose.Schema({
user: {
type: mongoose.Schema.Types.ObjectId,
ref: "users"
},
group: {
type: mongoose.Schema.Types.ObjectId,
ref: "group"
},
nameFirst: {
type: String,
required: true
},
nameLast: {
type: String,
required: true
},
code: {
type: Number,
required: true
},
date: {
type: Date,
default: Date.now
}
});

module.exports = mongoose.model("student", StudentSchema);
Loading

0 comments on commit 32d738b

Please sign in to comment.