266 lines
7.7 KiB
Dart
266 lines
7.7 KiB
Dart
// GENERATED CODE DO NOT EDIT
|
|
part of '../brick.g.dart';
|
|
|
|
Future<DutySchedule> _$DutyScheduleFromSupabase(
|
|
Map<String, dynamic> data, {
|
|
required SupabaseProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return DutySchedule(
|
|
id: data['id'] as String,
|
|
userId: data['user_id'] as String,
|
|
shiftType: data['shift_type'] as String,
|
|
startTime: DateTime.parse(data['start_time'] as String),
|
|
endTime: DateTime.parse(data['end_time'] as String),
|
|
status: data['status'] as String,
|
|
createdAt: DateTime.parse(data['created_at'] as String),
|
|
checkInAt: data['check_in_at'] == null
|
|
? null
|
|
: data['check_in_at'] == null
|
|
? null
|
|
: DateTime.tryParse(data['check_in_at'] as String),
|
|
relieverIds: data['reliever_ids'].toList().cast<String>(),
|
|
swapRequestId: data['swap_request_id'] == null
|
|
? null
|
|
: data['swap_request_id'] as String?,
|
|
);
|
|
}
|
|
|
|
Future<Map<String, dynamic>> _$DutyScheduleToSupabase(
|
|
DutySchedule instance, {
|
|
required SupabaseProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return {
|
|
'id': instance.id,
|
|
'user_id': instance.userId,
|
|
'shift_type': instance.shiftType,
|
|
'start_time': instance.startTime.toIso8601String(),
|
|
'end_time': instance.endTime.toIso8601String(),
|
|
'status': instance.status,
|
|
'created_at': instance.createdAt.toIso8601String(),
|
|
'check_in_at': instance.checkInAt?.toIso8601String(),
|
|
'reliever_ids': instance.relieverIds,
|
|
'swap_request_id': instance.swapRequestId,
|
|
};
|
|
}
|
|
|
|
Future<DutySchedule> _$DutyScheduleFromSqlite(
|
|
Map<String, dynamic> data, {
|
|
required SqliteProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return DutySchedule(
|
|
id: data['id'] as String,
|
|
userId: data['user_id'] as String,
|
|
shiftType: data['shift_type'] as String,
|
|
startTime: DateTime.parse(data['start_time'] as String),
|
|
endTime: DateTime.parse(data['end_time'] as String),
|
|
status: data['status'] as String,
|
|
createdAt: DateTime.parse(data['created_at'] as String),
|
|
checkInAt: data['check_in_at'] == null
|
|
? null
|
|
: data['check_in_at'] == null
|
|
? null
|
|
: DateTime.tryParse(data['check_in_at'] as String),
|
|
relieverIds: jsonDecode(data['reliever_ids']).toList().cast<String>(),
|
|
swapRequestId: data['swap_request_id'] == null
|
|
? null
|
|
: data['swap_request_id'] as String?,
|
|
)..primaryKey = data['_brick_id'] as int;
|
|
}
|
|
|
|
Future<Map<String, dynamic>> _$DutyScheduleToSqlite(
|
|
DutySchedule instance, {
|
|
required SqliteProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return {
|
|
'id': instance.id,
|
|
'user_id': instance.userId,
|
|
'shift_type': instance.shiftType,
|
|
'start_time': instance.startTime.toIso8601String(),
|
|
'end_time': instance.endTime.toIso8601String(),
|
|
'status': instance.status,
|
|
'created_at': instance.createdAt.toIso8601String(),
|
|
'check_in_at': instance.checkInAt?.toIso8601String(),
|
|
'reliever_ids': jsonEncode(instance.relieverIds),
|
|
'swap_request_id': instance.swapRequestId,
|
|
};
|
|
}
|
|
|
|
/// Construct a [DutySchedule]
|
|
class DutyScheduleAdapter
|
|
extends OfflineFirstWithSupabaseAdapter<DutySchedule> {
|
|
DutyScheduleAdapter();
|
|
|
|
@override
|
|
final supabaseTableName = 'duty_schedules';
|
|
@override
|
|
final defaultToNull = true;
|
|
@override
|
|
final fieldsToSupabaseColumns = {
|
|
'id': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'id',
|
|
),
|
|
'userId': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'user_id',
|
|
),
|
|
'shiftType': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'shift_type',
|
|
),
|
|
'startTime': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'start_time',
|
|
),
|
|
'endTime': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'end_time',
|
|
),
|
|
'status': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'status',
|
|
),
|
|
'createdAt': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'created_at',
|
|
),
|
|
'checkInAt': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'check_in_at',
|
|
),
|
|
'relieverIds': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'reliever_ids',
|
|
),
|
|
'swapRequestId': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'swap_request_id',
|
|
),
|
|
};
|
|
@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,
|
|
),
|
|
'userId': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'user_id',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'shiftType': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'shift_type',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'startTime': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'start_time',
|
|
iterable: false,
|
|
type: DateTime,
|
|
),
|
|
'endTime': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'end_time',
|
|
iterable: false,
|
|
type: DateTime,
|
|
),
|
|
'status': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'status',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'createdAt': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'created_at',
|
|
iterable: false,
|
|
type: DateTime,
|
|
),
|
|
'checkInAt': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'check_in_at',
|
|
iterable: false,
|
|
type: DateTime,
|
|
),
|
|
'relieverIds': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'reliever_ids',
|
|
iterable: true,
|
|
type: String,
|
|
),
|
|
'swapRequestId': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'swap_request_id',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
};
|
|
@override
|
|
Future<int?> primaryKeyByUniqueColumns(
|
|
DutySchedule instance,
|
|
DatabaseExecutor executor,
|
|
) async => instance.primaryKey;
|
|
@override
|
|
final String tableName = 'DutySchedule';
|
|
|
|
@override
|
|
Future<DutySchedule> fromSupabase(
|
|
Map<String, dynamic> input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$DutyScheduleFromSupabase(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
@override
|
|
Future<Map<String, dynamic>> toSupabase(
|
|
DutySchedule input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$DutyScheduleToSupabase(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
@override
|
|
Future<DutySchedule> fromSqlite(
|
|
Map<String, dynamic> input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$DutyScheduleFromSqlite(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
@override
|
|
Future<Map<String, dynamic>> toSqlite(
|
|
DutySchedule input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$DutyScheduleToSqlite(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
}
|