@lcas58/esmi-api-types 1.0.4 → 1.0.6
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/LICENSE +21 -0
- package/README.md +125 -13
- package/dist/{app.d.ts → src/app.d.ts} +8 -8
- package/dist/src/app.js +23 -0
- package/dist/src/db/schema/event.d.ts +264 -0
- package/dist/src/db/schema/event.js +38 -0
- package/dist/src/db/schema/index.d.ts +8 -0
- package/dist/src/db/schema/index.js +8 -0
- package/dist/src/db/schema/league.d.ts +261 -0
- package/dist/src/db/schema/league.js +27 -0
- package/dist/src/db/schema/location.d.ts +239 -0
- package/dist/src/db/schema/location.js +22 -0
- package/dist/src/db/schema/marketing.d.ts +77 -0
- package/dist/src/db/schema/marketing.js +16 -0
- package/dist/src/db/schema/organization.d.ts +882 -0
- package/dist/src/db/schema/organization.js +174 -0
- package/dist/src/db/schema/pickup.d.ts +417 -0
- package/dist/src/db/schema/pickup.js +42 -0
- package/dist/src/db/schema/tag.d.ts +261 -0
- package/dist/src/db/schema/tag.js +55 -0
- package/dist/src/db/schema/user.d.ts +597 -0
- package/dist/src/db/schema/user.js +45 -0
- package/dist/src/lib/types.d.ts +14 -0
- package/dist/src/shared/client-types.d.ts +14 -0
- package/dist/src/shared/client-types.js +13 -0
- package/dist/src/shared/index.d.ts +7 -0
- package/dist/src/shared/index.js +28 -0
- package/package.json +64 -19
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { relations } from "drizzle-orm";
|
|
2
|
+
import { index, pgTable, text, timestamp, uniqueIndex, varchar } from "drizzle-orm/pg-core";
|
|
3
|
+
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import event from "./event.js";
|
|
7
|
+
import tags, { organizationTags } from "./tag.js";
|
|
8
|
+
import { user } from "./user.js";
|
|
9
|
+
const organization = pgTable("organization", {
|
|
10
|
+
id: text("id").primaryKey().$defaultFn(() => randomUUID()),
|
|
11
|
+
name: varchar("name").notNull(),
|
|
12
|
+
description: text("description").notNull(),
|
|
13
|
+
ownerId: varchar("owner_id").references(() => user.id).notNull(),
|
|
14
|
+
slug: varchar("slug").notNull(), // normalized name with no spaces or special characters (unique)
|
|
15
|
+
status: varchar("status").notNull().default("inactive"),
|
|
16
|
+
avatar: varchar("avatar"), // DiceBear seed or R2 URL
|
|
17
|
+
city: varchar("city", { length: 120 }),
|
|
18
|
+
state: varchar("state", { length: 120 }),
|
|
19
|
+
stateCd: varchar("state_cd", { length: 120 }),
|
|
20
|
+
country: varchar("country", { length: 120 }),
|
|
21
|
+
createdAt: timestamp("created_at").$defaultFn(() => new Date()),
|
|
22
|
+
updatedAt: timestamp("updated_at").$defaultFn(() => new Date()).$onUpdateFn(() => new Date()),
|
|
23
|
+
}, table => ({
|
|
24
|
+
locationIdx: index("organization_location_idx").on(table.city, table.state, table.country),
|
|
25
|
+
orgSlugKey: uniqueIndex("organization_slug_key").on(table.slug),
|
|
26
|
+
}));
|
|
27
|
+
// New table for organization websites
|
|
28
|
+
export const organizationWebsites = pgTable("organization_websites", {
|
|
29
|
+
id: text("id").primaryKey().$defaultFn(() => randomUUID()),
|
|
30
|
+
organizationId: text("organization_id").references(() => organization.id, { onDelete: "cascade" }).notNull(),
|
|
31
|
+
url: varchar("url").notNull(),
|
|
32
|
+
label: varchar("label", { length: 100 }), // e.g., "Main Website", "Blog"
|
|
33
|
+
createdAt: timestamp("created_at").$defaultFn(() => new Date()),
|
|
34
|
+
updatedAt: timestamp("updated_at").$defaultFn(() => new Date()).$onUpdateFn(() => new Date()),
|
|
35
|
+
});
|
|
36
|
+
// New table for organization social media
|
|
37
|
+
export const organizationSocialMedia = pgTable("organization_social_media", {
|
|
38
|
+
id: text("id").primaryKey().$defaultFn(() => randomUUID()),
|
|
39
|
+
organizationId: text("organization_id").references(() => organization.id, { onDelete: "cascade" }).notNull(),
|
|
40
|
+
platform: varchar("platform", { length: 50 }).notNull(), // e.g., "twitter", "facebook", "linkedin"
|
|
41
|
+
url: varchar("url"), // Optional - can be built dynamically from platform + handle
|
|
42
|
+
handle: varchar("handle", { length: 100 }).notNull(), // e.g., "@companyname" or "companyname"
|
|
43
|
+
createdAt: timestamp("created_at").$defaultFn(() => new Date()),
|
|
44
|
+
updatedAt: timestamp("updated_at").$defaultFn(() => new Date()).$onUpdateFn(() => new Date()),
|
|
45
|
+
});
|
|
46
|
+
export const organizationRelations = relations(organization, ({ one, many }) => ({
|
|
47
|
+
owner: one(user, {
|
|
48
|
+
fields: [organization.ownerId],
|
|
49
|
+
references: [user.id],
|
|
50
|
+
}),
|
|
51
|
+
events: many(event),
|
|
52
|
+
tags: many(organizationTags),
|
|
53
|
+
websites: many(organizationWebsites),
|
|
54
|
+
socialMedia: many(organizationSocialMedia),
|
|
55
|
+
}));
|
|
56
|
+
export const organizationWebsitesRelations = relations(organizationWebsites, ({ one }) => ({
|
|
57
|
+
organization: one(organization, {
|
|
58
|
+
fields: [organizationWebsites.organizationId],
|
|
59
|
+
references: [organization.id],
|
|
60
|
+
}),
|
|
61
|
+
}));
|
|
62
|
+
export const organizationSocialMediaRelations = relations(organizationSocialMedia, ({ one }) => ({
|
|
63
|
+
organization: one(organization, {
|
|
64
|
+
fields: [organizationSocialMedia.organizationId],
|
|
65
|
+
references: [organization.id],
|
|
66
|
+
}),
|
|
67
|
+
}));
|
|
68
|
+
export const organizationTagsRelations = relations(organizationTags, ({ one }) => ({
|
|
69
|
+
organization: one(organization, {
|
|
70
|
+
fields: [organizationTags.organizationId],
|
|
71
|
+
references: [organization.id],
|
|
72
|
+
}),
|
|
73
|
+
tag: one(tags, {
|
|
74
|
+
fields: [organizationTags.tagId],
|
|
75
|
+
references: [tags.id],
|
|
76
|
+
}),
|
|
77
|
+
}));
|
|
78
|
+
export const selectOrganizationSchema = createSelectSchema(organization);
|
|
79
|
+
export const insertOrganizationSchema = createInsertSchema(organization, {
|
|
80
|
+
name: schema => schema.name.min(5).max(500),
|
|
81
|
+
description: schema => schema.description.max(500),
|
|
82
|
+
city: schema => schema.city.min(2).max(120),
|
|
83
|
+
state: schema => schema.state.max(120),
|
|
84
|
+
stateCd: schema => schema.stateCd.max(120),
|
|
85
|
+
country: schema => schema.country.min(2).max(120),
|
|
86
|
+
}).required({
|
|
87
|
+
name: true,
|
|
88
|
+
description: true,
|
|
89
|
+
city: true,
|
|
90
|
+
stateCd: true,
|
|
91
|
+
country: true,
|
|
92
|
+
}).omit({
|
|
93
|
+
id: true,
|
|
94
|
+
slug: true,
|
|
95
|
+
ownerId: true,
|
|
96
|
+
createdAt: true,
|
|
97
|
+
updatedAt: true,
|
|
98
|
+
});
|
|
99
|
+
// New schemas for related data
|
|
100
|
+
export const insertOrganizationWebsiteSchema = createInsertSchema(organizationWebsites, {
|
|
101
|
+
url: schema => schema.url.min(1).max(500),
|
|
102
|
+
label: schema => schema.label.max(100),
|
|
103
|
+
}).omit({
|
|
104
|
+
id: true,
|
|
105
|
+
organizationId: true,
|
|
106
|
+
createdAt: true,
|
|
107
|
+
updatedAt: true,
|
|
108
|
+
});
|
|
109
|
+
// Supported social media platforms
|
|
110
|
+
export const SOCIAL_MEDIA_PLATFORMS = [
|
|
111
|
+
"x",
|
|
112
|
+
"facebook",
|
|
113
|
+
"instagram",
|
|
114
|
+
];
|
|
115
|
+
export const insertOrganizationSocialMediaSchema = createInsertSchema(organizationSocialMedia, {
|
|
116
|
+
platform: schema => schema.platform.min(1).max(50).refine(val => SOCIAL_MEDIA_PLATFORMS.includes(val), { message: `Platform must be one of: ${SOCIAL_MEDIA_PLATFORMS.join(", ")}` }),
|
|
117
|
+
url: schema => schema.url.max(500),
|
|
118
|
+
handle: schema => schema.handle.min(1).max(100),
|
|
119
|
+
}).omit({
|
|
120
|
+
id: true,
|
|
121
|
+
organizationId: true,
|
|
122
|
+
createdAt: true,
|
|
123
|
+
updatedAt: true,
|
|
124
|
+
});
|
|
125
|
+
// Helper function to generate social media URLs dynamically
|
|
126
|
+
export function generateSocialMediaUrl(platform, handle) {
|
|
127
|
+
const cleanHandle = handle.startsWith("@") ? handle.slice(1) : handle;
|
|
128
|
+
switch (platform.toLowerCase()) {
|
|
129
|
+
case "x":
|
|
130
|
+
return `https://x.com/${cleanHandle}`;
|
|
131
|
+
case "facebook":
|
|
132
|
+
return `https://facebook.com/${cleanHandle}`;
|
|
133
|
+
case "instagram":
|
|
134
|
+
return `https://instagram.com/${cleanHandle}`;
|
|
135
|
+
default:
|
|
136
|
+
return `https://${platform}.com/${cleanHandle}`;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export const insertOrganizationTagSchema = createInsertSchema(organizationTags, {
|
|
140
|
+
tagId: schema => schema.tagId.min(1),
|
|
141
|
+
}).omit({
|
|
142
|
+
organizationId: true,
|
|
143
|
+
createdAt: true,
|
|
144
|
+
updatedAt: true,
|
|
145
|
+
});
|
|
146
|
+
export const getOrganizationWithDetailsSchema = selectOrganizationSchema.extend({
|
|
147
|
+
tags: z.array(z.object({
|
|
148
|
+
id: z.string(),
|
|
149
|
+
name: z.string(),
|
|
150
|
+
})),
|
|
151
|
+
websites: z.array(z.object({
|
|
152
|
+
id: z.string(),
|
|
153
|
+
url: z.string(),
|
|
154
|
+
label: z.string(),
|
|
155
|
+
})),
|
|
156
|
+
socialMedia: z.array(z.object({
|
|
157
|
+
id: z.string(),
|
|
158
|
+
platform: z.string(),
|
|
159
|
+
url: z.string(),
|
|
160
|
+
handle: z.string(),
|
|
161
|
+
})),
|
|
162
|
+
});
|
|
163
|
+
// Extended schema for creating organization with all details
|
|
164
|
+
export const createOrganizationWithDetailsSchema = insertOrganizationSchema.extend({
|
|
165
|
+
tags: insertOrganizationTagSchema.array().optional(),
|
|
166
|
+
websites: insertOrganizationWebsiteSchema.array().optional(),
|
|
167
|
+
socialMedia: insertOrganizationSocialMediaSchema.array().optional(),
|
|
168
|
+
});
|
|
169
|
+
export const patchOrganizationSchema = insertOrganizationSchema.partial().extend({
|
|
170
|
+
tags: insertOrganizationTagSchema.array().optional(),
|
|
171
|
+
websites: insertOrganizationWebsiteSchema.array().optional(),
|
|
172
|
+
socialMedia: insertOrganizationSocialMediaSchema.array().optional(),
|
|
173
|
+
});
|
|
174
|
+
export default organization;
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
declare const pickup: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
+
name: "pickup";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "pickup";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "PgText";
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
notNull: true;
|
|
13
|
+
hasDefault: true;
|
|
14
|
+
isPrimaryKey: true;
|
|
15
|
+
isAutoincrement: false;
|
|
16
|
+
hasRuntimeDefault: true;
|
|
17
|
+
enumValues: [string, ...string[]];
|
|
18
|
+
baseColumn: never;
|
|
19
|
+
generated: undefined;
|
|
20
|
+
}, {}, {}>;
|
|
21
|
+
eventId: import("drizzle-orm/pg-core").PgColumn<{
|
|
22
|
+
name: "event_id";
|
|
23
|
+
tableName: "pickup";
|
|
24
|
+
dataType: "string";
|
|
25
|
+
columnType: "PgText";
|
|
26
|
+
data: string;
|
|
27
|
+
driverParam: string;
|
|
28
|
+
notNull: true;
|
|
29
|
+
hasDefault: false;
|
|
30
|
+
isPrimaryKey: false;
|
|
31
|
+
isAutoincrement: false;
|
|
32
|
+
hasRuntimeDefault: false;
|
|
33
|
+
enumValues: [string, ...string[]];
|
|
34
|
+
baseColumn: never;
|
|
35
|
+
generated: undefined;
|
|
36
|
+
}, {}, {}>;
|
|
37
|
+
maxPlayers: import("drizzle-orm/pg-core").PgColumn<{
|
|
38
|
+
name: "max_players";
|
|
39
|
+
tableName: "pickup";
|
|
40
|
+
dataType: "number";
|
|
41
|
+
columnType: "PgInteger";
|
|
42
|
+
data: number;
|
|
43
|
+
driverParam: string | number;
|
|
44
|
+
notNull: true;
|
|
45
|
+
hasDefault: true;
|
|
46
|
+
isPrimaryKey: false;
|
|
47
|
+
isAutoincrement: false;
|
|
48
|
+
hasRuntimeDefault: false;
|
|
49
|
+
enumValues: undefined;
|
|
50
|
+
baseColumn: never;
|
|
51
|
+
generated: undefined;
|
|
52
|
+
}, {}, {}>;
|
|
53
|
+
minPlayers: import("drizzle-orm/pg-core").PgColumn<{
|
|
54
|
+
name: "min_players";
|
|
55
|
+
tableName: "pickup";
|
|
56
|
+
dataType: "number";
|
|
57
|
+
columnType: "PgInteger";
|
|
58
|
+
data: number;
|
|
59
|
+
driverParam: string | number;
|
|
60
|
+
notNull: true;
|
|
61
|
+
hasDefault: true;
|
|
62
|
+
isPrimaryKey: false;
|
|
63
|
+
isAutoincrement: false;
|
|
64
|
+
hasRuntimeDefault: false;
|
|
65
|
+
enumValues: undefined;
|
|
66
|
+
baseColumn: never;
|
|
67
|
+
generated: undefined;
|
|
68
|
+
}, {}, {}>;
|
|
69
|
+
currentPlayers: import("drizzle-orm/pg-core").PgColumn<{
|
|
70
|
+
name: "current_players";
|
|
71
|
+
tableName: "pickup";
|
|
72
|
+
dataType: "number";
|
|
73
|
+
columnType: "PgInteger";
|
|
74
|
+
data: number;
|
|
75
|
+
driverParam: string | number;
|
|
76
|
+
notNull: true;
|
|
77
|
+
hasDefault: true;
|
|
78
|
+
isPrimaryKey: false;
|
|
79
|
+
isAutoincrement: false;
|
|
80
|
+
hasRuntimeDefault: false;
|
|
81
|
+
enumValues: undefined;
|
|
82
|
+
baseColumn: never;
|
|
83
|
+
generated: undefined;
|
|
84
|
+
}, {}, {}>;
|
|
85
|
+
fieldSize: import("drizzle-orm/pg-core").PgColumn<{
|
|
86
|
+
name: "field_size";
|
|
87
|
+
tableName: "pickup";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
columnType: "PgVarchar";
|
|
90
|
+
data: string;
|
|
91
|
+
driverParam: string;
|
|
92
|
+
notNull: true;
|
|
93
|
+
hasDefault: true;
|
|
94
|
+
isPrimaryKey: false;
|
|
95
|
+
isAutoincrement: false;
|
|
96
|
+
hasRuntimeDefault: false;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
baseColumn: never;
|
|
99
|
+
generated: undefined;
|
|
100
|
+
}, {}, {}>;
|
|
101
|
+
gameLength: import("drizzle-orm/pg-core").PgColumn<{
|
|
102
|
+
name: "game_length";
|
|
103
|
+
tableName: "pickup";
|
|
104
|
+
dataType: "number";
|
|
105
|
+
columnType: "PgInteger";
|
|
106
|
+
data: number;
|
|
107
|
+
driverParam: string | number;
|
|
108
|
+
notNull: true;
|
|
109
|
+
hasDefault: true;
|
|
110
|
+
isPrimaryKey: false;
|
|
111
|
+
isAutoincrement: false;
|
|
112
|
+
hasRuntimeDefault: false;
|
|
113
|
+
enumValues: undefined;
|
|
114
|
+
baseColumn: never;
|
|
115
|
+
generated: undefined;
|
|
116
|
+
}, {}, {}>;
|
|
117
|
+
skillLevel: import("drizzle-orm/pg-core").PgColumn<{
|
|
118
|
+
name: "skill_level";
|
|
119
|
+
tableName: "pickup";
|
|
120
|
+
dataType: "string";
|
|
121
|
+
columnType: "PgVarchar";
|
|
122
|
+
data: string;
|
|
123
|
+
driverParam: string;
|
|
124
|
+
notNull: true;
|
|
125
|
+
hasDefault: true;
|
|
126
|
+
isPrimaryKey: false;
|
|
127
|
+
isAutoincrement: false;
|
|
128
|
+
hasRuntimeDefault: false;
|
|
129
|
+
enumValues: [string, ...string[]];
|
|
130
|
+
baseColumn: never;
|
|
131
|
+
generated: undefined;
|
|
132
|
+
}, {}, {}>;
|
|
133
|
+
images: import("drizzle-orm/pg-core").PgColumn<{
|
|
134
|
+
name: "images";
|
|
135
|
+
tableName: "pickup";
|
|
136
|
+
dataType: "string";
|
|
137
|
+
columnType: "PgText";
|
|
138
|
+
data: string;
|
|
139
|
+
driverParam: string;
|
|
140
|
+
notNull: false;
|
|
141
|
+
hasDefault: false;
|
|
142
|
+
isPrimaryKey: false;
|
|
143
|
+
isAutoincrement: false;
|
|
144
|
+
hasRuntimeDefault: false;
|
|
145
|
+
enumValues: [string, ...string[]];
|
|
146
|
+
baseColumn: never;
|
|
147
|
+
generated: undefined;
|
|
148
|
+
}, {}, {}>;
|
|
149
|
+
equipmentProvided: import("drizzle-orm/pg-core").PgColumn<{
|
|
150
|
+
name: "equipment_provided";
|
|
151
|
+
tableName: "pickup";
|
|
152
|
+
dataType: "string";
|
|
153
|
+
columnType: "PgVarchar";
|
|
154
|
+
data: string;
|
|
155
|
+
driverParam: string;
|
|
156
|
+
notNull: false;
|
|
157
|
+
hasDefault: false;
|
|
158
|
+
isPrimaryKey: false;
|
|
159
|
+
isAutoincrement: false;
|
|
160
|
+
hasRuntimeDefault: false;
|
|
161
|
+
enumValues: [string, ...string[]];
|
|
162
|
+
baseColumn: never;
|
|
163
|
+
generated: undefined;
|
|
164
|
+
}, {}, {}>;
|
|
165
|
+
equipmentRequired: import("drizzle-orm/pg-core").PgColumn<{
|
|
166
|
+
name: "equipment_required";
|
|
167
|
+
tableName: "pickup";
|
|
168
|
+
dataType: "string";
|
|
169
|
+
columnType: "PgVarchar";
|
|
170
|
+
data: string;
|
|
171
|
+
driverParam: string;
|
|
172
|
+
notNull: false;
|
|
173
|
+
hasDefault: false;
|
|
174
|
+
isPrimaryKey: false;
|
|
175
|
+
isAutoincrement: false;
|
|
176
|
+
hasRuntimeDefault: false;
|
|
177
|
+
enumValues: [string, ...string[]];
|
|
178
|
+
baseColumn: never;
|
|
179
|
+
generated: undefined;
|
|
180
|
+
}, {}, {}>;
|
|
181
|
+
cost: import("drizzle-orm/pg-core").PgColumn<{
|
|
182
|
+
name: "cost";
|
|
183
|
+
tableName: "pickup";
|
|
184
|
+
dataType: "number";
|
|
185
|
+
columnType: "PgInteger";
|
|
186
|
+
data: number;
|
|
187
|
+
driverParam: string | number;
|
|
188
|
+
notNull: false;
|
|
189
|
+
hasDefault: true;
|
|
190
|
+
isPrimaryKey: false;
|
|
191
|
+
isAutoincrement: false;
|
|
192
|
+
hasRuntimeDefault: false;
|
|
193
|
+
enumValues: undefined;
|
|
194
|
+
baseColumn: never;
|
|
195
|
+
generated: undefined;
|
|
196
|
+
}, {}, {}>;
|
|
197
|
+
costPerPlayer: import("drizzle-orm/pg-core").PgColumn<{
|
|
198
|
+
name: "cost_per_player";
|
|
199
|
+
tableName: "pickup";
|
|
200
|
+
dataType: "boolean";
|
|
201
|
+
columnType: "PgBoolean";
|
|
202
|
+
data: boolean;
|
|
203
|
+
driverParam: boolean;
|
|
204
|
+
notNull: true;
|
|
205
|
+
hasDefault: true;
|
|
206
|
+
isPrimaryKey: false;
|
|
207
|
+
isAutoincrement: false;
|
|
208
|
+
hasRuntimeDefault: false;
|
|
209
|
+
enumValues: undefined;
|
|
210
|
+
baseColumn: never;
|
|
211
|
+
generated: undefined;
|
|
212
|
+
}, {}, {}>;
|
|
213
|
+
rules: import("drizzle-orm/pg-core").PgColumn<{
|
|
214
|
+
name: "rules";
|
|
215
|
+
tableName: "pickup";
|
|
216
|
+
dataType: "string";
|
|
217
|
+
columnType: "PgText";
|
|
218
|
+
data: string;
|
|
219
|
+
driverParam: string;
|
|
220
|
+
notNull: false;
|
|
221
|
+
hasDefault: false;
|
|
222
|
+
isPrimaryKey: false;
|
|
223
|
+
isAutoincrement: false;
|
|
224
|
+
hasRuntimeDefault: false;
|
|
225
|
+
enumValues: [string, ...string[]];
|
|
226
|
+
baseColumn: never;
|
|
227
|
+
generated: undefined;
|
|
228
|
+
}, {}, {}>;
|
|
229
|
+
weatherDependent: import("drizzle-orm/pg-core").PgColumn<{
|
|
230
|
+
name: "weather_dependent";
|
|
231
|
+
tableName: "pickup";
|
|
232
|
+
dataType: "boolean";
|
|
233
|
+
columnType: "PgBoolean";
|
|
234
|
+
data: boolean;
|
|
235
|
+
driverParam: boolean;
|
|
236
|
+
notNull: true;
|
|
237
|
+
hasDefault: true;
|
|
238
|
+
isPrimaryKey: false;
|
|
239
|
+
isAutoincrement: false;
|
|
240
|
+
hasRuntimeDefault: false;
|
|
241
|
+
enumValues: undefined;
|
|
242
|
+
baseColumn: never;
|
|
243
|
+
generated: undefined;
|
|
244
|
+
}, {}, {}>;
|
|
245
|
+
startTime: import("drizzle-orm/pg-core").PgColumn<{
|
|
246
|
+
name: "start_time";
|
|
247
|
+
tableName: "pickup";
|
|
248
|
+
dataType: "date";
|
|
249
|
+
columnType: "PgTimestamp";
|
|
250
|
+
data: Date;
|
|
251
|
+
driverParam: string;
|
|
252
|
+
notNull: true;
|
|
253
|
+
hasDefault: false;
|
|
254
|
+
isPrimaryKey: false;
|
|
255
|
+
isAutoincrement: false;
|
|
256
|
+
hasRuntimeDefault: false;
|
|
257
|
+
enumValues: undefined;
|
|
258
|
+
baseColumn: never;
|
|
259
|
+
generated: undefined;
|
|
260
|
+
}, {}, {}>;
|
|
261
|
+
endTime: import("drizzle-orm/pg-core").PgColumn<{
|
|
262
|
+
name: "end_time";
|
|
263
|
+
tableName: "pickup";
|
|
264
|
+
dataType: "date";
|
|
265
|
+
columnType: "PgTimestamp";
|
|
266
|
+
data: Date;
|
|
267
|
+
driverParam: string;
|
|
268
|
+
notNull: true;
|
|
269
|
+
hasDefault: false;
|
|
270
|
+
isPrimaryKey: false;
|
|
271
|
+
isAutoincrement: false;
|
|
272
|
+
hasRuntimeDefault: false;
|
|
273
|
+
enumValues: undefined;
|
|
274
|
+
baseColumn: never;
|
|
275
|
+
generated: undefined;
|
|
276
|
+
}, {}, {}>;
|
|
277
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
278
|
+
name: "status";
|
|
279
|
+
tableName: "pickup";
|
|
280
|
+
dataType: "string";
|
|
281
|
+
columnType: "PgVarchar";
|
|
282
|
+
data: string;
|
|
283
|
+
driverParam: string;
|
|
284
|
+
notNull: true;
|
|
285
|
+
hasDefault: true;
|
|
286
|
+
isPrimaryKey: false;
|
|
287
|
+
isAutoincrement: false;
|
|
288
|
+
hasRuntimeDefault: false;
|
|
289
|
+
enumValues: [string, ...string[]];
|
|
290
|
+
baseColumn: never;
|
|
291
|
+
generated: undefined;
|
|
292
|
+
}, {}, {}>;
|
|
293
|
+
notes: import("drizzle-orm/pg-core").PgColumn<{
|
|
294
|
+
name: "notes";
|
|
295
|
+
tableName: "pickup";
|
|
296
|
+
dataType: "string";
|
|
297
|
+
columnType: "PgText";
|
|
298
|
+
data: string;
|
|
299
|
+
driverParam: string;
|
|
300
|
+
notNull: false;
|
|
301
|
+
hasDefault: false;
|
|
302
|
+
isPrimaryKey: false;
|
|
303
|
+
isAutoincrement: false;
|
|
304
|
+
hasRuntimeDefault: false;
|
|
305
|
+
enumValues: [string, ...string[]];
|
|
306
|
+
baseColumn: never;
|
|
307
|
+
generated: undefined;
|
|
308
|
+
}, {}, {}>;
|
|
309
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
310
|
+
name: "created_at";
|
|
311
|
+
tableName: "pickup";
|
|
312
|
+
dataType: "date";
|
|
313
|
+
columnType: "PgTimestamp";
|
|
314
|
+
data: Date;
|
|
315
|
+
driverParam: string;
|
|
316
|
+
notNull: true;
|
|
317
|
+
hasDefault: true;
|
|
318
|
+
isPrimaryKey: false;
|
|
319
|
+
isAutoincrement: false;
|
|
320
|
+
hasRuntimeDefault: false;
|
|
321
|
+
enumValues: undefined;
|
|
322
|
+
baseColumn: never;
|
|
323
|
+
generated: undefined;
|
|
324
|
+
}, {}, {}>;
|
|
325
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
326
|
+
name: "updated_at";
|
|
327
|
+
tableName: "pickup";
|
|
328
|
+
dataType: "date";
|
|
329
|
+
columnType: "PgTimestamp";
|
|
330
|
+
data: Date;
|
|
331
|
+
driverParam: string;
|
|
332
|
+
notNull: true;
|
|
333
|
+
hasDefault: true;
|
|
334
|
+
isPrimaryKey: false;
|
|
335
|
+
isAutoincrement: false;
|
|
336
|
+
hasRuntimeDefault: false;
|
|
337
|
+
enumValues: undefined;
|
|
338
|
+
baseColumn: never;
|
|
339
|
+
generated: undefined;
|
|
340
|
+
}, {}, {}>;
|
|
341
|
+
};
|
|
342
|
+
dialect: "pg";
|
|
343
|
+
}>;
|
|
344
|
+
export declare const pickupRelations: import("drizzle-orm").Relations<"pickup", {
|
|
345
|
+
event: import("drizzle-orm").One<"event", true>;
|
|
346
|
+
}>;
|
|
347
|
+
export declare const eventPickupRelations: import("drizzle-orm").Relations<"event", {
|
|
348
|
+
pickup: import("drizzle-orm").One<"pickup", true>;
|
|
349
|
+
}>;
|
|
350
|
+
export declare const selectPickupSchema: import("zod").ZodObject<{
|
|
351
|
+
id: import("zod").ZodString;
|
|
352
|
+
eventId: import("zod").ZodString;
|
|
353
|
+
maxPlayers: import("zod").ZodNumber;
|
|
354
|
+
minPlayers: import("zod").ZodNumber;
|
|
355
|
+
currentPlayers: import("zod").ZodNumber;
|
|
356
|
+
fieldSize: import("zod").ZodString;
|
|
357
|
+
gameLength: import("zod").ZodNumber;
|
|
358
|
+
skillLevel: import("zod").ZodString;
|
|
359
|
+
images: import("zod").ZodNullable<import("zod").ZodString>;
|
|
360
|
+
equipmentProvided: import("zod").ZodNullable<import("zod").ZodString>;
|
|
361
|
+
equipmentRequired: import("zod").ZodNullable<import("zod").ZodString>;
|
|
362
|
+
cost: import("zod").ZodNullable<import("zod").ZodNumber>;
|
|
363
|
+
costPerPlayer: import("zod").ZodBoolean;
|
|
364
|
+
rules: import("zod").ZodNullable<import("zod").ZodString>;
|
|
365
|
+
weatherDependent: import("zod").ZodBoolean;
|
|
366
|
+
startTime: import("zod").ZodDate;
|
|
367
|
+
endTime: import("zod").ZodDate;
|
|
368
|
+
status: import("zod").ZodString;
|
|
369
|
+
notes: import("zod").ZodNullable<import("zod").ZodString>;
|
|
370
|
+
createdAt: import("zod").ZodDate;
|
|
371
|
+
updatedAt: import("zod").ZodDate;
|
|
372
|
+
}, import("zod").UnknownKeysParam, import("zod").ZodTypeAny, {
|
|
373
|
+
id: string;
|
|
374
|
+
status: string;
|
|
375
|
+
createdAt: Date;
|
|
376
|
+
updatedAt: Date;
|
|
377
|
+
eventId: string;
|
|
378
|
+
maxPlayers: number;
|
|
379
|
+
minPlayers: number;
|
|
380
|
+
currentPlayers: number;
|
|
381
|
+
fieldSize: string;
|
|
382
|
+
gameLength: number;
|
|
383
|
+
skillLevel: string;
|
|
384
|
+
images: string | null;
|
|
385
|
+
equipmentProvided: string | null;
|
|
386
|
+
equipmentRequired: string | null;
|
|
387
|
+
cost: number | null;
|
|
388
|
+
costPerPlayer: boolean;
|
|
389
|
+
rules: string | null;
|
|
390
|
+
weatherDependent: boolean;
|
|
391
|
+
startTime: Date;
|
|
392
|
+
endTime: Date;
|
|
393
|
+
notes: string | null;
|
|
394
|
+
}, {
|
|
395
|
+
id: string;
|
|
396
|
+
status: string;
|
|
397
|
+
createdAt: Date;
|
|
398
|
+
updatedAt: Date;
|
|
399
|
+
eventId: string;
|
|
400
|
+
maxPlayers: number;
|
|
401
|
+
minPlayers: number;
|
|
402
|
+
currentPlayers: number;
|
|
403
|
+
fieldSize: string;
|
|
404
|
+
gameLength: number;
|
|
405
|
+
skillLevel: string;
|
|
406
|
+
images: string | null;
|
|
407
|
+
equipmentProvided: string | null;
|
|
408
|
+
equipmentRequired: string | null;
|
|
409
|
+
cost: number | null;
|
|
410
|
+
costPerPlayer: boolean;
|
|
411
|
+
rules: string | null;
|
|
412
|
+
weatherDependent: boolean;
|
|
413
|
+
startTime: Date;
|
|
414
|
+
endTime: Date;
|
|
415
|
+
notes: string | null;
|
|
416
|
+
}>;
|
|
417
|
+
export default pickup;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { relations } from "drizzle-orm";
|
|
2
|
+
import { boolean, integer, pgTable, text, timestamp, varchar } from "drizzle-orm/pg-core";
|
|
3
|
+
import { createSelectSchema } from "drizzle-zod";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import event from "./event.js";
|
|
6
|
+
const pickup = pgTable("pickup", {
|
|
7
|
+
id: text("id").primaryKey().$defaultFn(() => randomUUID()),
|
|
8
|
+
eventId: text("event_id").references(() => event.id, { onDelete: "cascade" }).notNull(),
|
|
9
|
+
maxPlayers: integer("max_players").notNull().default(22), // Maximum participants (default for soccer 11v11)
|
|
10
|
+
minPlayers: integer("min_players").notNull().default(4), // Minimum participants to start
|
|
11
|
+
currentPlayers: integer("current_players").notNull().default(0),
|
|
12
|
+
fieldSize: varchar("field_size", { length: 50 }).notNull().default("full"), // full, half, small, court, etc.
|
|
13
|
+
gameLength: integer("game_length").notNull().default(90), // Duration in minutes
|
|
14
|
+
skillLevel: varchar("skill_level", { length: 20 }).notNull().default("mixed"), // beginner, intermediate, advanced, mixed
|
|
15
|
+
images: text("images"), // Array of images
|
|
16
|
+
equipmentProvided: varchar("equipment_provided", { length: 255 }), // Equipment provided by organizer
|
|
17
|
+
equipmentRequired: varchar("equipment_required", { length: 255 }), // Equipment participants must bring
|
|
18
|
+
cost: integer("cost").default(0), // cost in cents
|
|
19
|
+
costPerPlayer: boolean("cost_per_player").notNull().default(true),
|
|
20
|
+
rules: text("rules"), // custom rules or modifications
|
|
21
|
+
weatherDependent: boolean("weather_dependent").notNull().default(true),
|
|
22
|
+
startTime: timestamp("start_time").notNull(),
|
|
23
|
+
endTime: timestamp("end_time").notNull(),
|
|
24
|
+
status: varchar("status", { length: 20 }).notNull().default("open"), // open, full, cancelled, completed
|
|
25
|
+
notes: text("notes"),
|
|
26
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
27
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull(),
|
|
28
|
+
});
|
|
29
|
+
export const pickupRelations = relations(pickup, ({ one }) => ({
|
|
30
|
+
event: one(event, {
|
|
31
|
+
fields: [pickup.eventId],
|
|
32
|
+
references: [event.id],
|
|
33
|
+
}),
|
|
34
|
+
}));
|
|
35
|
+
export const eventPickupRelations = relations(event, ({ one }) => ({
|
|
36
|
+
pickup: one(pickup, {
|
|
37
|
+
fields: [event.id],
|
|
38
|
+
references: [pickup.eventId],
|
|
39
|
+
}),
|
|
40
|
+
}));
|
|
41
|
+
export const selectPickupSchema = createSelectSchema(pickup);
|
|
42
|
+
export default pickup;
|