{"openapi":"3.0.3","info":{"title":"Anti Bots API","description":"API REST completa para la plataforma Anti Bots.","version":"1.0"},"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/antibots/AntiBots/1.0"},{"url":"http://localhost:4000/api"}],"tags":[{"name":"Authentication"},{"name":"Admin"},{"name":"Customer"},{"name":"Products"},{"name":"Product Types"},{"name":"Materials"},{"name":"Material Types"},{"name":"Publications"},{"name":"Comments"},{"name":"Cart"},{"name":"Orders"},{"name":"Quotes"},{"name":"Dashboard"}],"components":{"securitySchemes":{"cookieAuth":{"type":"apiKey","in":"cookie","name":"token"}},"schemas":{"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}},"LoginAdmin":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","example":"admin@gmail.com"},"password":{"type":"string","example":"Admin123"}}},"LoginCustomer":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","example":"cliente@gmail.com"},"password":{"type":"string","example":"Cliente123"}}},"Admin":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f123"},"name":{"type":"string","example":"Edwin"},"lastName":{"type":"string","example":"Alfaro"},"email":{"type":"string","example":"admin@gmail.com"},"phone":{"type":"string","example":"77778888"},"role":{"type":"string","example":"Administrator"},"state":{"type":"boolean","example":true}}},"RegisterAdmin":{"type":"object","required":["name","lastName","email","password"],"properties":{"name":{"type":"string","example":"Edwin"},"lastName":{"type":"string","example":"Alfaro"},"email":{"type":"string","example":"admin@gmail.com"},"phone":{"type":"string","example":"77778888"},"password":{"type":"string","example":"Admin123"}}},"Customer":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f999"},"name":{"type":"string","example":"Juan"},"lastName":{"type":"string","example":"Pérez"},"email":{"type":"string","example":"juan@gmail.com"},"phone":{"type":"string","example":"77778888"},"address":{"type":"string","example":"San Salvador"},"state":{"type":"boolean","example":true}}},"RegisterCustomer":{"type":"object","required":["name","lastName","email","password"],"properties":{"name":{"type":"string","example":"Juan"},"lastName":{"type":"string","example":"Pérez"},"email":{"type":"string","example":"juan@gmail.com"},"password":{"type":"string","example":"Cliente123"},"phone":{"type":"string","example":"77778888"},"address":{"type":"string","example":"San Salvador"}}},"Product":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f000"},"name":{"type":"string","example":"Mesa Industrial"},"description":{"type":"string","example":"Mesa fabricada en madera y hierro."},"price":{"type":"number","example":125.5},"stock":{"type":"integer","example":15},"typeProductId":{"type":"string","example":"6843abf5c4b67e2e4b91f999"}}},"ProductType":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f999"},"name":{"type":"string","example":"Muebles"},"description":{"type":"string","example":"Mobiliario de interior y exterior"}}},"Material":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f333"},"name":{"type":"string","example":"Roble"},"materialTypeId":{"type":"string","example":"6843abf5c4b67e2e4b91f444"},"unitPrice":{"type":"number","example":15.0}}},"MaterialType":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f444"},"name":{"type":"string","example":"Madera"}}},"Publication":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f555"},"title":{"type":"string","example":"Lanzamiento de la nueva colección"},"content":{"type":"string","example":"Descubre nuestros nuevos diseños industriales."},"image":{"type":"string","example":"https://res.cloudinary.com/demo/publication.jpg"}}},"Comment":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f666"},"publicationId":{"type":"string","example":"6843abf5c4b67e2e4b91f555"},"customerId":{"type":"string","example":"6843abf5c4b67e2e4b91f999"},"content":{"type":"string","example":"¡Excelente diseño, me encanta!"}}},"CartItem":{"type":"object","properties":{"productId":{"type":"string","example":"6843abf5c4b67e2e4b91f000"},"quantity":{"type":"integer","example":2}}},"Cart":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f777"},"customerId":{"type":"string","example":"6843abf5c4b67e2e4b91f999"},"items":{"type":"array","items":{"$ref":"#/components/schemas/CartItem"}}}},"Order":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91f888"},"customerId":{"type":"string","example":"6843abf5c4b67e2e4b91f999"},"totalAmount":{"type":"number","example":251.0},"status":{"type":"string","enum":["Pending","Processing","Completed","Cancelled"],"example":"Pending"}}},"Quote":{"type":"object","properties":{"_id":{"type":"string","example":"6843abf5c4b67e2e4b91fAAA"},"customerId":{"type":"string","example":"6843abf5c4b67e2e4b91f999"},"description":{"type":"string","example":"Cotización para mesa personalizada de 2x1m."},"estimatedPrice":{"type":"number","example":350.0},"status":{"type":"string","enum":["Requested","Approved","Rejected"],"example":"Requested"}}}}},"paths":{"/loginAdmin":{"post":{"tags":["Authentication"],"summary":"Iniciar sesión administrador","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginAdmin"}}}},"responses":{"200":{"description":"OK"}}}},"/loginCustomer":{"post":{"tags":["Authentication"],"summary":"Iniciar sesión cliente","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginCustomer"}}}},"responses":{"200":{"description":"OK"}}}},"/logout":{"post":{"tags":["Authentication"],"summary":"Cerrar sesión","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"OK"}}}},"/admin":{"get":{"tags":["Admin"],"summary":"Obtener todos los administradores","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Admin"}}}}}}},"post":{"tags":["Admin"],"summary":"Crear administrador","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterAdmin"}}}},"responses":{"201":{"description":"Creado"}}}},"/admin/{id}":{"get":{"tags":["Admin"],"summary":"Obtener administrador por ID","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"put":{"tags":["Admin"],"summary":"Actualizar administrador","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterAdmin"}}}},"responses":{"200":{"description":"OK"}}},"delete":{"tags":["Admin"],"summary":"Eliminar administrador","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/customer":{"get":{"tags":["Customer"],"summary":"Obtener todos los clientes","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}}}}}}},"post":{"tags":["Customer"],"summary":"Registrar nuevo cliente","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterCustomer"}}}},"responses":{"201":{"description":"Creado"}}}},"/customer/{id}":{"get":{"tags":["Customer"],"summary":"Obtener cliente por ID","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"put":{"tags":["Customer"],"summary":"Actualizar cliente","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterCustomer"}}}},"responses":{"200":{"description":"OK"}}},"delete":{"tags":["Customer"],"summary":"Eliminar cliente","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/product":{"get":{"tags":["Products"],"summary":"Obtener todos los productos","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Product"}}}}}}},"post":{"tags":["Products"],"summary":"Crear producto","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"responses":{"201":{"description":"Creado"}}}},"/product/{id}":{"get":{"tags":["Products"],"summary":"Obtener producto por ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"put":{"tags":["Products"],"summary":"Actualizar producto","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"responses":{"200":{"description":"OK"}}},"delete":{"tags":["Products"],"summary":"Eliminar producto","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/productType":{"get":{"tags":["Product Types"],"summary":"Obtener tipos de productos","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProductType"}}}}}}},"post":{"tags":["Product Types"],"summary":"Crear tipo de producto","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}}}}}},"responses":{"201":{"description":"Creado"}}}},"/productType/{id}":{"get":{"tags":["Product Types"],"summary":"Obtener tipo de producto por ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"put":{"tags":["Product Types"],"summary":"Actualizar tipo de producto","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"}}},"delete":{"tags":["Product Types"],"summary":"Eliminar tipo de producto","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/material":{"get":{"tags":["Materials"],"summary":"Obtener todos los materiales","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Material"}}}}}}},"post":{"tags":["Materials"],"summary":"Crear material","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","materialTypeId","unitPrice"],"properties":{"name":{"type":"string"},"materialTypeId":{"type":"string"},"unitPrice":{"type":"number"}}}}}},"responses":{"201":{"description":"Creado"}}}},"/material/{id}":{"get":{"tags":["Materials"],"summary":"Obtener material por ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"put":{"tags":["Materials"],"summary":"Actualizar material","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"materialTypeId":{"type":"string"},"unitPrice":{"type":"number"}}}}}},"responses":{"200":{"description":"OK"}}},"delete":{"tags":["Materials"],"summary":"Eliminar material","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/materialType":{"get":{"tags":["Material Types"],"summary":"Obtener tipos de materiales","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MaterialType"}}}}}}},"post":{"tags":["Material Types"],"summary":"Crear tipo de material","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Creado"}}}},"/materialType/{id}":{"get":{"tags":["Material Types"],"summary":"Obtener tipo de material por ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"put":{"tags":["Material Types"],"summary":"Actualizar tipo de material","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"}}},"delete":{"tags":["Material Types"],"summary":"Eliminar tipo de material","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/publication":{"get":{"tags":["Publications"],"summary":"Obtener publicaciones","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Publication"}}}}}}},"post":{"tags":["Publications"],"summary":"Crear publicación","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title","content"],"properties":{"title":{"type":"string"},"content":{"type":"string"},"image":{"type":"string"}}}}}},"responses":{"201":{"description":"Creado"}}}},"/publication/{id}":{"get":{"tags":["Publications"],"summary":"Obtener publicación por ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"put":{"tags":["Publications"],"summary":"Actualizar publicación","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"content":{"type":"string"},"image":{"type":"string"}}}}}},"responses":{"200":{"description":"OK"}}},"delete":{"tags":["Publications"],"summary":"Eliminar publicación","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/comment":{"get":{"tags":["Comments"],"summary":"Obtener comentarios","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Comment"}}}}}}},"post":{"tags":["Comments"],"summary":"Agregar comentario","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["publicationId","customerId","content"],"properties":{"publicationId":{"type":"string"},"customerId":{"type":"string"},"content":{"type":"string"}}}}}},"responses":{"201":{"description":"Creado"}}}},"/comment/{id}":{"delete":{"tags":["Comments"],"summary":"Eliminar comentario","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}}},"/cart/{customerId}":{"get":{"tags":["Cart"],"summary":"Obtener carrito de un cliente","security":[{"cookieAuth":[]}],"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Cart"}}}}}}},"/cart/add":{"post":{"tags":["Cart"],"summary":"Agregar ítem al carrito","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["customerId","productId","quantity"],"properties":{"customerId":{"type":"string"},"productId":{"type":"string"},"quantity":{"type":"integer"}}}}}},"responses":{"200":{"description":"Ítem añadido"}}}},"/cart/remove":{"post":{"tags":["Cart"],"summary":"Eliminar ítem del carrito","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["customerId","productId"],"properties":{"customerId":{"type":"string"},"productId":{"type":"string"}}}}}},"responses":{"200":{"description":"Ítem removido"}}}},"/order":{"get":{"tags":["Orders"],"summary":"Obtener todos los pedidos","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Order"}}}}}}},"post":{"tags":["Orders"],"summary":"Crear un nuevo pedido","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["customerId","totalAmount"],"properties":{"customerId":{"type":"string"},"totalAmount":{"type":"number"}}}}}},"responses":{"201":{"description":"Pedido creado"}}}},"/order/{id}":{"get":{"tags":["Orders"],"summary":"Obtener pedido por ID","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"put":{"tags":["Orders"],"summary":"Actualizar estado de un pedido","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["Pending","Processing","Completed","Cancelled"]}}}}}},"responses":{"200":{"description":"OK"}}}},"/quote":{"get":{"tags":["Quotes"],"summary":"Obtener todas las cotizaciones","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Quote"}}}}}}},"post":{"tags":["Quotes"],"summary":"Crear solicitud de cotización","security":[{"cookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["customerId","description"],"properties":{"customerId":{"type":"string"},"description":{"type":"string"}}}}}},"responses":{"201":{"description":"Cotización solicitada"}}}},"/quote/{id}":{"get":{"tags":["Quotes"],"summary":"Obtener cotización por ID","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"}}},"put":{"tags":["Quotes"],"summary":"Responder/Actualizar cotización","security":[{"cookieAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"estimatedPrice":{"type":"number"},"status":{"type":"string","enum":["Requested","Approved","Rejected"]}}}}}},"responses":{"200":{"description":"OK"}}}},"/dashboard/stats":{"get":{"tags":["Dashboard"],"summary":"Obtener estadísticas generales para el panel de administración","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"totalSales":{"type":"number","example":10450.0},"totalOrders":{"type":"integer","example":84},"totalCustomers":{"type":"integer","example":120},"totalProducts":{"type":"integer","example":45}}}}}}}}}}}