- GET /api/shop/endpoint
- PUT /api/shop/ban_vendor/{vendor_id}
- GET /api/shop/banned_vendors
- PUT /api/shop/unban_vendor/{vendor_id}
- PATCH /api/restore_shop/shop/{shop_id}
- GET /api/events/shop/actions
- PATCH /api/product/{id}
- GET /api/product/download/log
- PATCH /api/restore_product/{product_id}
-
Description: This endpoint handles GET requests and provides a simple message indicating the success of the request.
-
cURL:
curl -X GET https://spitfire-superadmin-1.onrender.com/api/shop/endpoint
-
POSTMAN:
- Method: GET
- URL:
https://spitfire-superadmin-1.onrender.com/api/shop/endpoint
-
Response:
{ "message": "This is the shop endpoint under /api/shop/endpoint" }
Replace {vendor_id}
with the actual UUID of the vendor.
-
Description: This endpoint handles PUT requests to ban a vendor by updating their shop data. If successful, it returns the details of the banned vendor.
-
cURL:
curl -X PUT https://spitfire-superadmin-1.onrender.com/api/shop/ban_vendor/{vendor_id}
-
POSTMAN:
- Method: PUT
- URL:
https://spitfire-superadmin-1.onrender.com/api/shop/ban_vendor/{vendor_id}
- Headers: None
- Body: None (Assuming the
vendor_id
is provided as a path variable)
-
Response:
{ "message": "Vendor account banned temporarily.", "vendor_details": { "id": "Vendor_ID", "merchant_id": "Merchant_ID", "name": "Vendor_Name", "policy_confirmation": "Policy_Confirmation", "restricted": "temporary", "admin_status": "suspended", "is_deleted": false, "reviewed": false, "rating": 0.0, "created_at": "Timestamp", "updated_at": "Timestamp" } }
-
Error (HTTP 400 - Vendor Already Banned):
{ "error": "Vendor is already banned." }
-
Error (HTTP 404 - Vendor Not Found):
{ "error": "Vendor not found." }
-
Description: This endpoint handles GET requests and retrieves a list of all temporarily banned vendors.
-
cURL:
curl -X GET https://spitfire-superadmin-1.onrender.com/api/shop/banned_vendors
-
POSTMAN:
- Method: GET
- URL:
https://spitfire-superadmin-1.onrender.com/api/shop/banned_vendors
- Headers: None
- Body: None
-
Response:
{ "message": "Banned vendors retrieved successfully.", "banned_vendors": [ { "id": "Vendor_ID", "merchant_id": "Merchant_ID", "name": "Vendor_Name", "policy_confirmation": "Policy_Confirmation", "restricted": "temporary", "admin_status": "suspended", "is_deleted": false, "reviewed": false, "rating": 0.0, "created_at": "Timestamp", "updated_at": "Timestamp" } // Additional banned vendor entries if available ] }
Unban a Vendor
-
Description: This endpoint is used to unban a vendor by updating their 'restricted' and 'admin_status' fields. The 'restricted' field is set to 'no' to indicate that the vendor is no longer restricted, and the 'admin_status' field is set to 'approved' to indicate that the vendor's status has been updated. Proper authentication and authorization checks should be added to secure this endpoint.
-
cURL:
curl -X PUT https://spitfire-superadmin-1.onrender.com/api/shop/unban_vendor/{vendor_id}
-
POSTMAN:
- Method: PUT
- URL:
https://spitfire-superadmin-1.onrender.com/api/shop/unban_vendor/{vendor_id}
- Headers:
Content-Type: application/json
- Body:
{ "status": "no" }
-
Path Variable:
{vendor_id}
: Unique identifier of the vendor to be unbanned.
-
Response:
{ "status": "Success", "message": "Vendor unbanned successfully.", "vendor_details": { "id": "Vendor_ID", "merchant_id": "Merchant_ID", "name": "Vendor_Name", "policy_confirmation": "Policy_Confirmation_Status", "restricted": "no", "admin_status": "approved", "is_deleted": "Shop_Deletion_Status", "reviewed": "Review_Status", "rating": "Vendor_Rating", "created_at": "Creation_Timestamp", "updated_at": "Last_Update_Timestamp" } }
-
Error (HTTP 404 - Vendor Not Found):
{ "status": "Error", "message": "Vendor not found." }
-
**Error (HTTP 400 - Vendor's Shop Not Active):
**
{
"status": "Error",
"message": "Vendor's shop is not active. Cannot unban."
}
- Error (HTTP 500 - Internal Server Error):
{ "message": "An error occurred.", "error": "Error_Message" }
Restore a Temporarily Deleted Shop
-
Description: This endpoint restores a temporarily deleted shop by setting its
is_deleted
attribute from "temporary" to "active". If the shop with the provided ID is not marked as deleted, it returns a success message indicating the same. -
cURL:
curl -X PATCH https://spitfire-superadmin-1.onrender.com/api/restore_shop/shop/{shop_id}
-
POSTMAN:
- Method: PATCH
- URL:
https://spitfire-superadmin-1.onrender.com/api/restore_shop/shop/{shop_id}
- Headers:
Content-Type: application/json
- Body:
{ "status": "temporary" }
-
Path Variable:
{shop_id}
: Unique identifier of the shop to be restored.
-
Response:
-
Success (HTTP 200 - Shop Restored Successfully):
{ "message": "Shop restored successfully" }
-
Success (HTTP 200 - Shop Not Marked as Deleted):
{ "message": "Shop is not marked as deleted" }
-
Error (HTTP 400 - Invalid JSON Data):
{ "error": "Bad Request", "message": "JSON data required" }
-
Error (HTTP 404 - Invalid Shop):
{ "error": "Not Found", "message": "Invalid shop" }
-
-
Description: This endpoint handles GET requests and retrieves a list of all shop-related actions from the event logs.
-
cURL:
curl -X GET https://spitfire-superadmin-1.onrender.com/api/events/shop/actions
-
POSTMAN:
- Method: GET
- URL:
https://spitfire-superadmin-1.onrender.com/api/events/shop/actions
- Headers: None
- Body: None
-
Response:
-
Success (HTTP 200):
[ { "id": "Action_ID", "shop_id": "Shop_ID", "action_type": "Action_Type", "timestamp": "Timestamp" }, // Additional shop action entries if available ]
-
Error (HTTP 500 - Internal Server Error):
{ "error": "Internal Server Error", "message": "An error occurred while processing the request" }
-
Replace {id}
with the ID of the product.
-
Description: This endpoint handles PATCH requests to temporarily delete a product by updating the 'is_deleted' field of the product in the database to 'temporary'. It also logs the action in the product_logs table.
-
cURL:
curl -X PATCH https://spitfire-superadmin-1.onrender.com/api/product/{id}
-
POSTMAN:
- Method: PATCH
- URL:
https://spitfire-superadmin-1.onrender.com/api/product/{id}
- Headers:
Content-Type: application/json
- Body:
{ "status": "temporary" }
-
Response:
-
Success (HTTP 200):
{ "message": "Product temporarily deleted", "data": null }
-
Error (HTTP 404 - Invalid Product):
{ "error": "Product not found", "message": "Invalid product" }
-
-
Description: This endpoint handles GET requests and allows downloading of product logs.
-
cURL:
curl -X GET https://spitfire-superadmin-1.onrender.com/api/product/download/log
-
POSTMAN:
- Method: GET
- URL:
https://spitfire-superadmin-1.onrender.com/api/product/download/log
Restore a Temporarily Deleted Product
-
Description: This endpoint restores a temporarily deleted product by setting its
is_deleted
attribute from "temporary" to "active". If the product with the provided ID is not marked as deleted, it returns a success message indicating the same. -
**
cURL:**
curl -X PATCH https://spitfire-superadmin-1.onrender.com/api/restore_product/{product_id}
-
POSTMAN:
- Method: PATCH
- URL:
https://spitfire-superadmin-1.onrender.com/api/restore_product/{product_id}
- Headers: None
- Body: None (Assuming the
product_id
is provided as a path variable)
-
Path Variable:
{product_id}
: Unique identifier of the product to be restored.
-
Response:
-
Success (HTTP 200):
{ "message": "Product restored successfully" }
-
Success (HTTP 200 - Product Not Marked as Deleted):
{ "message": "Product is not marked as deleted" }
-
Error (HTTP 404 - Invalid Product):
{ "error": "Invalid product", "message": "Product not found" }
-
These examples demonstrate how to make requests to the specified endpoints and provide detailed JSON responses for each endpoint's success and error scenarios using cURL and Postman. Remember to replace the dynamic path variables ({vendor_id}
and {id}
) with the correct values when making requests to the respective endpoints.
This is a template for the Shop
class, which appears to be part of a larger Python project. The Shop
class is defined within the context of a database, possibly using SQLAlchemy.
The Shop
class represents a shop in a system. It has various attributes and methods for managing shop-related data. Here's an overview of the class:
id
: A unique identifier for the shop.merchant_id
: A string representing the ID of the merchant who owns the shop. It's a foreign key referencing the "user" table.name
: The name of the shop.policy_confirmation
: A boolean indicating whether the shop has confirmed its policy.restricted
: An enumeration indicating the restriction status of the shop ('no'
,'temporary'
,'permanent'
).admin_status
: An enumeration indicating the admin status of the shop ('pending'
,'review'
,'approved'
,'blacklist'
).is_deleted
: An enumeration indicating the status of the shop ('active'
,'temporary'
).reviewed
: A boolean indicating whether the shop has been reviewed.rating
: A numeric rating for the shop.
__init__(self, merchant_id, name, policy_confimation, restricted, admin_status, is_deleted, reviewed, rating)
: Constructor method to initialize theShop
object with the provided attributes.__repr__(self)
: Returns an official representation of the object as a dictionary.format(self)
: Formats the object's attributes as a dictionary.
To create a new Shop
object, you can use the constructor as follows:
shop = Shop(merchant_id, name, policy_confirmation, restricted, admin_status, is_deleted, reviewed, rating)
- Endpoint: "/products"
- Description:This API provides endpoints for managing products..
- Description: Retrieve a list of products.
- Response:
- Status Code: 200
- Response Body:
{ "message": "List of products retrieved successfully.", "products": [ { "id": "product_id", "shop_id": "shop_id", "rating_id": "rating_id", "image_id": "image-id", "category_id": "catergory_id", "name": "username", "description": "notes", "quantity": "amount", "price": "price", "discount_price": "dis_price", "tax": "tax", "admin_status": "status", "is_deleted": "delete", "is_published": "boolean", "currency": "currency", "created_at": "time_created in UTCNow", "updated_at": "time_updated in UTCNow" } ] }
- Description: Create a new product.
- Response:
- Status Code: 201
- Response Body:
{ "id": "product_id", "shop_id": "shop_id", "rating_id": "rating_id", "image_id": "image-id", "category_id": "catergory_id", "name": "username", "description": "notes", "quantity": "amount", "price": "price", "discount_price": "dis_price", "tax": "tax", "admin_status": "status", "is_deleted": "delete", "is_published": "boolean", "currency": "currency", "created_at": "time_created in UTCNow", "updated_at": "time_updated in UTCNow" }
- Description: ID of the shop to which the product belongs.
- Type: string
- Description: ID of the product's rating.
- Type: string
- Description: ID of the product's image.
- Type: string
- Description: ID of the product's category.
- Type: string
- Description: Name of the product.
- Type: string
- Description: Description of the product.
- Type: string
- Description: Quantity of the product available.
- Type: integer
- Description: Price of the product.
- Type: numeric
- Description: Discounted price of the product.
- Type: numeric
- Description: Tax rate applied to the product.
- Type: numeric
- Description: Admin status of the product.
- Type: string
- Enum: ["pending", "review", "approved", "blacklist"]
- Description: Product status indicating whether it's active or temporary.
- Type: string
- Enum: ["active", "temporary"]
- Description: Flag indicating whether the product is published.
- Type: boolean
- Description: Currency code for the product's price.
- Type: string