Skip to content

Commit

Permalink
[Domain] Created new game code entities / model
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Jun 3, 2021
1 parent 172b704 commit 2265780
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 48 deletions.
31 changes: 0 additions & 31 deletions lib/domain/models/db/game_codes/game_codes_file.dart

This file was deleted.

3 changes: 2 additions & 1 deletion lib/domain/models/entities.dart
@@ -1,7 +1,8 @@
export 'entities/calculator/calculator_character_skill.dart';
export 'entities/calculator/calculator_item.dart';
export 'entities/calculator/calculator_session.dart';
export 'entities/game_code/used_game_code.dart';
export 'entities/game_code/game_code.dart';
export 'entities/game_code/game_code_reward.dart';
export 'entities/inventory/inventory_item.dart';
export 'entities/inventory/inventory_used_item.dart';
export 'entities/tierlist/tierlist_item.dart';
26 changes: 26 additions & 0 deletions lib/domain/models/entities/game_code/game_code.dart
@@ -0,0 +1,26 @@
import 'package:hive/hive.dart';

part 'game_code.g.dart';

@HiveType(typeId: 6)
class GameCode extends HiveObject {
@HiveField(0)
final String code;

@HiveField(1)
DateTime usedOn;

@HiveField(2)
DateTime discoveredOn;

@HiveField(3)
DateTime expiredOn;

@HiveField(4)
bool isExpired;

@HiveField(5)
int region;

GameCode(this.code, this.usedOn, this.discoveredOn, this.expiredOn, this.isExpired, this.region);
}
17 changes: 17 additions & 0 deletions lib/domain/models/entities/game_code/game_code_reward.dart
@@ -0,0 +1,17 @@
import 'package:hive/hive.dart';

part 'game_code_reward.g.dart';

@HiveType(typeId: 8)
class GameCodeReward extends HiveObject {
@HiveField(0)
final int gameCodeKey;

@HiveField(1)
final String itemKey;

@HiveField(2)
final int quantity;

GameCodeReward(this.gameCodeKey, this.itemKey, this.quantity);
}
14 changes: 0 additions & 14 deletions lib/domain/models/entities/game_code/used_game_code.dart

This file was deleted.

11 changes: 10 additions & 1 deletion lib/domain/models/game_codes/game_code_model.dart
@@ -1,16 +1,25 @@
import 'package:flutter/cupertino.dart';
import 'package:genshindb/domain/enums/enums.dart';
import 'package:genshindb/domain/models/models.dart';

class GameCodeModel {
final String code;
final AppServerResetTimeType region;

final DateTime discoveredOn;
final DateTime expiredOn;
final bool isExpired;

final bool isUsed;
final List<ItemAscensionMaterialModel> rewards;

GameCodeModel({
@required this.code,
@required this.isExpired,
@required this.isUsed,
@required this.rewards,
@required this.isExpired,
@required this.discoveredOn,
this.expiredOn,
this.region,
});
}
1 change: 0 additions & 1 deletion lib/domain/models/models.dart
Expand Up @@ -17,7 +17,6 @@ export 'db/characters/characters_file.dart';
export 'db/elements/element_debuff_file_model.dart';
export 'db/elements/element_reaction_file_model.dart';
export 'db/elements/elements_file.dart';
export 'db/game_codes/game_codes_file.dart';
export 'db/materials/material_file_model.dart';
export 'db/materials/materials_file.dart';
export 'db/monsters/monster_file_model.dart';
Expand Down

0 comments on commit 2265780

Please sign in to comment.