diff --git a/api/src/attachment/schemas/attachment.schema.ts b/api/src/attachment/schemas/attachment.schema.ts index a46753799..186c4dafa 100644 --- a/api/src/attachment/schemas/attachment.schema.ts +++ b/api/src/attachment/schemas/attachment.schema.ts @@ -38,6 +38,7 @@ export class AttachmentStub extends BaseSchema { @Prop({ type: String, required: true, + index: true, }) name: string; diff --git a/api/src/chat/schemas/subscriber.schema.ts b/api/src/chat/schemas/subscriber.schema.ts index ba3ea80a6..e87447e6b 100644 --- a/api/src/chat/schemas/subscriber.schema.ts +++ b/api/src/chat/schemas/subscriber.schema.ts @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. @@ -29,12 +29,14 @@ export class SubscriberStub extends BaseSchema { @Prop({ type: String, required: true, + index: true, }) first_name: string; @Prop({ type: String, required: true, + index: true, }) last_name: string; @@ -66,6 +68,7 @@ export class SubscriberStub extends BaseSchema { @Prop({ type: String, + index: true, }) foreign_id: string; @@ -154,7 +157,10 @@ export type SubscriberDocument = THydratedDocument; export const SubscriberModel: ModelDefinition = LifecycleHookManager.attach({ name: Subscriber.name, - schema: SchemaFactory.createForClass(SubscriberStub), + schema: SchemaFactory.createForClass(SubscriberStub).index({ + first_name: 1, + last_name: 1, + }), }); export default SubscriberModel.schema; diff --git a/api/src/cms/schemas/content.schema.ts b/api/src/cms/schemas/content.schema.ts index 9c98d6f38..2be14611e 100644 --- a/api/src/cms/schemas/content.schema.ts +++ b/api/src/cms/schemas/content.schema.ts @@ -34,7 +34,7 @@ export class ContentStub extends BaseSchema { /** * The title of the content. */ - @Prop({ type: String, required: true }) + @Prop({ type: String, required: true, index: true }) title: string; /** diff --git a/api/src/nlp/schemas/nlp-sample-entity.schema.ts b/api/src/nlp/schemas/nlp-sample-entity.schema.ts index cfe25c3ec..f1d8c3afc 100644 --- a/api/src/nlp/schemas/nlp-sample-entity.schema.ts +++ b/api/src/nlp/schemas/nlp-sample-entity.schema.ts @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. @@ -107,7 +107,10 @@ export type NlpSampleEntityDocument = THydratedDocument; export const NlpSampleEntityModel: ModelDefinition = LifecycleHookManager.attach({ name: NlpSampleEntity.name, - schema: SchemaFactory.createForClass(NlpSampleEntityStub), + schema: SchemaFactory.createForClass(NlpSampleEntityStub).index( + { sample: 1, entity: 1, value: 1 }, + { unique: true }, + ), }); export default NlpSampleEntityModel.schema; diff --git a/api/src/nlp/schemas/nlp-sample.schema.ts b/api/src/nlp/schemas/nlp-sample.schema.ts index 2a33ab964..38c80e3c7 100644 --- a/api/src/nlp/schemas/nlp-sample.schema.ts +++ b/api/src/nlp/schemas/nlp-sample.schema.ts @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. @@ -26,7 +26,7 @@ export class NlpSampleStub extends BaseSchema { /** * The content of the sample. */ - @Prop({ type: String, required: true }) + @Prop({ type: String, required: true, index: true }) text: string; /** diff --git a/api/src/nlp/schemas/nlp-value.schema.ts b/api/src/nlp/schemas/nlp-value.schema.ts index aef7149a9..347490ffe 100644 --- a/api/src/nlp/schemas/nlp-value.schema.ts +++ b/api/src/nlp/schemas/nlp-value.schema.ts @@ -119,7 +119,10 @@ export type NlpValueDocument = THydratedDocument; export const NlpValueModel: ModelDefinition = LifecycleHookManager.attach({ name: NlpValue.name, - schema: SchemaFactory.createForClass(NlpValueStub), + schema: SchemaFactory.createForClass(NlpValueStub).index( + { value: 1, entity: 1 }, + { unique: true }, + ), }); export default NlpValueModel.schema;