Skip to content

Commit b677ad9

Browse files
committed
feat(backend): Initial import till 19e4ed88059b208772589dabee2badf0a46f674b
1 parent ea40fea commit b677ad9

File tree

7 files changed

+705
-0
lines changed

7 files changed

+705
-0
lines changed

backend/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__pycache__
2+
caddy_data

backend/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.13-alpine3.21
2+
3+
WORKDIR /app
4+
5+
COPY ./requirements.txt /app/requirements.txt
6+
7+
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
8+
9+
COPY . /app
10+
11+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

backend/README.md

Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
# **betterslcm**
2+
3+
### **Info**
4+
5+
- **Version**: 0.1.0
6+
7+
---
8+
9+
### **Paths**
10+
11+
### /
12+
13+
**GET**
14+
15+
**Summary**: Redirect
16+
17+
**[ Responses ]**
18+
19+
code: 200
20+
21+
description: Successful Response
22+
23+
- application/json:
24+
25+
### /status
26+
27+
**GET**
28+
29+
**Summary**: Status
30+
31+
**[ Responses ]**
32+
33+
code: 200
34+
35+
description: Successful Response
36+
37+
- application/json:
38+
39+
### /login
40+
41+
**POST**
42+
43+
**Summary**: Login
44+
45+
**[ Request Body ]** \*
46+
47+
- application/json:
48+
49+
- $schema: Credentials
50+
51+
**Example Value**:
52+
53+
```json
54+
{
55+
"username" : string,
56+
"password" : string
57+
}
58+
```
59+
60+
**[ Responses ]**
61+
62+
code: 200
63+
64+
description: Successful Response
65+
66+
- application/json:
67+
68+
code: 422
69+
70+
description: Validation Error
71+
72+
- application/json:
73+
74+
- $schema: HTTPValidationError
75+
76+
**Example Value**:
77+
78+
```json
79+
{
80+
"detail" : [
81+
{
82+
"loc" : [
83+
],
84+
"msg" : string,
85+
"type" : string
86+
}
87+
]
88+
}
89+
```
90+
91+
### /attendance
92+
93+
**GET**
94+
95+
**Summary**: Attendance
96+
97+
**[ Responses ]**
98+
99+
code: 200
100+
101+
description: Successful Response
102+
103+
- application/json:
104+
105+
### /cgpa
106+
107+
**GET**
108+
109+
**Summary**: Cgpa
110+
111+
**[ Responses ]**
112+
113+
code: 200
114+
115+
description: Successful Response
116+
117+
- application/json:
118+
119+
### /grades
120+
121+
**GET**
122+
123+
**Summary**: Grades
124+
125+
**[ Parameters ]**
126+
127+
| name | in | description | type | required |
128+
| :------- | :---: | :---------- | :-----: | :------: |
129+
| semester | query | | integer | \* |
130+
131+
**[ Responses ]**
132+
133+
code: 200
134+
135+
description: Successful Response
136+
137+
- application/json:
138+
139+
code: 422
140+
141+
description: Validation Error
142+
143+
- application/json:
144+
145+
- $schema: HTTPValidationError
146+
147+
**Example Value**:
148+
149+
```json
150+
{
151+
"detail" : [
152+
{
153+
"loc" : [
154+
],
155+
"msg" : string,
156+
"type" : string
157+
}
158+
]
159+
}
160+
```
161+
162+
### /internal_marks
163+
164+
**GET**
165+
166+
**Summary**: Internal Marks
167+
168+
**[ Parameters ]**
169+
170+
| name | in | description | type | required |
171+
| :------- | :---: | :---------- | :-----: | :------: |
172+
| semester | query | | integer | \* |
173+
174+
**[ Responses ]**
175+
176+
code: 200
177+
178+
description: Successful Response
179+
180+
- application/json:
181+
182+
code: 422
183+
184+
description: Validation Error
185+
186+
- application/json:
187+
188+
- $schema: HTTPValidationError
189+
190+
**Example Value**:
191+
192+
```json
193+
{
194+
"detail" : [
195+
{
196+
"loc" : [
197+
],
198+
"msg" : string,
199+
"type" : string
200+
}
201+
]
202+
}
203+
```
204+
205+
---
206+
207+
### **Components**
208+
209+
### Schemas
210+
211+
**Credentials**
212+
213+
**username**:
214+
215+
- **string**
216+
217+
- _required: true_
218+
219+
- _nullable: false_
220+
221+
**password**:
222+
223+
- **string**
224+
225+
- _required: true_
226+
227+
- _nullable: false_
228+
229+
**HTTPValidationError**
230+
231+
**detail**:
232+
233+
- **array [ ValidationError ]**
234+
235+
- _required: false_
236+
237+
- _nullable: false_
238+
239+
**ValidationError**
240+
241+
**loc**:
242+
243+
- _required: true_
244+
245+
- _nullable: false_
246+
247+
**msg**:
248+
249+
- **string**
250+
251+
- _required: true_
252+
253+
- _nullable: false_
254+
255+
**type**:
256+
257+
- **string**
258+
259+
- _required: true_
260+
261+
- _nullable: false_
262+
263+
---

