Skip to content

Commit 382ac06

Browse files
committed
v1.0.5
1 parent 45d852a commit 382ac06

File tree

6 files changed

+97
-94
lines changed

6 files changed

+97
-94
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modl-gg/shared-web",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Shared schemas and types for the modl ecosystem.",
55
"main": "dist/index.js",
66
"module": "dist/esm/index.js",

src/components/ui/dialog.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
3131

3232
const DialogContent = React.forwardRef<
3333
React.ElementRef<typeof DialogPrimitive.Content>,
34-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
35-
>(({ className, children, ...props }, ref) => (
34+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & { overlayClassName?: string }
35+
>(({ className, children, overlayClassName, ...props }, ref) => (
3636
<DialogPortal>
37-
<DialogOverlay />
37+
<DialogOverlay className={overlayClassName} />
3838
<DialogPrimitive.Content
3939
ref={ref}
4040
className={cn(

src/schemas/ModlServerSchema.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,34 @@ export interface IModlServer extends Document {
1414
emailVerificationToken?: string;
1515

1616
// Provisioning & Status
17-
provisioningStatus: 'pending' | 'in-progress' | 'completed' | 'failed';
17+
provisioningStatus: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
1818
provisioningNotes?: string;
1919
provisioningSignInToken?: string;
2020
provisioningSignInTokenExpiresAt?: Date;
2121

2222
// Plan & Billing
23-
plan: 'free' | 'premium';
24-
subscription_status: 'active' | 'canceled' | 'past_due' | 'inactive' | 'trialing' | 'incomplete' | 'incomplete_expired' | 'unpaid' | 'paused';
25-
current_period_start?: Date;
26-
current_period_end?: Date;
27-
stripe_customer_id?: string;
28-
stripe_subscription_id?: string;
23+
plan: 'FREE' | 'PREMIUM';
24+
subscriptionStatus?: 'ACTIVE' | 'CANCELED' | 'PAST_DUE' | 'INACTIVE' | 'TRIALING' | 'INCOMPLETE' | 'INCOMPLETE_EXPIRED' | 'UNPAID' | 'PAUSED';
25+
currentPeriodStart?: Date;
26+
currentPeriodEnd?: Date;
27+
stripeCustomerId?: string;
28+
stripeSubscriptionId?: string;
2929

3030
// Usage Tracking & Billing
31-
cdn_usage_current_period?: number; // GB used in current billing period
32-
ai_requests_current_period?: number; // AI requests used in current billing period
33-
usage_billing_enabled?: boolean; // Whether to charge for overages
34-
usage_billing_updated_at?: Date;
31+
cdnUsageCurrentPeriod?: number; // GB used in current billing period
32+
aiRequestsCurrentPeriod?: number; // AI requests used in current billing period
33+
usageBillingEnabled?: boolean; // Whether to charge for overages
34+
usageBillingUpdatedAt?: Date;
3535

3636
// Migration Settings
3737
migrationFileSizeLimit?: number; // Custom migration file size limit in bytes (optional, defaults to 5GB)
3838

3939
// Custom Domain
40-
customDomain_override?: string;
41-
customDomain_status?: 'pending' | 'active' | 'error' | 'verifying';
42-
customDomain_lastChecked?: Date;
43-
customDomain_error?: string;
44-
customDomain_cloudflareId?: string;
40+
customDomainOverride?: string;
41+
customDomainStatus?: 'PENDING' | 'ACTIVE' | 'ERROR' | 'VERIFYING';
42+
customDomainLastChecked?: Date;
43+
customDomainError?: string;
44+
customDomainCloudflareId?: string;
4545

4646
// Analytics/Stats from modl-admin
4747
userCount: number;
@@ -63,32 +63,32 @@ export const ModlServerSchema = new Schema<IModlServer>({
6363
emailVerified: { type: Boolean, default: false, index: true },
6464
emailVerificationToken: { type: String, unique: true, sparse: true },
6565

66-
provisioningStatus: { type: String, enum: ['pending', 'in-progress', 'completed', 'failed'], default: 'pending', index: true },
66+
provisioningStatus: { type: String, enum: ['PENDING', 'IN_PROGRESS', 'COMPLETED', 'FAILED'], default: 'PENDING', index: true },
6767
provisioningNotes: { type: String },
6868
provisioningSignInToken: { type: String, unique: true, sparse: true },
6969
provisioningSignInTokenExpiresAt: { type: Date },
7070

71-
plan: { type: String, enum: ['free', 'premium'], default: 'free', index: true },
72-
subscription_status: { type: String, enum: ['active', 'canceled', 'past_due', 'inactive', 'trialing', 'incomplete', 'incomplete_expired', 'unpaid', 'paused'], default: 'inactive', index: true },
73-
current_period_start: { type: Date, sparse: true },
74-
current_period_end: { type: Date, sparse: true },
75-
stripe_customer_id: { type: String, unique: true, sparse: true },
76-
stripe_subscription_id: { type: String, unique: true, sparse: true },
71+
plan: { type: String, enum: ['FREE', 'PREMIUM'], default: 'FREE', index: true },
72+
subscriptionStatus: { type: String, enum: ['ACTIVE', 'CANCELED', 'PAST_DUE', 'INACTIVE', 'TRIALING', 'INCOMPLETE', 'INCOMPLETE_EXPIRED', 'UNPAID', 'PAUSED'], default: 'INACTIVE', index: true },
73+
currentPeriodStart: { type: Date, sparse: true },
74+
currentPeriodEnd: { type: Date, sparse: true },
75+
stripeCustomerId: { type: String, unique: true, sparse: true },
76+
stripeSubscriptionId: { type: String, unique: true, sparse: true },
7777

7878
// Usage Tracking & Billing
79-
cdn_usage_current_period: { type: Number, default: 0 },
80-
ai_requests_current_period: { type: Number, default: 0 },
81-
usage_billing_enabled: { type: Boolean, default: false },
82-
usage_billing_updated_at: { type: Date, sparse: true },
79+
cdnUsageCurrentPeriod: { type: Number, default: 0 },
80+
aiRequestsCurrentPeriod: { type: Number, default: 0 },
81+
usageBillingEnabled: { type: Boolean, default: false },
82+
usageBillingUpdatedAt: { type: Date, sparse: true },
8383

8484
// Migration Settings
8585
migrationFileSizeLimit: { type: Number, sparse: true },
8686

87-
customDomain_override: { type: String, unique: true, sparse: true },
88-
customDomain_status: { type: String, enum: ['pending', 'active', 'error', 'verifying'], sparse: true },
89-
customDomain_lastChecked: { type: Date, sparse: true },
90-
customDomain_error: { type: String, sparse: true },
91-
customDomain_cloudflareId: { type: String, unique: true, sparse: true },
87+
customDomainOverride: { type: String, unique: true, sparse: true },
88+
customDomainStatus: { type: String, enum: ['PENDING', 'ACTIVE', 'ERROR', 'VERIFYING'], sparse: true },
89+
customDomainLastChecked: { type: Date, sparse: true },
90+
customDomainError: { type: String, sparse: true },
91+
customDomainCloudflareId: { type: String, unique: true, sparse: true },
9292

9393
userCount: { type: Number, default: 0 },
9494
ticketCount: { type: Number, default: 0 },
@@ -104,11 +104,11 @@ export const ModlServerSchema = new Schema<IModlServer>({
104104

105105
// Indexes for common queries
106106
ModlServerSchema.index({ adminEmail: 1 });
107-
ModlServerSchema.index({ plan: 1, subscription_status: 1 });
107+
ModlServerSchema.index({ plan: 1, subscriptionStatus: 1 });
108108
ModlServerSchema.index({ provisioningStatus: 1, emailVerified: 1 });
109109
ModlServerSchema.index({ serverName: 'text', customDomain: 'text', adminEmail: 'text' });
110110

111111
// Only create the model on server-side (Node.js environment)
112112
export const ModlServerModel = typeof window === 'undefined' && mongoose?.models
113113
? (mongoose.models.ModlServer || model<IModlServer>('ModlServer', ModlServerSchema))
114-
: null;
114+
: null;

src/schemas/TenantSchemas.ts

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import mongoose, { Document, Schema, Types, Int32 } from 'mongoose';
1+
import mongoose, { Schema } from 'mongoose';
22
import slugify from 'slugify';
33

44
// Player Schemas
@@ -131,11 +131,10 @@ export const StaffSchema = new Schema({
131131
}, { timestamps: true });
132132

133133
export const InvitationSchema = new Schema({
134-
email: { type: String, required: true, unique: true },
134+
email: { type: String, required: true },
135135
role: { type: String, required: true }, // Removed enum to allow custom roles - validation handled in application logic
136136
token: { type: String, required: true, unique: true },
137137
expiresAt: { type: Date, required: true },
138-
status: { type: String, enum: ['pending', 'accepted'], default: 'pending' },
139138
}, { timestamps: true });
140139

141140

@@ -164,8 +163,8 @@ export const TicketSchema = new Schema({
164163
status: { type: String, required: true, enum: ['Unfinished', 'Open', 'Closed', 'Under Review', 'Pending Player Response', 'Resolved'], default: 'Unfinished' },
165164
subject: { type: String, default: '' },
166165
created: { type: Date, default: Date.now },
167-
creator: { type: String, required: true },
168-
creatorUuid: { type: String, required: true },
166+
creatorName: { type: String, required: true },
167+
creatorUuid: { type: String },
169168
reportedPlayer: { type: String },
170169
reportedPlayerUuid: { type: String },
171170
chatMessages: [{ type: String }],
@@ -215,11 +214,10 @@ export const KnowledgebaseArticleSchema = new Schema({
215214
title: { type: String, required: true, trim: true },
216215
slug: { type: String, unique: true, index: true },
217216
content: { type: String, required: true },
218-
category: { type: Schema.Types.ObjectId, ref: 'KnowledgebaseCategory', required: true },
219-
author: { type: Schema.Types.ObjectId, ref: 'User' },
220-
is_visible: { type: Boolean, default: true },
217+
categoryId: { type: String, required: true, index: true },
218+
isVisible: { type: Boolean, default: true },
221219
ordinal: { type: Number, default: 0 },
222-
}, { timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' } }
220+
}, { timestamps: true }
223221
);
224222

225223
KnowledgebaseArticleSchema.pre('save', function (next) {
@@ -234,8 +232,9 @@ export const KnowledgebaseCategorySchema = new Schema({
234232
slug: { type: String, unique: true, index: true },
235233
description: { type: String, trim: true },
236234
ordinal: { type: Number, default: 0 },
235+
isVisible: { type: Boolean, default: true },
237236
}, {
238-
timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' },
237+
timestamps: true,
239238
toJSON: { virtuals: true },
240239
toObject: { virtuals: true },
241240
}
@@ -251,7 +250,7 @@ KnowledgebaseCategorySchema.pre('save', function (next) {
251250
KnowledgebaseCategorySchema.virtual('articles', {
252251
ref: 'KnowledgebaseArticle',
253252
localField: '_id',
254-
foreignField: 'category',
253+
foreignField: 'categoryId',
255254
justOne: false,
256255
options: { sort: { ordinal: 1 } }
257256
});
@@ -262,42 +261,42 @@ export const HomepageCardSchema = new Schema({
262261
title: { type: String, required: true, trim: true },
263262
description: { type: String, required: true, trim: true },
264263
icon: { type: String, required: true, trim: true },
265-
icon_color: { type: String, trim: true },
266-
action_type: { type: String, required: true, enum: ['url', 'category_dropdown'], default: 'url' },
267-
action_url: { type: String, trim: true,
264+
iconColor: { type: String, trim: true },
265+
actionType: { type: String, required: true, enum: ['url', 'category_dropdown'], default: 'url' },
266+
actionUrl: { type: String, trim: true,
268267
validate: {
269268
validator: function(this: any, v: string) {
270-
return this.action_type !== 'url' || Boolean(v && v.length > 0);
269+
return this.actionType !== 'url' || Boolean(v && v.length > 0);
271270
},
272271
message: 'URL is required when action type is URL'
273272
}
274273
},
275-
action_button_text: { type: String, trim: true,
274+
actionButtonText: { type: String, trim: true,
276275
default: function(this: any) {
277-
return this.action_type === 'url' ? 'Learn More' : undefined;
276+
return this.actionType === 'url' ? 'Learn More' : undefined;
278277
}
279278
},
280-
category_id: { type: Schema.Types.ObjectId, ref: 'KnowledgebaseCategory',
279+
categoryId: { type: String,
281280
validate: {
282-
validator: function(this: any, v: Types.ObjectId) {
283-
return this.action_type !== 'category_dropdown' || Boolean(v);
281+
validator: function(this: any, v: string) {
282+
return this.actionType !== 'category_dropdown' || Boolean(v);
284283
},
285284
message: 'Category is required when action type is category dropdown'
286285
}
287286
},
288-
background_color: { type: String, trim: true },
289-
is_enabled: { type: Boolean, default: true },
287+
backgroundColor: { type: String, trim: true },
288+
isEnabled: { type: Boolean, default: true },
290289
ordinal: { type: Number, default: 0 },
291290
}, {
292-
timestamps: { createdAt: 'created_at', updatedAt: 'updated_at' },
291+
timestamps: true,
293292
toJSON: { virtuals: true },
294293
toObject: { virtuals: true }
295294
}
296295
);
297296

298297
HomepageCardSchema.virtual('category', {
299298
ref: 'KnowledgebaseCategory',
300-
localField: 'category_id',
299+
localField: 'categoryId',
301300
foreignField: '_id',
302301
justOne: true
303-
});
302+
});

src/types/index.ts

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ export interface Invitation {
3535
role: 'Admin' | 'Moderator' | 'Helper';
3636
token: string;
3737
expiresAt: Date;
38-
status: 'pending' | 'accepted';
38+
createdAt?: Date;
39+
updatedAt?: Date;
3940
}
4041

4142
// Authentication & Session
4243
export interface EmailCode {
4344
email: string;
44-
code: string;
45+
codeHash: string;
46+
failedAttempts: number;
4547
expiresAt: Date;
46-
used: boolean;
47-
createdAt: Date;
4848
}
4949

5050
// @ts-ignore
@@ -68,18 +68,22 @@ export interface IModlServer {
6868
databaseName?: string;
6969
adminEmail: string;
7070
emailVerified: boolean;
71-
provisioningStatus: 'pending' | 'in-progress' | 'completed' | 'failed';
72-
plan: 'free' | 'premium';
73-
subscription_status: 'active' | 'canceled' | 'past_due' | 'inactive' | 'trialing' | 'incomplete' | 'incomplete_expired' | 'unpaid' | 'paused';
74-
current_period_start?: Date;
75-
current_period_end?: Date;
76-
stripe_customer_id?: string;
77-
stripe_subscription_id?: string;
78-
cdn_usage_current_period?: number;
79-
ai_requests_current_period?: number;
80-
usage_billing_enabled?: boolean;
81-
customDomain_override?: string;
82-
customDomain_status?: 'pending' | 'active' | 'error' | 'verifying';
71+
provisioningStatus: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
72+
plan: 'FREE' | 'PREMIUM';
73+
subscriptionStatus?: 'ACTIVE' | 'CANCELED' | 'PAST_DUE' | 'INACTIVE' | 'TRIALING' | 'INCOMPLETE' | 'INCOMPLETE_EXPIRED' | 'UNPAID' | 'PAUSED';
74+
currentPeriodStart?: Date;
75+
currentPeriodEnd?: Date;
76+
stripeCustomerId?: string;
77+
stripeSubscriptionId?: string;
78+
cdnUsageCurrentPeriod?: number;
79+
aiRequestsCurrentPeriod?: number;
80+
usageBillingEnabled?: boolean;
81+
usageBillingUpdatedAt?: Date;
82+
customDomainOverride?: string;
83+
customDomainStatus?: 'PENDING' | 'ACTIVE' | 'ERROR' | 'VERIFYING';
84+
customDomainLastChecked?: Date;
85+
customDomainError?: string;
86+
customDomainCloudflareId?: string;
8387
userCount: number;
8488
ticketCount: number;
8589
region?: string;
@@ -206,8 +210,8 @@ export interface ITicket extends Document {
206210
subject: string;
207211
created: Date;
208212
updatedAt: Date;
209-
creator: string;
210-
creatorUuid: string;
213+
creatorName: string;
214+
creatorUuid?: string;
211215
reportedPlayer?: string;
212216
reportedPlayerUuid?: string;
213217
chatMessages?: string[];
@@ -233,15 +237,15 @@ export interface KnowledgebaseArticleStub {
233237
title: string;
234238
slug: string;
235239
ordinal: number;
236-
is_visible: boolean;
240+
isVisible: boolean;
237241
categoryId: string;
238242
}
239243

240244
export interface KnowledgebaseArticle extends KnowledgebaseArticleStub {
241245
content: string;
242246
category: { id: string; name: string; slug: string; };
243-
created_at: string;
244-
updated_at: string;
247+
createdAt: string;
248+
updatedAt: string;
245249
}
246250

247251
// Homepage Cards
@@ -250,13 +254,13 @@ export interface HomepageCard {
250254
title: string;
251255
description: string;
252256
icon: string;
253-
icon_color?: string;
254-
action_type: 'url' | 'category_dropdown';
255-
action_url?: string;
256-
action_button_text?: string;
257-
category_id?: string;
258-
background_color?: string;
259-
is_enabled: boolean;
257+
iconColor?: string;
258+
actionType: 'url' | 'category_dropdown';
259+
actionUrl?: string;
260+
actionButtonText?: string;
261+
categoryId?: string;
262+
backgroundColor?: string;
263+
isEnabled: boolean;
260264
ordinal: number;
261265
category?: KnowledgebaseCategory;
262266
}
@@ -322,4 +326,4 @@ export interface InsertServer {
322326
emailVerificationToken?: string;
323327
emailVerified?: boolean;
324328
}
325-
export type Server = InsertServer & { id: string; };
329+
export type Server = InsertServer & { id: string; };

0 commit comments

Comments
 (0)