Skip to content

Commit 3c97d10

Browse files
authored
Merge branch '100xdevs-cohort-2:master' into week-12
2 parents fb12329 + 364f8fc commit 3c97d10

File tree

29 files changed

+13665
-0
lines changed

29 files changed

+13665
-0
lines changed

week-10/1-postgres-simple/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

week-10/1-postgres-simple/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Simple SQL queries practise.
2+
3+
In this assignment, you'll be writing a bunch of SQL queries to interact with your postgres database.
4+
5+
## Pre-requisites
6+
Before you start, please grab a Postgres URL from either of the following -
7+
- https://neon.tech/
8+
- https://aiven.io/
9+
10+
and put it in config.ts
11+
12+
## Assignment
13+
You are supposed to write the `database` part of an full stack app.
14+
Specifically, you need to fill the functions in
15+
- src/db/user.ts
16+
- src/db/todo.ts
17+
18+
## Testing
19+
Run `npm run test` to run all the tests
20+
21+
## Call out
22+
The schema of the tables looks like this -
23+
```
24+
CREATE TABLE IF NOT EXISTS users (
25+
id SERIAL PRIMARY KEY,
26+
username VARCHAR(255) UNIQUE NOT NULL,
27+
password VARCHAR(255) NOT NULL,
28+
name VARCHAR(255) NOT NULL
29+
);
30+
CREATE TABLE IF NOT EXISTS todos (
31+
id SERIAL PRIMARY KEY,
32+
user_id INTEGER NOT NULL REFERENCES users(id),
33+
title VARCHAR(255) NOT NULL,
34+
description TEXT,
35+
done BOOLEAN DEFAULT false
36+
);
37+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// jest.config.js
2+
module.exports = {
3+
preset: 'ts-jest',
4+
testEnvironment: 'node',
5+
// Optionally, set up paths to match your project structure
6+
roots: ['<rootDir>/src'],
7+
// Transform settings if you have custom needs, but this is optional since ts-jest is preset
8+
transform: {
9+
'^.+\\.ts$': 'ts-jest',
10+
},
11+
// Module file extensions for importing
12+
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
13+
};
14+

0 commit comments

Comments
 (0)