Skip to content

Commit cdd2bce

Browse files
committed
Merge branch 'main' into deta-deploy
2 parents 5d8db6b + 30ce3b3 commit cdd2bce

3 files changed

Lines changed: 101 additions & 36 deletions

File tree

README.md

Lines changed: 79 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,96 @@
1-
<h1 align="center">LGU-TimetableAPI</hello>
1+
<h1 align="center">
2+
<br>
3+
<a href="https://timetable.lgu.edu.pk"><img src="https://user-images.githubusercontent.com/41378765/200201356-6ebba91a-dec8-4314-93ff-3b7268c4274c.png" alt="Lahore Garrison University" width="500"></a>
4+
<br>
5+
Timetable API
6+
<br>
7+
</h1>
8+
9+
<h4 align="center">Blazingly fast, lightweight and easy to use.</h4>
10+
11+
<p align="center">
12+
<a href="#"><img src="https://img.shields.io/badge/node-18.7.0-success"alt="Node 18.7.0"></a>
13+
<a href="#"><img src="https://img.shields.io/badge/API-v1.0-informational"></a>
14+
<a href="#"><img src="https://img.shields.io/github/repo-size/iivexii/LGU-TimetableAPI"></a>
15+
<a href="#">
16+
<img src="https://img.shields.io/github/forks/iivexii/LGU-TimetableAPI?color=30b781">
17+
</a>
18+
<a href="#">
19+
<img src="https://img.shields.io/github/stars/iivexii/LGU-TimetableAPI">
20+
</a>
21+
22+
</p>
223

3-
<h5 align="center"> Unofficial API for the timetable of Lahore Garrison University. </h5>
24+
<p align="center">
25+
<a href="#key-features">Key Features</a> •
26+
<a href="#how-to-use">How To Use</a> •
27+
<a href="#download">Download</a> •
28+
<a href="#routes">Routes</a> •
29+
<a href="#credits">Credits</a> •
30+
<a href="#used-by">Used By</a> •
31+
<a href="#our-contributors">Contributors</a> •
32+
<a href="#license">License</a>
33+
</p>
434

5-
### Routes
6-
All Routes requires these parameters: `session`, `semester`, `degree`, `section`
7-
| Route | Special Params | Description |
8-
|----------------------------|:------------:|:----------------|
9-
| `/` | _ | Fetch the timetable from `timetable.lgu.edu.pk` and return it in **JSON format**|
10-
| `/gc-integration` | _ | Create events on google calendar based on the official timetable. |
35+
<div align='center'><img src='https://user-images.githubusercontent.com/41378765/200203572-b2e45699-0d3e-423a-b9a6-2cc2578578ef.gif' width='1024'></div>
1136

12-
<br>
1337

14-
### Technologies used 🛠
38+
## Key Features
1539

16-
<p align="left">
40+
* 📑 Provide data in **JSON**
41+
* 🤝 APIs for all the important data like `semesters`, `degrees`, `sections` and `timetable`
42+
* ⚡ Fast and easy to use
43+
* 🔻 ligneweight with avg response size of `633.38 bytes` per request
1744

18-
<img src="https://img.shields.io/badge/JavaScript-323330?style=for-the-badge&logo=javascript&logoColor=F7DF1E">
19-
<img src="https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white">
20-
<img src="https://img.shields.io/badge/Express.js-404D59?style=for-the-badge">
21-
22-
<br>
23-
24-
### Complete documents about project 📘
25-
- please read [how to Setup](Docs) before diving into project.
26-
<br><br>
45+
## How To Use
46+
47+
To clone and run this application, you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line:
48+
49+
```bash
50+
# Clone this repository
51+
$ git clone https://github.com/IIvexII/LGU-TimetableAPI.git
52+
53+
# Go into the repository
54+
$ cd LGU-TimetableAPI
2755

28-
### See any issue ? ☠
29-
Create an issue with the correct label.
30-
<br><br>
56+
# Install dependencies
57+
$ npm install
3158

32-
### For folks who wants to contribute ❤
33-
- please read [how to contribute](https://github.com/IIvexII/LGU-TimetableAPI/blob/main/CONTRIBUTING.md) before getting started.
59+
# Run the app
60+
$ npm start
61+
```
3462

63+
> **Note**
64+
> If you're using Linux Bash for Windows, [see this guide](https://www.howtogeek.com/261575/how-to-run-graphical-linux-desktop-applications-from-windows-10s-bash-shell/) or use `node` from the command prompt.
3565
36-
Clone the repo in your own local machine
37-
Comment on the issue and we will reserve it for you. &nbsp;🌈 &nbsp;
3866

