333 lines
10 KiB
Dart
333 lines
10 KiB
Dart
// GENERATED CODE DO NOT EDIT
|
|
part of '../brick.g.dart';
|
|
|
|
Future<SwapRequest> _$SwapRequestFromSupabase(
|
|
Map<String, dynamic> data, {
|
|
required SupabaseProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return SwapRequest(
|
|
id: data['id'] as String,
|
|
requesterId: data['requester_id'] as String,
|
|
recipientId: data['recipient_id'] as String,
|
|
requesterScheduleId: data['requester_schedule_id'] as String,
|
|
targetScheduleId: data['target_shift_id'] == null
|
|
? null
|
|
: data['target_shift_id'] as String?,
|
|
status: data['status'] as String,
|
|
createdAt: DateTime.parse(data['created_at'] as String),
|
|
updatedAt: data['updated_at'] == null
|
|
? null
|
|
: data['updated_at'] == null
|
|
? null
|
|
: DateTime.tryParse(data['updated_at'] as String),
|
|
chatThreadId: data['chat_thread_id'] == null
|
|
? null
|
|
: data['chat_thread_id'] as String?,
|
|
shiftType: data['shift_type'] == null
|
|
? null
|
|
: data['shift_type'] as String?,
|
|
shiftStartTime: data['shift_start_time'] == null
|
|
? null
|
|
: data['shift_start_time'] == null
|
|
? null
|
|
: DateTime.tryParse(data['shift_start_time'] as String),
|
|
relieverIds: data['reliever_ids'] == null
|
|
? null
|
|
: data['reliever_ids']?.toList().cast<String>(),
|
|
approvedBy: data['approved_by'] == null
|
|
? null
|
|
: data['approved_by'] as String?,
|
|
);
|
|
}
|
|
|
|
Future<Map<String, dynamic>> _$SwapRequestToSupabase(
|
|
SwapRequest instance, {
|
|
required SupabaseProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return {
|
|
'id': instance.id,
|
|
'requester_id': instance.requesterId,
|
|
'recipient_id': instance.recipientId,
|
|
'requester_schedule_id': instance.requesterScheduleId,
|
|
'target_shift_id': instance.targetScheduleId,
|
|
'status': instance.status,
|
|
'created_at': instance.createdAt.toIso8601String(),
|
|
'updated_at': instance.updatedAt?.toIso8601String(),
|
|
'chat_thread_id': instance.chatThreadId,
|
|
'shift_type': instance.shiftType,
|
|
'shift_start_time': instance.shiftStartTime?.toIso8601String(),
|
|
'reliever_ids': instance.relieverIds,
|
|
'approved_by': instance.approvedBy,
|
|
};
|
|
}
|
|
|
|
Future<SwapRequest> _$SwapRequestFromSqlite(
|
|
Map<String, dynamic> data, {
|
|
required SqliteProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return SwapRequest(
|
|
id: data['id'] as String,
|
|
requesterId: data['requester_id'] as String,
|
|
recipientId: data['recipient_id'] as String,
|
|
requesterScheduleId: data['requester_schedule_id'] as String,
|
|
targetScheduleId: data['target_schedule_id'] == null
|
|
? null
|
|
: data['target_schedule_id'] as String?,
|
|
status: data['status'] as String,
|
|
createdAt: DateTime.parse(data['created_at'] as String),
|
|
updatedAt: data['updated_at'] == null
|
|
? null
|
|
: data['updated_at'] == null
|
|
? null
|
|
: DateTime.tryParse(data['updated_at'] as String),
|
|
chatThreadId: data['chat_thread_id'] == null
|
|
? null
|
|
: data['chat_thread_id'] as String?,
|
|
shiftType: data['shift_type'] == null
|
|
? null
|
|
: data['shift_type'] as String?,
|
|
shiftStartTime: data['shift_start_time'] == null
|
|
? null
|
|
: data['shift_start_time'] == null
|
|
? null
|
|
: DateTime.tryParse(data['shift_start_time'] as String),
|
|
relieverIds: data['reliever_ids'] == null
|
|
? null
|
|
: jsonDecode(data['reliever_ids']).toList().cast<String>(),
|
|
approvedBy: data['approved_by'] == null
|
|
? null
|
|
: data['approved_by'] as String?,
|
|
)..primaryKey = data['_brick_id'] as int;
|
|
}
|
|
|
|
Future<Map<String, dynamic>> _$SwapRequestToSqlite(
|
|
SwapRequest instance, {
|
|
required SqliteProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return {
|
|
'id': instance.id,
|
|
'requester_id': instance.requesterId,
|
|
'recipient_id': instance.recipientId,
|
|
'requester_schedule_id': instance.requesterScheduleId,
|
|
'target_schedule_id': instance.targetScheduleId,
|
|
'status': instance.status,
|
|
'created_at': instance.createdAt.toIso8601String(),
|
|
'updated_at': instance.updatedAt?.toIso8601String(),
|
|
'chat_thread_id': instance.chatThreadId,
|
|
'shift_type': instance.shiftType,
|
|
'shift_start_time': instance.shiftStartTime?.toIso8601String(),
|
|
'reliever_ids': instance.relieverIds == null
|
|
? null
|
|
: jsonEncode(instance.relieverIds),
|
|
'approved_by': instance.approvedBy,
|
|
};
|
|
}
|
|
|
|
/// Construct a [SwapRequest]
|
|
class SwapRequestAdapter extends OfflineFirstWithSupabaseAdapter<SwapRequest> {
|
|
SwapRequestAdapter();
|
|
|
|
@override
|
|
final supabaseTableName = 'swap_requests';
|
|
@override
|
|
final defaultToNull = true;
|
|
@override
|
|
final fieldsToSupabaseColumns = {
|
|
'id': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'id',
|
|
),
|
|
'requesterId': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'requester_id',
|
|
),
|
|
'recipientId': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'recipient_id',
|
|
),
|
|
'requesterScheduleId': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'requester_schedule_id',
|
|
),
|
|
'targetScheduleId': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'target_shift_id',
|
|
),
|
|
'status': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'status',
|
|
),
|
|
'createdAt': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'created_at',
|
|
),
|
|
'updatedAt': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'updated_at',
|
|
),
|
|
'chatThreadId': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'chat_thread_id',
|
|
),
|
|
'shiftType': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'shift_type',
|
|
),
|
|
'shiftStartTime': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'shift_start_time',
|
|
),
|
|
'relieverIds': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'reliever_ids',
|
|
),
|
|
'approvedBy': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'approved_by',
|
|
),
|
|
};
|
|
@override
|
|
final ignoreDuplicates = false;
|
|
@override
|
|
final uniqueFields = {};
|
|
@override
|
|
final Map<String, RuntimeSqliteColumnDefinition> fieldsToSqliteColumns = {
|
|
'primaryKey': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: '_brick_id',
|
|
iterable: false,
|
|
type: int,
|
|
),
|
|
'id': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'id',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'requesterId': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'requester_id',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'recipientId': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'recipient_id',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'requesterScheduleId': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'requester_schedule_id',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'targetScheduleId': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'target_schedule_id',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'status': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'status',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'createdAt': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'created_at',
|
|
iterable: false,
|
|
type: DateTime,
|
|
),
|
|
'updatedAt': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'updated_at',
|
|
iterable: false,
|
|
type: DateTime,
|
|
),
|
|
'chatThreadId': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'chat_thread_id',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'shiftType': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'shift_type',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'shiftStartTime': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'shift_start_time',
|
|
iterable: false,
|
|
type: DateTime,
|
|
),
|
|
'relieverIds': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'reliever_ids',
|
|
iterable: true,
|
|
type: String,
|
|
),
|
|
'approvedBy': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'approved_by',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
};
|
|
@override
|
|
Future<int?> primaryKeyByUniqueColumns(
|
|
SwapRequest instance,
|
|
DatabaseExecutor executor,
|
|
) async => instance.primaryKey;
|
|
@override
|
|
final String tableName = 'SwapRequest';
|
|
|
|
@override
|
|
Future<SwapRequest> fromSupabase(
|
|
Map<String, dynamic> input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$SwapRequestFromSupabase(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
@override
|
|
Future<Map<String, dynamic>> toSupabase(
|
|
SwapRequest input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$SwapRequestToSupabase(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
@override
|
|
Future<SwapRequest> fromSqlite(
|
|
Map<String, dynamic> input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$SwapRequestFromSqlite(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
@override
|
|
Future<Map<String, dynamic>> toSqlite(
|
|
SwapRequest input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$SwapRequestToSqlite(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
}
|