Offline Support
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
// GENERATED CODE DO NOT EDIT
|
||||
part of '../brick.g.dart';
|
||||
|
||||
Future<ItServiceRequestAction> _$ItServiceRequestActionFromSupabase(
|
||||
Map<String, dynamic> data, {
|
||||
required SupabaseProvider provider,
|
||||
OfflineFirstWithSupabaseRepository? repository,
|
||||
}) async {
|
||||
return ItServiceRequestAction(
|
||||
id: data['id'] as String,
|
||||
requestId: data['request_id'] as String,
|
||||
userId: data['user_id'] as String,
|
||||
actionTaken: data['action_taken'] == null
|
||||
? null
|
||||
: data['action_taken'] as String?,
|
||||
createdAt: DateTime.parse(data['created_at'] as String),
|
||||
updatedAt: DateTime.parse(data['updated_at'] as String),
|
||||
);
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> _$ItServiceRequestActionToSupabase(
|
||||
ItServiceRequestAction instance, {
|
||||
required SupabaseProvider provider,
|
||||
OfflineFirstWithSupabaseRepository? repository,
|
||||
}) async {
|
||||
return {
|
||||
'id': instance.id,
|
||||
'request_id': instance.requestId,
|
||||
'user_id': instance.userId,
|
||||
'action_taken': instance.actionTaken,
|
||||
'created_at': instance.createdAt.toIso8601String(),
|
||||
'updated_at': instance.updatedAt.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
Future<ItServiceRequestAction> _$ItServiceRequestActionFromSqlite(
|
||||
Map<String, dynamic> data, {
|
||||
required SqliteProvider provider,
|
||||
OfflineFirstWithSupabaseRepository? repository,
|
||||
}) async {
|
||||
return ItServiceRequestAction(
|
||||
id: data['id'] as String,
|
||||
requestId: data['request_id'] as String,
|
||||
userId: data['user_id'] as String,
|
||||
actionTaken: data['action_taken'] == null
|
||||
? null
|
||||
: data['action_taken'] as String?,
|
||||
createdAt: DateTime.parse(data['created_at'] as String),
|
||||
updatedAt: DateTime.parse(data['updated_at'] as String),
|
||||
)..primaryKey = data['_brick_id'] as int;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> _$ItServiceRequestActionToSqlite(
|
||||
ItServiceRequestAction instance, {
|
||||
required SqliteProvider provider,
|
||||
OfflineFirstWithSupabaseRepository? repository,
|
||||
}) async {
|
||||
return {
|
||||
'id': instance.id,
|
||||
'request_id': instance.requestId,
|
||||
'user_id': instance.userId,
|
||||
'action_taken': instance.actionTaken,
|
||||
'created_at': instance.createdAt.toIso8601String(),
|
||||
'updated_at': instance.updatedAt.toIso8601String(),
|
||||
};
|
||||
}
|
||||
|
||||
/// Construct a [ItServiceRequestAction]
|
||||
class ItServiceRequestActionAdapter
|
||||
extends OfflineFirstWithSupabaseAdapter<ItServiceRequestAction> {
|
||||
ItServiceRequestActionAdapter();
|
||||
|
||||
@override
|
||||
final supabaseTableName = 'it_service_request_actions';
|
||||
@override
|
||||
final defaultToNull = true;
|
||||
@override
|
||||
final fieldsToSupabaseColumns = {
|
||||
'id': const RuntimeSupabaseColumnDefinition(
|
||||
association: false,
|
||||
columnName: 'id',
|
||||
),
|
||||
'requestId': const RuntimeSupabaseColumnDefinition(
|
||||
association: false,
|
||||
columnName: 'request_id',
|
||||
),
|
||||
'userId': const RuntimeSupabaseColumnDefinition(
|
||||
association: false,
|
||||
columnName: 'user_id',
|
||||
),
|
||||
'actionTaken': const RuntimeSupabaseColumnDefinition(
|
||||
association: false,
|
||||
columnName: 'action_taken',
|
||||
),
|
||||
'createdAt': const RuntimeSupabaseColumnDefinition(
|
||||
association: false,
|
||||
columnName: 'created_at',
|
||||
),
|
||||
'updatedAt': const RuntimeSupabaseColumnDefinition(
|
||||
association: false,
|
||||
columnName: 'updated_at',
|
||||
),
|
||||
};
|
||||
@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,
|
||||
),
|
||||
'requestId': const RuntimeSqliteColumnDefinition(
|
||||
association: false,
|
||||
columnName: 'request_id',
|
||||
iterable: false,
|
||||
type: String,
|
||||
),
|
||||
'userId': const RuntimeSqliteColumnDefinition(
|
||||
association: false,
|
||||
columnName: 'user_id',
|
||||
iterable: false,
|
||||
type: String,
|
||||
),
|
||||
'actionTaken': const RuntimeSqliteColumnDefinition(
|
||||
association: false,
|
||||
columnName: 'action_taken',
|
||||
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,
|
||||
),
|
||||
};
|
||||
@override
|
||||
Future<int?> primaryKeyByUniqueColumns(
|
||||
ItServiceRequestAction instance,
|
||||
DatabaseExecutor executor,
|
||||
) async => instance.primaryKey;
|
||||
@override
|
||||
final String tableName = 'ItServiceRequestAction';
|
||||
|
||||
@override
|
||||
Future<ItServiceRequestAction> fromSupabase(
|
||||
Map<String, dynamic> input, {
|
||||
required provider,
|
||||
covariant OfflineFirstWithSupabaseRepository? repository,
|
||||
}) async => await _$ItServiceRequestActionFromSupabase(
|
||||
input,
|
||||
provider: provider,
|
||||
repository: repository,
|
||||
);
|
||||
@override
|
||||
Future<Map<String, dynamic>> toSupabase(
|
||||
ItServiceRequestAction input, {
|
||||
required provider,
|
||||
covariant OfflineFirstWithSupabaseRepository? repository,
|
||||
}) async => await _$ItServiceRequestActionToSupabase(
|
||||
input,
|
||||
provider: provider,
|
||||
repository: repository,
|
||||
);
|
||||
@override
|
||||
Future<ItServiceRequestAction> fromSqlite(
|
||||
Map<String, dynamic> input, {
|
||||
required provider,
|
||||
covariant OfflineFirstWithSupabaseRepository? repository,
|
||||
}) async => await _$ItServiceRequestActionFromSqlite(
|
||||
input,
|
||||
provider: provider,
|
||||
repository: repository,
|
||||
);
|
||||
@override
|
||||
Future<Map<String, dynamic>> toSqlite(
|
||||
ItServiceRequestAction input, {
|
||||
required provider,
|
||||
covariant OfflineFirstWithSupabaseRepository? repository,
|
||||
}) async => await _$ItServiceRequestActionToSqlite(
|
||||
input,
|
||||
provider: provider,
|
||||
repository: repository,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user