backend/main.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from fastapi import FastAPI, HTTPException, Request
2+
from fastapi.encoders import jsonable_encoder
3+
from fastapi.responses import JSONResponse
4+
from fastapi.responses import RedirectResponse
5+
from fastapi.middleware.cors import CORSMiddleware
6+
7+
from routers import betterslcm
8+
9+
app = FastAPI()
10+
11+
12+
app.add_middleware(
13+
CORSMiddleware,
14+
allow_origin_regex=".*",
15+
allow_credentials=True,
16+
allow_methods=["*"],
17+
allow_headers=["*"],
18+
)
19+
20+
21+
@app.exception_handler(HTTPException)
22+
async def validation_exception_handler(request: Request, exc: HTTPException):
23+
return JSONResponse(
24+
status_code=exc.status_code, content=jsonable_encoder(exc.detail)
25+
)
26+
27+
28+
@app.get("/")
29+
async def redirect():
30+
return RedirectResponse("https://github.com/whyredfire/betterslcm")
31+
32+
33+
@app.get("/status")
34+
async def status():
35+
return {"message": "OK"}
36+
37+
38+
app.include_router(betterslcm.app, prefix="/api")

backend/requirements.txt

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
annotated-types==0.7.0
2+
anyio==4.9.0
3+
astroid==3.3.9
4+
beautifulsoup4==4.13.3
5+
bs4==0.0.2
6+
certifi==2025.1.31
7+
charset-normalizer==3.4.1
8+
click==8.1.8
9+
dill==0.3.9
10+
dnspython==2.7.0
11+
email_validator==2.2.0
12+
fastapi==0.115.11
13+
fastapi-cli==0.0.7
14+
h11==0.14.0
15+
httpcore==1.0.7
16+
httptools==0.6.4
17+
httpx==0.28.1
18+
idna==3.10
19+
isort==6.0.1
20+
Jinja2==3.1.6
21+
markdown-it-py==3.0.0
22+
MarkupSafe==3.0.2
23+
mccabe==0.7.0
24+
mdurl==0.1.2
25+
platformdirs==4.3.6
26+
pydantic==2.10.6
27+
pydantic_core==2.27.2
28+
Pygments==2.19.1
29+
pylint==3.3.5
30+
python-dotenv==1.0.1
31+
python-multipart==0.0.20
32+
PyYAML==6.0.2
33+
requests==2.32.3
34+
rich==13.9.4
35+
rich-toolkit==0.13.2
36+
roman==5.0
37+
shellingham==1.5.4
38+
sniffio==1.3.1
39+
soupsieve==2.6
40+
starlette==0.46.1
41+
tomlkit==0.13.2
42+
typer==0.15.2
43+
typing_extensions==4.12.2
44+
urllib3==2.3.0
45+
uvicorn==0.34.0
46+
uvloop==0.21.0
47+
watchfiles==1.0.4
48+
websockets==15.0.1

0 commit comments

Comments
 (0)