Skip to content

Commit

Permalink
Merge branch 'Hexastack:main' into fix#220
Browse files Browse the repository at this point in the history
  • Loading branch information
devamitranjan authored Oct 18, 2024
2 parents c70bdc7 + 08b1dea commit 431b92a
Show file tree
Hide file tree
Showing 167 changed files with 740 additions and 465 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Please include a summary of the change and which issue is fixed. Please also inc

Fixes # (issue)

## Type of change
# Type of change:

Please delete options that are not relevant.

Expand All @@ -17,6 +17,6 @@ Please delete options that are not relevant.

- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation (Storybook)
- [ ] I have made corresponding changes to the documentation
- [ ] I have added unit tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.fixAll.eslint": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
Expand Down
3 changes: 2 additions & 1 deletion api/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ module.exports = {
'builtin', // Built-in imports (come from NodeJS native) go first
'external', // <- External imports
'unknown', // <- unknown
['sibling', 'parent'], // <- Relative imports, the sibling and parent types they can be mingled together
'parent', // <- Relative imports, the sibling and parent types they can be mingled together
'sibling',
'index', // <- index imports
'internal', // <- Absolute imports
],
Expand Down
3 changes: 2 additions & 1 deletion api/src/analytics/controllers/bot-stats.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { BotStatsController } from './bot-stats.controller';
import { BotStatsRepository } from '../repositories/bot-stats.repository';
import { BotStatsModel, BotStatsType } from '../schemas/bot-stats.schema';
import { BotStatsService } from '../services/bot-stats.service';

import { BotStatsController } from './bot-stats.controller';

