Skip to content

Commit

Permalink
refactor: code index alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
djabarovgeorge committed Apr 17, 2024
1 parent 10b4e0f commit 186e1f7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libs/dal/src/repositories/change/change.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const changeSchema = new Schema<ChangeDBModel>(
type: Schema.Types.ObjectId,
ref: 'Organization',
},
_entityId: Schema.Types.ObjectId,
_entityId: { type: Schema.Types.ObjectId, index: true },
_creatorId: {
type: Schema.Types.ObjectId,
ref: 'User',
Expand Down
6 changes: 5 additions & 1 deletion libs/dal/src/repositories/integration/integration.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const integrationSchema = new Schema<IntegrationDBModel>(
_organizationId: {
type: Schema.Types.ObjectId,
ref: 'Organization',
index: true,
},
providerId: Schema.Types.String,
channel: Schema.Types.String,
Expand Down Expand Up @@ -95,6 +94,11 @@ const integrationSchema = new Schema<IntegrationDBModel>(
schemaOptions
);

integrationSchema.index({
_organizationId: 1,
active: 1,
});

integrationSchema.plugin(mongooseDelete, { deletedAt: true, deletedBy: true, overrideMethods: 'all' });

// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down
1 change: 1 addition & 0 deletions libs/dal/src/repositories/layout/layout.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const layoutSchema = new Schema<LayoutDBModel>(
_environmentId: {
type: Schema.Types.ObjectId,
ref: 'Environment',
index: true,
},
_organizationId: {
type: Schema.Types.ObjectId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ messageTemplateSchema.index({
'triggers.identifier': 1,
});

messageTemplateSchema.index({
_parentId: 1,
});

messageTemplateSchema.plugin(mongooseDelete, { deletedAt: true, deletedBy: true, overrideMethods: 'all' });

// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down
5 changes: 0 additions & 5 deletions libs/dal/src/repositories/notification/notification.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,21 @@ const notificationSchema = new Schema<NotificationDBModel>(
_templateId: {
type: Schema.Types.ObjectId,
ref: 'NotificationTemplate',
index: true,
},
_environmentId: {
type: Schema.Types.ObjectId,
ref: 'Environment',
index: true,
},
_organizationId: {
type: Schema.Types.ObjectId,
ref: 'Organization',
index: true,
},
_subscriberId: {
type: Schema.Types.ObjectId,
ref: 'Subscriber',
index: true,
},
transactionId: {
type: Schema.Types.String,
index: true,
},
channels: [
{
Expand Down

0 comments on commit 186e1f7

Please sign in to comment.