Skip to content

Commit 2f8d919

Browse files
committed
Initial commit
0 parents  commit 2f8d919

33 files changed

+7478
-0
lines changed

.bolt/config.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"template": "bolt-vite-react-ts"
3+
}

.bolt/modified.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

.bolt/prompt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
For all designs I ask you to make, have them be beautiful, not cookie cutter. Make webpages that are fully featured and worthy for production.
2+
3+
By default, this template supports JSX syntax with Tailwind CSS classes, React hooks, and Lucide React for icons. Do not install other packages for UI themes, icons, etc unless absolutely necessary or I request them.
4+
5+
Use icons from lucide-react for logos.
6+
7+
Use stock photos from unsplash where appropriate, only valid URLs you know exist. Do not download the images, only link to them in image tags.
8+

.env

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MONGODB_URI=mongodb://localhost:27017/home_delivery_app
2+
JWT_SECRET=your_jwt_secret_here
3+
GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here

.eslintrc.cjs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:@typescript-eslint/recommended',
7+
'plugin:react-hooks/recommended',
8+
],
9+
ignorePatterns: ['dist', '.eslintrc.cjs'],
10+
parser: '@typescript-eslint/parser',
11+
plugins: ['react-refresh'],
12+
rules: {
13+
'react-refresh/only-export-components': [
14+
'warn',
15+
{ allowConstantExport: true },
16+
],
17+
},
18+
}

.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# bolt-vite-react-ja7iay
2+
3+
[Edit in StackBlitz next generation editor ⚡️](https://stackblitz.com/~/github.com/988yas/bolt-vite-react-ja7iay)

eslint.config.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
7+
export default tseslint.config(
8+
{ ignores: ['dist'] },
9+
{
10+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11+
files: ['**/*.{ts,tsx}'],
12+
languageOptions: {
13+
ecmaVersion: 2020,
14+
globals: globals.browser,
15+
},
16+
plugins: {
17+
'react-hooks': reactHooks,
18+
'react-refresh': reactRefresh,
19+
},
20+
rules: {
21+
...reactHooks.configs.recommended.rules,
22+
'react-refresh/only-export-components': [
23+
'warn',
24+
{ allowConstantExport: true },
25+
],
26+
},
27+
},
28+
)

index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React + TS</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

models/Order.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import mongoose from 'mongoose';
2+
3+
const orderSchema = new mongoose.Schema({
4+
client: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
5+
restaurant: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
6+
courier: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },
7+
items: [{
8+
name: String,
9+
price: Number,
10+
quantity: Number
11+
}],
12+
totalPrice: { type: Number, required: true },
13+
status: {
14+
type: String,
15+
enum: ['pending', 'preparing', 'ready_for_pickup', 'in_transit', 'delivered', 'cancelled'],
16+
default: 'pending'
17+
},
18+
deliveryAddress: { type: String, required: true },
19+
currentLocation: {
20+
type: { type: String, default: 'Point' },
21+
coordinates: { type: [Number], default: [0, 0] }
22+
}
23+
}, { timestamps: true });
24+
25+
orderSchema.index({ currentLocation: '2dsphere' });
26+
27+
export default mongoose.model('Order', orderSchema);

models/User.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import mongoose from 'mongoose';
2+
import bcrypt from 'bcryptjs';
3+
4+
const userSchema = new mongoose.Schema({
5+
name: { type: String, required: true },
6+
email: { type: String, required: true, unique: true },
7+
password: { type: String, required: true },
8+
role: { type: String, enum: ['client', 'restaurant', 'courier', 'admin'], required: true },
9+
address: { type: String },
10+
phone: { type: String },
11+
}, { timestamps: true });
12+
13+
userSchema.pre('save', async function(next) {
14+
if (!this.isModified('password')) return next();
15+
this.password = await bcrypt.hash(this.password, 12);
16+
next();
17+
});
18+
19+
userSchema.methods.comparePassword = async function(candidatePassword) {
20+
return await bcrypt.compare(candidatePassword, this.password);
21+
};
22+
23+
export default mongoose.model('User', userSchema);

0 commit comments

Comments
 (0)