Skip to content

Commit

Permalink
Issue #37: add todos
Browse files Browse the repository at this point in the history
  • Loading branch information
idrissneumann committed Dec 8, 2023
1 parent 8e2e09d commit 8720b14
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ export class QuickwitDataSource
message: 'Cannot save datasource, `index` is required',
};
}

// todo #37 /describe will give you the timeField
if (this.timeField === '' ) {
return {
status: 'error',
message: 'Cannot save datasource, `timeField` is required',
};
}

return lastValueFrom(
from(this.getResource('indexes/' + this.index)).pipe(
mergeMap((indexMetadata) => {
Expand Down Expand Up @@ -150,9 +153,12 @@ export class QuickwitDataSource
if (timestampField === undefined) {
return `No field named '${this.timeField}' found in the doc mapping. This should never happen.`;
}

// todo #37: no need anymore, will take the timestampField.field_mapping.output_format anyway
if (timestampField.field_mapping.output_format !== this.timeOutputFormat) {
return `Timestamp output format is declared as '${timestampField.field_mapping.output_format}' in the doc mapping, not '${this.timeOutputFormat}'.`;
}

const supportedTimestampOutputFormats = ['unix_timestamp_secs', 'unix_timestamp_millis', 'unix_timestamp_micros', 'unix_timestamp_nanos', 'iso8601', 'rfc3339'];
if (!supportedTimestampOutputFormats.includes(this.timeOutputFormat)) {
return `Timestamp output format '${this.timeOutputFormat} is not yet supported.`;
Expand Down

0 comments on commit 8720b14

Please sign in to comment.