Skip to content

Conflict edits regarding settings.py + urls.py #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c189116
Adding to temporary changes to Github
fardowza May 23, 2025
378da6e
Docker API
fardowza May 27, 2025
c1f1ec6
Django Car makes edits
fardowza May 27, 2025
8dcbe57
Module 3 par 2
fardowza Jun 9, 2025
a5253aa
Implement user registration, login, and logout features
nati416 Jun 10, 2025
2a7b93d
Module 1 changes.
nadra-m Jun 10, 2025
1807de9
Conflict edits settings.py + urls.py
nadra-m Jun 10, 2025
f367160
Merge branch 'main' into fardowza-edits
fardowza Jun 10, 2025
0599988
Merge pull request #1 from fardowza/fardowza-edits
fardowza Jun 10, 2025
c078f4b
Merge branch 'main' into new-nadra
nadra-m Jun 10, 2025
a6a8a03
Merge pull request #3 from fardowza/new-nadra
nadra-m Jun 10, 2025
f5418bd
bug
fardowza Jun 10, 2025
f29ca1d
Create main.yml
fardowza Jun 11, 2025
262544d
Update main.yml
fardowza Jun 11, 2025
86fbe59
Update main.yml
fardowza Jun 11, 2025
cf4dec1
Update inventory.js
fardowza Jun 11, 2025
cd3206b
Update dealership.js
fardowza Jun 11, 2025
77ce874
Update app.js
fardowza Jun 11, 2025
0128884
Update review.js
fardowza Jun 11, 2025
263926d
Update app.js
fardowza Jun 11, 2025
254329f
Update app.js
fardowza Jun 11, 2025
265a8fa
Update settings.py
fardowza Jun 11, 2025
d3af30b
Update settings.py
fardowza Jun 11, 2025
0867f66
Update views.py
fardowza Jun 11, 2025
0622ac7
Update views.py
fardowza Jun 11, 2025
1126d79
Update views.py
fardowza Jun 11, 2025
8be8f93
Update views.py
fardowza Jun 11, 2025
66db7c6
Update views.py
fardowza Jun 11, 2025
404fce5
Update views.py
fardowza Jun 11, 2025
b849010
Update views.py
fardowza Jun 11, 2025
35006f2
Update views.py
fardowza Jun 11, 2025
76158be
Update views.py
fardowza Jun 11, 2025
c18b3be
Contact page
nadra-m Jun 12, 2025
8f4d90e
Module 5 part 2
fardowza Jun 18, 2025
1691a00
Update urls.py
fardowza Jun 18, 2025
4296cf8
Update restapis.py
fardowza Jun 18, 2025
91cf12d
Update restapis.py
fardowza Jun 18, 2025
3d60146
Lint Collector Update
nadra-m Jun 24, 2025
9cef021
Lint Collector Update
nadra-m Jun 24, 2025
3774e68
Module 4&5
fardowza Jun 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
59 changes: 59 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 'Lint Code'

on:
push:
branches: [master, main]
pull_request:
branches: [master, main]

jobs:
lint_python:
name: Lint Python Files
runs-on: ubuntu-latest

steps:

- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8

- name: Print working directory
run: pwd

- name: Run Linter
run: |
pwd
# This command finds all Python files recursively and runs flake8 on them
find . -name "*.py" -exec flake8 {} +
echo "Linted all the python files successfully"

lint_js:
name: Lint JavaScript Files
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 14

- name: Install JSHint
run: npm install jshint --global

- name: Run Linter
run: |
# This command finds all JavaScript files recursively and runs JSHint on them
find ./server/database -name "*.js" -exec jshint {} +
echo "Linted all the js files successfully"
25 changes: 25 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM python:3.12.0-slim-bookworm

ENV PYTHONBUFFERED 1
ENV PYTHONWRITEBYTECODE 1

ENV APP=/app

# Change the workdir.
WORKDIR $APP

# Install the requirements
COPY requirements.txt $APP

RUN pip3 install -r requirements.txt

# Copy the rest of the files
COPY . $APP

EXPOSE 8000

RUN chmod +x /app/entrypoint.sh

ENTRYPOINT ["/bin/bash","/app/entrypoint.sh"]

CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "djangoproj.wsgi"]
51 changes: 35 additions & 16 deletions server/database/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*jshint esversion: 8 */
const express = require('express');
const mongoose = require('mongoose');
const fs = require('fs');
const cors = require('cors')
const app = express()
const cors = require('cors');
const app = express();
const port = 3030;

app.use(cors())
app.use(cors());
app.use(require('body-parser').urlencoded({ extended: false }));

const reviews_data = JSON.parse(fs.readFileSync("reviews.json", 'utf8'));
Expand All @@ -20,10 +21,10 @@ const Dealerships = require('./dealership');

try {
Reviews.deleteMany({}).then(()=>{
Reviews.insertMany(reviews_data['reviews']);
Reviews.insertMany(reviews_data.reviews);
});
Dealerships.deleteMany({}).then(()=>{
Dealerships.insertMany(dealerships_data['dealerships']);
Dealerships.insertMany(dealerships_data.dealerships);
});

} catch (error) {
Expand All @@ -33,7 +34,7 @@ try {

// Express route to home
app.get('/', async (req, res) => {
res.send("Welcome to the Mongoose API")
res.send("Welcome to the Mongoose API");
});

// Express route to fetch all reviews
Expand All @@ -59,34 +60,52 @@ app.get('/fetchReviews/dealer/:id', async (req, res) => {
// Express route to fetch all dealerships
app.get('/fetchDealers', async (req, res) => {
//Write your code here
try {
const documents = await Dealerships.find();
res.json(documents);
} catch (error) {
res.status(500).json({ error: 'Error fetching documents of Dealership' });
}
});

// Express route to fetch Dealers by a particular state
app.get('/fetchDealers/:state', async (req, res) => {
//Write your code here
try {
const documents = await Dealerships.find({state: req.params.state});
res.json(documents);
} catch (error) {
res.status(500).json({ error: 'Error fetching documents of Dealership' });
}
});

// Express route to fetch dealer by a particular id
app.get('/fetchDealer/:id', async (req, res) => {
//Write your code here
try {
const documents = await Dealerships.find({id: req.params.id});
res.json(documents);
} catch (error) {
res.status(500).json({ error: 'Error fetching documents of Dealership' });
}
});

//Express route to insert review
app.post('/insert_review', express.raw({ type: '*/*' }), async (req, res) => {
data = JSON.parse(req.body);
const documents = await Reviews.find().sort( { id: -1 } )
let new_id = documents[0]['id']+1
const documents = await Reviews.find().sort( { id: -1 } );
let new_id = documents[0].id+1;

const review = new Reviews({
"id": new_id,
"name": data['name'],
"dealership": data['dealership'],
"review": data['review'],
"purchase": data['purchase'],
"purchase_date": data['purchase_date'],
"car_make": data['car_make'],
"car_model": data['car_model'],
"car_year": data['car_year'],
"name": data.name,
"dealership": data.dealership,
"review": data.review,
"purchase": data.purchase,
"purchase_date": data.purchase_date,
"car_make": data.car_make,
"car_model": data.car_model,
"car_year": data.car_year,
});

try {
Expand Down
1 change: 1 addition & 0 deletions server/database/dealership.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint esversion: 8 */
const mongoose = require('mongoose');

const Schema = mongoose.Schema;
Expand Down
1 change: 1 addition & 0 deletions server/database/inventory.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint esversion: 8 */
const { Int32 } = require('mongodb');
const mongoose = require('mongoose');

Expand Down
1 change: 1 addition & 0 deletions server/database/node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading