Skip to content

Commit dec5312

Browse files
authored
Merge pull request #163 from cuappdev/aayush/refactor-packages
Aayush/refactor packages
2 parents 6597efb + 200303b commit dec5312

126 files changed

Lines changed: 6498 additions & 4959 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
module.exports = {
22
root: true,
3-
parser: '@typescript-eslint/parser',
3+
parser: "@typescript-eslint/parser",
44
parserOptions: {
55
tsconfigRootDir: __dirname,
6-
project: ['./tsconfig.json', '.eslintrc.js']
6+
project: ["./tsconfig.json"],
77
},
8-
plugins: [
9-
'@typescript-eslint',
8+
ignorePatterns: [
9+
".eslintrc.js",
10+
"jest.config.js",
11+
"ormconfig.ts",
12+
"swaggerDef.js",
1013
],
11-
extends: [
12-
'eslint:recommended',
13-
'plugin:@typescript-eslint/recommended'
14-
],
15-
};
14+
plugins: ["@typescript-eslint"],
15+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
16+
rules: {
17+
"@typescript-eslint/no-unused-vars": "off", // Disable unused variable warnings since eslint cannot recognize decoraters as being used
18+
},
19+
};

.github/pull_request_template.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,26 @@
22

33
<!-- Your title should be able to summarize what changes you've made in one sentence. For example: "Exclude staff from the check for follows". For stacked PRs, please indicate clearly in the title where in the stack you are. For example: "[Eatery Refactor][4/5] Converted all files to MVP model" -->
44

5-
65
## Overview
76

87
<!-- Summarize your changes here. -->
98

10-
11-
129
## Changes Made
1310

1411
<!-- Include details of what your changes actually are and how it is intended to work. -->
1512

16-
17-
1813
## Test Coverage
1914

2015
<!-- Describe how you tested this feature. Manual testing and/or unit testing. Please include repro steps and/or how to turn the feature on if applicable. -->
2116

22-
23-
2417
## Next Steps (delete if not applicable)
2518

2619
<!-- If this is part of a multi-PR change, please describe what changes you plan on addressing in future PRs. -->
2720

28-
29-
3021
## Related PRs or Issues (delete if not applicable)
3122

3223
<!-- List related PRs against other branches/repositories. -->
3324

34-
35-
3625
## Screenshots (delete if not applicable)
3726

3827
<!-- This could include of screenshots of the new feature / proof that the changes work. -->
@@ -41,8 +30,6 @@
4130

4231
<summary>Screen Shot Name</summary>
4332

44-
4533
<!-- Insert file link here. Newlines above and below your link are necessary for this to work. -->
46-
4734

48-
</details>
35+
</details>

.prettierrc

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

README.md

