refactor: update JSON parsing to ensure type safety for ID fields in models
This commit is contained in:
@@ -35,9 +35,9 @@ class CompanyModel extends Equatable {
|
|||||||
|
|
||||||
factory CompanyModel.fromJson(Map<String, dynamic> json) {
|
factory CompanyModel.fromJson(Map<String, dynamic> json) {
|
||||||
return CompanyModel(
|
return CompanyModel(
|
||||||
id: json['id'],
|
id: json['id'] as String,
|
||||||
createdAt: DateTime.parse(json['created_at']),
|
createdAt: DateTime.parse(json['created_at']),
|
||||||
userId: json['user_id'],
|
userId: json['user_id'] as String,
|
||||||
ragioneSociale: json['ragione_sociale'],
|
ragioneSociale: json['ragione_sociale'],
|
||||||
indirizzo: json['indirizzo'],
|
indirizzo: json['indirizzo'],
|
||||||
cap: json['cap'],
|
cap: json['cap'],
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
|
|
||||||
class CustomerFileModel extends Equatable {
|
class CustomerFileModel extends Equatable {
|
||||||
final int? id;
|
final String? id;
|
||||||
final String customerId; // Riferimento UUID
|
final String customerId; // Riferimento UUID
|
||||||
final String name;
|
final String name;
|
||||||
final String url;
|
final String url;
|
||||||
@@ -19,7 +19,7 @@ class CustomerFileModel extends Equatable {
|
|||||||
|
|
||||||
factory CustomerFileModel.fromJson(Map<String, dynamic> json) {
|
factory CustomerFileModel.fromJson(Map<String, dynamic> json) {
|
||||||
return CustomerFileModel(
|
return CustomerFileModel(
|
||||||
id: json['id'],
|
id: json['id'] as String,
|
||||||
customerId: json['customer_id'],
|
customerId: json['customer_id'],
|
||||||
name: json['name'],
|
name: json['name'],
|
||||||
url: json['url'],
|
url: json['url'],
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ class StoreModel extends Equatable {
|
|||||||
|
|
||||||
factory StoreModel.fromJson(Map<String, dynamic> json) {
|
factory StoreModel.fromJson(Map<String, dynamic> json) {
|
||||||
return StoreModel(
|
return StoreModel(
|
||||||
id: json['id'],
|
id: json['id'] as String,
|
||||||
nome: json['nome'],
|
nome: json['nome'],
|
||||||
companyId: json['company_id'],
|
companyId: json['company_id'] as String,
|
||||||
isActive: json['is_active'] ?? true,
|
isActive: json['is_active'] ?? true,
|
||||||
isPaid: json['is_paid'] ?? false,
|
isPaid: json['is_paid'] ?? false,
|
||||||
paymentExpiration: json['payment_expiration'] != null
|
paymentExpiration: json['payment_expiration'] != null
|
||||||
|
|||||||
Reference in New Issue
Block a user