mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
refactor: Improve code readability and maintainability in AnalyticsDatabaseService.ts
This commit is contained in:
parent
aede9af03d
commit
469e06280a
@ -53,14 +53,14 @@ import TableColumnType from 'Common/Types/AnalyticsDatabase/TableColumnType';
|
||||
export default class AnalyticsDatabaseService<
|
||||
TBaseModel extends AnalyticsBaseModel
|
||||
> extends BaseService {
|
||||
public modelType!: { new(): TBaseModel };
|
||||
public modelType!: { new (): TBaseModel };
|
||||
public database!: ClickhouseDatabase;
|
||||
public model!: TBaseModel;
|
||||
public databaseClient!: ClickhouseClient;
|
||||
public statementGenerator!: StatementGenerator<TBaseModel>;
|
||||
|
||||
public constructor(data: {
|
||||
modelType: { new(): TBaseModel };
|
||||
modelType: { new (): TBaseModel };
|
||||
database?: ClickhouseDatabase | undefined;
|
||||
}) {
|
||||
super();
|
||||
@ -765,7 +765,8 @@ export default class AnalyticsDatabaseService<
|
||||
await Promise.allSettled(promises);
|
||||
} else {
|
||||
logger.warn(
|
||||
`Realtime is not initialized. Skipping emitModelEvent for ${this.getModel().tableName
|
||||
`Realtime is not initialized. Skipping emitModelEvent for ${
|
||||
this.getModel().tableName
|
||||
}`
|
||||
);
|
||||
}
|
||||
@ -868,7 +869,6 @@ export default class AnalyticsDatabaseService<
|
||||
requiredField,
|
||||
data.getDefaultValueForColumn(requiredField)
|
||||
);
|
||||
|
||||
} else {
|
||||
throw new BadDataException(`${requiredField} is required`);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user