@mac777/project-pinecone-models 1.1.16 → 1.1.18

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.
@@ -1,16 +1,40 @@
1
1
  import { Document, Schema } from "mongoose";
2
+ export declare enum AuditSeverity {
3
+ INFO = "INFO",
4
+ WARNING = "WARNING",
5
+ CRITICAL = "CRITICAL"
6
+ }
7
+ export declare enum AuditCategory {
8
+ AUTH = "AUTH",
9
+ AUTHORIZATION = "AUTHORIZATION",
10
+ DATA_MODIFICATION = "DATA_MODIFICATION",
11
+ ADMIN_ACTION = "ADMIN_ACTION",
12
+ PAYMENT = "PAYMENT"
13
+ }
14
+ export declare enum AuditStatus {
15
+ SUCCESS = "SUCCESS",
16
+ FAILURE = "FAILURE"
17
+ }
2
18
  export interface IAuditLog extends Document {
3
- userId: string;
19
+ userId?: string;
4
20
  action: string;
5
- details: any;
6
- performedBy: string;
7
- targetType: string;
8
- targetId: string;
9
- metadata: {
10
- error: string;
11
- reason: string;
21
+ category: AuditCategory;
22
+ severity: AuditSeverity;
23
+ status: AuditStatus;
24
+ details?: any;
25
+ performedBy?: string;
26
+ targetType?: string;
27
+ targetId?: string;
28
+ metadata?: {
29
+ error?: string;
30
+ reason?: string;
31
+ [key: string]: any;
12
32
  };
33
+ ipAddress?: string;
34
+ userAgent?: string;
35
+ sessionId?: string;
13
36
  timestamp: Date;
37
+ expiresAt?: Date;
14
38
  }
15
39
  declare const auditLogSchema: Schema<IAuditLog, import("mongoose").Model<IAuditLog, any, any, any, Document<unknown, any, IAuditLog, any, {}> & IAuditLog & Required<{
16
40
  _id: import("mongoose").Types.ObjectId;
package/dist/AuditLog.js CHANGED
@@ -1,14 +1,64 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuditStatus = exports.AuditCategory = exports.AuditSeverity = void 0;
3
4
  const mongoose_1 = require("mongoose");
5
+ var AuditSeverity;
6
+ (function (AuditSeverity) {
7
+ AuditSeverity["INFO"] = "INFO";
8
+ AuditSeverity["WARNING"] = "WARNING";
9
+ AuditSeverity["CRITICAL"] = "CRITICAL";
10
+ })(AuditSeverity || (exports.AuditSeverity = AuditSeverity = {}));
11
+ var AuditCategory;
12
+ (function (AuditCategory) {
13
+ AuditCategory["AUTH"] = "AUTH";
14
+ AuditCategory["AUTHORIZATION"] = "AUTHORIZATION";
15
+ AuditCategory["DATA_MODIFICATION"] = "DATA_MODIFICATION";
16
+ AuditCategory["ADMIN_ACTION"] = "ADMIN_ACTION";
17
+ AuditCategory["PAYMENT"] = "PAYMENT";
18
+ })(AuditCategory || (exports.AuditCategory = AuditCategory = {}));
19
+ var AuditStatus;
20
+ (function (AuditStatus) {
21
+ AuditStatus["SUCCESS"] = "SUCCESS";
22
+ AuditStatus["FAILURE"] = "FAILURE";
23
+ })(AuditStatus || (exports.AuditStatus = AuditStatus = {}));
4
24
  const auditLogSchema = new mongoose_1.Schema({
5
- userId: { type: String },
6
- action: { type: String },
25
+ userId: { type: String, index: true },
26
+ action: { type: String, required: true, index: true },
27
+ category: {
28
+ type: String,
29
+ enum: Object.values(AuditCategory),
30
+ required: true,
31
+ index: true
32
+ },
33
+ severity: {
34
+ type: String,
35
+ enum: Object.values(AuditSeverity),
36
+ required: true,
37
+ index: true
38
+ },
39
+ status: {
40
+ type: String,
41
+ enum: Object.values(AuditStatus),
42
+ required: true,
43
+ index: true
44
+ },
7
45
  details: { type: Object },
8
46
  performedBy: { type: String },
9
- targetType: { type: String },
10
- targetId: { type: String },
47
+ targetType: { type: String, index: true },
48
+ targetId: { type: String, index: true },
11
49
  metadata: { type: Object },
12
- timestamp: { type: Date, default: Date.now },
50
+ ipAddress: { type: String },
51
+ userAgent: { type: String },
52
+ sessionId: { type: String, index: true },
53
+ timestamp: { type: Date, default: Date.now, index: true },
54
+ expiresAt: { type: Date, index: true }
55
+ }, {
56
+ timestamps: false // We use our own timestamp field
13
57
  });
58
+ // Compound indexes for common queries
59
+ auditLogSchema.index({ userId: 1, timestamp: -1 });
60
+ auditLogSchema.index({ category: 1, severity: 1, timestamp: -1 });
61
+ auditLogSchema.index({ status: 1, timestamp: -1 });
62
+ // TTL index for GDPR compliance - auto-delete after expiresAt
63
+ auditLogSchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
14
64
  exports.default = auditLogSchema;
package/dist/Event.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import mongoose from 'mongoose';
2
2
  declare const eventSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
3
+ status: "approved" | "rejected" | "draft" | "pending_approval" | "published" | "live" | "ended" | "cancelled";
3
4
  type: "other" | "concert" | "sports" | "conference" | "festival" | "theater" | "comedy" | "networking" | "workshop";
4
5
  createdAt: NativeDate;
5
6
  updatedAt: NativeDate;
6
- status: "approved" | "rejected" | "draft" | "pending_approval" | "published" | "live" | "ended" | "cancelled";
7
7
  hostId: mongoose.Types.ObjectId;
8
8
  title: string;
9
9
  categories: string[];
@@ -198,29 +198,29 @@ declare const eventSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
198
198
  verification?: {
199
199
  status: "pending" | "rejected" | "unverified" | "verified" | "needs_info";
200
200
  documents: mongoose.Types.DocumentArray<{
201
+ status?: "pending" | "approved" | "rejected" | null | undefined;
201
202
  type?: "venue_booking" | "permit" | "insurance" | "license" | "portfolio" | "additional_docs" | "other" | null | undefined;
202
203
  url?: string | null | undefined;
203
204
  filename?: string | null | undefined;
204
205
  objectKey?: string | null | undefined;
205
206
  uploadedAt?: NativeDate | null | undefined;
206
207
  rejectionReason?: string | null | undefined;
207
- status?: "pending" | "approved" | "rejected" | null | undefined;
208
208
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, any, {
209
+ status?: "pending" | "approved" | "rejected" | null | undefined;
209
210
  type?: "venue_booking" | "permit" | "insurance" | "license" | "portfolio" | "additional_docs" | "other" | null | undefined;
210
211
  url?: string | null | undefined;
211
212
  filename?: string | null | undefined;
212
213
  objectKey?: string | null | undefined;
213
214
  uploadedAt?: NativeDate | null | undefined;
214
215
  rejectionReason?: string | null | undefined;
215
- status?: "pending" | "approved" | "rejected" | null | undefined;
216
216
  }> & {
217
+ status?: "pending" | "approved" | "rejected" | null | undefined;
217
218
  type?: "venue_booking" | "permit" | "insurance" | "license" | "portfolio" | "additional_docs" | "other" | null | undefined;
218
219
  url?: string | null | undefined;
219
220
  filename?: string | null | undefined;
220
221
  objectKey?: string | null | undefined;
221
222
  uploadedAt?: NativeDate | null | undefined;
222
223
  rejectionReason?: string | null | undefined;
223
- status?: "pending" | "approved" | "rejected" | null | undefined;
224
224
  }>;
225
225
  rejectionReason?: string | null | undefined;
226
226
  additionalInfo?: string | null | undefined;
@@ -264,22 +264,22 @@ declare const eventSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
264
264
  } | null | undefined;
265
265
  moderation?: {
266
266
  flags: mongoose.Types.DocumentArray<{
267
- createdAt: NativeDate;
268
267
  status: "pending" | "resolved" | "dismissed";
269
- description?: string | null | undefined;
268
+ createdAt: NativeDate;
270
269
  reason?: string | null | undefined;
270
+ description?: string | null | undefined;
271
271
  reportedBy?: mongoose.Types.ObjectId | null | undefined;
272
272
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, any, {
273
- createdAt: NativeDate;
274
273
  status: "pending" | "resolved" | "dismissed";
275
- description?: string | null | undefined;
274
+ createdAt: NativeDate;
276
275
  reason?: string | null | undefined;
276
+ description?: string | null | undefined;
277
277
  reportedBy?: mongoose.Types.ObjectId | null | undefined;
278
278
  }> & {
279
- createdAt: NativeDate;
280
279
  status: "pending" | "resolved" | "dismissed";
281
- description?: string | null | undefined;
280
+ createdAt: NativeDate;
282
281
  reason?: string | null | undefined;
282
+ description?: string | null | undefined;
283
283
  reportedBy?: mongoose.Types.ObjectId | null | undefined;
284
284
  }>;
285
285
  isFlagged: boolean;
@@ -306,10 +306,10 @@ declare const eventSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
306
306
  tagline?: string | null | undefined;
307
307
  ageRestriction?: "all_ages" | "18+" | "21+" | null | undefined;
308
308
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
309
+ status: "approved" | "rejected" | "draft" | "pending_approval" | "published" | "live" | "ended" | "cancelled";
309
310
  type: "other" | "concert" | "sports" | "conference" | "festival" | "theater" | "comedy" | "networking" | "workshop";
310
311
  createdAt: NativeDate;
311
312
  updatedAt: NativeDate;
312
- status: "approved" | "rejected" | "draft" | "pending_approval" | "published" | "live" | "ended" | "cancelled";
313
313
  hostId: mongoose.Types.ObjectId;
314
314
  title: string;
315
315
  categories: string[];
@@ -504,29 +504,29 @@ declare const eventSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
504
504
  verification?: {
505
505
  status: "pending" | "rejected" | "unverified" | "verified" | "needs_info";
506
506
  documents: mongoose.Types.DocumentArray<{
507
+ status?: "pending" | "approved" | "rejected" | null | undefined;
507
508
  type?: "venue_booking" | "permit" | "insurance" | "license" | "portfolio" | "additional_docs" | "other" | null | undefined;
508
509
  url?: string | null | undefined;
509
510
  filename?: string | null | undefined;
510
511
  objectKey?: string | null | undefined;
511
512
  uploadedAt?: NativeDate | null | undefined;
512
513
  rejectionReason?: string | null | undefined;
513
- status?: "pending" | "approved" | "rejected" | null | undefined;
514
514
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, any, {
515
+ status?: "pending" | "approved" | "rejected" | null | undefined;
515
516
  type?: "venue_booking" | "permit" | "insurance" | "license" | "portfolio" | "additional_docs" | "other" | null | undefined;
516
517
  url?: string | null | undefined;
517
518
  filename?: string | null | undefined;
518
519
  objectKey?: string | null | undefined;
519
520
  uploadedAt?: NativeDate | null | undefined;
520
521
  rejectionReason?: string | null | undefined;
521
- status?: "pending" | "approved" | "rejected" | null | undefined;
522
522
  }> & {
523
+ status?: "pending" | "approved" | "rejected" | null | undefined;
523
524
  type?: "venue_booking" | "permit" | "insurance" | "license" | "portfolio" | "additional_docs" | "other" | null | undefined;
524
525
  url?: string | null | undefined;
525
526
  filename?: string | null | undefined;
526
527
  objectKey?: string | null | undefined;
527
528
  uploadedAt?: NativeDate | null | undefined;
528
529
  rejectionReason?: string | null | undefined;
529
- status?: "pending" | "approved" | "rejected" | null | undefined;
530
530
  }>;
531
531
  rejectionReason?: string | null | undefined;
532
532
  additionalInfo?: string | null | undefined;
@@ -570,22 +570,22 @@ declare const eventSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
570
570
  } | null | undefined;
571
571
  moderation?: {
572
572
  flags: mongoose.Types.DocumentArray<{
573
- createdAt: NativeDate;
574
573
  status: "pending" | "resolved" | "dismissed";
575
- description?: string | null | undefined;
574
+ createdAt: NativeDate;
576
575
  reason?: string | null | undefined;
576
+ description?: string | null | undefined;
577
577
  reportedBy?: mongoose.Types.ObjectId | null | undefined;
578
578
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, any, {
579
- createdAt: NativeDate;
580
579
  status: "pending" | "resolved" | "dismissed";
581
- description?: string | null | undefined;
580
+ createdAt: NativeDate;
582
581
  reason?: string | null | undefined;
582
+ description?: string | null | undefined;
583
583
  reportedBy?: mongoose.Types.ObjectId | null | undefined;
584
584
  }> & {
585
- createdAt: NativeDate;
586
585
  status: "pending" | "resolved" | "dismissed";
587
- description?: string | null | undefined;
586
+ createdAt: NativeDate;
588
587
  reason?: string | null | undefined;
588
+ description?: string | null | undefined;
589
589
  reportedBy?: mongoose.Types.ObjectId | null | undefined;
590
590
  }>;
591
591
  isFlagged: boolean;
@@ -612,10 +612,10 @@ declare const eventSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
612
612
  tagline?: string | null | undefined;
613
613
  ageRestriction?: "all_ages" | "18+" | "21+" | null | undefined;
614
614
  }>, {}, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & mongoose.FlatRecord<{
615
+ status: "approved" | "rejected" | "draft" | "pending_approval" | "published" | "live" | "ended" | "cancelled";
615
616
  type: "other" | "concert" | "sports" | "conference" | "festival" | "theater" | "comedy" | "networking" | "workshop";
616
617
  createdAt: NativeDate;
617
618
  updatedAt: NativeDate;
618
- status: "approved" | "rejected" | "draft" | "pending_approval" | "published" | "live" | "ended" | "cancelled";
619
619
  hostId: mongoose.Types.ObjectId;
620
620
  title: string;
621
621
  categories: string[];
@@ -810,29 +810,29 @@ declare const eventSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
810
810
  verification?: {
811
811
  status: "pending" | "rejected" | "unverified" | "verified" | "needs_info";
812
812
  documents: mongoose.Types.DocumentArray<{
813
+ status?: "pending" | "approved" | "rejected" | null | undefined;
813
814
  type?: "venue_booking" | "permit" | "insurance" | "license" | "portfolio" | "additional_docs" | "other" | null | undefined;
814
815
  url?: string | null | undefined;
815
816
  filename?: string | null | undefined;
816
817
  objectKey?: string | null | undefined;
817
818
  uploadedAt?: NativeDate | null | undefined;
818
819
  rejectionReason?: string | null | undefined;
819
- status?: "pending" | "approved" | "rejected" | null | undefined;
820
820
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, any, {
821
+ status?: "pending" | "approved" | "rejected" | null | undefined;
821
822
  type?: "venue_booking" | "permit" | "insurance" | "license" | "portfolio" | "additional_docs" | "other" | null | undefined;
822
823
  url?: string | null | undefined;
823
824
  filename?: string | null | undefined;
824
825
  objectKey?: string | null | undefined;
825
826
  uploadedAt?: NativeDate | null | undefined;
826
827
  rejectionReason?: string | null | undefined;
827
- status?: "pending" | "approved" | "rejected" | null | undefined;
828
828
  }> & {
829
+ status?: "pending" | "approved" | "rejected" | null | undefined;
829
830
  type?: "venue_booking" | "permit" | "insurance" | "license" | "portfolio" | "additional_docs" | "other" | null | undefined;
830
831
  url?: string | null | undefined;
831
832
  filename?: string | null | undefined;
832
833
  objectKey?: string | null | undefined;
833
834
  uploadedAt?: NativeDate | null | undefined;
834
835
  rejectionReason?: string | null | undefined;
835
- status?: "pending" | "approved" | "rejected" | null | undefined;
836
836
  }>;
837
837
  rejectionReason?: string | null | undefined;
838
838
  additionalInfo?: string | null | undefined;
@@ -876,22 +876,22 @@ declare const eventSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
876
876
  } | null | undefined;
877
877
  moderation?: {
878
878
  flags: mongoose.Types.DocumentArray<{
879
- createdAt: NativeDate;
880
879
  status: "pending" | "resolved" | "dismissed";
881
- description?: string | null | undefined;
880
+ createdAt: NativeDate;
882
881
  reason?: string | null | undefined;
882
+ description?: string | null | undefined;
883
883
  reportedBy?: mongoose.Types.ObjectId | null | undefined;
884
884
  }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, any, {
885
- createdAt: NativeDate;
886
885
  status: "pending" | "resolved" | "dismissed";
887
- description?: string | null | undefined;
886
+ createdAt: NativeDate;
888
887
  reason?: string | null | undefined;
888
+ description?: string | null | undefined;
889
889
  reportedBy?: mongoose.Types.ObjectId | null | undefined;
890
890
  }> & {
891
- createdAt: NativeDate;
892
891
  status: "pending" | "resolved" | "dismissed";
893
- description?: string | null | undefined;
892
+ createdAt: NativeDate;
894
893
  reason?: string | null | undefined;
894
+ description?: string | null | undefined;
895
895
  reportedBy?: mongoose.Types.ObjectId | null | undefined;
896
896
  }>;
897
897
  isFlagged: boolean;
package/dist/Media.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import mongoose from 'mongoose';
2
2
  declare const mediaSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
3
3
  userId: mongoose.Types.ObjectId;
4
+ status: "temp" | "permanent" | "deleted";
4
5
  type: "event_cover" | "event_gallery" | "verification_doc";
5
6
  filename: string;
6
7
  uploadedAt: NativeDate;
7
- status: "temp" | "permanent" | "deleted";
8
8
  provider: "imagekit" | "backblaze";
9
9
  mimeType: string;
10
+ expiresAt?: NativeDate | null | undefined;
10
11
  url?: string | null | undefined;
11
12
  thumbnailUrl?: string | null | undefined;
12
13
  objectKey?: string | null | undefined;
@@ -14,16 +15,16 @@ declare const mediaSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
14
15
  fileId?: string | null | undefined;
15
16
  bucketName?: string | null | undefined;
16
17
  movedToPermanentAt?: NativeDate | null | undefined;
17
- expiresAt?: NativeDate | null | undefined;
18
18
  size?: number | null | undefined;
19
19
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
20
20
  userId: mongoose.Types.ObjectId;
21
+ status: "temp" | "permanent" | "deleted";
21
22
  type: "event_cover" | "event_gallery" | "verification_doc";
22
23
  filename: string;
23
24
  uploadedAt: NativeDate;
24
- status: "temp" | "permanent" | "deleted";
25
25
  provider: "imagekit" | "backblaze";
26
26
  mimeType: string;
27
+ expiresAt?: NativeDate | null | undefined;
27
28
  url?: string | null | undefined;
28
29
  thumbnailUrl?: string | null | undefined;
29
30
  objectKey?: string | null | undefined;
@@ -31,16 +32,16 @@ declare const mediaSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
31
32
  fileId?: string | null | undefined;
32
33
  bucketName?: string | null | undefined;
33
34
  movedToPermanentAt?: NativeDate | null | undefined;
34
- expiresAt?: NativeDate | null | undefined;
35
35
  size?: number | null | undefined;
36
36
  }>, {}, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & mongoose.FlatRecord<{
37
37
  userId: mongoose.Types.ObjectId;
38
+ status: "temp" | "permanent" | "deleted";
38
39
  type: "event_cover" | "event_gallery" | "verification_doc";
39
40
  filename: string;
40
41
  uploadedAt: NativeDate;
41
- status: "temp" | "permanent" | "deleted";
42
42
  provider: "imagekit" | "backblaze";
43
43
  mimeType: string;
44
+ expiresAt?: NativeDate | null | undefined;
44
45
  url?: string | null | undefined;
45
46
  thumbnailUrl?: string | null | undefined;
46
47
  objectKey?: string | null | undefined;
@@ -48,7 +49,6 @@ declare const mediaSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
48
49
  fileId?: string | null | undefined;
49
50
  bucketName?: string | null | undefined;
50
51
  movedToPermanentAt?: NativeDate | null | undefined;
51
- expiresAt?: NativeDate | null | undefined;
52
52
  size?: number | null | undefined;
53
53
  }> & {
54
54
  _id: mongoose.Types.ObjectId;
package/dist/Order.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import mongoose from 'mongoose';
2
2
  declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
3
3
  userId: mongoose.Types.ObjectId;
4
- createdAt: NativeDate;
5
4
  status: "pending" | "cancelled" | "confirmed" | "refunded";
5
+ expiresAt: NativeDate;
6
+ createdAt: NativeDate;
6
7
  tickets: mongoose.Types.DocumentArray<{
7
8
  quantity: number;
8
9
  ticketVariantId: mongoose.Types.ObjectId;
@@ -23,7 +24,6 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
23
24
  subtotal: number;
24
25
  }>;
25
26
  eventId: mongoose.Types.ObjectId;
26
- expiresAt: NativeDate;
27
27
  orderNumber: string;
28
28
  requiresManualReview: boolean;
29
29
  manualReviewReason: string;
@@ -31,6 +31,8 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
31
31
  paymentStatus: "pending" | "succeeded" | "failed";
32
32
  ticketIds: mongoose.Types.ObjectId[];
33
33
  buyerEmail: string;
34
+ ipAddress?: string | null | undefined;
35
+ userAgent?: string | null | undefined;
34
36
  paidAt?: NativeDate | null | undefined;
35
37
  pricing?: {
36
38
  currency: string;
@@ -45,8 +47,6 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
45
47
  cancelledAt?: NativeDate | null | undefined;
46
48
  reminderSentAt?: NativeDate | null | undefined;
47
49
  buyerPhone?: string | null | undefined;
48
- ipAddress?: string | null | undefined;
49
- userAgent?: string | null | undefined;
50
50
  refund?: {
51
51
  reason: "event_cancelled" | "user_request" | "fraud";
52
52
  amount: number;
@@ -56,8 +56,9 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
56
56
  paymentId?: string | null | undefined;
57
57
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
58
58
  userId: mongoose.Types.ObjectId;
59
- createdAt: NativeDate;
60
59
  status: "pending" | "cancelled" | "confirmed" | "refunded";
60
+ expiresAt: NativeDate;
61
+ createdAt: NativeDate;
61
62
  tickets: mongoose.Types.DocumentArray<{
62
63
  quantity: number;
63
64
  ticketVariantId: mongoose.Types.ObjectId;
@@ -78,7 +79,6 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
78
79
  subtotal: number;
79
80
  }>;
80
81
  eventId: mongoose.Types.ObjectId;
81
- expiresAt: NativeDate;
82
82
  orderNumber: string;
83
83
  requiresManualReview: boolean;
84
84
  manualReviewReason: string;
@@ -86,6 +86,8 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
86
86
  paymentStatus: "pending" | "succeeded" | "failed";
87
87
  ticketIds: mongoose.Types.ObjectId[];
88
88
  buyerEmail: string;
89
+ ipAddress?: string | null | undefined;
90
+ userAgent?: string | null | undefined;
89
91
  paidAt?: NativeDate | null | undefined;
90
92
  pricing?: {
91
93
  currency: string;
@@ -100,8 +102,6 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
100
102
  cancelledAt?: NativeDate | null | undefined;
101
103
  reminderSentAt?: NativeDate | null | undefined;
102
104
  buyerPhone?: string | null | undefined;
103
- ipAddress?: string | null | undefined;
104
- userAgent?: string | null | undefined;
105
105
  refund?: {
106
106
  reason: "event_cancelled" | "user_request" | "fraud";
107
107
  amount: number;
@@ -111,8 +111,9 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
111
111
  paymentId?: string | null | undefined;
112
112
  }>, {}, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & mongoose.FlatRecord<{
113
113
  userId: mongoose.Types.ObjectId;
114
- createdAt: NativeDate;
115
114
  status: "pending" | "cancelled" | "confirmed" | "refunded";
115
+ expiresAt: NativeDate;
116
+ createdAt: NativeDate;
116
117
  tickets: mongoose.Types.DocumentArray<{
117
118
  quantity: number;
118
119
  ticketVariantId: mongoose.Types.ObjectId;
@@ -133,7 +134,6 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
133
134
  subtotal: number;
134
135
  }>;
135
136
  eventId: mongoose.Types.ObjectId;
136
- expiresAt: NativeDate;
137
137
  orderNumber: string;
138
138
  requiresManualReview: boolean;
139
139
  manualReviewReason: string;
@@ -141,6 +141,8 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
141
141
  paymentStatus: "pending" | "succeeded" | "failed";
142
142
  ticketIds: mongoose.Types.ObjectId[];
143
143
  buyerEmail: string;
144
+ ipAddress?: string | null | undefined;
145
+ userAgent?: string | null | undefined;
144
146
  paidAt?: NativeDate | null | undefined;
145
147
  pricing?: {
146
148
  currency: string;
@@ -155,8 +157,6 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
155
157
  cancelledAt?: NativeDate | null | undefined;
156
158
  reminderSentAt?: NativeDate | null | undefined;
157
159
  buyerPhone?: string | null | undefined;
158
- ipAddress?: string | null | undefined;
159
- userAgent?: string | null | undefined;
160
160
  refund?: {
161
161
  reason: "event_cancelled" | "user_request" | "fraud";
162
162
  amount: number;
@@ -5,6 +5,7 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
5
5
  }, {
6
6
  userId: mongoose.Types.ObjectId;
7
7
  status: "pending" | "cancelled" | "confirmed" | "refunded";
8
+ expiresAt: NativeDate;
8
9
  pricing: {
9
10
  currency: string;
10
11
  platformFee: number;
@@ -33,21 +34,20 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
33
34
  subtotal: number;
34
35
  }>;
35
36
  eventId: mongoose.Types.ObjectId;
36
- expiresAt: NativeDate;
37
37
  requiresManualReview: boolean;
38
38
  paymentMethod: "card" | "bkash" | "bank_transfer" | "free";
39
39
  paymentStatus: "pending" | "succeeded" | "failed";
40
40
  ticketIds: mongoose.Types.ObjectId[];
41
41
  buyerEmail: string;
42
42
  ticketCount: number;
43
+ ipAddress?: string | null | undefined;
44
+ userAgent?: string | null | undefined;
43
45
  paidAt?: NativeDate | null | undefined;
44
46
  refundedAt?: NativeDate | null | undefined;
45
47
  confirmedAt?: NativeDate | null | undefined;
46
48
  cancelledAt?: NativeDate | null | undefined;
47
49
  reminderSentAt?: NativeDate | null | undefined;
48
50
  buyerPhone?: string | null | undefined;
49
- ipAddress?: string | null | undefined;
50
- userAgent?: string | null | undefined;
51
51
  refund?: {
52
52
  reason: "event_cancelled" | "user_request" | "fraud";
53
53
  amount: number;
@@ -60,6 +60,7 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
60
60
  } & mongoose.DefaultTimestampProps, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
61
61
  userId: mongoose.Types.ObjectId;
62
62
  status: "pending" | "cancelled" | "confirmed" | "refunded";
63
+ expiresAt: NativeDate;
63
64
  pricing: {
64
65
  currency: string;
65
66
  platformFee: number;
@@ -88,21 +89,20 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
88
89
  subtotal: number;
89
90
  }>;
90
91
  eventId: mongoose.Types.ObjectId;
91
- expiresAt: NativeDate;
92
92
  requiresManualReview: boolean;
93
93
  paymentMethod: "card" | "bkash" | "bank_transfer" | "free";
94
94
  paymentStatus: "pending" | "succeeded" | "failed";
95
95
  ticketIds: mongoose.Types.ObjectId[];
96
96
  buyerEmail: string;
97
97
  ticketCount: number;
98
+ ipAddress?: string | null | undefined;
99
+ userAgent?: string | null | undefined;
98
100
  paidAt?: NativeDate | null | undefined;
99
101
  refundedAt?: NativeDate | null | undefined;
100
102
  confirmedAt?: NativeDate | null | undefined;
101
103
  cancelledAt?: NativeDate | null | undefined;
102
104
  reminderSentAt?: NativeDate | null | undefined;
103
105
  buyerPhone?: string | null | undefined;
104
- ipAddress?: string | null | undefined;
105
- userAgent?: string | null | undefined;
106
106
  refund?: {
107
107
  reason: "event_cancelled" | "user_request" | "fraud";
108
108
  amount: number;
@@ -118,6 +118,7 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
118
118
  }>> & mongoose.FlatRecord<{
119
119
  userId: mongoose.Types.ObjectId;
120
120
  status: "pending" | "cancelled" | "confirmed" | "refunded";
121
+ expiresAt: NativeDate;
121
122
  pricing: {
122
123
  currency: string;
123
124
  platformFee: number;
@@ -146,21 +147,20 @@ declare const orderSchema: mongoose.Schema<any, mongoose.Model<any, any, any, an
146
147
  subtotal: number;
147
148
  }>;
148
149
  eventId: mongoose.Types.ObjectId;
149
- expiresAt: NativeDate;
150
150
  requiresManualReview: boolean;
151
151
  paymentMethod: "card" | "bkash" | "bank_transfer" | "free";
152
152
  paymentStatus: "pending" | "succeeded" | "failed";
153
153
  ticketIds: mongoose.Types.ObjectId[];
154
154
  buyerEmail: string;
155
155
  ticketCount: number;
156
+ ipAddress?: string | null | undefined;
157
+ userAgent?: string | null | undefined;
156
158
  paidAt?: NativeDate | null | undefined;
157
159
  refundedAt?: NativeDate | null | undefined;
158
160
  confirmedAt?: NativeDate | null | undefined;
159
161
  cancelledAt?: NativeDate | null | undefined;
160
162
  reminderSentAt?: NativeDate | null | undefined;
161
163
  buyerPhone?: string | null | undefined;
162
- ipAddress?: string | null | undefined;
163
- userAgent?: string | null | undefined;
164
164
  refund?: {
165
165
  reason: "event_cancelled" | "user_request" | "fraud";
166
166
  amount: number;
package/dist/Payment.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import mongoose from 'mongoose';
2
2
  declare const paymentSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
3
3
  userId: mongoose.Types.ObjectId;
4
- createdAt: NativeDate;
5
4
  status: "pending" | "refunded" | "succeeded" | "failed";
5
+ createdAt: NativeDate;
6
6
  amount: number;
7
7
  currency: string;
8
8
  paymentId: string;
@@ -19,8 +19,8 @@ declare const paymentSchema: mongoose.Schema<any, mongoose.Model<any, any, any,
19
19
  brand?: "visa" | "mastercard" | "amex" | "discover" | null | undefined;
20
20
  }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
21
21
  userId: mongoose.Types.ObjectId;
22
- createdAt: NativeDate;
23
22
  status: "pending" | "refunded" | "succeeded" | "failed";
23
+ createdAt: NativeDate;
24
24
  amount: number;
25
25
  currency: string;
26
26
  paymentId: string;
@@ -37,8 +37,8 @@ declare const paymentSchema: mongoose.Schema<any, mongoose.Model<any, any, any,
37
37
  brand?: "visa" | "mastercard" | "amex" | "discover" | null | undefined;
38
38
  }>, {}, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & mongoose.FlatRecord<{
39
39
  userId: mongoose.Types.ObjectId;
40
- createdAt: NativeDate;
41
40
  status: "pending" | "refunded" | "succeeded" | "failed";
41
+ createdAt: NativeDate;
42
42
  amount: number;
43
43
  currency: string;
44
44
  paymentId: string;
package/dist/User.d.ts CHANGED
@@ -10,6 +10,29 @@ declare const userSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any
10
10
  emailVerified: boolean;
11
11
  phoneVerified: boolean;
12
12
  nidVerified: boolean;
13
+ verification?: {
14
+ status: "pending" | "rejected" | "unverified" | "verified";
15
+ documents: mongoose.Types.DocumentArray<{
16
+ type: "other" | "nid" | "trade_license" | "tax_certificate";
17
+ url: string;
18
+ filename: string;
19
+ uploadedAt: NativeDate;
20
+ }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, any, {
21
+ type: "other" | "nid" | "trade_license" | "tax_certificate";
22
+ url: string;
23
+ filename: string;
24
+ uploadedAt: NativeDate;
25
+ }> & {
26
+ type: "other" | "nid" | "trade_license" | "tax_certificate";
27
+ url: string;
28
+ filename: string;
29
+ uploadedAt: NativeDate;
30
+ }>;
31
+ rejectionReason?: string | null | undefined;
32
+ reviewedBy?: mongoose.Types.ObjectId | null | undefined;
33
+ reviewedAt?: NativeDate | null | undefined;
34
+ submittedAt?: NativeDate | null | undefined;
35
+ } | null | undefined;
13
36
  moderation?: {
14
37
  isSuspended: boolean;
15
38
  isVerified: boolean;
@@ -38,6 +61,22 @@ declare const userSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any
38
61
  } | null | undefined;
39
62
  refreshToken?: string | null | undefined;
40
63
  googleId?: string | null | undefined;
64
+ hostProfile?: {
65
+ contactPerson?: {
66
+ name?: string | null | undefined;
67
+ designation?: string | null | undefined;
68
+ phone?: string | null | undefined;
69
+ email?: string | null | undefined;
70
+ } | null | undefined;
71
+ role?: "event_organizer" | "venue_owner" | "authorized_rep" | "artist" | null | undefined;
72
+ organizationName?: string | null | undefined;
73
+ } | null | undefined;
74
+ profileCompleteness?: {
75
+ hasContactInfo: boolean;
76
+ hasPaymentDetails: boolean;
77
+ hasVerificationDocs: boolean;
78
+ isComplete: boolean;
79
+ } | null | undefined;
41
80
  } & mongoose.DefaultTimestampProps, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
42
81
  email: string;
43
82
  role: "user" | "host" | "admin";
@@ -47,6 +86,29 @@ declare const userSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any
47
86
  emailVerified: boolean;
48
87
  phoneVerified: boolean;
49
88
  nidVerified: boolean;
89
+ verification?: {
90
+ status: "pending" | "rejected" | "unverified" | "verified";
91
+ documents: mongoose.Types.DocumentArray<{
92
+ type: "other" | "nid" | "trade_license" | "tax_certificate";
93
+ url: string;
94
+ filename: string;
95
+ uploadedAt: NativeDate;
96
+ }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, any, {
97
+ type: "other" | "nid" | "trade_license" | "tax_certificate";
98
+ url: string;
99
+ filename: string;
100
+ uploadedAt: NativeDate;
101
+ }> & {
102
+ type: "other" | "nid" | "trade_license" | "tax_certificate";
103
+ url: string;
104
+ filename: string;
105
+ uploadedAt: NativeDate;
106
+ }>;
107
+ rejectionReason?: string | null | undefined;
108
+ reviewedBy?: mongoose.Types.ObjectId | null | undefined;
109
+ reviewedAt?: NativeDate | null | undefined;
110
+ submittedAt?: NativeDate | null | undefined;
111
+ } | null | undefined;
50
112
  moderation?: {
51
113
  isSuspended: boolean;
52
114
  isVerified: boolean;
@@ -75,6 +137,22 @@ declare const userSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any
75
137
  } | null | undefined;
76
138
  refreshToken?: string | null | undefined;
77
139
  googleId?: string | null | undefined;
140
+ hostProfile?: {
141
+ contactPerson?: {
142
+ name?: string | null | undefined;
143
+ designation?: string | null | undefined;
144
+ phone?: string | null | undefined;
145
+ email?: string | null | undefined;
146
+ } | null | undefined;
147
+ role?: "event_organizer" | "venue_owner" | "authorized_rep" | "artist" | null | undefined;
148
+ organizationName?: string | null | undefined;
149
+ } | null | undefined;
150
+ profileCompleteness?: {
151
+ hasContactInfo: boolean;
152
+ hasPaymentDetails: boolean;
153
+ hasVerificationDocs: boolean;
154
+ isComplete: boolean;
155
+ } | null | undefined;
78
156
  } & mongoose.DefaultTimestampProps>, {}, mongoose.ResolveSchemaOptions<{
79
157
  timestamps: true;
80
158
  }>> & mongoose.FlatRecord<{
@@ -86,6 +164,29 @@ declare const userSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any
86
164
  emailVerified: boolean;
87
165
  phoneVerified: boolean;
88
166
  nidVerified: boolean;
167
+ verification?: {
168
+ status: "pending" | "rejected" | "unverified" | "verified";
169
+ documents: mongoose.Types.DocumentArray<{
170
+ type: "other" | "nid" | "trade_license" | "tax_certificate";
171
+ url: string;
172
+ filename: string;
173
+ uploadedAt: NativeDate;
174
+ }, mongoose.Types.Subdocument<mongoose.mongo.BSON.ObjectId, any, {
175
+ type: "other" | "nid" | "trade_license" | "tax_certificate";
176
+ url: string;
177
+ filename: string;
178
+ uploadedAt: NativeDate;
179
+ }> & {
180
+ type: "other" | "nid" | "trade_license" | "tax_certificate";
181
+ url: string;
182
+ filename: string;
183
+ uploadedAt: NativeDate;
184
+ }>;
185
+ rejectionReason?: string | null | undefined;
186
+ reviewedBy?: mongoose.Types.ObjectId | null | undefined;
187
+ reviewedAt?: NativeDate | null | undefined;
188
+ submittedAt?: NativeDate | null | undefined;
189
+ } | null | undefined;
89
190
  moderation?: {
90
191
  isSuspended: boolean;
91
192
  isVerified: boolean;
@@ -114,6 +215,22 @@ declare const userSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any
114
215
  } | null | undefined;
115
216
  refreshToken?: string | null | undefined;
116
217
  googleId?: string | null | undefined;
218
+ hostProfile?: {
219
+ contactPerson?: {
220
+ name?: string | null | undefined;
221
+ designation?: string | null | undefined;
222
+ phone?: string | null | undefined;
223
+ email?: string | null | undefined;
224
+ } | null | undefined;
225
+ role?: "event_organizer" | "venue_owner" | "authorized_rep" | "artist" | null | undefined;
226
+ organizationName?: string | null | undefined;
227
+ } | null | undefined;
228
+ profileCompleteness?: {
229
+ hasContactInfo: boolean;
230
+ hasPaymentDetails: boolean;
231
+ hasVerificationDocs: boolean;
232
+ isComplete: boolean;
233
+ } | null | undefined;
117
234
  } & mongoose.DefaultTimestampProps> & {
118
235
  _id: mongoose.Types.ObjectId;
119
236
  } & {
package/dist/User.js CHANGED
@@ -141,6 +141,99 @@ const userSchema = new mongoose_1.default.Schema({
141
141
  googleId: {
142
142
  type: String,
143
143
  required: false
144
+ },
145
+ // Host Profile (for event organizers)
146
+ hostProfile: {
147
+ organizationName: {
148
+ type: String,
149
+ required: false
150
+ },
151
+ role: {
152
+ type: String,
153
+ enum: ['event_organizer', 'venue_owner', 'authorized_rep', 'artist'],
154
+ required: false
155
+ },
156
+ contactPerson: {
157
+ name: {
158
+ type: String,
159
+ required: false
160
+ },
161
+ email: {
162
+ type: String,
163
+ required: false
164
+ },
165
+ phone: {
166
+ type: String,
167
+ required: false
168
+ },
169
+ designation: {
170
+ type: String,
171
+ required: false
172
+ }
173
+ }
174
+ },
175
+ // Verification (for hosts)
176
+ verification: {
177
+ status: {
178
+ type: String,
179
+ enum: ['unverified', 'pending', 'verified', 'rejected'],
180
+ default: 'unverified'
181
+ },
182
+ documents: [{
183
+ type: {
184
+ type: String,
185
+ enum: ['nid', 'trade_license', 'tax_certificate', 'other'],
186
+ required: true
187
+ },
188
+ url: {
189
+ type: String,
190
+ required: true
191
+ },
192
+ filename: {
193
+ type: String,
194
+ required: true
195
+ },
196
+ uploadedAt: {
197
+ type: Date,
198
+ default: Date.now
199
+ }
200
+ }],
201
+ submittedAt: {
202
+ type: Date,
203
+ required: false
204
+ },
205
+ reviewedAt: {
206
+ type: Date,
207
+ required: false
208
+ },
209
+ reviewedBy: {
210
+ type: mongoose_1.default.Schema.Types.ObjectId,
211
+ ref: 'User',
212
+ required: false
213
+ },
214
+ rejectionReason: {
215
+ type: String,
216
+ required: false
217
+ }
218
+ },
219
+ // Profile Completeness Tracking
220
+ profileCompleteness: {
221
+ hasContactInfo: {
222
+ type: Boolean,
223
+ default: false
224
+ },
225
+ hasPaymentDetails: {
226
+ type: Boolean,
227
+ default: false
228
+ },
229
+ hasVerificationDocs: {
230
+ type: Boolean,
231
+ default: false
232
+ },
233
+ isComplete: {
234
+ type: Boolean,
235
+ default: false
236
+ }
144
237
  }
145
238
  }, {
146
239
  timestamps: true
package/dist/User.v2.d.ts CHANGED
@@ -3,8 +3,8 @@ declare const userSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any
3
3
  timestamps: true;
4
4
  strict: true;
5
5
  }, {
6
- role: "user" | "host" | "admin";
7
6
  status: "deleted" | "active" | "suspended";
7
+ role: "user" | "host" | "admin";
8
8
  payout?: {
9
9
  method: "bkash" | "bank_transfer";
10
10
  verified: boolean;
@@ -56,8 +56,8 @@ declare const userSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any
56
56
  } | null | undefined;
57
57
  lastLoginAt?: NativeDate | null | undefined;
58
58
  } & mongoose.DefaultTimestampProps, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
59
- role: "user" | "host" | "admin";
60
59
  status: "deleted" | "active" | "suspended";
60
+ role: "user" | "host" | "admin";
61
61
  payout?: {
62
62
  method: "bkash" | "bank_transfer";
63
63
  verified: boolean;
@@ -112,8 +112,8 @@ declare const userSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any
112
112
  timestamps: true;
113
113
  strict: true;
114
114
  }>> & mongoose.FlatRecord<{
115
- role: "user" | "host" | "admin";
116
115
  status: "deleted" | "active" | "suspended";
116
+ role: "user" | "host" | "admin";
117
117
  payout?: {
118
118
  method: "bkash" | "bank_transfer";
119
119
  verified: boolean;
package/dist/index.d.ts CHANGED
@@ -8,3 +8,5 @@ export { default as userSchema } from './User';
8
8
  export { default as eventViewsSchema } from './Event.views';
9
9
  export { default as payoutSchema } from './Payout';
10
10
  export { default as auditLogSchema } from './AuditLog';
11
+ export type { IAuditLog } from './AuditLog';
12
+ export { AuditSeverity, AuditCategory, AuditStatus } from './AuditLog';
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.auditLogSchema = exports.payoutSchema = exports.eventViewsSchema = exports.userSchema = exports.orderSchema = exports.paymentSchema = exports.bkashSchema = exports.mediaSchema = exports.ticketSchema = exports.eventSchema = void 0;
6
+ exports.AuditStatus = exports.AuditCategory = exports.AuditSeverity = exports.auditLogSchema = exports.payoutSchema = exports.eventViewsSchema = exports.userSchema = exports.orderSchema = exports.paymentSchema = exports.bkashSchema = exports.mediaSchema = exports.ticketSchema = exports.eventSchema = void 0;
7
7
  // Shared database models for Pinecone microservices
8
8
  var Event_1 = require("./Event");
9
9
  Object.defineProperty(exports, "eventSchema", { enumerable: true, get: function () { return __importDefault(Event_1).default; } });
@@ -25,3 +25,7 @@ var Payout_1 = require("./Payout");
25
25
  Object.defineProperty(exports, "payoutSchema", { enumerable: true, get: function () { return __importDefault(Payout_1).default; } });
26
26
  var AuditLog_1 = require("./AuditLog");
27
27
  Object.defineProperty(exports, "auditLogSchema", { enumerable: true, get: function () { return __importDefault(AuditLog_1).default; } });
28
+ var AuditLog_2 = require("./AuditLog");
29
+ Object.defineProperty(exports, "AuditSeverity", { enumerable: true, get: function () { return AuditLog_2.AuditSeverity; } });
30
+ Object.defineProperty(exports, "AuditCategory", { enumerable: true, get: function () { return AuditLog_2.AuditCategory; } });
31
+ Object.defineProperty(exports, "AuditStatus", { enumerable: true, get: function () { return AuditLog_2.AuditStatus; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mac777/project-pinecone-models",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
package/src/AuditLog.ts CHANGED
@@ -1,25 +1,87 @@
1
1
  import { Document, Schema } from "mongoose";
2
2
 
3
+ export enum AuditSeverity {
4
+ INFO = 'INFO',
5
+ WARNING = 'WARNING',
6
+ CRITICAL = 'CRITICAL'
7
+ }
8
+
9
+ export enum AuditCategory {
10
+ AUTH = 'AUTH',
11
+ AUTHORIZATION = 'AUTHORIZATION',
12
+ DATA_MODIFICATION = 'DATA_MODIFICATION',
13
+ ADMIN_ACTION = 'ADMIN_ACTION',
14
+ PAYMENT = 'PAYMENT'
15
+ }
16
+
17
+ export enum AuditStatus {
18
+ SUCCESS = 'SUCCESS',
19
+ FAILURE = 'FAILURE'
20
+ }
21
+
3
22
  export interface IAuditLog extends Document {
4
- userId: string;
23
+ userId?: string;
5
24
  action: string;
6
- details: any;
7
- performedBy: string;
8
- targetType: string;
9
- targetId: string;
10
- metadata: { error: string, reason: string };
25
+ category: AuditCategory;
26
+ severity: AuditSeverity;
27
+ status: AuditStatus;
28
+ details?: any;
29
+ performedBy?: string;
30
+ targetType?: string;
31
+ targetId?: string;
32
+ metadata?: {
33
+ error?: string;
34
+ reason?: string;
35
+ [key: string]: any;
36
+ };
37
+ ipAddress?: string;
38
+ userAgent?: string;
39
+ sessionId?: string;
11
40
  timestamp: Date;
41
+ expiresAt?: Date;
12
42
  }
13
43
 
14
44
  const auditLogSchema = new Schema<IAuditLog>({
15
- userId: { type: String },
16
- action: { type: String },
45
+ userId: { type: String, index: true },
46
+ action: { type: String, required: true, index: true },
47
+ category: {
48
+ type: String,
49
+ enum: Object.values(AuditCategory),
50
+ required: true,
51
+ index: true
52
+ },
53
+ severity: {
54
+ type: String,
55
+ enum: Object.values(AuditSeverity),
56
+ required: true,
57
+ index: true
58
+ },
59
+ status: {
60
+ type: String,
61
+ enum: Object.values(AuditStatus),
62
+ required: true,
63
+ index: true
64
+ },
17
65
  details: { type: Object },
18
66
  performedBy: { type: String },
19
- targetType: { type: String },
20
- targetId: { type: String },
67
+ targetType: { type: String, index: true },
68
+ targetId: { type: String, index: true },
21
69
  metadata: { type: Object },
22
- timestamp: { type: Date, default: Date.now },
70
+ ipAddress: { type: String },
71
+ userAgent: { type: String },
72
+ sessionId: { type: String, index: true },
73
+ timestamp: { type: Date, default: Date.now, index: true },
74
+ expiresAt: { type: Date, index: true }
75
+ }, {
76
+ timestamps: false // We use our own timestamp field
23
77
  });
24
78
 
25
- export default auditLogSchema;
79
+ // Compound indexes for common queries
80
+ auditLogSchema.index({ userId: 1, timestamp: -1 });
81
+ auditLogSchema.index({ category: 1, severity: 1, timestamp: -1 });
82
+ auditLogSchema.index({ status: 1, timestamp: -1 });
83
+
84
+ // TTL index for GDPR compliance - auto-delete after expiresAt
85
+ auditLogSchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
86
+
87
+ export default auditLogSchema;
package/src/User.ts CHANGED
@@ -139,6 +139,102 @@ const userSchema = new mongoose.Schema({
139
139
  googleId: {
140
140
  type: String,
141
141
  required: false
142
+ },
143
+
144
+ // Host Profile (for event organizers)
145
+ hostProfile: {
146
+ organizationName: {
147
+ type: String,
148
+ required: false
149
+ },
150
+ role: {
151
+ type: String,
152
+ enum: ['event_organizer', 'venue_owner', 'authorized_rep', 'artist'],
153
+ required: false
154
+ },
155
+ contactPerson: {
156
+ name: {
157
+ type: String,
158
+ required: false
159
+ },
160
+ email: {
161
+ type: String,
162
+ required: false
163
+ },
164
+ phone: {
165
+ type: String,
166
+ required: false
167
+ },
168
+ designation: {
169
+ type: String,
170
+ required: false
171
+ }
172
+ }
173
+ },
174
+
175
+ // Verification (for hosts)
176
+ verification: {
177
+ status: {
178
+ type: String,
179
+ enum: ['unverified', 'pending', 'verified', 'rejected'],
180
+ default: 'unverified'
181
+ },
182
+ documents: [{
183
+ type: {
184
+ type: String,
185
+ enum: ['nid', 'trade_license', 'tax_certificate', 'other'],
186
+ required: true
187
+ },
188
+ url: {
189
+ type: String,
190
+ required: true
191
+ },
192
+ filename: {
193
+ type: String,
194
+ required: true
195
+ },
196
+ uploadedAt: {
197
+ type: Date,
198
+ default: Date.now
199
+ }
200
+ }],
201
+ submittedAt: {
202
+ type: Date,
203
+ required: false
204
+ },
205
+ reviewedAt: {
206
+ type: Date,
207
+ required: false
208
+ },
209
+ reviewedBy: {
210
+ type: mongoose.Schema.Types.ObjectId,
211
+ ref: 'User',
212
+ required: false
213
+ },
214
+ rejectionReason: {
215
+ type: String,
216
+ required: false
217
+ }
218
+ },
219
+
220
+ // Profile Completeness Tracking
221
+ profileCompleteness: {
222
+ hasContactInfo: {
223
+ type: Boolean,
224
+ default: false
225
+ },
226
+ hasPaymentDetails: {
227
+ type: Boolean,
228
+ default: false
229
+ },
230
+ hasVerificationDocs: {
231
+ type: Boolean,
232
+ default: false
233
+ },
234
+ isComplete: {
235
+ type: Boolean,
236
+ default: false
237
+ }
142
238
  }
143
239
  }, {
144
240
  timestamps: true
package/src/index.ts CHANGED
@@ -8,4 +8,6 @@ export { default as orderSchema } from './Order';
8
8
  export { default as userSchema } from './User';
9
9
  export { default as eventViewsSchema } from './Event.views';
10
10
  export { default as payoutSchema } from './Payout';
11
- export { default as auditLogSchema } from './AuditLog';
11
+ export { default as auditLogSchema } from './AuditLog';
12
+ export type { IAuditLog } from './AuditLog';
13
+ export { AuditSeverity, AuditCategory, AuditStatus } from './AuditLog';