Core service layer.

### Hierarchy

- GBCoreService

### Implements

- any

## Index

### Constructors

- constructor

### Properties

- adminService
- changeColumnQuery
- createTableQuery
- dialect
- queryGenerator
- sequelize

### Methods

- changeColumnQueryOverride
- createTableQueryOverride
- initDatabase
- loadInstance
- loadInstances
- syncDatabaseStructure

## Constructors

### constructor

- new GBCoreService(): GBCoreService

- - Defined in deploy/core.gbapp/services/GBCoreService.ts:74

  Constructor retrieves default values.

  #### Returns GBCoreService

## Properties

### adminService

adminService: GBAdminService

- Defined in deploy/core.gbapp/services/GBCoreService.ts:54

Administrative services.

### Private changeColumnQuery

changeColumnQuery: function

- Defined in deploy/core.gbapp/services/GBCoreService.ts:69

Custom change column query.

#### Type declaration

- - (tableName: any, attributes: any): string

  - #### Parameters

    - ##### tableName: any

    - ##### attributes: any

    #### Returns string

### Private createTableQuery

createTableQuery: function

- Defined in deploy/core.gbapp/services/GBCoreService.ts:64

Custom create table query.

#### Type declaration

- - (tableName: any, attributes: any, options: any): string

  - #### Parameters

    - ##### tableName: any

    - ##### attributes: any

    - ##### options: any

    #### Returns string

### Private dialect

dialect: string

- Defined in deploy/core.gbapp/services/GBCoreService.ts:74

Dialect used. Tested: mssql and sqlite.

### Private queryGenerator

queryGenerator: any

- Defined in deploy/core.gbapp/services/GBCoreService.ts:59

Allows filtering on SQL generated before send to the database.

### sequelize

sequelize: Sequelize

- Defined in deploy/core.gbapp/services/GBCoreService.ts:49

Data access layer instance.

## Methods

### Private changeColumnQueryOverride

- changeColumnQueryOverride(tableName: any, attributes: any): string

- - Defined in deploy/core.gbapp/services/GBCoreService.ts:214

  SQL: let sql = '' + 'ALTER TABLE [UserGroup]\n' + ' ADD CONSTRAINT [invalid1] FOREIGN KEY ([userId1], [userId2], [userId3]) REFERENCES [User] ([userId1], [userId2], [userId3]) ON DELETE NO ACTION,\n' + ' CONSTRAINT [invalid2] FOREIGN KEY ([groupId1], [groupId2]) REFERENCES [Group] ([groupId1], [groupId2]) ON DELETE NO ACTION, \n' + ' CONSTRAINT [invalid3] FOREIGN KEY ([instanceId1]) REFERENCES [Instance] ([instanceId1]) ON DELETE NO ACTION\n'

  #### Parameters

  - ##### tableName: any

  - ##### attributes: any

  #### Returns string

### Private createTableQueryOverride

- createTableQueryOverride(tableName: any, attributes: any, options: any): string

- - Defined in deploy/core.gbapp/services/GBCoreService.ts:169

  SQL:

  // let sql: string = '' + // 'IF OBJECT_ID(\'[UserGroup]\', \'U\') IS NULL\n' + // 'CREATE TABLE [UserGroup] (\n' + // ' [id] INTEGER NOT NULL IDENTITY(1,1),\n' + // ' [userId] INTEGER NULL,\n' + // ' [groupId] INTEGER NULL,\n' + // ' [instanceId] INTEGER NULL,\n' + // ' PRIMARY KEY ([id1], [id2]),\n' + // ' FOREIGN KEY ([userId1], [userId2], [userId3]) REFERENCES [User] ([userId1], [userId2], [userId3]) ON DELETE NO ACTION,\n' + // ' FOREIGN KEY ([groupId1], [groupId2]) REFERENCES [Group] ([groupId1], [groupId1]) ON DELETE NO ACTION,\n' + // ' FOREIGN KEY ([instanceId]) REFERENCES [Instance] ([instanceId]) ON DELETE NO ACTION)'

  #### Parameters

  - ##### tableName: any

  - ##### attributes: any

  - ##### options: any

  #### Returns string

### initDatabase

- initDatabase(): Promise<Object>

- - Defined in deploy/core.gbapp/services/GBCoreService.ts:87

  Gets database config and connect to storage.

  #### Returns Promise<Object>

### loadInstance

- loadInstance(botId: string): Promise<IGBInstance>

- - Defined in deploy/core.gbapp/services/GBCoreService.ts:275

  Loads just one Bot instance.

  #### Parameters

  - ##### botId: string

  #### Returns Promise<IGBInstance>

### loadInstances

- loadInstances(): Promise<IGBInstance>

- - Defined in deploy/core.gbapp/services/GBCoreService.ts:268

  Loads all items to start several listeners.

  #### Returns Promise<IGBInstance>

### syncDatabaseStructure

- syncDatabaseStructure(): Promise<any>

- - Defined in deploy/core.gbapp/services/GBCoreService.ts:249

  #### Returns Promise<any>

Generated using TypeDoc