- Create a Docerized instance of this database. Write the SQL and a dockerfile to launch the DB, and create the tables required.
Write a node JS script that inserts 2 users into the database, and creates 2 messages between the users. Then query the database and retreive the information on the 2 users and their chat history. Log this data to the node console.
- Sample of a Postgres DB schema: https://drawsql.app/stingray/diagrams/cion-backend-interview# .
-
Please Run the application with this command:
docker-compose -f "docker-compose.yml" up -d --build
-
Login with the credentials : email: [email protected] password: secret
-
Click on Add New Server and name it
-
Go to connection tab into the field host :
your local ip or localhost
, username:postgres
and password :newPassword
-
Go to Databases, cion-db, Schemas, public, tables and there are 2 tables messages and users
-
Create 2 new queries:
-
SELECT message_id, from_user, to_user, date, body FROM public.messages;
-
SELECT user_id, display_name, email FROM public.users;
-
Also you can enter to the coinainer log cion-code-test and check the log
- Self-review code changes
- Add or update tests
- Ensure tests pass locally