Sistemas de Base de datos, grupo 9
- PAIS: Created with a sequence
pais_seq
and a check constraint oncontinente
. - SUBASTADORA: Created with a sequence
subastadora_seq
and a foreign key constraint onidPais
. - PRODUCTORAS: Created with a sequence
productoras_seq
and a foreign key constraint onidPais
. - FLORISTERIAS: Created with a sequence
floristerias_seq
and a foreign key constraint onidPais
. - CLIENTE_NATURAL: Created with a sequence
cliente_natural_seq
. - CLIENTE_JURIDICO: Created with a sequence
cliente_juridico_seq
and a unique constraint onRIF
. - FLOR_CORTES: Created with a sequence
flor_cortes_seq
. - SIGNIFICADO: Created with a sequence
significado_seq
and a check constraint onTipo
. - COLOR: Created with a sequence
color_seq
. - ENLACES: Created with a sequence
enlaces_seq
and foreign key constraints onIdSignificado
,idColor
, andidCorte
. - CATALOGOPRODUCTOR: Created with foreign key constraints on
idCorte
andidProductora
, and a unique constraint onvbn
. - CONTRATO: Created with foreign key constraints on
idSubastadora
,idProductora
, andren_nContrato
, and check constraints ontipoProductor
andporcentajeProduccion
. - CANTIDAD_OFRECIDA: Created with foreign key constraints on
idContratoSubastadora
,idContratoProductora
,idNContrato
,idCatalogoProductora
,idCatalogoCorte
, andidVnb
. - PAGOS: Created with a sequence
pagos_seq
and foreign key constraints onidContratoSubastadora
,idContratoProductora
, andidNContrato
. - CONTACTOS: Created with a foreign key constraint on
idFloristeria
. - AFILIACION: Created with foreign key constraints on
idFloristeria
andidSubastadora
. - FACTURA: Created with foreign key constraints on
idAfiliacionFloristeria
andidAfiliacionSubastadora
. - LOTE: Created with foreign key constraints on
idCantidadContratoSubastadora
,idCantidadContratoProductora
,idCantidad_NContrato
,idCantidadCatalogoProductora
,idCantidadCorte
,idCantidadvnb
, andidFactura
. - CATALOGO_FLORISTERIA: Created with foreign key constraints on
idFloristeria
,idCorteFlor
, andidColor
. - HISTORICO_PRECIO_FLOR: Created with foreign key constraints on
idCatalogoFloristeria
andidCatalogocodigo
. - DETALLE_BOUQUET: Created with foreign key constraints on
idCatalogoFloristeria
andidCatalogocodigo
. - FACTURA_FINAL: Created with foreign key constraints on
idFloristeria
,idClienteNatural
, andidClienteJuridico
. - DETALLE_FACTURA: Created with foreign key constraints on
idFActuraFloristeria
,idNumFactura
,catalogoFloristeria
,catalogoCodigo
,bouquetFloristeria
,bouquetcodigo
, andbouquetId
. - TELEFONOS: Created with foreign key constraints on
idSubastadora
,idProductora
, andidFloristeria
.
- Created sequences for various tables to auto-increment primary keys.
- Added check constraints to ensure data integrity.
- Added foreign key constraints to maintain relationships between tables.
- Created triggers and functions for various operations such as checking nationality of producers, verifying active contracts, calculating commissions, and more.
- GET /api/productoras: Fetches all productoras.
- GET /api/catalogoProductor/:id: Fetches catalogo for a specific productora.
- GET /api/detalleFlores/:florId/:productorId: Fetches details of specific flores.
- GET /api/floristerias: Fetches all floristerias.
- GET /api/floresValoraciones/:idFloristeria: Fetches flores with valoraciones for a specific floristeria.
- GET /api/informacionFlor/:idFloristeria/:idFlor: Fetches information of a specific flor.
- GET /api/facturas: Fetches all facturas.
- GET /api/florCortes: Fetches all flor cortes.
- GET /api/coloresDeCorte/:corteId: Fetches colores for a specific corte.
- GET /api/coloresDeCortePorNombre/:nombre: Fetches colores for a specific corte by name.
- GET /api/obtener-contratos-productora: Fetches contratos for a specific productora.
- GET /api/informacionFactura/:facturaId: Fetches information of a specific factura.
- Configured database connection using
pg
and environment variables.
- getProductoras: Fetches all productoras.
- getCatalogoProductoraById: Fetches catalogo for a specific productora.
- getDetalleFlores: Fetches details of specific flores.
- getFloristerias: Fetches all floristerias.
- getFloresValoraciones: Fetches flores with valoraciones for a specific floristeria.
- getInformacionFlor: Fetches information of a specific flor.
- getFacturas: Fetches all facturas.
- getInformacionFactura: Fetches information of a specific factura.
- getFlorCortes: Fetches all flor cortes.
- getContratosProductora: Fetches contratos for a specific productora.
curl -X GET http://localhost:3000/api/productoras
curl -X GET http://localhost:3000/api/catalogoProductor/1
curl -X GET http://localhost:3000/api/detalleFlores/1/1
curl -X GET http://localhost:3000/api/floristerias
curl -X GET http://localhost:3000/api/floresValoraciones/1
curl -X GET http://localhost:3000/api/informacionFlor/1/1
curl -X GET http://localhost:3000/api/facturas
curl -X GET http://localhost:3000/api/florCortes
curl -X GET http://localhost:3000/api/coloresDeCorte/1
curl -X GET http://localhost:3000/api/coloresDeCortePorNombre/rosa
curl -X GET http://localhost:3000/api/obtener-contratos-productora?productoraId=1
curl -X GET http://localhost:3000/api/informacionFactura/1
- Node.js
- PostgreSQL
Create a .env
file in the root directory of the project and add the following environment variables:
DB_USER=your_database_user
DB_HOST=your_database_host
DB_DATABASE=your_database_name
DB_PASSWORD=your_database_password
DB_PORT=your_database_port
npm install
npm start
- Create a new PostgreSQL database.
- Run the SQL scripts in the
.sql
directory to create tables, sequences, constraints, triggers, and functions. - Insert initial data into the tables using the provided SQL scripts.
This project is a database management system for a flower auction platform. It includes various SQL scripts for creating and managing tables, sequences, constraints, triggers, and functions. The project also includes an API built with Node.js and Express to interact with the database.
The API provides endpoints for fetching data related to productoras, floristerias, flores, facturas, and more. Each endpoint is documented with examples of how to use them.
The database is designed to handle various entities such as countries, auction houses, producers, florists, customers, flowers, contracts, payments, and more. Each entity is represented by a table, and relationships between entities are maintained using foreign key constraints.
The SQL scripts in the .sql
directory include commands for creating tables, sequences, constraints, triggers, and functions. These scripts are organized into different files based on their functionality.
To run the project locally, follow the steps mentioned in the "Setting Up the Database and Running the Project Locally" section. Make sure to configure the environment variables and install the necessary dependencies.
If you would like to contribute to this project, please fork the repository and submit a pull request with your changes. Make sure to follow the coding standards and include appropriate documentation for your changes.
This project is licensed under the MIT License. See the LICENSE
file for more details.