Skip to content

Commit 630ae28

Browse files
Tayeb-AliTayeb-Ali
Tayeb-Ali
authored and
Tayeb-Ali
committed
Fix issus
1 parent 4a418fe commit 630ae28

File tree

3 files changed

+68
-5
lines changed

3 files changed

+68
-5
lines changed

src/models/Salon.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import mongoose from 'mongoose';
2+
3+
const Schmea = mongoose.Schema;
4+
5+
const salonSchema = new Schmea({
6+
name: {
7+
type: String,
8+
required: "Name is required"
9+
},
10+
details: {
11+
type: String,
12+
// lowercase: true,
13+
// match: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/,
14+
required: "description is required"
15+
},
16+
image: {
17+
type: String,
18+
required: "image is required"
19+
},
20+
Address: {
21+
type: String,
22+
required: "Address is required"
23+
},
24+
lat: {
25+
type: Number,
26+
required: "Latitude is required"
27+
},
28+
lng: {
29+
type: Number,
30+
required: "Longitude is required"
31+
32+
},
33+
logo: {
34+
type: String,
35+
// required: "Logo is required"
36+
},
37+
admin_id: {
38+
type: String,
39+
}
40+
});
41+
42+
const Salon = mongoose.model("Salon", salonSchema);
43+
44+
export default Salon;

src/models/User.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import mongoose from 'mongoose';
2+
3+
const Schmea = mongoose.Schema;
4+
5+
const userSchema = new Schmea({
6+
name: {
7+
type: String,
8+
required: "Name is required"
9+
},
10+
email: {
11+
type: String,
12+
lowercase: true,
13+
match: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/,
14+
required: "Email is required"
15+
},
16+
password: {
17+
type: String,
18+
required: "Password is required"
19+
}
20+
});
21+
22+
const User = mongoose.model("User", userSchema);
23+
24+
export default User;

src/routes/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ router.post('/users/register',
1515
validate(SaveUser),
1616
asyncMethod(userController.register)
1717
);
18-
router.post('/salon', asyncMethod(salonController.salon()));
19-
router.post('/', asyncMethod(salonController.index()));
20-
21-
// router.get('/v2/salon', asyncMethod(isLogggedIn), salonController.index());
22-
2318
router.post('/users/login', asyncMethod(userController.login));
2419
router.get('/users/me', asyncMethod(isLogggedIn), userController.getData);
2520

0 commit comments

Comments
 (0)