241 lines
6.7 KiB
Dart
241 lines
6.7 KiB
Dart
// GENERATED CODE DO NOT EDIT
|
|
part of '../brick.g.dart';
|
|
|
|
Future<Profile> _$ProfileFromSupabase(
|
|
Map<String, dynamic> data, {
|
|
required SupabaseProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return Profile(
|
|
id: data['id'] as String,
|
|
role: data['role'] as String,
|
|
fullName: data['full_name'] as String,
|
|
religion: data['religion'] as String,
|
|
allowTracking: data['allow_tracking'] as bool,
|
|
avatarUrl: data['avatar_url'] == null
|
|
? null
|
|
: data['avatar_url'] as String?,
|
|
facePhotoUrl: data['face_photo_url'] == null
|
|
? null
|
|
: data['face_photo_url'] as String?,
|
|
faceEnrolledAt: data['face_enrolled_at'] == null
|
|
? null
|
|
: data['face_enrolled_at'] == null
|
|
? null
|
|
: DateTime.tryParse(data['face_enrolled_at'] as String),
|
|
);
|
|
}
|
|
|
|
Future<Map<String, dynamic>> _$ProfileToSupabase(
|
|
Profile instance, {
|
|
required SupabaseProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return {
|
|
'id': instance.id,
|
|
'role': instance.role,
|
|
'full_name': instance.fullName,
|
|
'religion': instance.religion,
|
|
'allow_tracking': instance.allowTracking,
|
|
'avatar_url': instance.avatarUrl,
|
|
'face_photo_url': instance.facePhotoUrl,
|
|
'face_enrolled_at': instance.faceEnrolledAt?.toIso8601String(),
|
|
};
|
|
}
|
|
|
|
Future<Profile> _$ProfileFromSqlite(
|
|
Map<String, dynamic> data, {
|
|
required SqliteProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return Profile(
|
|
id: data['id'] as String,
|
|
role: data['role'] as String,
|
|
fullName: data['full_name'] as String,
|
|
religion: data['religion'] as String,
|
|
allowTracking: data['allow_tracking'] == 1,
|
|
avatarUrl: data['avatar_url'] == null
|
|
? null
|
|
: data['avatar_url'] as String?,
|
|
facePhotoUrl: data['face_photo_url'] == null
|
|
? null
|
|
: data['face_photo_url'] as String?,
|
|
faceEnrolledAt: data['face_enrolled_at'] == null
|
|
? null
|
|
: data['face_enrolled_at'] == null
|
|
? null
|
|
: DateTime.tryParse(data['face_enrolled_at'] as String),
|
|
)..primaryKey = data['_brick_id'] as int;
|
|
}
|
|
|
|
Future<Map<String, dynamic>> _$ProfileToSqlite(
|
|
Profile instance, {
|
|
required SqliteProvider provider,
|
|
OfflineFirstWithSupabaseRepository? repository,
|
|
}) async {
|
|
return {
|
|
'id': instance.id,
|
|
'role': instance.role,
|
|
'full_name': instance.fullName,
|
|
'religion': instance.religion,
|
|
'allow_tracking': instance.allowTracking ? 1 : 0,
|
|
'avatar_url': instance.avatarUrl,
|
|
'face_photo_url': instance.facePhotoUrl,
|
|
'face_enrolled_at': instance.faceEnrolledAt?.toIso8601String(),
|
|
};
|
|
}
|
|
|
|
/// Construct a [Profile]
|
|
class ProfileAdapter extends OfflineFirstWithSupabaseAdapter<Profile> {
|
|
ProfileAdapter();
|
|
|
|
@override
|
|
final supabaseTableName = 'profiles';
|
|
@override
|
|
final defaultToNull = true;
|
|
@override
|
|
final fieldsToSupabaseColumns = {
|
|
'id': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'id',
|
|
),
|
|
'role': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'role',
|
|
),
|
|
'fullName': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'full_name',
|
|
),
|
|
'religion': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'religion',
|
|
),
|
|
'allowTracking': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'allow_tracking',
|
|
),
|
|
'avatarUrl': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'avatar_url',
|
|
),
|
|
'facePhotoUrl': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'face_photo_url',
|
|
),
|
|
'faceEnrolledAt': const RuntimeSupabaseColumnDefinition(
|
|
association: false,
|
|
columnName: 'face_enrolled_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,
|
|
),
|
|
'role': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'role',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'fullName': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'full_name',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'religion': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'religion',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'allowTracking': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'allow_tracking',
|
|
iterable: false,
|
|
type: bool,
|
|
),
|
|
'avatarUrl': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'avatar_url',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'facePhotoUrl': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'face_photo_url',
|
|
iterable: false,
|
|
type: String,
|
|
),
|
|
'faceEnrolledAt': const RuntimeSqliteColumnDefinition(
|
|
association: false,
|
|
columnName: 'face_enrolled_at',
|
|
iterable: false,
|
|
type: DateTime,
|
|
),
|
|
};
|
|
@override
|
|
Future<int?> primaryKeyByUniqueColumns(
|
|
Profile instance,
|
|
DatabaseExecutor executor,
|
|
) async => instance.primaryKey;
|
|
@override
|
|
final String tableName = 'Profile';
|
|
|
|
@override
|
|
Future<Profile> fromSupabase(
|
|
Map<String, dynamic> input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$ProfileFromSupabase(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
@override
|
|
Future<Map<String, dynamic>> toSupabase(
|
|
Profile input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$ProfileToSupabase(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
@override
|
|
Future<Profile> fromSqlite(
|
|
Map<String, dynamic> input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$ProfileFromSqlite(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
@override
|
|
Future<Map<String, dynamic>> toSqlite(
|
|
Profile input, {
|
|
required provider,
|
|
covariant OfflineFirstWithSupabaseRepository? repository,
|
|
}) async => await _$ProfileToSqlite(
|
|
input,
|
|
provider: provider,
|
|
repository: repository,
|
|
);
|
|
}
|