Skip to content

Commit 15ec20d

Browse files
authored
Merge pull request #93 from ToastedDev/dev
chore: fmt
2 parents 186e435 + 899a35e commit 15ec20d

Some content is hidden

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

53 files changed

+4397
-3343
lines changed

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ scripts/*
99
*.config.js
1010
.DS_Store
1111
node_modules
12+
**/bun.lockb
1213
coverage
1314
.next
1415
build
@@ -17,4 +18,5 @@ build
1718
!jest.config.js
1819
!plopfile.js
1920
!react-shim.js
20-
!tsup.config.ts
21+
!tsup.config.ts
22+
**/favicon.ico

.eslintrc.json

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@
4343
"prettier/prettier": [
4444
"warn",
4545
{
46-
"tabWidth": 4
46+
"tabWidth": 4,
47+
"useTabs": false,
48+
"semi": true,
49+
"singleQuote": false,
50+
"trailingComma": "es5"
4751
}
4852
],
4953
"no-unused-vars": "off",
@@ -99,26 +103,14 @@
99103
},
100104
{
101105
"blankLine": "always",
102-
"prev": [
103-
"const",
104-
"let",
105-
"var"
106-
],
106+
"prev": ["const", "let", "var"],
107107
"next": "*"
108108
},
109109
{
110110
"blankLine": "any",
111-
"prev": [
112-
"const",
113-
"let",
114-
"var"
115-
],
116-
"next": [
117-
"const",
118-
"let",
119-
"var"
120-
]
111+
"prev": ["const", "let", "var"],
112+
"next": ["const", "let", "var"]
121113
}
122114
]
123115
}
124-
}
116+
}

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tabWidth": 4,
3+
"useTabs": false,
4+
"semi": true,
5+
"singleQuote": false,
6+
"trailingComma": "es5"
7+
}

api/package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"name": "@chatr/api",
3-
"type": "module",
4-
"version": "0.1.0",
5-
"scripts": {
6-
"dev": "bun with-env bun --watch src/index.ts --dev",
7-
"with-env": "dotenv -e ../.env --"
8-
},
9-
"dependencies": {
10-
"cors": "^2.8.5",
11-
"cron": "^3.1.7",
12-
"express": "^4.19.2",
13-
"mysql2": "^3.10.3"
14-
},
15-
"devDependencies": {
16-
"@types/bun": "latest",
17-
"@types/cors": "^2.8.17",
18-
"@types/express": "^4.17.21",
19-
"dotenv-cli": "^7.4.2"
20-
}
2+
"name": "@chatr/api",
3+
"type": "module",
4+
"version": "0.1.0",
5+
"scripts": {
6+
"dev": "bun with-env bun --watch src/index.ts --dev",
7+
"with-env": "dotenv -e ../.env --"
8+
},
9+
"dependencies": {
10+
"cors": "^2.8.5",
11+
"cron": "^3.1.7",
12+
"express": "^4.19.2",
13+
"mysql2": "^3.10.3"
14+
},
15+
"devDependencies": {
16+
"@types/bun": "latest",
17+
"@types/cors": "^2.8.17",
18+
"@types/express": "^4.17.21",
19+
"dotenv-cli": "^7.4.2"
20+
}
2121
}

api/src/db/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import mysql from "mysql2";
22

33
// Create a MySQL connection pool
44
export const pool = mysql.createPool({
5-
host: process.env.MYSQL_ADDRESS as string,
6-
port: parseInt(process.env.MYSQL_PORT as string),
7-
user: process.env.MYSQL_USER as string,
8-
password: process.env.MYSQL_PASSWORD as string,
9-
database: process.env.MYSQL_DATABASE as string,
5+
host: process.env.MYSQL_ADDRESS as string,
6+
port: parseInt(process.env.MYSQL_PORT as string),
7+
user: process.env.MYSQL_USER as string,
8+
password: process.env.MYSQL_PASSWORD as string,
9+
database: process.env.MYSQL_DATABASE as string,
1010
});
1111

12-
export * from './init';
13-
export * from './queries/guilds';
14-
export * from './queries/users';
15-
export * from './queries/updates';
16-
export * from './queries/tracking';
12+
export * from "./init";
13+
export * from "./queries/guilds";
14+
export * from "./queries/users";
15+
export * from "./queries/updates";
16+
export * from "./queries/tracking";

api/src/db/init.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { pool } from ".";
22

33
export async function initTables() {
4-
const createGuildsTable = `
4+
const createGuildsTable = `
55
CREATE TABLE IF NOT EXISTS guilds (
66
id VARCHAR(255) NOT NULL PRIMARY KEY,
77
name VARCHAR(255),
@@ -13,7 +13,7 @@ export async function initTables() {
1313
is_in_guild BOOLEAN DEFAULT TRUE
1414
)
1515
`;
16-
const createUsersTable = `
16+
const createUsersTable = `
1717
CREATE TABLE IF NOT EXISTS users (
1818
id VARCHAR(255) NOT NULL,
1919
guild_id VARCHAR(255) NOT NULL,
@@ -28,15 +28,15 @@ export async function initTables() {
2828
PRIMARY KEY (id, guild_id)
2929
)
3030
`;
31-
const createRolesTable = `
31+
const createRolesTable = `
3232
CREATE TABLE IF NOT EXISTS roles (
3333
id VARCHAR(255) NOT NULL PRIMARY KEY,
3434
guild_id VARCHAR(255) NOT NULL,
3535
name VARCHAR(255),
3636
level INT NOT NULL
3737
)
3838
`;
39-
const createTrackingTable = `
39+
const createTrackingTable = `
4040
CREATE TABLE IF NOT EXISTS tracking (
4141
time TIMESTAMP,
4242
user_id VARCHAR(255) NOT NULL,
@@ -45,35 +45,35 @@ export async function initTables() {
4545
)
4646
`;
4747

48-
pool.query(createGuildsTable, (err) => {
49-
if (err) {
50-
console.error("Error creating guilds table:", err);
51-
} else {
52-
console.log("Guilds table created");
53-
}
54-
});
48+
pool.query(createGuildsTable, (err) => {
49+
if (err) {
50+
console.error("Error creating guilds table:", err);
51+
} else {
52+
console.log("Guilds table created");
53+
}
54+
});
5555

56-
pool.query(createUsersTable, (err) => {
57-
if (err) {
58-
console.error("Error creating users table:", err);
59-
} else {
60-
console.log("Users table created");
61-
}
62-
});
56+
pool.query(createUsersTable, (err) => {
57+
if (err) {
58+
console.error("Error creating users table:", err);
59+
} else {
60+
console.log("Users table created");
61+
}
62+
});
6363

64-
pool.query(createRolesTable, (err) => {
65-
if (err) {
66-
console.error("Error creating roles table:", err);
67-
} else {
68-
console.log("Roles table created");
69-
}
70-
});
64+
pool.query(createRolesTable, (err) => {
65+
if (err) {
66+
console.error("Error creating roles table:", err);
67+
} else {
68+
console.log("Roles table created");
69+
}
70+
});
7171

72-
pool.query(createTrackingTable, (err) => {
73-
if (err) {
74-
console.error("Error creating tracking table:", err);
75-
} else {
76-
console.log("Tracking table created");
77-
}
78-
});
72+
pool.query(createTrackingTable, (err) => {
73+
if (err) {
74+
console.error("Error creating tracking table:", err);
75+
} else {
76+
console.log("Tracking table created");
77+
}
78+
});
7979
}

0 commit comments

Comments
 (0)