mandreshope 40ef71a28b refactor: Standardizes data model naming convention
Renames `AuthStruct` to `AuthModel` and `ProductStruct` to `ProductModel` to align with a consistent data model naming convention.

Updates all relevant imports, type declarations, and method signatures across the application to reflect these changes, improving codebase clarity and maintainability.

Includes minor code style improvements and refactorings in other components.
2025-07-29 10:09:03 +03:00

33 lines
799 B
Dart

import 'package:barcode_scanner/backend/objectbox/entities/product/product_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'product_model.freezed.dart';
part 'product_model.g.dart';
@Freezed(toJson: true)
abstract class ProductModel with _$ProductModel {
factory ProductModel({
@Default(0) int id,
String? code,
String? name,
String? description,
String? price,
String? quantity,
String? image,
}) = _ProductModel;
factory ProductModel.fromJson(Map<String, dynamic> json) =>
_$ProductModelFromJson(json);
}
extension ProductModelExt on ProductModel {
ProductEntity get toEntity => ProductEntity(
id: id,
name: name,
description: description,
price: price,
quantity: quantity,
image: image,
);
}