- GET User Profile Info
- Edit User Profile Info
- Edit Username
- Edit Email
- Edit Gender
- Change Password
- Get User Profile Image
- Edit User Profile Image
- Get All Users
- User Login
- Admin Login
- User SignUp
- Purchase
- Get User Orders
- Cancel User Order
- Get All Orders
- Get All Products
- Get Product By ID Using Search Query
- Get Product By ID Using Query Params
- Create New Product
- Update Product
- Delete Product
- Upload Image
- Get Promoted Products
/profile
- Authorization: token
{
"username": "pass",
"email": "[email protected]",
"gender": "male",
}
/profile
- Authorization: token
{
"email": "[email protected]",
"username": "foo",
"gender": "male"
}
{
"email": "[email protected]",
"username": "foo",
"gender": "male"
}
/profile/username
- Authorization: token
- Content-Type: application/json
{
"username": "ahmed"
}
{
"username": "updated username"
}
/profile/email
- Authorization: token
- Content-Type: application/json
{
"email": "[email protected]"
}
{
"email": "updated email"
}
/profile/gender
- Authorization: token
- Content-Type: application/json
{
"gender": "female/male"
}
{
"gender": "male/female"
}
/profile/changepassword
- Authorization: token
- Content-Type: application/json
{
"oldPassword": "1234",
"newPassword": "12345"
}
{
"isUpdated": "true"
}
/profile/userImage
- Authorization: token
{
"userImage": "image url"
}
/profile/userImage
- Authorization: token
- Content-Type: multipart/form-data
{
"userImage": "actual image"
}
{
"userImage": "updated url image"
}
/profile/all
[
{
"_id": "63ec1ad0048d87baf78c10a3",
"username": "abdallahnagy",
"email": "abdallahnagy",
"password": "$2b$10$pf7N5n1uy9h9FsVXhhPiievOGP2qQ5gPc0cLS44t9pyPg72J0ZrSi",
"gender": "male",
"orders": [
"63ee8a1aa7275c207a25a1bc",
"63ee8ffe0ed264678a07bd6f",
"63ee8fff0ed264678a07bd74",
"63ee90659c958f6618044fec",
"63ee90669c958f6618044ff1",
"63ee91357b9e04c6db5beb2b",
"63ee93068aecead3066f2847",
"63ee9400ca8c05c234379b0d",
"63ee94905f424bea2c86b80f"
],
"__v": 33,
"userImage": "http://localhost:3000/63ec1ad0048d87baf78c10a3_man.png"
}
]
/reg/login
- Authorization: token
- Content-Type: application/json
{
"email": "[email protected]",
"password": "1234"
}
{
"accessToken": "token"
}
/admin/login
- Authorization: token
- Content-Type: application/json
{
"email": "[email protected]",
"password": "1234"
}
{
"accessToken": "token"
}
/reg/signup
- Authorization: token
- Content-Type: application/json
{
"username": "username",
"email": "[email protected]",
"password": "1234",
"confirmPassword": "1234",
"gender": "male/female"
}
{
"accessToken": "token"
}
/purchase
- Authorization: token
- Content-Type: application/json
["product1 id", "product2 id"]
returns list of orders
[
{
"_id": "63e9c8fce1e5bff66fc1d029",
"userId": "63e4827cb01cc4b8fac999de",
"productId": "63e961c66b87884e29323042",
"status": "pending",
"__v": 0
},
{
"_id": "63e9c8fce1e5bff66fc1d02c",
"userId": "63e4827cb01cc4b8fac999de",
"productId": "63e962176b87884e29323044",
"status": "pending",
"__v": 0
}
]
/orders
- Authorization: token
- Content-Type: application/json
returns list of user orders
[
{
"_id": "63e963956b87884e29323048",
"userId": "63e4827cb01cc4b8fac999de",
"productId": {
"_id": "63e961c66b87884e29323042",
"name": "coffee",
"price": 10,
"description": "amazing drink",
"__v": 0
},
"status": "pending",
"__v": 0
}
]
/orders/?orderId=123
- Authorization: token
- Content-Type: application/json
returns list of user orders
{
"isCanceled": true
}
/orders/:id
- Content-Type: application/json
returns the updated order
{
"_id": "63f3188ad34d710d4d788f90",
"userId": "63f1019235616e754b68a208",
"productId": "63eb407c7f213bc350607f4d",
"amount": 1,
"totalPrice": 150,
"status": "rejected/accepted",
"__v": 0
}
/orders/all
returns array of orders
[
{
"_id": "63f1ac6a26fee32859ec797e",
"userId": {
"_id": "63f11ab5b373b70370958065",
"username": "karim",
"email": "[email protected]",
"password": "$2b$10$dFzAqskqhKJeRBiiR9aH..yMI0cBYRsJeRV4q3aintiaTIdILxuZq",
"gender": "male",
"userImage": "http://localhost:3000/defProfileImage.png",
"orders": [
"63f1aa72e5b78b2acc4c8be9",
"63f1aaabe5b78b2acc4c8bfa",
"63f1ac6926fee32859ec7979",
"63f1ac6a26fee32859ec797e"
],
"__v": 6
},
"productId": {
"_id": "63eb410f87e48a6731b4cc4c",
"name": "Glacé",
"price": 150,
"description": "Amazing",
"photo": "http://localhost:3000/14Glacé.jpg",
"__v": 0
},
"amount": 1,
"totalPrice": 150,
"status": "pending",
"__v": 0
}
]
/api/products
{
"success": true,
"count": 2,
"data": [
{
"_id": "63e8f2031ebb0a2061cb1009",
"name": "Latte",
"price": 13.2,
"description": "Amazing Latte",
"photo": "http://localhost:3000/3Latte.jpg",
"__v": 0
}
,
{
"_id": "63e8f2031ebb0a2061cb1509",
"name": "Tea",
"price": 13.2,
"description": "Amazing Coffee",
"photo": "http://localhost:3000/Tea.jpg",
"__v": 0
}
]
}
/api/products?searchQuery
{
"success": true,
"count": 1,
"data": [
{
"_id": "63e8f2031ebb0a2061cb1009",
"name": "Latte",
"price": 13.2,
"description": "Amazing Coffee",
"photo": "http://localhost:3000/3Latte.jpg",
"__v": 0
}
}
/api/products/:id
{
"success": true,
"data": {
"_id": "63e8f1e71ebb0a2061cb1007",
"name": "FrenchCappuccino",
"price": 40,
"description": "Amazing Juice",
"photo": "http://localhost:3000/7FrenchCappuccino.jpg",
"__v": 0
}
}
/api/products
- Content-Type: application/json
{
"success": true,
"data": {
"_id": "63e8f1e71ebb0a2061cb1007",
"name": "FrenchCappuccino",
"price": 40,
"description": "Amazing Juice",
"photo": "http://localhost:3000/7FrenchCappuccino.jpg",
"__v": 0
}
}
/api/products/:id
- Content-Type: application/json
{
"success": true,
"data": {
"_id": "63e8f1e71ebb0a2061cb1007",
"name": "FrenchCappuccino",
"price": 40,
"description": "Amazing Juice",
"photo": "http://localhost:3000/7FrenchCappuccino.jpg",
"__v": 0
}
}
/api/products/:id
204 No Content
/api/products/:id/photo
- Content-Type: multipart/form-data
{
"success": true,
"data":"http://localhost:3000/7FrenchCappuccino.jpg"
}
/promotions
[
{
"_id": "63e8f2031ebb0a2061cb1009",
"name": "Latte",
"price": 13.2,
"description": "Amazing Coffee",
"photo": "http://localhost:3000/3Latte.jpg"
}
]