vr-models 1.0.35 → 1.0.37

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.
@@ -0,0 +1,201 @@
1
+ import { Model, InferAttributes, InferCreationAttributes, CreationOptional, NonAttribute, ModelStatic } from "vr-migrations";
2
+ import type { User } from "./user.models";
3
+ export type AppTheme = "light" | "dark" | "system";
4
+ export type ButtonStyle = "rounded" | "square" | "pill";
5
+ export type FontFamily = "system" | "roboto" | "poppins" | "inter" | "montserrat";
6
+ export interface AppSpecsAttributes {
7
+ id: string;
8
+ appName: string;
9
+ appShortName: string | null;
10
+ appDescription: string | null;
11
+ appIcon: string | null;
12
+ appLogo: string | null;
13
+ appFavicon: string | null;
14
+ appSplashScreen: string | null;
15
+ appDefaultLanguage: string;
16
+ appSupportedLanguages: string[];
17
+ primaryColor: string;
18
+ secondaryColor: string;
19
+ accentColor: string;
20
+ successColor: string;
21
+ errorColor: string;
22
+ warningColor: string;
23
+ infoColor: string;
24
+ backgroundColor: string;
25
+ textColor: string;
26
+ buttonColor: string;
27
+ buttonTextColor: string;
28
+ theme: AppTheme;
29
+ buttonStyle: ButtonStyle;
30
+ fontFamily: FontFamily;
31
+ borderRadius: number;
32
+ enableAnimations: boolean;
33
+ enablePushNotifications: boolean;
34
+ enableEmailNotifications: boolean;
35
+ enableSmsNotifications: boolean;
36
+ privacyPolicy: string | null;
37
+ privacyPolicyVersion: string | null;
38
+ privacyPolicyUpdatedAt: Date | null;
39
+ termsAndConditions: string | null;
40
+ termsAndConditionsVersion: string | null;
41
+ termsAndConditionsUpdatedAt: Date | null;
42
+ aboutUs: string | null;
43
+ aboutUsUpdatedAt: Date | null;
44
+ cookiePolicy: string | null;
45
+ cookiePolicyVersion: string | null;
46
+ cookiePolicyUpdatedAt: Date | null;
47
+ refundPolicy: string | null;
48
+ refundPolicyVersion: string | null;
49
+ refundPolicyUpdatedAt: Date | null;
50
+ appVersion: string | null;
51
+ minimumSupportedVersion: string | null;
52
+ latestVersion: string | null;
53
+ forceUpdate: boolean;
54
+ facebookUrl: string | null;
55
+ twitterUrl: string | null;
56
+ instagramUrl: string | null;
57
+ linkedinUrl: string | null;
58
+ youtubeUrl: string | null;
59
+ websiteUrl: string | null;
60
+ supportEmail: string | null;
61
+ supportPhone: string | null;
62
+ companyName: string | null;
63
+ companyAddress: string | null;
64
+ companyEmail: string | null;
65
+ companyPhone: string | null;
66
+ companyTaxId: string | null;
67
+ enableRiderApp: boolean;
68
+ enablePassengerApp: boolean;
69
+ enableAgentApp: boolean;
70
+ enableAdminDashboard: boolean;
71
+ enableGuestCheckout: boolean;
72
+ enableReferrals: boolean;
73
+ enableWallet: boolean;
74
+ enablePromoCodes: boolean;
75
+ enableReviews: boolean;
76
+ enableChat: boolean;
77
+ enableVoiceCall: boolean;
78
+ enableMaps: boolean;
79
+ enablePayment: boolean;
80
+ isUnderMaintenance: boolean;
81
+ maintenanceMessage: string | null;
82
+ maintenanceStartAt: Date | null;
83
+ maintenanceEndAt: Date | null;
84
+ googleAnalyticsId: string | null;
85
+ facebookPixelId: string | null;
86
+ sentryDsn: string | null;
87
+ updatedBy: string | null;
88
+ version: number;
89
+ isActive: boolean;
90
+ createdAt: Date;
91
+ updatedAt: Date;
92
+ lastEditor?: User;
93
+ }
94
+ export interface AppSpecsCreationAttributes extends Omit<AppSpecsAttributes, "id" | "createdAt" | "updatedAt" | "version" | "isActive" | "privacyPolicyUpdatedAt" | "termsAndConditionsUpdatedAt" | "aboutUsUpdatedAt" | "cookiePolicyUpdatedAt" | "refundPolicyUpdatedAt"> {
95
+ id?: string;
96
+ version?: number;
97
+ isActive?: boolean;
98
+ privacyPolicyUpdatedAt?: Date | null;
99
+ termsAndConditionsUpdatedAt?: Date | null;
100
+ aboutUsUpdatedAt?: Date | null;
101
+ cookiePolicyUpdatedAt?: Date | null;
102
+ refundPolicyUpdatedAt?: Date | null;
103
+ }
104
+ export declare class AppSpecs extends Model<InferAttributes<AppSpecs>, InferCreationAttributes<AppSpecs>> implements AppSpecsAttributes {
105
+ id: CreationOptional<string>;
106
+ appName: string;
107
+ appShortName: CreationOptional<string | null>;
108
+ appDescription: CreationOptional<string | null>;
109
+ appIcon: CreationOptional<string | null>;
110
+ appLogo: CreationOptional<string | null>;
111
+ appFavicon: CreationOptional<string | null>;
112
+ appSplashScreen: CreationOptional<string | null>;
113
+ appDefaultLanguage: CreationOptional<string>;
114
+ appSupportedLanguages: CreationOptional<string[]>;
115
+ primaryColor: CreationOptional<string>;
116
+ secondaryColor: CreationOptional<string>;
117
+ accentColor: CreationOptional<string>;
118
+ successColor: CreationOptional<string>;
119
+ errorColor: CreationOptional<string>;
120
+ warningColor: CreationOptional<string>;
121
+ infoColor: CreationOptional<string>;
122
+ backgroundColor: CreationOptional<string>;
123
+ textColor: CreationOptional<string>;
124
+ buttonColor: CreationOptional<string>;
125
+ buttonTextColor: CreationOptional<string>;
126
+ theme: CreationOptional<AppTheme>;
127
+ buttonStyle: CreationOptional<ButtonStyle>;
128
+ fontFamily: CreationOptional<FontFamily>;
129
+ borderRadius: CreationOptional<number>;
130
+ enableAnimations: CreationOptional<boolean>;
131
+ enablePushNotifications: CreationOptional<boolean>;
132
+ enableEmailNotifications: CreationOptional<boolean>;
133
+ enableSmsNotifications: CreationOptional<boolean>;
134
+ privacyPolicy: CreationOptional<string | null>;
135
+ privacyPolicyVersion: CreationOptional<string | null>;
136
+ privacyPolicyUpdatedAt: CreationOptional<Date | null>;
137
+ termsAndConditions: CreationOptional<string | null>;
138
+ termsAndConditionsVersion: CreationOptional<string | null>;
139
+ termsAndConditionsUpdatedAt: CreationOptional<Date | null>;
140
+ aboutUs: CreationOptional<string | null>;
141
+ aboutUsUpdatedAt: CreationOptional<Date | null>;
142
+ cookiePolicy: CreationOptional<string | null>;
143
+ cookiePolicyVersion: CreationOptional<string | null>;
144
+ cookiePolicyUpdatedAt: CreationOptional<Date | null>;
145
+ refundPolicy: CreationOptional<string | null>;
146
+ refundPolicyVersion: CreationOptional<string | null>;
147
+ refundPolicyUpdatedAt: CreationOptional<Date | null>;
148
+ appVersion: CreationOptional<string | null>;
149
+ minimumSupportedVersion: CreationOptional<string | null>;
150
+ latestVersion: CreationOptional<string | null>;
151
+ forceUpdate: CreationOptional<boolean>;
152
+ facebookUrl: CreationOptional<string | null>;
153
+ twitterUrl: CreationOptional<string | null>;
154
+ instagramUrl: CreationOptional<string | null>;
155
+ linkedinUrl: CreationOptional<string | null>;
156
+ youtubeUrl: CreationOptional<string | null>;
157
+ websiteUrl: CreationOptional<string | null>;
158
+ supportEmail: CreationOptional<string | null>;
159
+ supportPhone: CreationOptional<string | null>;
160
+ companyName: CreationOptional<string | null>;
161
+ companyAddress: CreationOptional<string | null>;
162
+ companyEmail: CreationOptional<string | null>;
163
+ companyPhone: CreationOptional<string | null>;
164
+ companyTaxId: CreationOptional<string | null>;
165
+ enableRiderApp: CreationOptional<boolean>;
166
+ enablePassengerApp: CreationOptional<boolean>;
167
+ enableAgentApp: CreationOptional<boolean>;
168
+ enableAdminDashboard: CreationOptional<boolean>;
169
+ enableGuestCheckout: CreationOptional<boolean>;
170
+ enableReferrals: CreationOptional<boolean>;
171
+ enableWallet: CreationOptional<boolean>;
172
+ enablePromoCodes: CreationOptional<boolean>;
173
+ enableReviews: CreationOptional<boolean>;
174
+ enableChat: CreationOptional<boolean>;
175
+ enableVoiceCall: CreationOptional<boolean>;
176
+ enableMaps: CreationOptional<boolean>;
177
+ enablePayment: CreationOptional<boolean>;
178
+ isUnderMaintenance: CreationOptional<boolean>;
179
+ maintenanceMessage: CreationOptional<string | null>;
180
+ maintenanceStartAt: CreationOptional<Date | null>;
181
+ maintenanceEndAt: CreationOptional<Date | null>;
182
+ googleAnalyticsId: CreationOptional<string | null>;
183
+ facebookPixelId: CreationOptional<string | null>;
184
+ sentryDsn: CreationOptional<string | null>;
185
+ updatedBy: CreationOptional<string | null>;
186
+ version: CreationOptional<number>;
187
+ isActive: CreationOptional<boolean>;
188
+ readonly createdAt: CreationOptional<Date>;
189
+ readonly updatedAt: CreationOptional<Date>;
190
+ lastEditor?: NonAttribute<User>;
191
+ static initialize(sequelize: any): void;
192
+ static associate(models: Record<string, ModelStatic<Model>>): void;
193
+ updateWithVersion(data: Partial<AppSpecsAttributes>, editorId: string): Promise<void>;
194
+ archive(): Promise<void>;
195
+ activate(): Promise<void>;
196
+ getColorPalette(): Record<string, string>;
197
+ isInMaintenance(): boolean;
198
+ getMaintenanceMessage(): string | null;
199
+ static getActive(): Promise<AppSpecs | null>;
200
+ }
201
+ export type AppSpecsModel = typeof AppSpecs;
@@ -0,0 +1,500 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppSpecs = void 0;
4
+ const vr_migrations_1 = require("vr-migrations");
5
+ class AppSpecs extends vr_migrations_1.Model {
6
+ // Static initialization method
7
+ static initialize(sequelize) {
8
+ this.init({
9
+ id: {
10
+ type: vr_migrations_1.DataTypes.UUID,
11
+ defaultValue: vr_migrations_1.DataTypes.UUIDV4,
12
+ primaryKey: true,
13
+ },
14
+ // App Identity
15
+ appName: {
16
+ type: vr_migrations_1.DataTypes.STRING(100),
17
+ allowNull: false,
18
+ defaultValue: "VR App",
19
+ },
20
+ appShortName: {
21
+ type: vr_migrations_1.DataTypes.STRING(50),
22
+ allowNull: true,
23
+ },
24
+ appDescription: {
25
+ type: vr_migrations_1.DataTypes.TEXT,
26
+ allowNull: true,
27
+ },
28
+ appIcon: {
29
+ type: vr_migrations_1.DataTypes.STRING(500),
30
+ allowNull: true,
31
+ },
32
+ appLogo: {
33
+ type: vr_migrations_1.DataTypes.STRING(500),
34
+ allowNull: true,
35
+ },
36
+ appFavicon: {
37
+ type: vr_migrations_1.DataTypes.STRING(500),
38
+ allowNull: true,
39
+ },
40
+ appSplashScreen: {
41
+ type: vr_migrations_1.DataTypes.STRING(500),
42
+ allowNull: true,
43
+ },
44
+ appDefaultLanguage: {
45
+ type: vr_migrations_1.DataTypes.STRING(10),
46
+ allowNull: false,
47
+ defaultValue: "en",
48
+ },
49
+ appSupportedLanguages: {
50
+ type: vr_migrations_1.DataTypes.ARRAY(vr_migrations_1.DataTypes.STRING(10)),
51
+ allowNull: false,
52
+ defaultValue: ["en", "fr"],
53
+ },
54
+ // Branding & Colors
55
+ primaryColor: {
56
+ type: vr_migrations_1.DataTypes.STRING(7),
57
+ allowNull: false,
58
+ defaultValue: "#3B82F6",
59
+ validate: {
60
+ is: /^#[0-9A-Fa-f]{6}$/i,
61
+ },
62
+ },
63
+ secondaryColor: {
64
+ type: vr_migrations_1.DataTypes.STRING(7),
65
+ allowNull: false,
66
+ defaultValue: "#10B981",
67
+ },
68
+ accentColor: {
69
+ type: vr_migrations_1.DataTypes.STRING(7),
70
+ allowNull: false,
71
+ defaultValue: "#F59E0B",
72
+ },
73
+ successColor: {
74
+ type: vr_migrations_1.DataTypes.STRING(7),
75
+ allowNull: false,
76
+ defaultValue: "#10B981",
77
+ },
78
+ errorColor: {
79
+ type: vr_migrations_1.DataTypes.STRING(7),
80
+ allowNull: false,
81
+ defaultValue: "#EF4444",
82
+ },
83
+ warningColor: {
84
+ type: vr_migrations_1.DataTypes.STRING(7),
85
+ allowNull: false,
86
+ defaultValue: "#F59E0B",
87
+ },
88
+ infoColor: {
89
+ type: vr_migrations_1.DataTypes.STRING(7),
90
+ allowNull: false,
91
+ defaultValue: "#3B82F6",
92
+ },
93
+ backgroundColor: {
94
+ type: vr_migrations_1.DataTypes.STRING(7),
95
+ allowNull: false,
96
+ defaultValue: "#FFFFFF",
97
+ },
98
+ textColor: {
99
+ type: vr_migrations_1.DataTypes.STRING(7),
100
+ allowNull: false,
101
+ defaultValue: "#1F2937",
102
+ },
103
+ buttonColor: {
104
+ type: vr_migrations_1.DataTypes.STRING(7),
105
+ allowNull: false,
106
+ defaultValue: "#3B82F6",
107
+ },
108
+ buttonTextColor: {
109
+ type: vr_migrations_1.DataTypes.STRING(7),
110
+ allowNull: false,
111
+ defaultValue: "#FFFFFF",
112
+ },
113
+ // UI/UX
114
+ theme: {
115
+ type: vr_migrations_1.DataTypes.ENUM("light", "dark", "system"),
116
+ allowNull: false,
117
+ defaultValue: "system",
118
+ },
119
+ buttonStyle: {
120
+ type: vr_migrations_1.DataTypes.ENUM("rounded", "square", "pill"),
121
+ allowNull: false,
122
+ defaultValue: "rounded",
123
+ },
124
+ fontFamily: {
125
+ type: vr_migrations_1.DataTypes.ENUM("system", "roboto", "poppins", "inter", "montserrat"),
126
+ allowNull: false,
127
+ defaultValue: "system",
128
+ },
129
+ borderRadius: {
130
+ type: vr_migrations_1.DataTypes.INTEGER,
131
+ allowNull: false,
132
+ defaultValue: 8,
133
+ },
134
+ enableAnimations: {
135
+ type: vr_migrations_1.DataTypes.BOOLEAN,
136
+ allowNull: false,
137
+ defaultValue: true,
138
+ },
139
+ enablePushNotifications: {
140
+ type: vr_migrations_1.DataTypes.BOOLEAN,
141
+ allowNull: false,
142
+ defaultValue: true,
143
+ },
144
+ enableEmailNotifications: {
145
+ type: vr_migrations_1.DataTypes.BOOLEAN,
146
+ allowNull: false,
147
+ defaultValue: true,
148
+ },
149
+ enableSmsNotifications: {
150
+ type: vr_migrations_1.DataTypes.BOOLEAN,
151
+ allowNull: false,
152
+ defaultValue: true,
153
+ },
154
+ // Legal Documents
155
+ privacyPolicy: {
156
+ type: vr_migrations_1.DataTypes.TEXT,
157
+ allowNull: true,
158
+ },
159
+ privacyPolicyVersion: {
160
+ type: vr_migrations_1.DataTypes.STRING(20),
161
+ allowNull: true,
162
+ },
163
+ privacyPolicyUpdatedAt: {
164
+ type: vr_migrations_1.DataTypes.DATE,
165
+ allowNull: true,
166
+ },
167
+ termsAndConditions: {
168
+ type: vr_migrations_1.DataTypes.TEXT,
169
+ allowNull: true,
170
+ },
171
+ termsAndConditionsVersion: {
172
+ type: vr_migrations_1.DataTypes.STRING(20),
173
+ allowNull: true,
174
+ },
175
+ termsAndConditionsUpdatedAt: {
176
+ type: vr_migrations_1.DataTypes.DATE,
177
+ allowNull: true,
178
+ },
179
+ aboutUs: {
180
+ type: vr_migrations_1.DataTypes.TEXT,
181
+ allowNull: true,
182
+ },
183
+ aboutUsUpdatedAt: {
184
+ type: vr_migrations_1.DataTypes.DATE,
185
+ allowNull: true,
186
+ },
187
+ cookiePolicy: {
188
+ type: vr_migrations_1.DataTypes.TEXT,
189
+ allowNull: true,
190
+ },
191
+ cookiePolicyVersion: {
192
+ type: vr_migrations_1.DataTypes.STRING(20),
193
+ allowNull: true,
194
+ },
195
+ cookiePolicyUpdatedAt: {
196
+ type: vr_migrations_1.DataTypes.DATE,
197
+ allowNull: true,
198
+ },
199
+ refundPolicy: {
200
+ type: vr_migrations_1.DataTypes.TEXT,
201
+ allowNull: true,
202
+ },
203
+ refundPolicyVersion: {
204
+ type: vr_migrations_1.DataTypes.STRING(20),
205
+ allowNull: true,
206
+ },
207
+ refundPolicyUpdatedAt: {
208
+ type: vr_migrations_1.DataTypes.DATE,
209
+ allowNull: true,
210
+ },
211
+ // App Metadata
212
+ appVersion: {
213
+ type: vr_migrations_1.DataTypes.STRING(20),
214
+ allowNull: true,
215
+ },
216
+ minimumSupportedVersion: {
217
+ type: vr_migrations_1.DataTypes.STRING(20),
218
+ allowNull: true,
219
+ },
220
+ latestVersion: {
221
+ type: vr_migrations_1.DataTypes.STRING(20),
222
+ allowNull: true,
223
+ },
224
+ forceUpdate: {
225
+ type: vr_migrations_1.DataTypes.BOOLEAN,
226
+ allowNull: false,
227
+ defaultValue: false,
228
+ },
229
+ // Social Links
230
+ facebookUrl: {
231
+ type: vr_migrations_1.DataTypes.STRING(255),
232
+ allowNull: true,
233
+ },
234
+ twitterUrl: {
235
+ type: vr_migrations_1.DataTypes.STRING(255),
236
+ allowNull: true,
237
+ },
238
+ instagramUrl: {
239
+ type: vr_migrations_1.DataTypes.STRING(255),
240
+ allowNull: true,
241
+ },
242
+ linkedinUrl: {
243
+ type: vr_migrations_1.DataTypes.STRING(255),
244
+ allowNull: true,
245
+ },
246
+ youtubeUrl: {
247
+ type: vr_migrations_1.DataTypes.STRING(255),
248
+ allowNull: true,
249
+ },
250
+ websiteUrl: {
251
+ type: vr_migrations_1.DataTypes.STRING(255),
252
+ allowNull: true,
253
+ },
254
+ supportEmail: {
255
+ type: vr_migrations_1.DataTypes.STRING(100),
256
+ allowNull: true,
257
+ },
258
+ supportPhone: {
259
+ type: vr_migrations_1.DataTypes.STRING(20),
260
+ allowNull: true,
261
+ },
262
+ // Contact Info
263
+ companyName: {
264
+ type: vr_migrations_1.DataTypes.STRING(200),
265
+ allowNull: true,
266
+ },
267
+ companyAddress: {
268
+ type: vr_migrations_1.DataTypes.TEXT,
269
+ allowNull: true,
270
+ },
271
+ companyEmail: {
272
+ type: vr_migrations_1.DataTypes.STRING(100),
273
+ allowNull: true,
274
+ },
275
+ companyPhone: {
276
+ type: vr_migrations_1.DataTypes.STRING(20),
277
+ allowNull: true,
278
+ },
279
+ companyTaxId: {
280
+ type: vr_migrations_1.DataTypes.STRING(50),
281
+ allowNull: true,
282
+ },
283
+ // Feature Flags
284
+ enableRiderApp: {
285
+ type: vr_migrations_1.DataTypes.BOOLEAN,
286
+ allowNull: false,
287
+ defaultValue: true,
288
+ },
289
+ enablePassengerApp: {
290
+ type: vr_migrations_1.DataTypes.BOOLEAN,
291
+ allowNull: false,
292
+ defaultValue: true,
293
+ },
294
+ enableAgentApp: {
295
+ type: vr_migrations_1.DataTypes.BOOLEAN,
296
+ allowNull: false,
297
+ defaultValue: true,
298
+ },
299
+ enableAdminDashboard: {
300
+ type: vr_migrations_1.DataTypes.BOOLEAN,
301
+ allowNull: false,
302
+ defaultValue: true,
303
+ },
304
+ enableGuestCheckout: {
305
+ type: vr_migrations_1.DataTypes.BOOLEAN,
306
+ allowNull: false,
307
+ defaultValue: false,
308
+ },
309
+ enableReferrals: {
310
+ type: vr_migrations_1.DataTypes.BOOLEAN,
311
+ allowNull: false,
312
+ defaultValue: true,
313
+ },
314
+ enableWallet: {
315
+ type: vr_migrations_1.DataTypes.BOOLEAN,
316
+ allowNull: false,
317
+ defaultValue: true,
318
+ },
319
+ enablePromoCodes: {
320
+ type: vr_migrations_1.DataTypes.BOOLEAN,
321
+ allowNull: false,
322
+ defaultValue: true,
323
+ },
324
+ enableReviews: {
325
+ type: vr_migrations_1.DataTypes.BOOLEAN,
326
+ allowNull: false,
327
+ defaultValue: true,
328
+ },
329
+ enableChat: {
330
+ type: vr_migrations_1.DataTypes.BOOLEAN,
331
+ allowNull: false,
332
+ defaultValue: true,
333
+ },
334
+ enableVoiceCall: {
335
+ type: vr_migrations_1.DataTypes.BOOLEAN,
336
+ allowNull: false,
337
+ defaultValue: true,
338
+ },
339
+ enableMaps: {
340
+ type: vr_migrations_1.DataTypes.BOOLEAN,
341
+ allowNull: false,
342
+ defaultValue: true,
343
+ },
344
+ enablePayment: {
345
+ type: vr_migrations_1.DataTypes.BOOLEAN,
346
+ allowNull: false,
347
+ defaultValue: true,
348
+ },
349
+ // Maintenance
350
+ isUnderMaintenance: {
351
+ type: vr_migrations_1.DataTypes.BOOLEAN,
352
+ allowNull: false,
353
+ defaultValue: false,
354
+ },
355
+ maintenanceMessage: {
356
+ type: vr_migrations_1.DataTypes.TEXT,
357
+ allowNull: true,
358
+ },
359
+ maintenanceStartAt: {
360
+ type: vr_migrations_1.DataTypes.DATE,
361
+ allowNull: true,
362
+ },
363
+ maintenanceEndAt: {
364
+ type: vr_migrations_1.DataTypes.DATE,
365
+ allowNull: true,
366
+ },
367
+ // Analytics & Tracking
368
+ googleAnalyticsId: {
369
+ type: vr_migrations_1.DataTypes.STRING(50),
370
+ allowNull: true,
371
+ },
372
+ facebookPixelId: {
373
+ type: vr_migrations_1.DataTypes.STRING(50),
374
+ allowNull: true,
375
+ },
376
+ sentryDsn: {
377
+ type: vr_migrations_1.DataTypes.STRING(255),
378
+ allowNull: true,
379
+ },
380
+ // Admin Info
381
+ updatedBy: {
382
+ type: vr_migrations_1.DataTypes.UUID,
383
+ allowNull: true,
384
+ },
385
+ version: {
386
+ type: vr_migrations_1.DataTypes.INTEGER,
387
+ allowNull: false,
388
+ defaultValue: 1,
389
+ },
390
+ isActive: {
391
+ type: vr_migrations_1.DataTypes.BOOLEAN,
392
+ allowNull: false,
393
+ defaultValue: true,
394
+ },
395
+ createdAt: {
396
+ type: vr_migrations_1.DataTypes.DATE,
397
+ defaultValue: vr_migrations_1.DataTypes.NOW,
398
+ },
399
+ updatedAt: {
400
+ type: vr_migrations_1.DataTypes.DATE,
401
+ defaultValue: vr_migrations_1.DataTypes.NOW,
402
+ },
403
+ }, {
404
+ sequelize,
405
+ modelName: "AppSpecs",
406
+ tableName: "app_specs",
407
+ timestamps: true,
408
+ freezeTableName: true,
409
+ indexes: [
410
+ {
411
+ fields: ["isActive"],
412
+ name: "app_specs_is_active_idx",
413
+ },
414
+ {
415
+ fields: ["version"],
416
+ name: "app_specs_version_idx",
417
+ },
418
+ ],
419
+ });
420
+ }
421
+ // Static association method
422
+ static associate(models) {
423
+ this.belongsTo(models.User, {
424
+ foreignKey: "updatedBy",
425
+ as: "lastEditor",
426
+ onDelete: "SET NULL",
427
+ onUpdate: "CASCADE",
428
+ });
429
+ }
430
+ // Custom instance methods
431
+ async updateWithVersion(data, editorId) {
432
+ this.version += 1;
433
+ this.updatedBy = editorId;
434
+ Object.assign(this, data);
435
+ // Update document timestamps if they changed
436
+ if (data.privacyPolicy && data.privacyPolicy !== this.privacyPolicy) {
437
+ this.privacyPolicyUpdatedAt = new Date();
438
+ }
439
+ if (data.termsAndConditions &&
440
+ data.termsAndConditions !== this.termsAndConditions) {
441
+ this.termsAndConditionsUpdatedAt = new Date();
442
+ }
443
+ if (data.aboutUs && data.aboutUs !== this.aboutUs) {
444
+ this.aboutUsUpdatedAt = new Date();
445
+ }
446
+ if (data.cookiePolicy && data.cookiePolicy !== this.cookiePolicy) {
447
+ this.cookiePolicyUpdatedAt = new Date();
448
+ }
449
+ if (data.refundPolicy && data.refundPolicy !== this.refundPolicy) {
450
+ this.refundPolicyUpdatedAt = new Date();
451
+ }
452
+ await this.save();
453
+ }
454
+ async archive() {
455
+ this.isActive = false;
456
+ await this.save();
457
+ }
458
+ async activate() {
459
+ this.isActive = true;
460
+ await this.save();
461
+ }
462
+ getColorPalette() {
463
+ return {
464
+ primary: this.primaryColor,
465
+ secondary: this.secondaryColor,
466
+ accent: this.accentColor,
467
+ success: this.successColor,
468
+ error: this.errorColor,
469
+ warning: this.warningColor,
470
+ info: this.infoColor,
471
+ background: this.backgroundColor,
472
+ text: this.textColor,
473
+ button: this.buttonColor,
474
+ buttonText: this.buttonTextColor,
475
+ };
476
+ }
477
+ isInMaintenance() {
478
+ if (!this.isUnderMaintenance)
479
+ return false;
480
+ const now = new Date();
481
+ if (this.maintenanceStartAt && now < this.maintenanceStartAt)
482
+ return false;
483
+ if (this.maintenanceEndAt && now > this.maintenanceEndAt)
484
+ return false;
485
+ return true;
486
+ }
487
+ getMaintenanceMessage() {
488
+ if (!this.isInMaintenance())
489
+ return null;
490
+ return (this.maintenanceMessage ||
491
+ "We are currently under maintenance. Please check back later.");
492
+ }
493
+ static async getActive() {
494
+ return await this.findOne({
495
+ where: { isActive: true },
496
+ order: [["version", "DESC"]],
497
+ });
498
+ }
499
+ }
500
+ exports.AppSpecs = AppSpecs;
@@ -11,4 +11,5 @@ export * from "./transaction.models";
11
11
  export * from "./installment.models";
