update
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:data_channel/data_channel.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../common/api/api_client.dart';
|
||||
import '../../../common/api/api_failure.dart';
|
||||
import '../../../common/function/app_function.dart';
|
||||
import '../../../common/url/api_path.dart';
|
||||
import '../../../domain/table/table.dart';
|
||||
import '../table_dtos.dart';
|
||||
|
||||
@injectable
|
||||
class TableRemoteDataProvider {
|
||||
final ApiClient _apiClient;
|
||||
final _logName = 'TableRemoteDataProvider';
|
||||
|
||||
TableRemoteDataProvider(this._apiClient);
|
||||
|
||||
Future<DC<TableFailure, ListTableDto>> fetchTables({
|
||||
int page = 1,
|
||||
int limit = 50,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _apiClient.get(
|
||||
ApiPath.tables,
|
||||
headers: getAuthorizationHeader(),
|
||||
params: {'page': page, 'limit': limit},
|
||||
);
|
||||
|
||||
if (response.data['data'] == null) {
|
||||
return DC.error(TableFailure.empty());
|
||||
}
|
||||
|
||||
final tables = ListTableDto.fromJson(
|
||||
response.data['data'] as Map<String, dynamic>,
|
||||
);
|
||||
|
||||
return DC.data(tables);
|
||||
} on ApiFailure catch (e, s) {
|
||||
log('fetchTablesError', name: _logName, error: e, stackTrace: s);
|
||||
return DC.error(TableFailure.serverError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
part of '../table_dtos.dart';
|
||||
|
||||
@freezed
|
||||
class ListTableDto with _$ListTableDto {
|
||||
const ListTableDto._();
|
||||
|
||||
const factory ListTableDto({
|
||||
@JsonKey(name: "tables") List<TableDto>? tables,
|
||||
@JsonKey(name: "total_count") int? totalCount,
|
||||
@JsonKey(name: "page") int? page,
|
||||
@JsonKey(name: "limit") int? limit,
|
||||
@JsonKey(name: "total_pages") int? totalPages,
|
||||
}) = _ListTableDto;
|
||||
|
||||
factory ListTableDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$ListTableDtoFromJson(json);
|
||||
|
||||
ListTable toDomain() => ListTable(
|
||||
tables: tables?.map((dto) => dto.toDomain()).toList() ?? [],
|
||||
totalCount: totalCount ?? 0,
|
||||
page: page ?? 0,
|
||||
limit: limit ?? 0,
|
||||
totalPages: totalPages ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class TableDto with _$TableDto {
|
||||
const TableDto._();
|
||||
|
||||
const factory TableDto({
|
||||
@JsonKey(name: "id") String? id,
|
||||
@JsonKey(name: "organization_id") String? organizationId,
|
||||
@JsonKey(name: "outlet_id") String? outletId,
|
||||
@JsonKey(name: "table_name") String? tableName,
|
||||
@JsonKey(name: "status") String? status,
|
||||
@JsonKey(name: "payment_amount") int? paymentAmount,
|
||||
@JsonKey(name: "position_x") double? positionX,
|
||||
@JsonKey(name: "position_y") double? positionY,
|
||||
@JsonKey(name: "capacity") int? capacity,
|
||||
@JsonKey(name: "is_active") bool? isActive,
|
||||
@JsonKey(name: "created_at") String? createdAt,
|
||||
@JsonKey(name: "updated_at") String? updatedAt,
|
||||
}) = _TableDto;
|
||||
|
||||
factory TableDto.fromJson(Map<String, dynamic> json) =>
|
||||
_$TableDtoFromJson(json);
|
||||
|
||||
/// Mapping ke domain
|
||||
Table toDomain() => Table(
|
||||
id: id ?? '',
|
||||
organizationId: organizationId ?? '',
|
||||
outletId: outletId ?? '',
|
||||
tableName: tableName ?? '',
|
||||
status: status?.toTableStatusType() ?? TableStatusType.unknown,
|
||||
paymentAmount: paymentAmount ?? 0,
|
||||
positionX: positionX ?? 0.0,
|
||||
positionY: positionY ?? 0.0,
|
||||
capacity: capacity ?? 0,
|
||||
isActive: isActive ?? false,
|
||||
createdAt: createdAt != null ? DateTime.parse(createdAt!) : DateTime(1970),
|
||||
updatedAt: updatedAt != null ? DateTime.parse(updatedAt!) : DateTime(1970),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/table/table.dart';
|
||||
import '../datasources/remote_data_provider.dart';
|
||||
|
||||
@Injectable(as: ITableRepository)
|
||||
class TableRepository implements ITableRepository {
|
||||
final TableRemoteDataProvider _remoteDataProvider;
|
||||
final _logName = 'TableRepository';
|
||||
|
||||
TableRepository(this._remoteDataProvider);
|
||||
|
||||
@override
|
||||
Future<Either<TableFailure, ListTable>> fetchTables({
|
||||
int page = 1,
|
||||
int limit = 50,
|
||||
}) async {
|
||||
try {
|
||||
final result = await _remoteDataProvider.fetchTables(
|
||||
page: page,
|
||||
limit: limit,
|
||||
);
|
||||
|
||||
if (result.hasError) {
|
||||
return left(result.error!);
|
||||
}
|
||||
|
||||
final tables = result.data!.toDomain();
|
||||
|
||||
return right(tables);
|
||||
} catch (e) {
|
||||
log('fetchTables', name: _logName, error: e);
|
||||
return left(const TableFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../common/extension/extension.dart';
|
||||
import '../../domain/table/table.dart';
|
||||
|
||||
part 'table_dtos.freezed.dart';
|
||||
part 'table_dtos.g.dart';
|
||||
|
||||
part 'dtos/table_dto.dart';
|
||||
@@ -0,0 +1,735 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'table_dtos.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
ListTableDto _$ListTableDtoFromJson(Map<String, dynamic> json) {
|
||||
return _ListTableDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ListTableDto {
|
||||
@JsonKey(name: "tables")
|
||||
List<TableDto>? get tables => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "total_count")
|
||||
int? get totalCount => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "page")
|
||||
int? get page => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "limit")
|
||||
int? get limit => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "total_pages")
|
||||
int? get totalPages => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this ListTableDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ListTableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ListTableDtoCopyWith<ListTableDto> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ListTableDtoCopyWith<$Res> {
|
||||
factory $ListTableDtoCopyWith(
|
||||
ListTableDto value,
|
||||
$Res Function(ListTableDto) then,
|
||||
) = _$ListTableDtoCopyWithImpl<$Res, ListTableDto>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "tables") List<TableDto>? tables,
|
||||
@JsonKey(name: "total_count") int? totalCount,
|
||||
@JsonKey(name: "page") int? page,
|
||||
@JsonKey(name: "limit") int? limit,
|
||||
@JsonKey(name: "total_pages") int? totalPages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ListTableDtoCopyWithImpl<$Res, $Val extends ListTableDto>
|
||||
implements $ListTableDtoCopyWith<$Res> {
|
||||
_$ListTableDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ListTableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? tables = freezed,
|
||||
Object? totalCount = freezed,
|
||||
Object? page = freezed,
|
||||
Object? limit = freezed,
|
||||
Object? totalPages = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
tables: freezed == tables
|
||||
? _value.tables
|
||||
: tables // ignore: cast_nullable_to_non_nullable
|
||||
as List<TableDto>?,
|
||||
totalCount: freezed == totalCount
|
||||
? _value.totalCount
|
||||
: totalCount // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
page: freezed == page
|
||||
? _value.page
|
||||
: page // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
limit: freezed == limit
|
||||
? _value.limit
|
||||
: limit // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
totalPages: freezed == totalPages
|
||||
? _value.totalPages
|
||||
: totalPages // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ListTableDtoImplCopyWith<$Res>
|
||||
implements $ListTableDtoCopyWith<$Res> {
|
||||
factory _$$ListTableDtoImplCopyWith(
|
||||
_$ListTableDtoImpl value,
|
||||
$Res Function(_$ListTableDtoImpl) then,
|
||||
) = __$$ListTableDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "tables") List<TableDto>? tables,
|
||||
@JsonKey(name: "total_count") int? totalCount,
|
||||
@JsonKey(name: "page") int? page,
|
||||
@JsonKey(name: "limit") int? limit,
|
||||
@JsonKey(name: "total_pages") int? totalPages,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ListTableDtoImplCopyWithImpl<$Res>
|
||||
extends _$ListTableDtoCopyWithImpl<$Res, _$ListTableDtoImpl>
|
||||
implements _$$ListTableDtoImplCopyWith<$Res> {
|
||||
__$$ListTableDtoImplCopyWithImpl(
|
||||
_$ListTableDtoImpl _value,
|
||||
$Res Function(_$ListTableDtoImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ListTableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? tables = freezed,
|
||||
Object? totalCount = freezed,
|
||||
Object? page = freezed,
|
||||
Object? limit = freezed,
|
||||
Object? totalPages = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$ListTableDtoImpl(
|
||||
tables: freezed == tables
|
||||
? _value._tables
|
||||
: tables // ignore: cast_nullable_to_non_nullable
|
||||
as List<TableDto>?,
|
||||
totalCount: freezed == totalCount
|
||||
? _value.totalCount
|
||||
: totalCount // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
page: freezed == page
|
||||
? _value.page
|
||||
: page // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
limit: freezed == limit
|
||||
? _value.limit
|
||||
: limit // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
totalPages: freezed == totalPages
|
||||
? _value.totalPages
|
||||
: totalPages // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$ListTableDtoImpl extends _ListTableDto {
|
||||
const _$ListTableDtoImpl({
|
||||
@JsonKey(name: "tables") final List<TableDto>? tables,
|
||||
@JsonKey(name: "total_count") this.totalCount,
|
||||
@JsonKey(name: "page") this.page,
|
||||
@JsonKey(name: "limit") this.limit,
|
||||
@JsonKey(name: "total_pages") this.totalPages,
|
||||
}) : _tables = tables,
|
||||
super._();
|
||||
|
||||
factory _$ListTableDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$ListTableDtoImplFromJson(json);
|
||||
|
||||
final List<TableDto>? _tables;
|
||||
@override
|
||||
@JsonKey(name: "tables")
|
||||
List<TableDto>? get tables {
|
||||
final value = _tables;
|
||||
if (value == null) return null;
|
||||
if (_tables is EqualUnmodifiableListView) return _tables;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(value);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey(name: "total_count")
|
||||
final int? totalCount;
|
||||
@override
|
||||
@JsonKey(name: "page")
|
||||
final int? page;
|
||||
@override
|
||||
@JsonKey(name: "limit")
|
||||
final int? limit;
|
||||
@override
|
||||
@JsonKey(name: "total_pages")
|
||||
final int? totalPages;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ListTableDto(tables: $tables, totalCount: $totalCount, page: $page, limit: $limit, totalPages: $totalPages)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ListTableDtoImpl &&
|
||||
const DeepCollectionEquality().equals(other._tables, _tables) &&
|
||||
(identical(other.totalCount, totalCount) ||
|
||||
other.totalCount == totalCount) &&
|
||||
(identical(other.page, page) || other.page == page) &&
|
||||
(identical(other.limit, limit) || other.limit == limit) &&
|
||||
(identical(other.totalPages, totalPages) ||
|
||||
other.totalPages == totalPages));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
const DeepCollectionEquality().hash(_tables),
|
||||
totalCount,
|
||||
page,
|
||||
limit,
|
||||
totalPages,
|
||||
);
|
||||
|
||||
/// Create a copy of ListTableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ListTableDtoImplCopyWith<_$ListTableDtoImpl> get copyWith =>
|
||||
__$$ListTableDtoImplCopyWithImpl<_$ListTableDtoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$ListTableDtoImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ListTableDto extends ListTableDto {
|
||||
const factory _ListTableDto({
|
||||
@JsonKey(name: "tables") final List<TableDto>? tables,
|
||||
@JsonKey(name: "total_count") final int? totalCount,
|
||||
@JsonKey(name: "page") final int? page,
|
||||
@JsonKey(name: "limit") final int? limit,
|
||||
@JsonKey(name: "total_pages") final int? totalPages,
|
||||
}) = _$ListTableDtoImpl;
|
||||
const _ListTableDto._() : super._();
|
||||
|
||||
factory _ListTableDto.fromJson(Map<String, dynamic> json) =
|
||||
_$ListTableDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "tables")
|
||||
List<TableDto>? get tables;
|
||||
@override
|
||||
@JsonKey(name: "total_count")
|
||||
int? get totalCount;
|
||||
@override
|
||||
@JsonKey(name: "page")
|
||||
int? get page;
|
||||
@override
|
||||
@JsonKey(name: "limit")
|
||||
int? get limit;
|
||||
@override
|
||||
@JsonKey(name: "total_pages")
|
||||
int? get totalPages;
|
||||
|
||||
/// Create a copy of ListTableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ListTableDtoImplCopyWith<_$ListTableDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
TableDto _$TableDtoFromJson(Map<String, dynamic> json) {
|
||||
return _TableDto.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$TableDto {
|
||||
@JsonKey(name: "id")
|
||||
String? get id => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "organization_id")
|
||||
String? get organizationId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "outlet_id")
|
||||
String? get outletId => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "table_name")
|
||||
String? get tableName => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "status")
|
||||
String? get status => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "payment_amount")
|
||||
int? get paymentAmount => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "position_x")
|
||||
double? get positionX => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "position_y")
|
||||
double? get positionY => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "capacity")
|
||||
int? get capacity => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "is_active")
|
||||
bool? get isActive => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "created_at")
|
||||
String? get createdAt => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: "updated_at")
|
||||
String? get updatedAt => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this TableDto to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of TableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$TableDtoCopyWith<TableDto> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $TableDtoCopyWith<$Res> {
|
||||
factory $TableDtoCopyWith(TableDto value, $Res Function(TableDto) then) =
|
||||
_$TableDtoCopyWithImpl<$Res, TableDto>;
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "id") String? id,
|
||||
@JsonKey(name: "organization_id") String? organizationId,
|
||||
@JsonKey(name: "outlet_id") String? outletId,
|
||||
@JsonKey(name: "table_name") String? tableName,
|
||||
@JsonKey(name: "status") String? status,
|
||||
@JsonKey(name: "payment_amount") int? paymentAmount,
|
||||
@JsonKey(name: "position_x") double? positionX,
|
||||
@JsonKey(name: "position_y") double? positionY,
|
||||
@JsonKey(name: "capacity") int? capacity,
|
||||
@JsonKey(name: "is_active") bool? isActive,
|
||||
@JsonKey(name: "created_at") String? createdAt,
|
||||
@JsonKey(name: "updated_at") String? updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$TableDtoCopyWithImpl<$Res, $Val extends TableDto>
|
||||
implements $TableDtoCopyWith<$Res> {
|
||||
_$TableDtoCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of TableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = freezed,
|
||||
Object? organizationId = freezed,
|
||||
Object? outletId = freezed,
|
||||
Object? tableName = freezed,
|
||||
Object? status = freezed,
|
||||
Object? paymentAmount = freezed,
|
||||
Object? positionX = freezed,
|
||||
Object? positionY = freezed,
|
||||
Object? capacity = freezed,
|
||||
Object? isActive = freezed,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
organizationId: freezed == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
outletId: freezed == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
tableName: freezed == tableName
|
||||
? _value.tableName
|
||||
: tableName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
status: freezed == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
paymentAmount: freezed == paymentAmount
|
||||
? _value.paymentAmount
|
||||
: paymentAmount // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
positionX: freezed == positionX
|
||||
? _value.positionX
|
||||
: positionX // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
positionY: freezed == positionY
|
||||
? _value.positionY
|
||||
: positionY // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
capacity: freezed == capacity
|
||||
? _value.capacity
|
||||
: capacity // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
isActive: freezed == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$TableDtoImplCopyWith<$Res>
|
||||
implements $TableDtoCopyWith<$Res> {
|
||||
factory _$$TableDtoImplCopyWith(
|
||||
_$TableDtoImpl value,
|
||||
$Res Function(_$TableDtoImpl) then,
|
||||
) = __$$TableDtoImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
@JsonKey(name: "id") String? id,
|
||||
@JsonKey(name: "organization_id") String? organizationId,
|
||||
@JsonKey(name: "outlet_id") String? outletId,
|
||||
@JsonKey(name: "table_name") String? tableName,
|
||||
@JsonKey(name: "status") String? status,
|
||||
@JsonKey(name: "payment_amount") int? paymentAmount,
|
||||
@JsonKey(name: "position_x") double? positionX,
|
||||
@JsonKey(name: "position_y") double? positionY,
|
||||
@JsonKey(name: "capacity") int? capacity,
|
||||
@JsonKey(name: "is_active") bool? isActive,
|
||||
@JsonKey(name: "created_at") String? createdAt,
|
||||
@JsonKey(name: "updated_at") String? updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$TableDtoImplCopyWithImpl<$Res>
|
||||
extends _$TableDtoCopyWithImpl<$Res, _$TableDtoImpl>
|
||||
implements _$$TableDtoImplCopyWith<$Res> {
|
||||
__$$TableDtoImplCopyWithImpl(
|
||||
_$TableDtoImpl _value,
|
||||
$Res Function(_$TableDtoImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of TableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = freezed,
|
||||
Object? organizationId = freezed,
|
||||
Object? outletId = freezed,
|
||||
Object? tableName = freezed,
|
||||
Object? status = freezed,
|
||||
Object? paymentAmount = freezed,
|
||||
Object? positionX = freezed,
|
||||
Object? positionY = freezed,
|
||||
Object? capacity = freezed,
|
||||
Object? isActive = freezed,
|
||||
Object? createdAt = freezed,
|
||||
Object? updatedAt = freezed,
|
||||
}) {
|
||||
return _then(
|
||||
_$TableDtoImpl(
|
||||
id: freezed == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
organizationId: freezed == organizationId
|
||||
? _value.organizationId
|
||||
: organizationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
outletId: freezed == outletId
|
||||
? _value.outletId
|
||||
: outletId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
tableName: freezed == tableName
|
||||
? _value.tableName
|
||||
: tableName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
status: freezed == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
paymentAmount: freezed == paymentAmount
|
||||
? _value.paymentAmount
|
||||
: paymentAmount // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
positionX: freezed == positionX
|
||||
? _value.positionX
|
||||
: positionX // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
positionY: freezed == positionY
|
||||
? _value.positionY
|
||||
: positionY // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
capacity: freezed == capacity
|
||||
? _value.capacity
|
||||
: capacity // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
isActive: freezed == isActive
|
||||
? _value.isActive
|
||||
: isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool?,
|
||||
createdAt: freezed == createdAt
|
||||
? _value.createdAt
|
||||
: createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
updatedAt: freezed == updatedAt
|
||||
? _value.updatedAt
|
||||
: updatedAt // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$TableDtoImpl extends _TableDto {
|
||||
const _$TableDtoImpl({
|
||||
@JsonKey(name: "id") this.id,
|
||||
@JsonKey(name: "organization_id") this.organizationId,
|
||||
@JsonKey(name: "outlet_id") this.outletId,
|
||||
@JsonKey(name: "table_name") this.tableName,
|
||||
@JsonKey(name: "status") this.status,
|
||||
@JsonKey(name: "payment_amount") this.paymentAmount,
|
||||
@JsonKey(name: "position_x") this.positionX,
|
||||
@JsonKey(name: "position_y") this.positionY,
|
||||
@JsonKey(name: "capacity") this.capacity,
|
||||
@JsonKey(name: "is_active") this.isActive,
|
||||
@JsonKey(name: "created_at") this.createdAt,
|
||||
@JsonKey(name: "updated_at") this.updatedAt,
|
||||
}) : super._();
|
||||
|
||||
factory _$TableDtoImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$TableDtoImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: "id")
|
||||
final String? id;
|
||||
@override
|
||||
@JsonKey(name: "organization_id")
|
||||
final String? organizationId;
|
||||
@override
|
||||
@JsonKey(name: "outlet_id")
|
||||
final String? outletId;
|
||||
@override
|
||||
@JsonKey(name: "table_name")
|
||||
final String? tableName;
|
||||
@override
|
||||
@JsonKey(name: "status")
|
||||
final String? status;
|
||||
@override
|
||||
@JsonKey(name: "payment_amount")
|
||||
final int? paymentAmount;
|
||||
@override
|
||||
@JsonKey(name: "position_x")
|
||||
final double? positionX;
|
||||
@override
|
||||
@JsonKey(name: "position_y")
|
||||
final double? positionY;
|
||||
@override
|
||||
@JsonKey(name: "capacity")
|
||||
final int? capacity;
|
||||
@override
|
||||
@JsonKey(name: "is_active")
|
||||
final bool? isActive;
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
final String? createdAt;
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
final String? updatedAt;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TableDto(id: $id, organizationId: $organizationId, outletId: $outletId, tableName: $tableName, status: $status, paymentAmount: $paymentAmount, positionX: $positionX, positionY: $positionY, capacity: $capacity, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$TableDtoImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.organizationId, organizationId) ||
|
||||
other.organizationId == organizationId) &&
|
||||
(identical(other.outletId, outletId) ||
|
||||
other.outletId == outletId) &&
|
||||
(identical(other.tableName, tableName) ||
|
||||
other.tableName == tableName) &&
|
||||
(identical(other.status, status) || other.status == status) &&
|
||||
(identical(other.paymentAmount, paymentAmount) ||
|
||||
other.paymentAmount == paymentAmount) &&
|
||||
(identical(other.positionX, positionX) ||
|
||||
other.positionX == positionX) &&
|
||||
(identical(other.positionY, positionY) ||
|
||||
other.positionY == positionY) &&
|
||||
(identical(other.capacity, capacity) ||
|
||||
other.capacity == capacity) &&
|
||||
(identical(other.isActive, isActive) ||
|
||||
other.isActive == isActive) &&
|
||||
(identical(other.createdAt, createdAt) ||
|
||||
other.createdAt == createdAt) &&
|
||||
(identical(other.updatedAt, updatedAt) ||
|
||||
other.updatedAt == updatedAt));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
organizationId,
|
||||
outletId,
|
||||
tableName,
|
||||
status,
|
||||
paymentAmount,
|
||||
positionX,
|
||||
positionY,
|
||||
capacity,
|
||||
isActive,
|
||||
createdAt,
|
||||
updatedAt,
|
||||
);
|
||||
|
||||
/// Create a copy of TableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$TableDtoImplCopyWith<_$TableDtoImpl> get copyWith =>
|
||||
__$$TableDtoImplCopyWithImpl<_$TableDtoImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$TableDtoImplToJson(this);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _TableDto extends TableDto {
|
||||
const factory _TableDto({
|
||||
@JsonKey(name: "id") final String? id,
|
||||
@JsonKey(name: "organization_id") final String? organizationId,
|
||||
@JsonKey(name: "outlet_id") final String? outletId,
|
||||
@JsonKey(name: "table_name") final String? tableName,
|
||||
@JsonKey(name: "status") final String? status,
|
||||
@JsonKey(name: "payment_amount") final int? paymentAmount,
|
||||
@JsonKey(name: "position_x") final double? positionX,
|
||||
@JsonKey(name: "position_y") final double? positionY,
|
||||
@JsonKey(name: "capacity") final int? capacity,
|
||||
@JsonKey(name: "is_active") final bool? isActive,
|
||||
@JsonKey(name: "created_at") final String? createdAt,
|
||||
@JsonKey(name: "updated_at") final String? updatedAt,
|
||||
}) = _$TableDtoImpl;
|
||||
const _TableDto._() : super._();
|
||||
|
||||
factory _TableDto.fromJson(Map<String, dynamic> json) =
|
||||
_$TableDtoImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: "id")
|
||||
String? get id;
|
||||
@override
|
||||
@JsonKey(name: "organization_id")
|
||||
String? get organizationId;
|
||||
@override
|
||||
@JsonKey(name: "outlet_id")
|
||||
String? get outletId;
|
||||
@override
|
||||
@JsonKey(name: "table_name")
|
||||
String? get tableName;
|
||||
@override
|
||||
@JsonKey(name: "status")
|
||||
String? get status;
|
||||
@override
|
||||
@JsonKey(name: "payment_amount")
|
||||
int? get paymentAmount;
|
||||
@override
|
||||
@JsonKey(name: "position_x")
|
||||
double? get positionX;
|
||||
@override
|
||||
@JsonKey(name: "position_y")
|
||||
double? get positionY;
|
||||
@override
|
||||
@JsonKey(name: "capacity")
|
||||
int? get capacity;
|
||||
@override
|
||||
@JsonKey(name: "is_active")
|
||||
bool? get isActive;
|
||||
@override
|
||||
@JsonKey(name: "created_at")
|
||||
String? get createdAt;
|
||||
@override
|
||||
@JsonKey(name: "updated_at")
|
||||
String? get updatedAt;
|
||||
|
||||
/// Create a copy of TableDto
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$TableDtoImplCopyWith<_$TableDtoImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'table_dtos.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$ListTableDtoImpl _$$ListTableDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ListTableDtoImpl(
|
||||
tables: (json['tables'] as List<dynamic>?)
|
||||
?.map((e) => TableDto.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
totalCount: (json['total_count'] as num?)?.toInt(),
|
||||
page: (json['page'] as num?)?.toInt(),
|
||||
limit: (json['limit'] as num?)?.toInt(),
|
||||
totalPages: (json['total_pages'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ListTableDtoImplToJson(_$ListTableDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'tables': instance.tables,
|
||||
'total_count': instance.totalCount,
|
||||
'page': instance.page,
|
||||
'limit': instance.limit,
|
||||
'total_pages': instance.totalPages,
|
||||
};
|
||||
|
||||
_$TableDtoImpl _$$TableDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$TableDtoImpl(
|
||||
id: json['id'] as String?,
|
||||
organizationId: json['organization_id'] as String?,
|
||||
outletId: json['outlet_id'] as String?,
|
||||
tableName: json['table_name'] as String?,
|
||||
status: json['status'] as String?,
|
||||
paymentAmount: (json['payment_amount'] as num?)?.toInt(),
|
||||
positionX: (json['position_x'] as num?)?.toDouble(),
|
||||
positionY: (json['position_y'] as num?)?.toDouble(),
|
||||
capacity: (json['capacity'] as num?)?.toInt(),
|
||||
isActive: json['is_active'] as bool?,
|
||||
createdAt: json['created_at'] as String?,
|
||||
updatedAt: json['updated_at'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$TableDtoImplToJson(_$TableDtoImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'organization_id': instance.organizationId,
|
||||
'outlet_id': instance.outletId,
|
||||
'table_name': instance.tableName,
|
||||
'status': instance.status,
|
||||
'payment_amount': instance.paymentAmount,
|
||||
'position_x': instance.positionX,
|
||||
'position_y': instance.positionY,
|
||||
'capacity': instance.capacity,
|
||||
'is_active': instance.isActive,
|
||||
'created_at': instance.createdAt,
|
||||
'updated_at': instance.updatedAt,
|
||||
};
|
||||
Reference in New Issue
Block a user