Skip to content

Commit 311bed0

Browse files
authored
Merge pull request #50 from crux-bphc/style/format-code
Added formatter config file for frontend and updated formatting for both front and backend
2 parents 65afa93 + 6cd33c5 commit 311bed0

53 files changed

Lines changed: 1476 additions & 1483 deletions

Some content is hidden

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

backend/.prettierrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"trailingComma": "es5",
33
"tabWidth": 2,
4-
"useTabs": false,
4+
"useTabs": false,
55
"semi": true,
66
"singleQuote": false
7-
}
7+
}

backend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"dev": "npx ts-node-dev src/index.ts",
88
"build": "tsc",
9-
"start": "node dist/index.js"
9+
"start": "node dist/index.js",
10+
"format": "prettier --write ."
1011
},
1112
"keywords": [],
1213
"author": "",

backend/src/controllers/account.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ export async function checkVerificationController(
5151
if (verifiedUser.cfHandle && verifiedUser.id) {
5252
//Refresh user data with priority 1! (Lower is more urgent)
5353
await fetchUserSubmissions(verifiedUser.cfHandle, verifiedUser.id, 1);
54-
await fetchUserRatingChanges(
55-
verifiedUser.cfHandle,
56-
verifiedUser.id,
57-
1
58-
);
54+
await fetchUserRatingChanges(verifiedUser.cfHandle, verifiedUser.id, 1);
5955
}
6056
res.status(200).json({
6157
success: true,

backend/src/drizzle.config.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import {config} from "dotenv";
1+
import { config } from "dotenv";
22
import { defineConfig } from "drizzle-kit";
33

4-
config({ path: "../../.env"});
4+
config({ path: "../../.env" });
55

66
export default defineConfig({
7-
dialect: "postgresql",
8-
out: "./drizzle",
9-
schema: "./drizzle/schema.ts",
10-
dbCredentials: {
7+
dialect: "postgresql",
8+
out: "./drizzle",
9+
schema: "./drizzle/schema.ts",
10+
dbCredentials: {
1111
host: "localhost",
1212
port: Number(process.env.PGPORT!),
1313
user: process.env.POSTGRES_USER!,
1414
password: process.env.POSTGRES_PASSWORD!,
1515
database: process.env.POSTGRES_DB!,
16-
ssl: false
17-
},
18-
verbose: true,
19-
strict: true
16+
ssl: false,
17+
},
18+
verbose: true,
19+
strict: true,
2020
});

backend/src/drizzle/db.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { drizzle } from 'drizzle-orm/node-postgres';
2-
import { Client } from 'pg';
3-
import * as schema from './schema';
1+
import { drizzle } from "drizzle-orm/node-postgres";
2+
import { Client } from "pg";
3+
import * as schema from "./schema";
44

55
export const client = new Client({
66
host: process.env.POSTGRES_HOST!,
77
port: Number(process.env.PGPORT!),
88
user: process.env.POSTGRES_USER!,
99
password: process.env.POSTGRES_PASSWORD!,
1010
database: process.env.POSTGRES_DB!,
11-
ssl: false
11+
ssl: false,
1212
});
1313

1414
// { schema } is used for relational queries

backend/src/drizzle/meta/0000_snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@
171171
"internal": {
172172
"tables": {}
173173
}
174-
}
174+
}

backend/src/drizzle/meta/0001_snapshot.json

Lines changed: 27 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,8 @@
4848
"name": "cf_user_stats_user_id_users_id_fk",
4949
"tableFrom": "cf_user_stats",
5050
"tableTo": "users",
51-
"columnsFrom": [
52-
"user_id"
53-
],
54-
"columnsTo": [
55-
"id"
56-
],
51+
"columnsFrom": ["user_id"],
52+
"columnsTo": ["id"],
5753
"onDelete": "no action",
5854
"onUpdate": "no action"
5955
}
@@ -112,9 +108,7 @@
112108
"contests_external_id_unique": {
113109
"name": "contests_external_id_unique",
114110
"nullsNotDistinct": false,
115-
"columns": [
116-
"external_id"
117-
]
111+
"columns": ["external_id"]
118112
}
119113
},
120114
"policies": {},
@@ -157,12 +151,8 @@
157151
"name": "potd_problem_id_problems_id_fk",
158152
"tableFrom": "potd",
159153
"tableTo": "problems",
160-
"columnsFrom": [
161-
"problem_id"
162-
],
163-
"columnsTo": [
164-
"id"
165-
],
154+
"columnsFrom": ["problem_id"],
155+
"columnsTo": ["id"],
166156
"onDelete": "no action",
167157
"onUpdate": "no action"
168158
}
@@ -172,9 +162,7 @@
172162
"potd_date_unique": {
173163
"name": "potd_date_unique",
174164
"nullsNotDistinct": false,
175-
"columns": [
176-
"date"
177-
]
165+
"columns": ["date"]
178166
}
179167
},
180168
"policies": {},
@@ -217,25 +205,17 @@
217205
"name": "potd_solves_potd_id_potd_id_fk",
218206
"tableFrom": "potd_solves",
219207
"tableTo": "potd",
220-
"columnsFrom": [
221-
"potd_id"
222-
],
223-
"columnsTo": [
224-
"id"
225-
],
208+
"columnsFrom": ["potd_id"],
209+
"columnsTo": ["id"],
226210
"onDelete": "no action",
227211
"onUpdate": "no action"
228212
},
229213
"potd_solves_user_id_users_id_fk": {
230214
"name": "potd_solves_user_id_users_id_fk",
231215
"tableFrom": "potd_solves",
232216
"tableTo": "users",
233-
"columnsFrom": [
234-
"user_id"
235-
],
236-
"columnsTo": [
237-
"id"
238-
],
217+
"columnsFrom": ["user_id"],
218+
"columnsTo": ["id"],
239219
"onDelete": "no action",
240220
"onUpdate": "no action"
241221
}
@@ -321,12 +301,8 @@
321301
"name": "problems_contest_id_contests_external_id_fk",
322302
"tableFrom": "problems",
323303
"tableTo": "contests",
324-
"columnsFrom": [
325-
"contest_id"
326-
],
327-
"columnsTo": [
328-
"external_id"
329-
],
304+
"columnsFrom": ["contest_id"],
305+
"columnsTo": ["external_id"],
330306
"onDelete": "no action",
331307
"onUpdate": "no action"
332308
}
@@ -409,25 +385,17 @@
409385
"name": "submissions_user_id_users_id_fk",
410386
"tableFrom": "submissions",
411387
"tableTo": "users",
412-
"columnsFrom": [
413-
"user_id"
414-
],
415-
"columnsTo": [
416-
"id"
417-
],
388+
"columnsFrom": ["user_id"],
389+
"columnsTo": ["id"],
418390
"onDelete": "no action",
419391
"onUpdate": "no action"
420392
},
421393
"submissions_problem_id_problems_id_fk": {
422394
"name": "submissions_problem_id_problems_id_fk",
423395
"tableFrom": "submissions",
424396
"tableTo": "problems",
425-
"columnsFrom": [
426-
"problem_id"
427-
],
428-
"columnsTo": [
429-
"id"
430-
],
397+
"columnsFrom": ["problem_id"],
398+
"columnsTo": ["id"],
431399
"onDelete": "no action",
432400
"onUpdate": "no action"
433401
}
@@ -503,25 +471,17 @@
503471
"name": "user_contests_user_id_users_id_fk",
504472
"tableFrom": "user_contests",
505473
"tableTo": "users",
506-
"columnsFrom": [
507-
"user_id"
508-
],
509-
"columnsTo": [
510-
"id"
511-
],
474+
"columnsFrom": ["user_id"],
475+
"columnsTo": ["id"],
512476
"onDelete": "no action",
513477
"onUpdate": "no action"
514478
},
515479
"user_contests_contest_id_contests_external_id_fk": {
516480
"name": "user_contests_contest_id_contests_external_id_fk",
517481
"tableFrom": "user_contests",
518482
"tableTo": "contests",
519-
"columnsFrom": [
520-
"contest_id"
521-
],
522-
"columnsTo": [
523-
"external_id"
524-
],
483+
"columnsFrom": ["contest_id"],
484+
"columnsTo": ["external_id"],
525485
"onDelete": "no action",
526486
"onUpdate": "no action"
527487
}
@@ -617,37 +577,27 @@
617577
"users_email_unique": {
618578
"name": "users_email_unique",
619579
"nullsNotDistinct": false,
620-
"columns": [
621-
"email"
622-
]
580+
"columns": ["email"]
623581
},
624582
"users_cf_handle_unique": {
625583
"name": "users_cf_handle_unique",
626584
"nullsNotDistinct": false,
627-
"columns": [
628-
"cf_handle"
629-
]
585+
"columns": ["cf_handle"]
630586
},
631587
"users_codechef_handle_unique": {
632588
"name": "users_codechef_handle_unique",
633589
"nullsNotDistinct": false,
634-
"columns": [
635-
"codechef_handle"
636-
]
590+
"columns": ["codechef_handle"]
637591
},
638592
"users_atcoder_handle_unique": {
639593
"name": "users_atcoder_handle_unique",
640594
"nullsNotDistinct": false,
641-
"columns": [
642-
"atcoder_handle"
643-
]
595+
"columns": ["atcoder_handle"]
644596
},
645597
"users_leetcode_handle_unique": {
646598
"name": "users_leetcode_handle_unique",
647599
"nullsNotDistinct": false,
648-
"columns": [
649-
"leetcode_handle"
650-
]
600+
"columns": ["leetcode_handle"]
651601
}
652602
},
653603
"policies": {},
@@ -659,14 +609,7 @@
659609
"public.verdict": {
660610
"name": "verdict",
661611
"schema": "public",
662-
"values": [
663-
"AC",
664-
"WA",
665-
"TLE",
666-
"RE",
667-
"CE",
668-
"other"
669-
]
612+
"values": ["AC", "WA", "TLE", "RE", "CE", "other"]
670613
}
671614
},
672615
"schemas": {},
@@ -679,4 +622,4 @@
679622
"schemas": {},
680623
"tables": {}
681624
}
682-
}
625+
}

0 commit comments

Comments
 (0)