Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Mobile App CI / test (push) Waiting to run
Mobile App CI / build-android (push) Blocked by required conditions
Mobile App CI / build-ios (push) Blocked by required conditions
Web App CI / test (push) Waiting to run
Web App CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Deploy Telegram Bot / Deploy Telegram Bot (push) Waiting to run
38 lines
1.5 KiB
Dart
38 lines
1.5 KiB
Dart
import 'package:mnemo_cards_common_backend/mnemo_cards_common_backend.dart';
|
|
import 'package:mnemo_cards_common/mnemo_cards_common.dart';
|
|
|
|
extension ProductExt on MnemoCardsProductDto {
|
|
MnemoCardsProductModel toModel() => MnemoCardsProductModelBase(
|
|
productId: id,
|
|
type: type.toModel(),
|
|
);
|
|
}
|
|
|
|
extension ProductModelTypeExt on MnemoCardsProductType {
|
|
MnemoCardsProductModelType toModel() => switch (this) {
|
|
MnemoCardsProductType.pack => MnemoCardsProductModelType.pack,
|
|
MnemoCardsProductType.subscription =>
|
|
MnemoCardsProductModelType.subscription,
|
|
MnemoCardsProductType.discount => MnemoCardsProductModelType.discount,
|
|
MnemoCardsProductType.unknown => MnemoCardsProductModelType.unknown,
|
|
MnemoCardsProductType.game => MnemoCardsProductModelType.game,
|
|
};
|
|
}
|
|
|
|
extension ProductModelExt on MnemoCardsProductModel {
|
|
MnemoCardsProductDto toDto() => MnemoCardsProductDto(
|
|
id: id?.toString(),
|
|
type: type.toDto(),
|
|
);
|
|
}
|
|
|
|
extension ProductTypeExt on MnemoCardsProductModelType {
|
|
MnemoCardsProductType toDto() => switch (this) {
|
|
MnemoCardsProductModelType.pack => MnemoCardsProductType.pack,
|
|
MnemoCardsProductModelType.subscription =>
|
|
MnemoCardsProductType.subscription,
|
|
MnemoCardsProductModelType.discount => MnemoCardsProductType.discount,
|
|
MnemoCardsProductModelType.unknown => MnemoCardsProductType.unknown,
|
|
MnemoCardsProductModelType.game => MnemoCardsProductType.game,
|
|
};
|
|
}
|