Skip to content

Commit

Permalink
[Domain] Added initial dto and entity to save telemetry data
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Jul 6, 2024
1 parent 64bae11 commit 8ec1384
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/domain/models/dtos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ export 'dtos/api_response_dto.dart';
export 'dtos/empty_response_dto.dart';
export 'dtos/requests/base_request_dto.dart';
export 'dtos/requests/get_resource_diff_request_dto.dart';
export 'dtos/requests/save_app_logs_request_dto.dart';
export 'dtos/responses/game_code_response_dto.dart';
export 'dtos/responses/resource_diff_response_dto.dart';
32 changes: 32 additions & 0 deletions lib/domain/models/dtos/requests/save_app_logs_request_dto.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:json_annotation/json_annotation.dart';

part 'save_app_logs_request_dto.g.dart';

@JsonSerializable(explicitToJson: true)
class SaveAppLogsRequestDto {
final List<SaveAppLogRequestDto> logs;

const SaveAppLogsRequestDto({
required this.logs,
});

Map<String, dynamic> toJson() => _$SaveAppLogsRequestDtoToJson(this);

factory SaveAppLogsRequestDto.fromJson(Map<String, dynamic> json) => _$SaveAppLogsRequestDtoFromJson(json);
}

@JsonSerializable()
class SaveAppLogRequestDto {
final int timestamp;

final String message;

const SaveAppLogRequestDto({
required this.timestamp,
required this.message,
});

Map<String, dynamic> toJson() => _$SaveAppLogRequestDtoToJson(this);

factory SaveAppLogRequestDto.fromJson(Map<String, dynamic> json) => _$SaveAppLogRequestDtoFromJson(json);
}
1 change: 1 addition & 0 deletions lib/domain/models/entities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export 'entities/notifications/notification_gadget.dart';
export 'entities/notifications/notification_realm_currency.dart';
export 'entities/notifications/notification_resin.dart';
export 'entities/notifications/notification_weekly_boss.dart';
export 'entities/telemetry/telemetry.dart';
export 'entities/tierlist/tierlist_item.dart';
export 'entities/wish_simulator/wish_simulator_banner_item_pull_history.dart';
export 'entities/wish_simulator/wish_simulator_banner_pull_history.dart';
15 changes: 15 additions & 0 deletions lib/domain/models/entities/telemetry/telemetry.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:hive/hive.dart';
import 'package:shiori/domain/models/entities/base_entity.dart';

part 'telemetry.g.dart';

@HiveType(typeId: 25)
class Telemetry extends BaseEntity {
@HiveField(0)
final DateTime createdAt;

@HiveField(1)
final String message;

Telemetry(this.createdAt, this.message);
}

0 comments on commit 8ec1384

Please sign in to comment.