Skip to content

Commit

Permalink
fix indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
wulff007 committed Oct 27, 2024
1 parent f1f0e3f commit 3705f70
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tabbled-server",
"version": "0.3.7",
"version": "0.3.8",
"public": true,
"license": "MIT",
"scripts": {
Expand Down
5 changes: 3 additions & 2 deletions src/data-indexer/data-indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class DataIndexer {
}

public async dataReindex(params: DataReindexDto, context: Context) : Promise<number> {
let adapter: IndexerDataAdapter = this.getAdapter(params.dataSourceConfig.type)
let adapter: IndexerDataAdapter = this.getAdapter(params.dataSourceConfig.type)

if (!adapter)
throw `DataSource has no ability to index`
Expand Down Expand Up @@ -280,6 +280,7 @@ export class DataIndexer {
continue
}

//TODO This is not support multiple field type
for(let j in items) {
items[j][field.alias] = await this.replaceLinkedDataToItem(items[j][field.alias], index, fields)
}
Expand All @@ -306,7 +307,7 @@ export class DataIndexer {


} else {
this.logger.warn(`Item id must be a type of string`)
this.logger.warn(`Item id must be a type of string, current type is ${typeof id}, may by field is multiple?`)
return {
id: id
}
Expand Down
4 changes: 3 additions & 1 deletion src/datasources/datasourceV2.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export class DataSourceV2Service {
.values(d)
.orUpdate(['type', 'title', 'searchable', 'filterable',
'sortable', 'is_multiple','default_value', 'datasource_ref',
'autoincrement', 'required', 'enum_values', 'precision',
'autoincrement', 'nullable', 'enum_values', 'precision',
'format', 'updated_by', 'updated_at', 'deleted_at',
'deleted_by', 'version'],
['account_id', 'datasource_alias', 'alias'])
Expand Down Expand Up @@ -698,6 +698,7 @@ export class DataSourceV2Service {

@OnEvent('config-update.datasource.*', {async: true})
async handleDataSourceConfigUpdate(data) {
console.log('config-update.datasource.*')

let queryRunner = this.datasource.createQueryRunner()
await queryRunner.startTransaction()
Expand All @@ -706,6 +707,7 @@ export class DataSourceV2Service {
await this.updateDatasourceFromV1(queryRunner, data.item, data.context)
await queryRunner.commitTransaction()
} catch (e) {
console.log(e)
await queryRunner.rollbackTransaction()
throw e
} finally {
Expand Down

0 comments on commit 3705f70

Please sign in to comment.