Merge branch 'main' into fix/channel-data-inference-type-issue

This commit is contained in:
Med Marrouchi
2024-12-10 07:34:09 +01:00
committed by GitHub
39 changed files with 557 additions and 99 deletions

View File

@@ -56,7 +56,7 @@ import { SubscriberService } from '../services/subscriber.service';
@UseInterceptors(CsrfInterceptor)
@Controller('message')
export class MessageController extends BaseController<
Message,
AnyMessage,
MessageStub,
MessagePopulate,
MessageFull

View File

@@ -72,7 +72,7 @@ export class MessageRepository extends BaseRepository<
until = new Date(),
limit: number = 30,
) {
return await this.findPage(
return await this.find(
{
$or: [{ recipient: subscriber.id }, { sender: subscriber.id }],
createdAt: { $lt: until },
@@ -96,7 +96,7 @@ export class MessageRepository extends BaseRepository<
since = new Date(),
limit: number = 30,
) {
return await this.findPage(
return await this.find(
{
$or: [{ recipient: subscriber.id }, { sender: subscriber.id }],
createdAt: { $gt: since },

View File

@@ -106,7 +106,7 @@ export class SubscriberRepository extends BaseRepository<
* @returns The constructed query object.
*/
findByForeignIdQuery(id: string) {
return this.findPageQuery(
return this.findQuery(
{ foreign_id: id },
{ skip: 0, limit: 1, sort: ['lastvisit', 'desc'] },
);

View File

@@ -7,7 +7,7 @@
*/
import { ChannelName } from '@/channel/types';
import { Nlp } from '@/helper/types';
import { NLU } from '@/helper/types';
import { Subscriber } from '../subscriber.schema';
@@ -17,7 +17,7 @@ export interface Context {
channel?: ChannelName;
text?: string;
payload?: Payload | string;
nlp?: Nlp.ParseEntities | null;
nlp?: NLU.ParseEntities | null;
vars: { [key: string]: any };
user_location: {
address?: Record<string, string>;

View File

@@ -13,7 +13,7 @@ import { AttachmentService } from '@/attachment/services/attachment.service';
import EventWrapper from '@/channel/lib/EventWrapper';
import { ContentService } from '@/cms/services/content.service';
import { CONSOLE_CHANNEL_NAME } from '@/extensions/channels/console/settings';
import { Nlp } from '@/helper/types';
import { NLU } from '@/helper/types';
import { I18nService } from '@/i18n/services/i18n.service';
import { LanguageService } from '@/i18n/services/language.service';
import { LoggerService } from '@/logger/logger.service';
@@ -254,7 +254,7 @@ export class BlockService extends BaseService<Block, BlockPopulate, BlockFull> {
* @returns The NLP patterns that matches
*/
matchNLP(
nlp: Nlp.ParseEntities,
nlp: NLU.ParseEntities,
block: Block | BlockFull,
): NlpPattern[] | undefined {
// No nlp entities to check against

View File

@@ -126,7 +126,7 @@ export class MessageService extends BaseService<
* @returns The message history since the specified date.
*/
async findLastMessages(subscriber: Subscriber, limit: number = 5) {
const lastMessages = await this.findPage(
const lastMessages = await this.find(
{
$or: [{ sender: subscriber.id }, { recipient: subscriber.id }],
},