forked from 100xdevs-cohort-2/assignments
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbab013
commit 4429657
Showing
27 changed files
with
13,595 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Simple SQL queries practise. | ||
|
||
In this assignment, you'll be writing a bunch of SQL queries to interact with your postgres database. | ||
|
||
## Pre-requisites | ||
Before you start, please grab a Postgres URL from either of the following - | ||
- https://neon.tech/ | ||
- https://aiven.io/ | ||
|
||
and put it in config.ts | ||
|
||
## Assignment | ||
You are supposed to write the `database` part of an full stack app. | ||
Specifically, you need to fill the functions in | ||
- src/db/user.ts | ||
- src/db/todo.ts | ||
|
||
## Testing | ||
Run `npm run test` to run all the tests | ||
|
||
## Call out | ||
The schema of the tables looks like this - | ||
``` | ||
CREATE TABLE IF NOT EXISTS users ( | ||
id SERIAL PRIMARY KEY, | ||
username VARCHAR(255) UNIQUE NOT NULL, | ||
password VARCHAR(255) NOT NULL, | ||
name VARCHAR(255) NOT NULL | ||
); | ||
CREATE TABLE IF NOT EXISTS todos ( | ||
id SERIAL PRIMARY KEY, | ||
user_id INTEGER NOT NULL REFERENCES users(id), | ||
title VARCHAR(255) NOT NULL, | ||
description TEXT, | ||
done BOOLEAN DEFAULT false | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// jest.config.js | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
// Optionally, set up paths to match your project structure | ||
roots: ['<rootDir>/src'], | ||
// Transform settings if you have custom needs, but this is optional since ts-jest is preset | ||
transform: { | ||
'^.+\\.ts$': 'ts-jest', | ||
}, | ||
// Module file extensions for importing | ||
moduleFileExtensions: ['ts', 'js', 'json', 'node'], | ||
}; | ||
|
Oops, something went wrong.