67+
## Download
3968

40-
Your contribution is highly appreciated 🙏.</br>
69+
You can [download](https://github.com/IIvexII/LGU-TimetableAPI/releases/tag/v1.0) the latest installable version of Timetable API for Windows, macOS and Linux.
4170

71+
## Routes
4272

73+
| Route | Special Params | Description | Example |
74+
|----------------------------|:--------------------------:|:------------------------------------------------------:|---------------------------|
75+
| GET `/semesters` | _ | return a **JSON** Object containing semesters. | [demo](https://lgu-timetable-api.deta.dev/semesters)|
76+
| GET `/degrees` | `semester` | all the degree programs in a specific semester. | [demo](https://lgu-timetable-api.deta.dev/degrees?semester=5)|
77+
| GET `/sections` | `semester`,`degree` | all the section in a semester with via degree program. | [demo](https://lgu-timetable-api.deta.dev/sections?semester=1&degree=BSCS)|
78+
| GET `/timetable` | `semester`, `degree`, `section` | all the degree programs in a specific semester.| [demo](https://lgu-timetable-api.deta.dev/timetable?semester=3&degree=BSCS&section=A)|
4379

4480

45-
### Example
46-
[Get Timetable in JSON](https://lgu-timetable-api.deta.dev?session=jjedrbhv59rmhc871qs1i7gv97&semester=5&degree=BSCS&section=A) - **Note**: Login and provide session as paramtere
47-
<br><br>
81+
## Credits
4882

49-
## Repo Status
83+
This software uses the following open source packages:
84+
85+
- [Node.js](https://nodejs.org/)
86+
- [Express.js](https://expressjs.com/)
87+
- [Shield.io](https://shields.io/)
88+
- [JSDOM](https://github.com/jsdom/jsdom)
89+
90+
## Used By
91+
92+
[LGU Timetable Front-end](https://github.com/Zain-ul-din/LGU-BetterTimeTable) - Lightweight timetable frontend on top of this API.
5093

51-
![GitHub Issues Open](https://img.shields.io/github/issues/IIvexII/LGU-TimetableAPI?style=for-the-badge&color=green)
52-
![GitHub PR Open](https://img.shields.io/github/issues-pr/IIvexII/LGU-TimetableAPI?style=for-the-badge&color=aqua)
53-
![GitHub PR closed](https://img.shields.io/github/issues-pr-closed-raw/IIvexII/LGU-TimetableAPI?style=for-the-badge&color=blue)
54-
![GitHub language count](https://img.shields.io/github/languages/count/IIvexII/LGU-TimetableAPI?style=for-the-badge&color=brightgreen)
5594

5695
## Our Contributors
5796

@@ -63,3 +102,7 @@ Your contribution is highly appreciated 🙏.</br>
63102
<h4 font-weight="bold">This repository is maintained by <a href="https://github.com/IIvexII">IIvexII</a></h4>
64103
<p> Show some ❤️ by starring this awesome repository! </p>
65104
</div>
105+
106+
## License
107+
108+
MIT - ✔️ Commercial use ✔️ Modification ✔️ Distribution ✔️ Private use

src/controllers/TimetableController.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,27 @@ class TimetableController {
8686

8787
res.send(timetable?.timetable);
8888
}
89+
static async getMetadata(req, res) {
90+
const sections = await Section.find({});
91+
const metadata = {};
92+
93+
for (let section of sections) {
94+
if (metadata[section.degree.semester.name]?.length > 0) {
95+
metadata[section.degree.semester.name].push({
96+
degree: section.degree.degreeName,
97+
section: section.sectionTag,
98+
});
99+
} else {
100+
metadata[section.degree.semester.name] = [
101+
{
102+
degree: section.degree.degreeName,
103+
section: section.sectionTag,
104+
},
105+
];
106+
}
107+
}
108+
res.send(metadata);
109+
}
89110
}
90111

91112
module.exports = { TimetableController };

src/routes/TimetableRouter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { TimetableController } = require('../controllers');
44

55
const router = Router();
66

7+
router.get('/metadata', TimetableController.getMetadata);
78
router.get('/semesters', TimetableController.getSemesters);
89
router.get('/degrees', TimetableController.getDegrees);
910
router.get('/sections', TimetableController.getSections);

0 commit comments

Comments
 (0)