Skip to content

chore: fmt #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .eslintignore
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't deny because of favicon but sure 😭

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should probably add the other file types like png and jpg even though we don't have them, because eslint will probably also complain about them

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but let's add that in when we come around to it because I didn't see this comment and it's too late now 😭

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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh I can live with this config

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
Loading