@ravxd/velocitydb 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +271 -0
- package/dist/index.d.cts +1218 -0
- package/dist/index.d.ts +1218 -0
- package/dist/index.js +235 -0
- package/package.json +14 -2
- package/.env.example +0 -1
- package/bun.lock +0 -211
- package/drizzle/0000_bright_tony_stark.sql +0 -74
- package/drizzle/meta/0000_snapshot.json +0 -564
- package/drizzle/meta/_journal.json +0 -13
- package/drizzle.config.ts +0 -11
- package/src/client.ts +0 -25
- package/src/helpers.ts +0 -43
- package/src/index.ts +0 -3
- package/src/schema.ts +0 -142
- package/tsconfig.json +0 -13
package/src/schema.ts
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
pgTable,
|
|
3
|
-
text,
|
|
4
|
-
boolean,
|
|
5
|
-
date,
|
|
6
|
-
timestamp,
|
|
7
|
-
pgEnum,
|
|
8
|
-
uuid,
|
|
9
|
-
index,
|
|
10
|
-
} from "drizzle-orm/pg-core";
|
|
11
|
-
|
|
12
|
-
// ─── Enums ────────────────────────────────────────────────────────────────────
|
|
13
|
-
|
|
14
|
-
export const memberRoleEnum = pgEnum("member_role", [
|
|
15
|
-
"member",
|
|
16
|
-
"officer",
|
|
17
|
-
"guildmaster",
|
|
18
|
-
]);
|
|
19
|
-
|
|
20
|
-
export const linkStatusEnum = pgEnum("link_status", [
|
|
21
|
-
"unlinked",
|
|
22
|
-
"linked",
|
|
23
|
-
"pending", // picked from unclaimed list, awaiting admin approval — reserved for future use
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
export const requestStatusEnum = pgEnum("request_status", [
|
|
27
|
-
"pending",
|
|
28
|
-
"approved",
|
|
29
|
-
"rejected",
|
|
30
|
-
]);
|
|
31
|
-
|
|
32
|
-
// ─── Members ──────────────────────────────────────────────────────────────────
|
|
33
|
-
|
|
34
|
-
export const members = pgTable(
|
|
35
|
-
"members",
|
|
36
|
-
{
|
|
37
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
38
|
-
discordId: text("discord_id").notNull().unique(),
|
|
39
|
-
discordUsername: text("discord_username").notNull(),
|
|
40
|
-
displayName: text("display_name").notNull(),
|
|
41
|
-
battletag: text("battletag"),
|
|
42
|
-
role: memberRoleEnum("role").notNull().default("member"),
|
|
43
|
-
isAdmin: boolean("is_admin").notNull().default(false),
|
|
44
|
-
|
|
45
|
-
// WoWUtils link
|
|
46
|
-
wowutilsMemberId: text("wowutils_member_id").unique(),
|
|
47
|
-
wowutilsAlias: text("wowutils_alias"),
|
|
48
|
-
wowutilsRank: text("wowutils_rank"),
|
|
49
|
-
wowutilsMainRole: text("wowutils_main_role"),
|
|
50
|
-
linkStatus: linkStatusEnum("link_status").notNull().default("unlinked"),
|
|
51
|
-
|
|
52
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
53
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
|
54
|
-
},
|
|
55
|
-
(t) => [index("members_discord_id_idx").on(t.discordId)]
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
// ─── Characters ───────────────────────────────────────────────────────────────
|
|
59
|
-
|
|
60
|
-
export const characters = pgTable(
|
|
61
|
-
"characters",
|
|
62
|
-
{
|
|
63
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
64
|
-
memberId: uuid("member_id")
|
|
65
|
-
.notNull()
|
|
66
|
-
.references(() => members.id, { onDelete: "cascade" }),
|
|
67
|
-
|
|
68
|
-
name: text("name").notNull(),
|
|
69
|
-
realm: text("realm").notNull(),
|
|
70
|
-
class: text("class").notNull(),
|
|
71
|
-
spec: text("spec").notNull(),
|
|
72
|
-
status: text("status").notNull().default("active"),
|
|
73
|
-
isMain: boolean("is_main").notNull().default(false),
|
|
74
|
-
|
|
75
|
-
// Synced from WoWUtils — null if manually added
|
|
76
|
-
wowutilsCharacterId: text("wowutils_character_id").unique(),
|
|
77
|
-
|
|
78
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
79
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
|
80
|
-
},
|
|
81
|
-
(t) => [index("characters_member_id_idx").on(t.memberId)]
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
// ─── Requests ─────────────────────────────────────────────────────────────────
|
|
85
|
-
|
|
86
|
-
// weekStart is always a Wednesday (the start of the raid tracking week).
|
|
87
|
-
// Helper: getWeekStart(date) → most recent Wednesday on or before date.
|
|
88
|
-
export const requests = pgTable(
|
|
89
|
-
"requests",
|
|
90
|
-
{
|
|
91
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
92
|
-
memberId: uuid("member_id")
|
|
93
|
-
.notNull()
|
|
94
|
-
.references(() => members.id, { onDelete: "cascade" }),
|
|
95
|
-
characterId: uuid("character_id").references(() => characters.id, {
|
|
96
|
-
onDelete: "set null",
|
|
97
|
-
}),
|
|
98
|
-
|
|
99
|
-
// Denormalised snapshot in case character record changes later
|
|
100
|
-
characterName: text("character_name").notNull(),
|
|
101
|
-
classSpec: text("class_spec").notNull(),
|
|
102
|
-
notes: text("notes"),
|
|
103
|
-
|
|
104
|
-
weekStart: date("week_start").notNull(), // Wednesday of the tracking week
|
|
105
|
-
status: requestStatusEnum("status").notNull().default("pending"),
|
|
106
|
-
|
|
107
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
108
|
-
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
|
109
|
-
},
|
|
110
|
-
(t) => [
|
|
111
|
-
index("requests_week_start_idx").on(t.weekStart),
|
|
112
|
-
index("requests_member_id_idx").on(t.memberId),
|
|
113
|
-
]
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
// ─── AFK Entries ──────────────────────────────────────────────────────────────
|
|
117
|
-
|
|
118
|
-
export const afkEntries = pgTable(
|
|
119
|
-
"afk_entries",
|
|
120
|
-
{
|
|
121
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
122
|
-
memberId: uuid("member_id")
|
|
123
|
-
.notNull()
|
|
124
|
-
.references(() => members.id, { onDelete: "cascade" }),
|
|
125
|
-
afkDate: date("afk_date").notNull(),
|
|
126
|
-
notes: text("notes"),
|
|
127
|
-
createdAt: timestamp("created_at").notNull().defaultNow(),
|
|
128
|
-
},
|
|
129
|
-
(t) => [
|
|
130
|
-
index("afk_entries_member_id_idx").on(t.memberId),
|
|
131
|
-
index("afk_entries_date_idx").on(t.afkDate),
|
|
132
|
-
]
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
// ─── WoWUtils Sync State ──────────────────────────────────────────────────────
|
|
136
|
-
|
|
137
|
-
// Single-row table tracking the last time the roster was synced from WoWUtils.
|
|
138
|
-
export const syncState = pgTable("sync_state", {
|
|
139
|
-
id: uuid("id").primaryKey().defaultRandom(),
|
|
140
|
-
lastSyncedAt: timestamp("last_synced_at").notNull().defaultNow(),
|
|
141
|
-
syncedBy: text("synced_by"), // discord username or "system"
|
|
142
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"noImplicitAny": false,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"outDir": "./dist",
|
|
10
|
-
"rootDir": "./src"
|
|
11
|
-
},
|
|
12
|
-
"include": ["src", "drizzle.config.ts"]
|
|
13
|
-
}
|