12
12
  export * from "./ban.models";
13
13
  export * from "./suspension.models";
14
- export type { UserModel, TransactionModel, SecurityClearanceModel, ProductModel, PricingModel, PaymentModel, IdempotencyRecordModel, EventLogModel, DevicePaymentPlanModel, DeviceModel, InstallmentModel, BanModel, SuspensionModel, } from "./types";
14
+ export * from "./appSpecs.models";
15
+ export type { UserModel, TransactionModel, SecurityClearanceModel, ProductModel, PricingModel, PaymentModel, IdempotencyRecordModel, EventLogModel, DevicePaymentPlanModel, DeviceModel, InstallmentModel, BanModel, SuspensionModel, AppSpecsModel, } from "./types";
@@ -27,3 +27,4 @@ __exportStar(require("./transaction.models"), exports);
27
27
  __exportStar(require("./installment.models"), exports);
28
28
  __exportStar(require("./ban.models"), exports);
29
29
  __exportStar(require("./suspension.models"), exports);
30
+ __exportStar(require("./appSpecs.models"), exports);
@@ -11,3 +11,4 @@ export type { DeviceModel } from "./device.models";
11
11
  export type { InstallmentModel } from "./installment.models";
12
12
  export type { BanModel } from "./ban.models";
13
13
  export type { SuspensionModel } from "./suspension.models";
14
+ export type { AppSpecsModel } from "./appSpecs.models";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vr-models",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "Shared database models package for VR applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",