Repository: trade-tariff-commodi-tea
Express app enabling gamification of description classification (converting a description to a commodity code) as part of continuous search improvemments.
README
Express app enabling gamification of description
classification (converting a description to a commodity code)
as part of continuous search improvemments.
Prerequisites
- Node.js (v14 or higher)
- Yarn
- Sequelize CLI
- Docker
- Docker Compose
Setup
Install Dependencies
Docker
Follow the intstructions
here
to use OTT Docker environment and docker-compose for local development
docker compose up --build -d
- Stop and Remove Containers
docker compose down
Sequelize
-
Review npx sequelize --help
for more commands.
-
Create database.
You don’t need to provide the database name in this command;
it will be created dynamically based on the configuration in a configs.ts file.
npx sequelize-cli db:create
- Create a Model.
The model has been created for testing purpose, you can delete it and recreate yours
npx sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string
npx sequelize migration:generate --name create-user
- Run migrations.
Migrations are automatically run when you use Docker Compose.
To manually run migrations:
npx sequelize db:migrate
- Create a Seeder.
Seeder has been created for testing purpose,
you can delete it and recreate your own
npx sequelize seed:generate --name demo-user
-
Update the Seeder File
Edit the generated seed file in seeders/
directory to include the data you want to seed.
-
Run the seeder.
Seed data is automatically applied when you use Docker Compose.
To manually run the seeder:
npx sequelize db:seed:all
Access the Database using psql
- Access the PostgreSQL Container
docker exec -it <db-container-name> psql -U <postgres-user> -d <postgres-db>
Useful psql Commands
\dt
SELECT * FROM <table-name>;
\d+ <table-name>
\q
Resources