Skip to content

Latest commit

 

History

History
253 lines (199 loc) · 4.2 KB

README.md

File metadata and controls

253 lines (199 loc) · 4.2 KB

Appointment-maker-api

This API provides functionalities for managing appointments efficiently, facilitating communication between admins and users. Below are the key routes and controllers along with example API responses:

Routes and Controllers

Admin Operations

1. POST /registeradmin

Register a new admin.

Example:

Request:
{
    "email": "[email protected]",
    "name": "Admin Name",
    "password": "admin123",
    "shop": "My Shop"
}

Response:
{
    "msg": "success",
    "token": "jwt_token_here"
}

2. POST /adminlogin

Admin login.

Example:

Request:
{
    "email": "[email protected]",
    "password": "admin123"
}

Response:
{
    "msg": "success",
    "token": "jwt_token_here"
}

3. POST /adminslot

Update admin's working slots.

Example:

Request:
{
    "name": "My Shop",
    "Object": {"Monday": "9AM-5PM", "Tuesday": "9AM-5PM", ...}
}

Response:
{
    "msg": "Updated successfully"
}

4. GET /getapp/:id

Get appointments for a specific admin.

Example:

Response:
{
    "app": [
        {"user": "user_id_1", "service": "Service 1", ...},
        {"user": "user_id_2", "service": "Service 2", ...},
        ...
    ]
}

5. POST /setcomp

Set appointment as completed.

Example:

Request:
{
    "adminemail": "[email protected]",
    "time": "14:00"
}

Response:
{
    "msg": "Appointment marked as completed"
}

6. GET /allapp/:id

Get all appointments for a specific admin.

Example:

Response:
{
    "appointments": [
        {"user": "user_id_1", "service": "Service 1", ...},
        {"user": "user_id_2", "service": "Service 2", ...},
        ...
    ]
}

7. GET /getslot/:id

Get specific working slots for an admin.

Example:

Response:
{
    "slots": {"Monday": "9AM-5PM", "Tuesday": "9AM-5PM", ...}
}

8. GET /shops

Get a list of all shops.

Example:

Response:
{
    "all": [
        {"shopName": "Shop 1", ...},
        {"shopName": "Shop 2", ...},
        ...
    ]
}

9. GET /shops/:id

Get specific information about a shop.

Example:

Response:
{
    "shop": "Shop Name",
    "slots": {"Monday": "9AM-5PM", "Tuesday": "9AM-5PM", ...}
}

User Operations

10. POST /registeruser

Register a new user.

Example:

Request:
{
    "email": "[email protected]",
    "name": "User Name",
    "password": "user123"
}

Response:
{
    "msg": "success",
    "token": "jwt_token_here"
}

11. POST /userlogin

User login.

Example:

Request:
{
    "email": "[email protected]",
    "password": "user123"
}

Response:
{
    "msg": "success",
    "token": "jwt_token_here"
}

12. GET /shops

Get a list of all shops.

Example:

Response:
{
    "all": [
        {"shopName": "Shop 1", ...},
        {"shopName": "Shop 2", ...},
        ...
    ]
}

13. GET /shops/:id

Get specific information about a shop.

Example:

Response:
{
    "shop": "Shop Name",
    "slots": {"Monday": "9AM-5PM", "Tuesday": "9AM-5PM", ...}
}

14. POST /makeapp

Make a new appointment.

Example:

Request:
{
    "userid": "user_id",
    "name": "Shop Name",
    "service": "Service Name",
    "date": "2022-02-28",
    "day": "Monday",
    "time": "14:00",
    "msg": "Additional Message",
    "Object": {"custom_field_1": "value_1", "custom_field_2": "value_2"},
    "useremail": "[email protected]"
}

Response:
{
    "msg": "Appointment created successfully"
}

This documentation provides a comprehensive overview of the API routes and expected responses. Ensure that you handle errors and edge cases appropriately in your implementation.