Lines changed: 83 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ all required dependencies are installed. Copy the `.env_template` to either a
2424
necessary.
2525
2626
In addition, this codebase requires these files in the project root to run:
27-
- `.env` → Copy from `.env_template` and fill with your database credentials, Firebase configs, and API keys
28-
- `resell.pem` → Private key file required for authentication
29-
- a resell firebase json file → Firebase service account key for connecting to Firebase
27+
28+
- `.env` → Copy from `.env_template` and fill with your database credentials, Firebase configs, and API keys
29+
- `resell.pem` → Private key file required for authentication
30+
- a resell firebase json file → Firebase service account key for connecting to Firebase
3031
3132
---
3233
@@ -37,48 +38,48 @@ Steps to install Postgres:
3738
### macOS (via Homebrew)
3839
3940
1. Update Homebrew
40-
```
41-
brew update
42-
```
41+
42+
```
43+
brew update
44+
```
4345
4446
2. Install and start
45-
```
46-
brew install postgresql
47-
brew services start postgresql
48-
```
47+
48+
```
49+
brew install postgresql
50+
brew services start postgresql
51+
```
4952
5053
3. Initialize DB
51-
```
52-
initdb /usr/local/var/postgres
53-
```
54+
55+
```
56+
initdb /usr/local/var/postgres
57+
```
5458
5559
4. Create User
56-
In order to run the create and alter commands, you must be inside psql.
57-
```
58-
psql postgres
60+
In order to run the create and alter commands, you must be inside psql.
61+
` psql postgres
5962
create user postgres with password 'postgres';
6063
alter user postgres with superuser;
6164
create database "resell-dev";
62-
```
65+
`
6366
6467
Use the \l command to see if the "resell-dev" is owned by user postgres. If
6568
instead it is owned by another root user, drop the database via:
66-
```
67-
drop database "resell-dev";
68-
```
69+
` drop database "resell-dev";
70+
`
6971
and login to psql via
70-
```
71-
psql postgres postgres
72-
```
72+
` psql postgres postgres
73+
`
7374
Then, create the database again, and it should be owned by user postgres.
7475
7576
---
7677
7778
### Windows (via Installer)
7879
79-
1. Download PostgreSQL from https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
80-
2. During install, include **Command Line Tools** and **pgAdmin 4**. Set the default password for the `postgres` user (e.g., `postgres`).
81-
3. Add PostgreSQL’s bin folder to PATH:
80+
1. Download PostgreSQL from https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
81+
2. During install, include **Command Line Tools** and **pgAdmin 4**. Set the default password for the `postgres` user (e.g., `postgres`).
82+
3. Add PostgreSQL’s bin folder to PATH:
8283
```
8384
C:\Program Files\PostgreSQL\<version>\bin
8485
```
@@ -109,27 +110,30 @@ Then, create the database again, and it should be owned by user postgres.
109110
In order to connect to the database, follow these steps:
110111
111112
### macOS
113+
112114
1. Install Homebrew
113-
```
114-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
115-
```
115+
```
116+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
117+
```
116118
2. Update Homebrew to ensure you have the latest information
117-
```
118-
brew update
119-
```
119+
```
120+
brew update
121+
```
120122
3. Install pgAdmin
121-
```
122-
brew install --cask pgadmin4
123-
```
123+
```
124+
brew install --cask pgadmin4
125+
```
124126
125127
Open pgAdmin and configure the connection using the defined user and password.
126128
127129
### Windows
128-
pgAdmin is installed by default with PostgreSQL. Launch it from the Start Menu and configure a new connection with:
129-
- Host: `localhost`
130-
- Port: `5432`
131-
- Username: `postgres`
132-
- Password: `postgres`
130+
131+
pgAdmin is installed by default with PostgreSQL. Launch it from the Start Menu and configure a new connection with:
132+
133+
- Host: `localhost`
134+
- Port: `5432`
135+
- Username: `postgres`
136+
- Password: `postgres`
133137
134138
---
135139
@@ -138,27 +142,32 @@ pgAdmin is installed by default with PostgreSQL. Launch it from the Start Menu a
138142
This codebase uses the [pgvector](https://github.com/pgvector/pgvector) extension.
139143
140144
### macOS
145+
141146
```
142147
brew install pgvector
143148
psql -U postgres -d resell-dev -c "CREATE EXTENSION vector;"
144149
```
145150
146151
### Windows (manual install)
147-
1. Download/build pgvector from GitHub releases.
148-
2. Copy files:
149-
- `vector.control` → `C:\Program Files\PostgreSQL\<version>\share\extension\`
150-
- `vector.dll` → `C:\Program Files\PostgreSQL\<version>\lib\`
151-
3. Restart PostgreSQL service.
152-
4. In psql:
152+
153+
1. Download/build pgvector from GitHub releases.
154+
2. Copy files:
155+
- `vector.control` → `C:\Program Files\PostgreSQL\<version>\share\extension\`
156+
- `vector.dll` → `C:\Program Files\PostgreSQL\<version>\lib\`
157+
3. Restart PostgreSQL service.
158+
4. In psql:
153159
```
154160
CREATE EXTENSION vector;
155161
```
156162
157163
### Docker (cross-platform alternative)
164+
158165
```
159166
docker run -d --name pgvector -e POSTGRES_PASSWORD=postgres -p 5432:5432 ankane/pgvector
160167
```
168+
161169
Update `.env`:
170+
162171
```
163172
DATABASE_URL=postgres://postgres:postgres@localhost:5432/resell-dev
164173
```
@@ -168,6 +177,7 @@ DATABASE_URL=postgres://postgres:postgres@localhost:5432/resell-dev
168177
## Create/Update Objects in Postgres DB
169178
170179
To create/update the database objects, run:
180+
171181
```
172182
npm run db:migrate
173183
```
@@ -179,27 +189,31 @@ npm run db:migrate
179189
If you are encountering any migrations errors, use this as a last resort!
180190
181191
1. Log into psql and run
182-
```
183-
drop database "resell-dev"
184-
```
185-
This will delete all data in your database as well. Make sure you do not have any important data in your database.
192+
193+
```
194+
drop database "resell-dev"
195+
```
196+
197+
This will delete all data in your database as well. Make sure you do not have any important data in your database.
186198
187199
2. Create the database again via.
188-
```
189-
create database "resell-dev"
190-
```
200+
201+
```
202+
create database "resell-dev"
203+
```
191204
192205
3. Delete all of the migration files in the "migrations" folder
193206
194207
4. Create a new migration file titled "init" via.
195-
```
196-
npm run db:migrate:generate init
197-
```
208+
209+
```
210+
npm run db:migrate:generate init
211+
```
198212
199213
5. Run the migration
200-
```
201-
npm run db:migrate
202-
```
214+
```
215+
npm run db:migrate
216+
```
203217
204218
---
205219
@@ -237,7 +251,6 @@ Before you can dump from the remote dev server, you need to configure the connec
237251
- Database name
238252
- Username
239253
- Password
240-
241254
6. **Configure SSL Settings**
242255
- Go to the **Parameters** tab
243256
- Find `sslmode` and set it to **required**
@@ -255,6 +268,7 @@ Before you can dump from the remote dev server, you need to configure the connec
255268
**Option A: Dump from Remote Server (Recommended)**
256269
257270
Once you have the remote dev server configured in pgAdmin (see Step 0), use those connection details to dump:
271+
258272
```bash
259273
REMOTE_DB_HOST=your-dev-server-host \
260274
REMOTE_DB_PORT=your-port \
@@ -270,6 +284,7 @@ Replace the values with your actual DigitalOcean connection details from pgAdmin
270284
**Option B: Dump from Local Database**
271285

272286
If your dev database is local, simply run:
287+
273288
```bash
274289
./scripts/dump-dev-db.sh
275290
```
@@ -279,42 +294,49 @@ This automatically detects your Docker container or native postgres installation
279294
#### Step 2: Import into Local resell-dev Database
280295

281296
The import script automatically detects your postgres setup (Docker or native) and imports accordingly:
297+
282298
```bash
283299
./scripts/import-dev-data.sh
284300
```
301+
285302
**WARNING: This will replace all data in your local resell-dev database!** You'll be prompted to confirm.
286303

287304
**What these commands do:**
288305

289306
The first command (dump):
307+
290308
- Connects to the **remote DigitalOcean hosted dev database** (appdev-postgres)
291309
- Reads the `resell-dev` database from DigitalOcean (READ ONLY - no changes to remote!)
292310
- Saves a copy to `dumps/dev_db_dump_[timestamp].sql` on your machine
293311

294312
The second command (import):
313+
295314
- Finds the dump file you just created
296315
- Imports it into your **local `resell-dev`** database (in postgres-docker)
297316
- Shows a summary of imported tables and row counts
298317

299318
**Important Note:** Both the remote DigitalOcean database and your local database are named `resell-dev`, but they are completely SEPARATE. The dump script only reads from DigitalOcean and never modifies it.
300319

301320
**Manual Override Options:**
321+
302322
- Force Docker: `FORCE_DOCKER=1 ./scripts/import-dev-data.sh`
303323
- Force Native: `FORCE_NATIVE=1 ./scripts/import-dev-data.sh`
304324

305325
**Supported Setups:**
326+
306327
- Docker containers (like `my_postgres`)
307328
- Native PostgreSQL installations (Homebrew, apt, etc.)
308329
- Custom PostgreSQL setups on localhost:5432
309330

310331
### Option 2: Use Data Seeder (Alternative)
311332

312-
This project includes a mechanism for seeding consistent data for the dev environment using TypeORM and typeorm-seeding.
333+
This project includes a mechanism for seeding consistent data for the dev environment using TypeORM and typeorm-seeding.
313334
The seeders generate users, posts, feedback, reviews, reports, and requests, making sure all devs work with the same data set.
314335

315336
### Running the Seeder
316337

317338
To seed the database for dev, use the following command:
339+
318340
```
319341
npm run db:seed
320342
```

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ services:
77
- ./serviceAccountKey.json:/app/serviceAccountKey.json:ro
88
env_file: .env
99
ports:
10-
- "3000:3000"
10+
- "3000:3000"

0 commit comments

Comments
 (0)