Skip to content

Commit

Permalink
Merge pull request #93 from ToastedDev/dev
Browse files Browse the repository at this point in the history
chore: fmt
  • Loading branch information
GalvinPython authored Dec 23, 2024
2 parents 186e435 + 899a35e commit 15ec20d
Show file tree
Hide file tree
Showing 53 changed files with 4,397 additions and 3,343 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ scripts/*
*.config.js
.DS_Store
node_modules
**/bun.lockb
coverage
.next
build
Expand All @@ -17,4 +18,5 @@ build
!jest.config.js
!plopfile.js
!react-shim.js
!tsup.config.ts
!tsup.config.ts
**/favicon.ico
26 changes: 9 additions & 17 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@
"prettier/prettier": [
"warn",
{
"tabWidth": 4
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "es5"
}
],
"no-unused-vars": "off",
Expand Down Expand Up @@ -99,26 +103,14 @@
},
{
"blankLine": "always",
"prev": [
"const",
"let",
"var"
],
"prev": ["const", "let", "var"],
"next": "*"
},
{
"blankLine": "any",
"prev": [
"const",
"let",
"var"
],
"next": [
"const",
"let",
"var"
]
"prev": ["const", "let", "var"],
"next": ["const", "let", "var"]
}
]
}
}
}
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "es5"
}
38 changes: 19 additions & 19 deletions api/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "@chatr/api",
"type": "module",
"version": "0.1.0",
"scripts": {
"dev": "bun with-env bun --watch src/index.ts --dev",
"with-env": "dotenv -e ../.env --"
},
"dependencies": {
"cors": "^2.8.5",
"cron": "^3.1.7",
"express": "^4.19.2",
"mysql2": "^3.10.3"
},
"devDependencies": {
"@types/bun": "latest",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"dotenv-cli": "^7.4.2"
}
"name": "@chatr/api",
"type": "module",
"version": "0.1.0",
"scripts": {
"dev": "bun with-env bun --watch src/index.ts --dev",
"with-env": "dotenv -e ../.env --"
},
"dependencies": {
"cors": "^2.8.5",
"cron": "^3.1.7",
"express": "^4.19.2",
"mysql2": "^3.10.3"
},
"devDependencies": {
"@types/bun": "latest",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"dotenv-cli": "^7.4.2"
}
}
20 changes: 10 additions & 10 deletions api/src/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import mysql from "mysql2";

// Create a MySQL connection pool
export const pool = mysql.createPool({
host: process.env.MYSQL_ADDRESS as string,
port: parseInt(process.env.MYSQL_PORT as string),
user: process.env.MYSQL_USER as string,
password: process.env.MYSQL_PASSWORD as string,
database: process.env.MYSQL_DATABASE as string,
host: process.env.MYSQL_ADDRESS as string,
port: parseInt(process.env.MYSQL_PORT as string),
user: process.env.MYSQL_USER as string,
password: process.env.MYSQL_PASSWORD as string,
database: process.env.MYSQL_DATABASE as string,
});

export * from './init';
export * from './queries/guilds';
export * from './queries/users';
export * from './queries/updates';
export * from './queries/tracking';
export * from "./init";
export * from "./queries/guilds";
export * from "./queries/users";
export * from "./queries/updates";
export * from "./queries/tracking";
64 changes: 32 additions & 32 deletions api/src/db/init.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { pool } from ".";

export async function initTables() {
const createGuildsTable = `
const createGuildsTable = `
CREATE TABLE IF NOT EXISTS guilds (
id VARCHAR(255) NOT NULL PRIMARY KEY,
name VARCHAR(255),
Expand All @@ -13,7 +13,7 @@ export async function initTables() {
is_in_guild BOOLEAN DEFAULT TRUE
)
`;
const createUsersTable = `
const createUsersTable = `
CREATE TABLE IF NOT EXISTS users (
id VARCHAR(255) NOT NULL,
guild_id VARCHAR(255) NOT NULL,
Expand All @@ -28,15 +28,15 @@ export async function initTables() {
PRIMARY KEY (id, guild_id)
)
`;
const createRolesTable = `
const createRolesTable = `
CREATE TABLE IF NOT EXISTS roles (
id VARCHAR(255) NOT NULL PRIMARY KEY,
guild_id VARCHAR(255) NOT NULL,
name VARCHAR(255),
level INT NOT NULL
)
`;
const createTrackingTable = `
const createTrackingTable = `
CREATE TABLE IF NOT EXISTS tracking (
time TIMESTAMP,
user_id VARCHAR(255) NOT NULL,
Expand All @@ -45,35 +45,35 @@ export async function initTables() {
)
`;

pool.query(createGuildsTable, (err) => {
if (err) {
console.error("Error creating guilds table:", err);
} else {
console.log("Guilds table created");
}
});
pool.query(createGuildsTable, (err) => {
if (err) {
console.error("Error creating guilds table:", err);
} else {
console.log("Guilds table created");
}
});

pool.query(createUsersTable, (err) => {
if (err) {
console.error("Error creating users table:", err);
} else {
console.log("Users table created");
}
});
pool.query(createUsersTable, (err) => {
if (err) {
console.error("Error creating users table:", err);
} else {
console.log("Users table created");
}
});

pool.query(createRolesTable, (err) => {
if (err) {
console.error("Error creating roles table:", err);
} else {
console.log("Roles table created");
}
});
pool.query(createRolesTable, (err) => {
if (err) {
console.error("Error creating roles table:", err);
} else {
console.log("Roles table created");
}
});

pool.query(createTrackingTable, (err) => {
if (err) {
console.error("Error creating tracking table:", err);
} else {
console.log("Tracking table created");
}
});
pool.query(createTrackingTable, (err) => {
if (err) {
console.error("Error creating tracking table:", err);
} else {
console.log("Tracking table created");
}
});
}
Loading

0 comments on commit 15ec20d

Please sign in to comment.