
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.
76 lines
2.6 KiB
Dart
76 lines
2.6 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'stock_picking_model.freezed.dart';
|
|
part 'stock_picking_model.g.dart';
|
|
|
|
@freezed
|
|
abstract class StockPickingResponse with _$StockPickingResponse {
|
|
const factory StockPickingResponse({
|
|
required String jsonrpc,
|
|
required int id,
|
|
required StockPickingResult result,
|
|
}) = _StockPickingResponse;
|
|
|
|
factory StockPickingResponse.fromJson(Map<String, dynamic> json) =>
|
|
_$StockPickingResponseFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
abstract class StockPickingResult with _$StockPickingResult {
|
|
const factory StockPickingResult({
|
|
required int length,
|
|
required List<StockPickingRecord> records,
|
|
}) = _StockPickingResult;
|
|
|
|
factory StockPickingResult.fromJson(Map<String, dynamic> json) =>
|
|
_$StockPickingResultFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
abstract class StockPickingRecord with _$StockPickingRecord {
|
|
const factory StockPickingRecord({
|
|
required int id,
|
|
@JsonKey(name: 'company_id') required IdOnly companyId,
|
|
required String priority,
|
|
required String name,
|
|
@JsonKey(name: 'partner_id') required DisplayNameId partnerId,
|
|
@JsonKey(name: 'user_id') dynamic userId, // peut ĂȘtre false ou null
|
|
@JsonKey(name: 'scheduled_date') required String scheduledDate,
|
|
@JsonKey(name: 'picking_type_code') required String pickingTypeCode,
|
|
@JsonKey(name: 'products_availability_state')
|
|
dynamic productsAvailabilityState,
|
|
@JsonKey(name: 'products_availability') dynamic productsAvailability,
|
|
@JsonKey(name: 'date_deadline') required String dateDeadline,
|
|
@JsonKey(name: 'date_done') dynamic dateDone,
|
|
required String origin,
|
|
@JsonKey(name: 'backorder_id') dynamic backorderId,
|
|
@JsonKey(name: 'picking_type_id') required DisplayNameId pickingTypeId,
|
|
required String state,
|
|
@JsonKey(name: 'activity_exception_decoration')
|
|
dynamic activityExceptionDecoration,
|
|
@JsonKey(name: 'activity_exception_icon') dynamic activityExceptionIcon,
|
|
@JsonKey(name: 'json_popover') dynamic jsonPopover,
|
|
}) = _StockPickingRecord;
|
|
|
|
factory StockPickingRecord.fromJson(Map<String, dynamic> json) =>
|
|
_$StockPickingRecordFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
abstract class IdOnly with _$IdOnly {
|
|
const factory IdOnly({required int id}) = _IdOnly;
|
|
|
|
factory IdOnly.fromJson(Map<String, dynamic> json) => _$IdOnlyFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
abstract class DisplayNameId with _$DisplayNameId {
|
|
const factory DisplayNameId({
|
|
required int id,
|
|
@JsonKey(name: 'display_name') required String displayName,
|
|
}) = _DisplayNameId;
|
|
|
|
factory DisplayNameId.fromJson(Map<String, dynamic> json) =>
|
|
_$DisplayNameIdFromJson(json);
|
|
}
|