1.1.0 #29

Merged
Xominus merged 25 commits from discord into main 2026-08-22 18:00:22 +00:00
3 changed files with 19 additions and 8 deletions
Showing only changes of commit 4d7581620f - Show all commits
+7 -5
View File
@@ -70,9 +70,11 @@ async function seedCalculator(standardsConfigId: string): Promise<void> {
}
async function seedAccounts(): Promise<void> {
const ACCOUNT_NAME = "Xominus";
const existing = await db.selectFrom("accounts")
.select(["id"])
.where("name", "=", DEFAULT_NAME)
.where("name", "=", ACCOUNT_NAME)
.executeTakeFirst();
if (existing) {
log.info({ id: existing.id }, "default account already seeded, skipping");
@@ -81,9 +83,9 @@ async function seedAccounts(): Promise<void> {
const account = await db.insertInto("accounts")
.values({
name: DEFAULT_NAME,
discord_id: "1521640671721685157",
email: "outgrow_document040@simplelogin.com"
name: ACCOUNT_NAME,
discord_id: "1325552430942916731",
email: "xominus@bladeandbrawn.com"
})
.returning("id")
.executeTakeFirstOrThrow();
@@ -92,7 +94,7 @@ async function seedAccounts(): Promise<void> {
await db.insertInto("assessments")
.values({
account_id: account.id,
name: DEFAULT_NAME,
name: ACCOUNT_NAME,
gender: Gender.Male,
age: 25,
weight: 80,
+8 -2
View File
@@ -7,10 +7,16 @@ import { t } from "elysia";
export class AccountsService {
constructor(private Calculator: CalculatorService) { }
private static idComparison(id: string): ["accounts.id" | "accounts.discord_id", "=", string] {
return id.startsWith("@")
? ["accounts.discord_id", "=", id.slice(1)]
: ["accounts.id", "=", id];
}
async get(id: string) {
return await (db).selectFrom("accounts")
.selectAll()
.where("id", "=", id)
.where(...AccountsService.idComparison(id))
.executeTakeFirst();
}
@@ -22,7 +28,7 @@ export class AccountsService {
"assessments.perf_back_squat", "assessments.perf_bench_press", "assessments.perf_broad_jump",
"assessments.perf_cone_drill", "assessments.perf_deadlift", "assessments.perf_run"
])
.where("accounts.id", "=", id)
.where(...AccountsService.idComparison(id))
.orderBy("assessments.created_at", "desc")
.limit(1)
.executeTakeFirst();
+4 -1
View File
@@ -1,10 +1,13 @@
import type { Message } from "discord.js";
import type { Command } from "../service";
import { api } from "../../../util";
export default {
name: "stats",
description: "View your fitness statistics!",
execute: async (message: Message) => {
console.log("Stats executed");
const res = await api.accounts({ id: `@${message.author.id}` }).stats.get();
const stats = res.data;
console.log(stats);
}
} as Command;