describe('BotStatsController', () => {
let botStatsController: BotStatsController;

Expand Down
3 changes: 2 additions & 1 deletion api/src/analytics/controllers/bot-stats.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

import { Controller, Get, Query } from '@nestjs/common';

import { ToLinesType } from './../schemas/bot-stats.schema';
import { BotStatsFindDatumDto, BotStatsFindDto } from '../dto/bot-stats.dto';
import { BotStats, BotStatsType } from '../schemas/bot-stats.schema';
import { BotStatsService } from '../services/bot-stats.service';
import { aMonthAgo } from '../utilities';

import { ToLinesType } from './../schemas/bot-stats.schema';

@Controller('botstats')
export class BotStatsController {
constructor(private readonly botStatsService: BotStatsService) {}
Expand Down
3 changes: 2 additions & 1 deletion api/src/analytics/repositories/bot-stats.repository.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { BotStatsRepository } from './bot-stats.repository';
import {
BotStats,
BotStatsModel,
BotStatsType,
} from '../schemas/bot-stats.schema';

import { BotStatsRepository } from './bot-stats.repository';

describe('BotStatsRepository', () => {
let botStatsRepository: BotStatsRepository;
let botStatsModel: Model<BotStats>;
Expand Down
3 changes: 2 additions & 1 deletion api/src/analytics/services/bot-stats.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { BotStatsService } from './bot-stats.service';
import { BotStatsRepository } from '../repositories/bot-stats.repository';
import { BotStatsModel, BotStatsType } from '../schemas/bot-stats.schema';

import { BotStatsService } from './bot-stats.service';

describe('BotStatsService', () => {
let botStatsService: BotStatsService;

Expand Down
3 changes: 2 additions & 1 deletion api/src/attachment/controllers/attachment.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { AttachmentController } from './attachment.controller';
import { attachment, attachmentFile } from '../mocks/attachment.mock';
import { AttachmentRepository } from '../repositories/attachment.repository';
import { AttachmentModel, Attachment } from '../schemas/attachment.schema';
import { AttachmentService } from '../services/attachment.service';

import { AttachmentController } from './attachment.controller';

describe('AttachmentController', () => {
let attachmentController: AttachmentController;
let attachmentService: AttachmentService;
Expand Down
3 changes: 2 additions & 1 deletion api/src/channel/lib/Handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import { SettingService } from '@/setting/services/setting.service';
import { SocketRequest } from '@/websocket/utils/socket-request';
import { SocketResponse } from '@/websocket/utils/socket-response';

import EventWrapper from './EventWrapper';
import { ChannelService } from '../channel.service';

import EventWrapper from './EventWrapper';

@Injectable()
export default abstract class ChannelHandler {
protected settings: SettingCreateDto[] = [];
Expand Down
5 changes: 3 additions & 2 deletions api/src/chat/controllers/block.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { CategoryModel, Category } from './../schemas/category.schema';
import { BlockController } from './block.controller';
import { BlockCreateDto, BlockUpdateDto } from '../dto/block.dto';
import { BlockRepository } from '../repositories/block.repository';
import { CategoryRepository } from '../repositories/category.repository';
Expand All @@ -56,6 +54,9 @@ import { BlockService } from '../services/block.service';
import { CategoryService } from '../services/category.service';
import { LabelService } from '../services/label.service';

import { CategoryModel, Category } from './../schemas/category.schema';
import { BlockController } from './block.controller';

describe('BlockController', () => {
let blockController: BlockController;
let blockService: BlockService;
Expand Down
2 changes: 1 addition & 1 deletion api/src/chat/controllers/block.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class BlockController extends BaseController<
plugin: p.id,
args: p.settings.reduce(
(acc, setting) => {
acc[setting.id] = setting.value;
acc[setting.label] = setting.value;
return acc;
},
{} as { [key: string]: any },
Expand Down
5 changes: 3 additions & 2 deletions api/src/chat/controllers/category.contoller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { Category, CategoryModel } from './../schemas/category.schema';
import { CategoryController } from './category.controller';
import { CategoryCreateDto, CategoryUpdateDto } from '../dto/category.dto';
import { BlockRepository } from '../repositories/block.repository';
import { CategoryRepository } from '../repositories/category.repository';
Expand All @@ -42,6 +40,9 @@ import { LabelModel } from '../schemas/label.schema';
import { BlockService } from '../services/block.service';
import { CategoryService } from '../services/category.service';

import { Category, CategoryModel } from './../schemas/category.schema';
import { CategoryController } from './category.controller';

describe('CategoryController', () => {
let categoryController: CategoryController;
let categoryService: CategoryService;
Expand Down
3 changes: 2 additions & 1 deletion api/src/chat/controllers/context-var.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { ContextVarController } from './context-var.controller';
import {
ContextVarCreateDto,
ContextVarUpdateDto,
Expand All @@ -32,6 +31,8 @@ import { ContextVarRepository } from '../repositories/context-var.repository';
import { ContextVarModel, ContextVar } from '../schemas/context-var.schema';
import { ContextVarService } from '../services/context-var.service';

import { ContextVarController } from './context-var.controller';

describe('ContextVarController', () => {
let contextVarController: ContextVarController;
let contextVarService: ContextVarService;
Expand Down
3 changes: 2 additions & 1 deletion api/src/chat/controllers/label.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { LabelController } from './label.controller';
import { LabelCreateDto, LabelUpdateDto } from '../dto/label.dto';
import { LabelRepository } from '../repositories/label.repository';
import { SubscriberRepository } from '../repositories/subscriber.repository';
Expand All @@ -41,6 +40,8 @@ import { SubscriberModel } from '../schemas/subscriber.schema';
import { LabelService } from '../services/label.service';
import { SubscriberService } from '../services/subscriber.service';

import { LabelController } from './label.controller';

describe('LabelController', () => {
let labelController: LabelController;
let labelService: LabelService;
Expand Down
3 changes: 2 additions & 1 deletion api/src/chat/controllers/message.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { MessageController } from './message.controller';
import { MessageRepository } from '../repositories/message.repository';
import { SubscriberRepository } from '../repositories/subscriber.repository';
import { Message, MessageModel } from '../schemas/message.schema';
import { Subscriber, SubscriberModel } from '../schemas/subscriber.schema';
import { MessageService } from '../services/message.service';
import { SubscriberService } from '../services/subscriber.service';

import { MessageController } from './message.controller';

describe('MessageController', () => {
let messageController: MessageController;
let messageService: MessageService;
Expand Down
7 changes: 4 additions & 3 deletions api/src/chat/controllers/subscriber.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ import {
import { SocketEventDispatcherService } from '@/websocket/services/socket-event-dispatcher.service';
import { WebsocketGateway } from '@/websocket/websocket.gateway';

import { UserService } from './../../user/services/user.service';
import { LabelService } from './../services/label.service';
import { SubscriberController } from './subscriber.controller';
import { LabelRepository } from '../repositories/label.repository';
import { SubscriberRepository } from '../repositories/subscriber.repository';
import { LabelModel, Label } from '../schemas/label.schema';
import { SubscriberModel, Subscriber } from '../schemas/subscriber.schema';
import { SubscriberService } from '../services/subscriber.service';

import { UserService } from './../../user/services/user.service';
import { LabelService } from './../services/label.service';
import { SubscriberController } from './subscriber.controller';

describe('SubscriberController', () => {
let subscriberController: SubscriberController;
let subscriberService: SubscriberService;
Expand Down
5 changes: 3 additions & 2 deletions api/src/chat/repositories/block.repository.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { BlockRepository } from './block.repository';
import { CategoryRepository } from './category.repository';
import { BlockModel, Block } from '../schemas/block.schema';
import { CategoryModel, Category } from '../schemas/category.schema';
import { LabelModel } from '../schemas/label.schema';

import { BlockRepository } from './block.repository';
import { CategoryRepository } from './category.repository';

describe('BlockRepository', () => {
let blockRepository: BlockRepository;
let categoryRepository: CategoryRepository;
Expand Down
5 changes: 3 additions & 2 deletions api/src/chat/repositories/label.repository.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { LabelRepository } from './label.repository';
import { SubscriberRepository } from './subscriber.repository';
import { LabelModel, Label } from '../schemas/label.schema';
import { SubscriberModel, Subscriber } from '../schemas/subscriber.schema';

import { LabelRepository } from './label.repository';
import { SubscriberRepository } from './subscriber.repository';

describe('LabelRepository', () => {
let labelRepository: LabelRepository;
let labelModel: Model<Label>;
Expand Down
5 changes: 3 additions & 2 deletions api/src/chat/repositories/message.repository.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { MessageRepository } from './message.repository';
import { SubscriberRepository } from './subscriber.repository';
import { MessageModel, Message } from '../schemas/message.schema';
import { SubscriberModel } from '../schemas/subscriber.schema';
import { AnyMessage } from '../schemas/types/message';

import { MessageRepository } from './message.repository';
import { SubscriberRepository } from './subscriber.repository';

describe('MessageRepository', () => {
let messageRepository: MessageRepository;
let userRepository: UserRepository;
Expand Down
5 changes: 3 additions & 2 deletions api/src/chat/repositories/subscriber.repository.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { LabelRepository } from './label.repository';
import { SubscriberRepository } from './subscriber.repository';
import { LabelModel, Label } from '../schemas/label.schema';
import {
SubscriberModel,
Subscriber,
SubscriberFull,
} from '../schemas/subscriber.schema';

import { LabelRepository } from './label.repository';
import { SubscriberRepository } from './subscriber.repository';

describe('SubscriberRepository', () => {
let subscriberRepository: SubscriberRepository;
let subscriberModel: Model<Subscriber>;
Expand Down
9 changes: 5 additions & 4 deletions api/src/chat/schemas/block.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ import { BaseSchema } from '@/utils/generics/base-schema';
import { LifecycleHookManager } from '@/utils/generics/lifecycle-hook-manager';
import { TFilterPopulateFields } from '@/utils/types/filter.types';

import { isValidMessage } from '../validation-rules/is-message';
import { isPatternList } from '../validation-rules/is-pattern-list';
import { isPosition } from '../validation-rules/is-position';
import { isValidVarCapture } from '../validation-rules/is-valid-capture';

import { Category } from './category.schema';
import { Label } from './label.schema';
import { CaptureVar } from './types/capture-var';
import { BlockMessage } from './types/message';
import { BlockOptions } from './types/options';
import { Pattern } from './types/pattern';
import { Position } from './types/position';
import { isValidMessage } from '../validation-rules/is-message';
import { isPatternList } from '../validation-rules/is-pattern-list';
import { isPosition } from '../validation-rules/is-position';
import { isValidVarCapture } from '../validation-rules/is-valid-capture';

@Schema({ timestamps: true })
export class BlockStub extends BaseSchema {
Expand Down
3 changes: 2 additions & 1 deletion api/src/chat/schemas/types/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

import { Nlp } from '@/nlp/lib/types';

import { Payload } from './quick-reply';
import { Subscriber } from '../subscriber.schema';

import { Payload } from './quick-reply';

export interface Context {
channel?: string;
text?: string;
Expand Down
3 changes: 2 additions & 1 deletion api/src/chat/schemas/types/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import { Attachment } from '@/attachment/schemas/attachment.schema';
import { Content } from '@/cms/schemas/content.schema';

import { Message } from '../message.schema';

import {
AttachmentForeignKey,
AttachmentPayload,
Expand All @@ -18,7 +20,6 @@ import {
import { Button } from './button';
import { ContentOptions } from './options';
import { StdQuickReply } from './quick-reply';
import { Message } from '../message.schema';

/**
* StdEventType enum is declared, and currently not used
Expand Down
7 changes: 4 additions & 3 deletions api/src/chat/services/block.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ import {
rootMongooseTestModule,
} from '@/utils/test/test';

import { CategoryRepository } from './../repositories/category.repository';
import { BlockService } from './block.service';
import { CategoryService } from './category.service';
import { BlockRepository } from '../repositories/block.repository';
import { Block, BlockModel } from '../schemas/block.schema';
import { Category, CategoryModel } from '../schemas/category.schema';
Expand All @@ -71,6 +68,10 @@ import { Context } from '../schemas/types/context';
import { PayloadType, StdOutgoingListMessage } from '../schemas/types/message';
import { SubscriberContext } from '../schemas/types/subscriberContext';

import { CategoryRepository } from './../repositories/category.repository';
import { BlockService } from './block.service';
import { CategoryService } from './category.service';

describe('BlockService', () => {
let blockRepository: BlockRepository;
let categoryRepository: CategoryRepository;
Expand Down
Loading

0 comments on commit 431b92a

Please sign in to comment.