37376 lines
1.2 MiB
37376 lines
1.2 MiB
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'app_database.dart';
|
|
|
|
// ignore_for_file: type=lint
|
|
class $TenantsTable extends Tenants with TableInfo<$TenantsTable, Tenant> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$TenantsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _businessCodeMeta = const VerificationMeta(
|
|
'businessCode',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> businessCode = GeneratedColumn<String>(
|
|
'business_code',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _businessNameMeta = const VerificationMeta(
|
|
'businessName',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> businessName = GeneratedColumn<String>(
|
|
'business_name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _businessEmailMeta = const VerificationMeta(
|
|
'businessEmail',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> businessEmail = GeneratedColumn<String>(
|
|
'business_email',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _businessPhoneMeta = const VerificationMeta(
|
|
'businessPhone',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> businessPhone = GeneratedColumn<String>(
|
|
'business_phone',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _businessTypeMeta = const VerificationMeta(
|
|
'businessType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> businessType = GeneratedColumn<String>(
|
|
'business_type',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _localLogoPathMeta = const VerificationMeta(
|
|
'localLogoPath',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localLogoPath = GeneratedColumn<String>(
|
|
'local_logo_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _serverLogoUrlMeta = const VerificationMeta(
|
|
'serverLogoUrl',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverLogoUrl = GeneratedColumn<String>(
|
|
'server_logo_url',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _subdomainMeta = const VerificationMeta(
|
|
'subdomain',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> subdomain = GeneratedColumn<String>(
|
|
'subdomain',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _onlinStoreNameMeta = const VerificationMeta(
|
|
'onlinStoreName',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> onlinStoreName = GeneratedColumn<String>(
|
|
'onlin_store_name',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _onlineOpenTimeMeta = const VerificationMeta(
|
|
'onlineOpenTime',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> onlineOpenTime = GeneratedColumn<String>(
|
|
'online_open_time',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _onlineCloseTimeMeta = const VerificationMeta(
|
|
'onlineCloseTime',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> onlineCloseTime = GeneratedColumn<String>(
|
|
'online_close_time',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _isCloseServiceMeta = const VerificationMeta(
|
|
'isCloseService',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isCloseService = GeneratedColumn<bool>(
|
|
'is_close_service',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_close_service" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _preparationTimeMinutesMeta =
|
|
const VerificationMeta('preparationTimeMinutes');
|
|
@override
|
|
late final GeneratedColumn<int> preparationTimeMinutes = GeneratedColumn<int>(
|
|
'preparation_time_minutes',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _orderIntervalMinutesMeta =
|
|
const VerificationMeta('orderIntervalMinutes');
|
|
@override
|
|
late final GeneratedColumn<int> orderIntervalMinutes = GeneratedColumn<int>(
|
|
'order_interval_minutes',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _allowCodMeta = const VerificationMeta(
|
|
'allowCod',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> allowCod = GeneratedColumn<bool>(
|
|
'allow_cod',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("allow_cod" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _maxDeliveryRadiusKmMeta =
|
|
const VerificationMeta('maxDeliveryRadiusKm');
|
|
@override
|
|
late final GeneratedColumn<double> maxDeliveryRadiusKm =
|
|
GeneratedColumn<double>(
|
|
'max_delivery_radius_km',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _deliveryFeeTypeMeta = const VerificationMeta(
|
|
'deliveryFeeType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> deliveryFeeType = GeneratedColumn<String>(
|
|
'delivery_fee_type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('fixed'),
|
|
);
|
|
static const VerificationMeta _deliveryFlatFeeMeta = const VerificationMeta(
|
|
'deliveryFlatFee',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> deliveryFlatFee = GeneratedColumn<double>(
|
|
'delivery_flat_fee',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _deliveryFeePerKmMeta = const VerificationMeta(
|
|
'deliveryFeePerKm',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> deliveryFeePerKm = GeneratedColumn<double>(
|
|
'delivery_fee_per_km',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _deliveryBaseFeeMeta = const VerificationMeta(
|
|
'deliveryBaseFee',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> deliveryBaseFee = GeneratedColumn<double>(
|
|
'delivery_base_fee',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _reviewDisplayTypeMeta = const VerificationMeta(
|
|
'reviewDisplayType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> reviewDisplayType =
|
|
GeneratedColumn<String>(
|
|
'review_display_type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('rating_only'),
|
|
);
|
|
static const VerificationMeta _reviewDisplayPolicyMeta =
|
|
const VerificationMeta('reviewDisplayPolicy');
|
|
@override
|
|
late final GeneratedColumn<String> reviewDisplayPolicy =
|
|
GeneratedColumn<String>(
|
|
'review_display_policy',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('four_and_five_star_only'),
|
|
);
|
|
static const VerificationMeta _subscriptionLevelMeta = const VerificationMeta(
|
|
'subscriptionLevel',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> subscriptionLevel =
|
|
GeneratedColumn<String>(
|
|
'subscription_level',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('standart'),
|
|
);
|
|
static const VerificationMeta _limitOutletMeta = const VerificationMeta(
|
|
'limitOutlet',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> limitOutlet = GeneratedColumn<int>(
|
|
'limit_outlet',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(5),
|
|
);
|
|
static const VerificationMeta _subscriptionExpiresAtMeta =
|
|
const VerificationMeta('subscriptionExpiresAt');
|
|
@override
|
|
late final GeneratedColumn<DateTime> subscriptionExpiresAt =
|
|
GeneratedColumn<DateTime>(
|
|
'subscription_expires_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
businessCode,
|
|
businessName,
|
|
businessEmail,
|
|
businessPhone,
|
|
businessType,
|
|
localLogoPath,
|
|
serverLogoUrl,
|
|
subdomain,
|
|
onlinStoreName,
|
|
onlineOpenTime,
|
|
onlineCloseTime,
|
|
isCloseService,
|
|
preparationTimeMinutes,
|
|
orderIntervalMinutes,
|
|
allowCod,
|
|
maxDeliveryRadiusKm,
|
|
deliveryFeeType,
|
|
deliveryFlatFee,
|
|
deliveryFeePerKm,
|
|
deliveryBaseFee,
|
|
reviewDisplayType,
|
|
reviewDisplayPolicy,
|
|
subscriptionLevel,
|
|
limitOutlet,
|
|
subscriptionExpiresAt,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'tenants';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Tenant> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('business_code')) {
|
|
context.handle(
|
|
_businessCodeMeta,
|
|
businessCode.isAcceptableOrUnknown(
|
|
data['business_code']!,
|
|
_businessCodeMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_businessCodeMeta);
|
|
}
|
|
if (data.containsKey('business_name')) {
|
|
context.handle(
|
|
_businessNameMeta,
|
|
businessName.isAcceptableOrUnknown(
|
|
data['business_name']!,
|
|
_businessNameMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_businessNameMeta);
|
|
}
|
|
if (data.containsKey('business_email')) {
|
|
context.handle(
|
|
_businessEmailMeta,
|
|
businessEmail.isAcceptableOrUnknown(
|
|
data['business_email']!,
|
|
_businessEmailMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('business_phone')) {
|
|
context.handle(
|
|
_businessPhoneMeta,
|
|
businessPhone.isAcceptableOrUnknown(
|
|
data['business_phone']!,
|
|
_businessPhoneMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('business_type')) {
|
|
context.handle(
|
|
_businessTypeMeta,
|
|
businessType.isAcceptableOrUnknown(
|
|
data['business_type']!,
|
|
_businessTypeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('local_logo_path')) {
|
|
context.handle(
|
|
_localLogoPathMeta,
|
|
localLogoPath.isAcceptableOrUnknown(
|
|
data['local_logo_path']!,
|
|
_localLogoPathMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('server_logo_url')) {
|
|
context.handle(
|
|
_serverLogoUrlMeta,
|
|
serverLogoUrl.isAcceptableOrUnknown(
|
|
data['server_logo_url']!,
|
|
_serverLogoUrlMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('subdomain')) {
|
|
context.handle(
|
|
_subdomainMeta,
|
|
subdomain.isAcceptableOrUnknown(data['subdomain']!, _subdomainMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('onlin_store_name')) {
|
|
context.handle(
|
|
_onlinStoreNameMeta,
|
|
onlinStoreName.isAcceptableOrUnknown(
|
|
data['onlin_store_name']!,
|
|
_onlinStoreNameMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('online_open_time')) {
|
|
context.handle(
|
|
_onlineOpenTimeMeta,
|
|
onlineOpenTime.isAcceptableOrUnknown(
|
|
data['online_open_time']!,
|
|
_onlineOpenTimeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('online_close_time')) {
|
|
context.handle(
|
|
_onlineCloseTimeMeta,
|
|
onlineCloseTime.isAcceptableOrUnknown(
|
|
data['online_close_time']!,
|
|
_onlineCloseTimeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('is_close_service')) {
|
|
context.handle(
|
|
_isCloseServiceMeta,
|
|
isCloseService.isAcceptableOrUnknown(
|
|
data['is_close_service']!,
|
|
_isCloseServiceMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('preparation_time_minutes')) {
|
|
context.handle(
|
|
_preparationTimeMinutesMeta,
|
|
preparationTimeMinutes.isAcceptableOrUnknown(
|
|
data['preparation_time_minutes']!,
|
|
_preparationTimeMinutesMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('order_interval_minutes')) {
|
|
context.handle(
|
|
_orderIntervalMinutesMeta,
|
|
orderIntervalMinutes.isAcceptableOrUnknown(
|
|
data['order_interval_minutes']!,
|
|
_orderIntervalMinutesMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('allow_cod')) {
|
|
context.handle(
|
|
_allowCodMeta,
|
|
allowCod.isAcceptableOrUnknown(data['allow_cod']!, _allowCodMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('max_delivery_radius_km')) {
|
|
context.handle(
|
|
_maxDeliveryRadiusKmMeta,
|
|
maxDeliveryRadiusKm.isAcceptableOrUnknown(
|
|
data['max_delivery_radius_km']!,
|
|
_maxDeliveryRadiusKmMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('delivery_fee_type')) {
|
|
context.handle(
|
|
_deliveryFeeTypeMeta,
|
|
deliveryFeeType.isAcceptableOrUnknown(
|
|
data['delivery_fee_type']!,
|
|
_deliveryFeeTypeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('delivery_flat_fee')) {
|
|
context.handle(
|
|
_deliveryFlatFeeMeta,
|
|
deliveryFlatFee.isAcceptableOrUnknown(
|
|
data['delivery_flat_fee']!,
|
|
_deliveryFlatFeeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('delivery_fee_per_km')) {
|
|
context.handle(
|
|
_deliveryFeePerKmMeta,
|
|
deliveryFeePerKm.isAcceptableOrUnknown(
|
|
data['delivery_fee_per_km']!,
|
|
_deliveryFeePerKmMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('delivery_base_fee')) {
|
|
context.handle(
|
|
_deliveryBaseFeeMeta,
|
|
deliveryBaseFee.isAcceptableOrUnknown(
|
|
data['delivery_base_fee']!,
|
|
_deliveryBaseFeeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('review_display_type')) {
|
|
context.handle(
|
|
_reviewDisplayTypeMeta,
|
|
reviewDisplayType.isAcceptableOrUnknown(
|
|
data['review_display_type']!,
|
|
_reviewDisplayTypeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('review_display_policy')) {
|
|
context.handle(
|
|
_reviewDisplayPolicyMeta,
|
|
reviewDisplayPolicy.isAcceptableOrUnknown(
|
|
data['review_display_policy']!,
|
|
_reviewDisplayPolicyMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('subscription_level')) {
|
|
context.handle(
|
|
_subscriptionLevelMeta,
|
|
subscriptionLevel.isAcceptableOrUnknown(
|
|
data['subscription_level']!,
|
|
_subscriptionLevelMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('limit_outlet')) {
|
|
context.handle(
|
|
_limitOutletMeta,
|
|
limitOutlet.isAcceptableOrUnknown(
|
|
data['limit_outlet']!,
|
|
_limitOutletMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('subscription_expires_at')) {
|
|
context.handle(
|
|
_subscriptionExpiresAtMeta,
|
|
subscriptionExpiresAt.isAcceptableOrUnknown(
|
|
data['subscription_expires_at']!,
|
|
_subscriptionExpiresAtMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Tenant map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Tenant(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
businessCode: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}business_code'],
|
|
)!,
|
|
businessName: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}business_name'],
|
|
)!,
|
|
businessEmail: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}business_email'],
|
|
),
|
|
businessPhone: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}business_phone'],
|
|
),
|
|
businessType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}business_type'],
|
|
),
|
|
localLogoPath: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_logo_path'],
|
|
),
|
|
serverLogoUrl: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_logo_url'],
|
|
),
|
|
subdomain: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}subdomain'],
|
|
),
|
|
onlinStoreName: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}onlin_store_name'],
|
|
),
|
|
onlineOpenTime: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}online_open_time'],
|
|
),
|
|
onlineCloseTime: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}online_close_time'],
|
|
),
|
|
isCloseService: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_close_service'],
|
|
)!,
|
|
preparationTimeMinutes: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}preparation_time_minutes'],
|
|
)!,
|
|
orderIntervalMinutes: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}order_interval_minutes'],
|
|
)!,
|
|
allowCod: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}allow_cod'],
|
|
)!,
|
|
maxDeliveryRadiusKm: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}max_delivery_radius_km'],
|
|
)!,
|
|
deliveryFeeType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}delivery_fee_type'],
|
|
)!,
|
|
deliveryFlatFee: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}delivery_flat_fee'],
|
|
)!,
|
|
deliveryFeePerKm: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}delivery_fee_per_km'],
|
|
)!,
|
|
deliveryBaseFee: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}delivery_base_fee'],
|
|
)!,
|
|
reviewDisplayType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}review_display_type'],
|
|
)!,
|
|
reviewDisplayPolicy: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}review_display_policy'],
|
|
)!,
|
|
subscriptionLevel: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}subscription_level'],
|
|
)!,
|
|
limitOutlet: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}limit_outlet'],
|
|
)!,
|
|
subscriptionExpiresAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}subscription_expires_at'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$TenantsTable createAlias(String alias) {
|
|
return $TenantsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Tenant extends DataClass implements Insertable<Tenant> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String businessCode;
|
|
final String businessName;
|
|
final String? businessEmail;
|
|
final String? businessPhone;
|
|
final String? businessType;
|
|
final String? localLogoPath;
|
|
final String? serverLogoUrl;
|
|
final String? subdomain;
|
|
final String? onlinStoreName;
|
|
final String? onlineOpenTime;
|
|
final String? onlineCloseTime;
|
|
final bool isCloseService;
|
|
final int preparationTimeMinutes;
|
|
final int orderIntervalMinutes;
|
|
final bool allowCod;
|
|
final double maxDeliveryRadiusKm;
|
|
final String deliveryFeeType;
|
|
final double deliveryFlatFee;
|
|
final double deliveryFeePerKm;
|
|
final double deliveryBaseFee;
|
|
final String reviewDisplayType;
|
|
final String reviewDisplayPolicy;
|
|
final String subscriptionLevel;
|
|
final int limitOutlet;
|
|
final DateTime? subscriptionExpiresAt;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const Tenant({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.businessCode,
|
|
required this.businessName,
|
|
this.businessEmail,
|
|
this.businessPhone,
|
|
this.businessType,
|
|
this.localLogoPath,
|
|
this.serverLogoUrl,
|
|
this.subdomain,
|
|
this.onlinStoreName,
|
|
this.onlineOpenTime,
|
|
this.onlineCloseTime,
|
|
required this.isCloseService,
|
|
required this.preparationTimeMinutes,
|
|
required this.orderIntervalMinutes,
|
|
required this.allowCod,
|
|
required this.maxDeliveryRadiusKm,
|
|
required this.deliveryFeeType,
|
|
required this.deliveryFlatFee,
|
|
required this.deliveryFeePerKm,
|
|
required this.deliveryBaseFee,
|
|
required this.reviewDisplayType,
|
|
required this.reviewDisplayPolicy,
|
|
required this.subscriptionLevel,
|
|
required this.limitOutlet,
|
|
this.subscriptionExpiresAt,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['business_code'] = Variable<String>(businessCode);
|
|
map['business_name'] = Variable<String>(businessName);
|
|
if (!nullToAbsent || businessEmail != null) {
|
|
map['business_email'] = Variable<String>(businessEmail);
|
|
}
|
|
if (!nullToAbsent || businessPhone != null) {
|
|
map['business_phone'] = Variable<String>(businessPhone);
|
|
}
|
|
if (!nullToAbsent || businessType != null) {
|
|
map['business_type'] = Variable<String>(businessType);
|
|
}
|
|
if (!nullToAbsent || localLogoPath != null) {
|
|
map['local_logo_path'] = Variable<String>(localLogoPath);
|
|
}
|
|
if (!nullToAbsent || serverLogoUrl != null) {
|
|
map['server_logo_url'] = Variable<String>(serverLogoUrl);
|
|
}
|
|
if (!nullToAbsent || subdomain != null) {
|
|
map['subdomain'] = Variable<String>(subdomain);
|
|
}
|
|
if (!nullToAbsent || onlinStoreName != null) {
|
|
map['onlin_store_name'] = Variable<String>(onlinStoreName);
|
|
}
|
|
if (!nullToAbsent || onlineOpenTime != null) {
|
|
map['online_open_time'] = Variable<String>(onlineOpenTime);
|
|
}
|
|
if (!nullToAbsent || onlineCloseTime != null) {
|
|
map['online_close_time'] = Variable<String>(onlineCloseTime);
|
|
}
|
|
map['is_close_service'] = Variable<bool>(isCloseService);
|
|
map['preparation_time_minutes'] = Variable<int>(preparationTimeMinutes);
|
|
map['order_interval_minutes'] = Variable<int>(orderIntervalMinutes);
|
|
map['allow_cod'] = Variable<bool>(allowCod);
|
|
map['max_delivery_radius_km'] = Variable<double>(maxDeliveryRadiusKm);
|
|
map['delivery_fee_type'] = Variable<String>(deliveryFeeType);
|
|
map['delivery_flat_fee'] = Variable<double>(deliveryFlatFee);
|
|
map['delivery_fee_per_km'] = Variable<double>(deliveryFeePerKm);
|
|
map['delivery_base_fee'] = Variable<double>(deliveryBaseFee);
|
|
map['review_display_type'] = Variable<String>(reviewDisplayType);
|
|
map['review_display_policy'] = Variable<String>(reviewDisplayPolicy);
|
|
map['subscription_level'] = Variable<String>(subscriptionLevel);
|
|
map['limit_outlet'] = Variable<int>(limitOutlet);
|
|
if (!nullToAbsent || subscriptionExpiresAt != null) {
|
|
map['subscription_expires_at'] = Variable<DateTime>(
|
|
subscriptionExpiresAt,
|
|
);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
TenantsCompanion toCompanion(bool nullToAbsent) {
|
|
return TenantsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
businessCode: Value(businessCode),
|
|
businessName: Value(businessName),
|
|
businessEmail: businessEmail == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(businessEmail),
|
|
businessPhone: businessPhone == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(businessPhone),
|
|
businessType: businessType == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(businessType),
|
|
localLogoPath: localLogoPath == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(localLogoPath),
|
|
serverLogoUrl: serverLogoUrl == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverLogoUrl),
|
|
subdomain: subdomain == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(subdomain),
|
|
onlinStoreName: onlinStoreName == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(onlinStoreName),
|
|
onlineOpenTime: onlineOpenTime == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(onlineOpenTime),
|
|
onlineCloseTime: onlineCloseTime == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(onlineCloseTime),
|
|
isCloseService: Value(isCloseService),
|
|
preparationTimeMinutes: Value(preparationTimeMinutes),
|
|
orderIntervalMinutes: Value(orderIntervalMinutes),
|
|
allowCod: Value(allowCod),
|
|
maxDeliveryRadiusKm: Value(maxDeliveryRadiusKm),
|
|
deliveryFeeType: Value(deliveryFeeType),
|
|
deliveryFlatFee: Value(deliveryFlatFee),
|
|
deliveryFeePerKm: Value(deliveryFeePerKm),
|
|
deliveryBaseFee: Value(deliveryBaseFee),
|
|
reviewDisplayType: Value(reviewDisplayType),
|
|
reviewDisplayPolicy: Value(reviewDisplayPolicy),
|
|
subscriptionLevel: Value(subscriptionLevel),
|
|
limitOutlet: Value(limitOutlet),
|
|
subscriptionExpiresAt: subscriptionExpiresAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(subscriptionExpiresAt),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory Tenant.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Tenant(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
businessCode: serializer.fromJson<String>(json['businessCode']),
|
|
businessName: serializer.fromJson<String>(json['businessName']),
|
|
businessEmail: serializer.fromJson<String?>(json['businessEmail']),
|
|
businessPhone: serializer.fromJson<String?>(json['businessPhone']),
|
|
businessType: serializer.fromJson<String?>(json['businessType']),
|
|
localLogoPath: serializer.fromJson<String?>(json['localLogoPath']),
|
|
serverLogoUrl: serializer.fromJson<String?>(json['serverLogoUrl']),
|
|
subdomain: serializer.fromJson<String?>(json['subdomain']),
|
|
onlinStoreName: serializer.fromJson<String?>(json['onlinStoreName']),
|
|
onlineOpenTime: serializer.fromJson<String?>(json['onlineOpenTime']),
|
|
onlineCloseTime: serializer.fromJson<String?>(json['onlineCloseTime']),
|
|
isCloseService: serializer.fromJson<bool>(json['isCloseService']),
|
|
preparationTimeMinutes: serializer.fromJson<int>(
|
|
json['preparationTimeMinutes'],
|
|
),
|
|
orderIntervalMinutes: serializer.fromJson<int>(
|
|
json['orderIntervalMinutes'],
|
|
),
|
|
allowCod: serializer.fromJson<bool>(json['allowCod']),
|
|
maxDeliveryRadiusKm: serializer.fromJson<double>(
|
|
json['maxDeliveryRadiusKm'],
|
|
),
|
|
deliveryFeeType: serializer.fromJson<String>(json['deliveryFeeType']),
|
|
deliveryFlatFee: serializer.fromJson<double>(json['deliveryFlatFee']),
|
|
deliveryFeePerKm: serializer.fromJson<double>(json['deliveryFeePerKm']),
|
|
deliveryBaseFee: serializer.fromJson<double>(json['deliveryBaseFee']),
|
|
reviewDisplayType: serializer.fromJson<String>(json['reviewDisplayType']),
|
|
reviewDisplayPolicy: serializer.fromJson<String>(
|
|
json['reviewDisplayPolicy'],
|
|
),
|
|
subscriptionLevel: serializer.fromJson<String>(json['subscriptionLevel']),
|
|
limitOutlet: serializer.fromJson<int>(json['limitOutlet']),
|
|
subscriptionExpiresAt: serializer.fromJson<DateTime?>(
|
|
json['subscriptionExpiresAt'],
|
|
),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'businessCode': serializer.toJson<String>(businessCode),
|
|
'businessName': serializer.toJson<String>(businessName),
|
|
'businessEmail': serializer.toJson<String?>(businessEmail),
|
|
'businessPhone': serializer.toJson<String?>(businessPhone),
|
|
'businessType': serializer.toJson<String?>(businessType),
|
|
'localLogoPath': serializer.toJson<String?>(localLogoPath),
|
|
'serverLogoUrl': serializer.toJson<String?>(serverLogoUrl),
|
|
'subdomain': serializer.toJson<String?>(subdomain),
|
|
'onlinStoreName': serializer.toJson<String?>(onlinStoreName),
|
|
'onlineOpenTime': serializer.toJson<String?>(onlineOpenTime),
|
|
'onlineCloseTime': serializer.toJson<String?>(onlineCloseTime),
|
|
'isCloseService': serializer.toJson<bool>(isCloseService),
|
|
'preparationTimeMinutes': serializer.toJson<int>(preparationTimeMinutes),
|
|
'orderIntervalMinutes': serializer.toJson<int>(orderIntervalMinutes),
|
|
'allowCod': serializer.toJson<bool>(allowCod),
|
|
'maxDeliveryRadiusKm': serializer.toJson<double>(maxDeliveryRadiusKm),
|
|
'deliveryFeeType': serializer.toJson<String>(deliveryFeeType),
|
|
'deliveryFlatFee': serializer.toJson<double>(deliveryFlatFee),
|
|
'deliveryFeePerKm': serializer.toJson<double>(deliveryFeePerKm),
|
|
'deliveryBaseFee': serializer.toJson<double>(deliveryBaseFee),
|
|
'reviewDisplayType': serializer.toJson<String>(reviewDisplayType),
|
|
'reviewDisplayPolicy': serializer.toJson<String>(reviewDisplayPolicy),
|
|
'subscriptionLevel': serializer.toJson<String>(subscriptionLevel),
|
|
'limitOutlet': serializer.toJson<int>(limitOutlet),
|
|
'subscriptionExpiresAt': serializer.toJson<DateTime?>(
|
|
subscriptionExpiresAt,
|
|
),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
Tenant copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? businessCode,
|
|
String? businessName,
|
|
Value<String?> businessEmail = const Value.absent(),
|
|
Value<String?> businessPhone = const Value.absent(),
|
|
Value<String?> businessType = const Value.absent(),
|
|
Value<String?> localLogoPath = const Value.absent(),
|
|
Value<String?> serverLogoUrl = const Value.absent(),
|
|
Value<String?> subdomain = const Value.absent(),
|
|
Value<String?> onlinStoreName = const Value.absent(),
|
|
Value<String?> onlineOpenTime = const Value.absent(),
|
|
Value<String?> onlineCloseTime = const Value.absent(),
|
|
bool? isCloseService,
|
|
int? preparationTimeMinutes,
|
|
int? orderIntervalMinutes,
|
|
bool? allowCod,
|
|
double? maxDeliveryRadiusKm,
|
|
String? deliveryFeeType,
|
|
double? deliveryFlatFee,
|
|
double? deliveryFeePerKm,
|
|
double? deliveryBaseFee,
|
|
String? reviewDisplayType,
|
|
String? reviewDisplayPolicy,
|
|
String? subscriptionLevel,
|
|
int? limitOutlet,
|
|
Value<DateTime?> subscriptionExpiresAt = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => Tenant(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
businessCode: businessCode ?? this.businessCode,
|
|
businessName: businessName ?? this.businessName,
|
|
businessEmail: businessEmail.present
|
|
? businessEmail.value
|
|
: this.businessEmail,
|
|
businessPhone: businessPhone.present
|
|
? businessPhone.value
|
|
: this.businessPhone,
|
|
businessType: businessType.present ? businessType.value : this.businessType,
|
|
localLogoPath: localLogoPath.present
|
|
? localLogoPath.value
|
|
: this.localLogoPath,
|
|
serverLogoUrl: serverLogoUrl.present
|
|
? serverLogoUrl.value
|
|
: this.serverLogoUrl,
|
|
subdomain: subdomain.present ? subdomain.value : this.subdomain,
|
|
onlinStoreName: onlinStoreName.present
|
|
? onlinStoreName.value
|
|
: this.onlinStoreName,
|
|
onlineOpenTime: onlineOpenTime.present
|
|
? onlineOpenTime.value
|
|
: this.onlineOpenTime,
|
|
onlineCloseTime: onlineCloseTime.present
|
|
? onlineCloseTime.value
|
|
: this.onlineCloseTime,
|
|
isCloseService: isCloseService ?? this.isCloseService,
|
|
preparationTimeMinutes:
|
|
preparationTimeMinutes ?? this.preparationTimeMinutes,
|
|
orderIntervalMinutes: orderIntervalMinutes ?? this.orderIntervalMinutes,
|
|
allowCod: allowCod ?? this.allowCod,
|
|
maxDeliveryRadiusKm: maxDeliveryRadiusKm ?? this.maxDeliveryRadiusKm,
|
|
deliveryFeeType: deliveryFeeType ?? this.deliveryFeeType,
|
|
deliveryFlatFee: deliveryFlatFee ?? this.deliveryFlatFee,
|
|
deliveryFeePerKm: deliveryFeePerKm ?? this.deliveryFeePerKm,
|
|
deliveryBaseFee: deliveryBaseFee ?? this.deliveryBaseFee,
|
|
reviewDisplayType: reviewDisplayType ?? this.reviewDisplayType,
|
|
reviewDisplayPolicy: reviewDisplayPolicy ?? this.reviewDisplayPolicy,
|
|
subscriptionLevel: subscriptionLevel ?? this.subscriptionLevel,
|
|
limitOutlet: limitOutlet ?? this.limitOutlet,
|
|
subscriptionExpiresAt: subscriptionExpiresAt.present
|
|
? subscriptionExpiresAt.value
|
|
: this.subscriptionExpiresAt,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
Tenant copyWithCompanion(TenantsCompanion data) {
|
|
return Tenant(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
businessCode: data.businessCode.present
|
|
? data.businessCode.value
|
|
: this.businessCode,
|
|
businessName: data.businessName.present
|
|
? data.businessName.value
|
|
: this.businessName,
|
|
businessEmail: data.businessEmail.present
|
|
? data.businessEmail.value
|
|
: this.businessEmail,
|
|
businessPhone: data.businessPhone.present
|
|
? data.businessPhone.value
|
|
: this.businessPhone,
|
|
businessType: data.businessType.present
|
|
? data.businessType.value
|
|
: this.businessType,
|
|
localLogoPath: data.localLogoPath.present
|
|
? data.localLogoPath.value
|
|
: this.localLogoPath,
|
|
serverLogoUrl: data.serverLogoUrl.present
|
|
? data.serverLogoUrl.value
|
|
: this.serverLogoUrl,
|
|
subdomain: data.subdomain.present ? data.subdomain.value : this.subdomain,
|
|
onlinStoreName: data.onlinStoreName.present
|
|
? data.onlinStoreName.value
|
|
: this.onlinStoreName,
|
|
onlineOpenTime: data.onlineOpenTime.present
|
|
? data.onlineOpenTime.value
|
|
: this.onlineOpenTime,
|
|
onlineCloseTime: data.onlineCloseTime.present
|
|
? data.onlineCloseTime.value
|
|
: this.onlineCloseTime,
|
|
isCloseService: data.isCloseService.present
|
|
? data.isCloseService.value
|
|
: this.isCloseService,
|
|
preparationTimeMinutes: data.preparationTimeMinutes.present
|
|
? data.preparationTimeMinutes.value
|
|
: this.preparationTimeMinutes,
|
|
orderIntervalMinutes: data.orderIntervalMinutes.present
|
|
? data.orderIntervalMinutes.value
|
|
: this.orderIntervalMinutes,
|
|
allowCod: data.allowCod.present ? data.allowCod.value : this.allowCod,
|
|
maxDeliveryRadiusKm: data.maxDeliveryRadiusKm.present
|
|
? data.maxDeliveryRadiusKm.value
|
|
: this.maxDeliveryRadiusKm,
|
|
deliveryFeeType: data.deliveryFeeType.present
|
|
? data.deliveryFeeType.value
|
|
: this.deliveryFeeType,
|
|
deliveryFlatFee: data.deliveryFlatFee.present
|
|
? data.deliveryFlatFee.value
|
|
: this.deliveryFlatFee,
|
|
deliveryFeePerKm: data.deliveryFeePerKm.present
|
|
? data.deliveryFeePerKm.value
|
|
: this.deliveryFeePerKm,
|
|
deliveryBaseFee: data.deliveryBaseFee.present
|
|
? data.deliveryBaseFee.value
|
|
: this.deliveryBaseFee,
|
|
reviewDisplayType: data.reviewDisplayType.present
|
|
? data.reviewDisplayType.value
|
|
: this.reviewDisplayType,
|
|
reviewDisplayPolicy: data.reviewDisplayPolicy.present
|
|
? data.reviewDisplayPolicy.value
|
|
: this.reviewDisplayPolicy,
|
|
subscriptionLevel: data.subscriptionLevel.present
|
|
? data.subscriptionLevel.value
|
|
: this.subscriptionLevel,
|
|
limitOutlet: data.limitOutlet.present
|
|
? data.limitOutlet.value
|
|
: this.limitOutlet,
|
|
subscriptionExpiresAt: data.subscriptionExpiresAt.present
|
|
? data.subscriptionExpiresAt.value
|
|
: this.subscriptionExpiresAt,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Tenant(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('businessCode: $businessCode, ')
|
|
..write('businessName: $businessName, ')
|
|
..write('businessEmail: $businessEmail, ')
|
|
..write('businessPhone: $businessPhone, ')
|
|
..write('businessType: $businessType, ')
|
|
..write('localLogoPath: $localLogoPath, ')
|
|
..write('serverLogoUrl: $serverLogoUrl, ')
|
|
..write('subdomain: $subdomain, ')
|
|
..write('onlinStoreName: $onlinStoreName, ')
|
|
..write('onlineOpenTime: $onlineOpenTime, ')
|
|
..write('onlineCloseTime: $onlineCloseTime, ')
|
|
..write('isCloseService: $isCloseService, ')
|
|
..write('preparationTimeMinutes: $preparationTimeMinutes, ')
|
|
..write('orderIntervalMinutes: $orderIntervalMinutes, ')
|
|
..write('allowCod: $allowCod, ')
|
|
..write('maxDeliveryRadiusKm: $maxDeliveryRadiusKm, ')
|
|
..write('deliveryFeeType: $deliveryFeeType, ')
|
|
..write('deliveryFlatFee: $deliveryFlatFee, ')
|
|
..write('deliveryFeePerKm: $deliveryFeePerKm, ')
|
|
..write('deliveryBaseFee: $deliveryBaseFee, ')
|
|
..write('reviewDisplayType: $reviewDisplayType, ')
|
|
..write('reviewDisplayPolicy: $reviewDisplayPolicy, ')
|
|
..write('subscriptionLevel: $subscriptionLevel, ')
|
|
..write('limitOutlet: $limitOutlet, ')
|
|
..write('subscriptionExpiresAt: $subscriptionExpiresAt, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hashAll([
|
|
localId,
|
|
serverId,
|
|
businessCode,
|
|
businessName,
|
|
businessEmail,
|
|
businessPhone,
|
|
businessType,
|
|
localLogoPath,
|
|
serverLogoUrl,
|
|
subdomain,
|
|
onlinStoreName,
|
|
onlineOpenTime,
|
|
onlineCloseTime,
|
|
isCloseService,
|
|
preparationTimeMinutes,
|
|
orderIntervalMinutes,
|
|
allowCod,
|
|
maxDeliveryRadiusKm,
|
|
deliveryFeeType,
|
|
deliveryFlatFee,
|
|
deliveryFeePerKm,
|
|
deliveryBaseFee,
|
|
reviewDisplayType,
|
|
reviewDisplayPolicy,
|
|
subscriptionLevel,
|
|
limitOutlet,
|
|
subscriptionExpiresAt,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
]);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Tenant &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.businessCode == this.businessCode &&
|
|
other.businessName == this.businessName &&
|
|
other.businessEmail == this.businessEmail &&
|
|
other.businessPhone == this.businessPhone &&
|
|
other.businessType == this.businessType &&
|
|
other.localLogoPath == this.localLogoPath &&
|
|
other.serverLogoUrl == this.serverLogoUrl &&
|
|
other.subdomain == this.subdomain &&
|
|
other.onlinStoreName == this.onlinStoreName &&
|
|
other.onlineOpenTime == this.onlineOpenTime &&
|
|
other.onlineCloseTime == this.onlineCloseTime &&
|
|
other.isCloseService == this.isCloseService &&
|
|
other.preparationTimeMinutes == this.preparationTimeMinutes &&
|
|
other.orderIntervalMinutes == this.orderIntervalMinutes &&
|
|
other.allowCod == this.allowCod &&
|
|
other.maxDeliveryRadiusKm == this.maxDeliveryRadiusKm &&
|
|
other.deliveryFeeType == this.deliveryFeeType &&
|
|
other.deliveryFlatFee == this.deliveryFlatFee &&
|
|
other.deliveryFeePerKm == this.deliveryFeePerKm &&
|
|
other.deliveryBaseFee == this.deliveryBaseFee &&
|
|
other.reviewDisplayType == this.reviewDisplayType &&
|
|
other.reviewDisplayPolicy == this.reviewDisplayPolicy &&
|
|
other.subscriptionLevel == this.subscriptionLevel &&
|
|
other.limitOutlet == this.limitOutlet &&
|
|
other.subscriptionExpiresAt == this.subscriptionExpiresAt &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class TenantsCompanion extends UpdateCompanion<Tenant> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> businessCode;
|
|
final Value<String> businessName;
|
|
final Value<String?> businessEmail;
|
|
final Value<String?> businessPhone;
|
|
final Value<String?> businessType;
|
|
final Value<String?> localLogoPath;
|
|
final Value<String?> serverLogoUrl;
|
|
final Value<String?> subdomain;
|
|
final Value<String?> onlinStoreName;
|
|
final Value<String?> onlineOpenTime;
|
|
final Value<String?> onlineCloseTime;
|
|
final Value<bool> isCloseService;
|
|
final Value<int> preparationTimeMinutes;
|
|
final Value<int> orderIntervalMinutes;
|
|
final Value<bool> allowCod;
|
|
final Value<double> maxDeliveryRadiusKm;
|
|
final Value<String> deliveryFeeType;
|
|
final Value<double> deliveryFlatFee;
|
|
final Value<double> deliveryFeePerKm;
|
|
final Value<double> deliveryBaseFee;
|
|
final Value<String> reviewDisplayType;
|
|
final Value<String> reviewDisplayPolicy;
|
|
final Value<String> subscriptionLevel;
|
|
final Value<int> limitOutlet;
|
|
final Value<DateTime?> subscriptionExpiresAt;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const TenantsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.businessCode = const Value.absent(),
|
|
this.businessName = const Value.absent(),
|
|
this.businessEmail = const Value.absent(),
|
|
this.businessPhone = const Value.absent(),
|
|
this.businessType = const Value.absent(),
|
|
this.localLogoPath = const Value.absent(),
|
|
this.serverLogoUrl = const Value.absent(),
|
|
this.subdomain = const Value.absent(),
|
|
this.onlinStoreName = const Value.absent(),
|
|
this.onlineOpenTime = const Value.absent(),
|
|
this.onlineCloseTime = const Value.absent(),
|
|
this.isCloseService = const Value.absent(),
|
|
this.preparationTimeMinutes = const Value.absent(),
|
|
this.orderIntervalMinutes = const Value.absent(),
|
|
this.allowCod = const Value.absent(),
|
|
this.maxDeliveryRadiusKm = const Value.absent(),
|
|
this.deliveryFeeType = const Value.absent(),
|
|
this.deliveryFlatFee = const Value.absent(),
|
|
this.deliveryFeePerKm = const Value.absent(),
|
|
this.deliveryBaseFee = const Value.absent(),
|
|
this.reviewDisplayType = const Value.absent(),
|
|
this.reviewDisplayPolicy = const Value.absent(),
|
|
this.subscriptionLevel = const Value.absent(),
|
|
this.limitOutlet = const Value.absent(),
|
|
this.subscriptionExpiresAt = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
TenantsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String businessCode,
|
|
required String businessName,
|
|
this.businessEmail = const Value.absent(),
|
|
this.businessPhone = const Value.absent(),
|
|
this.businessType = const Value.absent(),
|
|
this.localLogoPath = const Value.absent(),
|
|
this.serverLogoUrl = const Value.absent(),
|
|
this.subdomain = const Value.absent(),
|
|
this.onlinStoreName = const Value.absent(),
|
|
this.onlineOpenTime = const Value.absent(),
|
|
this.onlineCloseTime = const Value.absent(),
|
|
this.isCloseService = const Value.absent(),
|
|
this.preparationTimeMinutes = const Value.absent(),
|
|
this.orderIntervalMinutes = const Value.absent(),
|
|
this.allowCod = const Value.absent(),
|
|
this.maxDeliveryRadiusKm = const Value.absent(),
|
|
this.deliveryFeeType = const Value.absent(),
|
|
this.deliveryFlatFee = const Value.absent(),
|
|
this.deliveryFeePerKm = const Value.absent(),
|
|
this.deliveryBaseFee = const Value.absent(),
|
|
this.reviewDisplayType = const Value.absent(),
|
|
this.reviewDisplayPolicy = const Value.absent(),
|
|
this.subscriptionLevel = const Value.absent(),
|
|
this.limitOutlet = const Value.absent(),
|
|
this.subscriptionExpiresAt = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : businessCode = Value(businessCode),
|
|
businessName = Value(businessName);
|
|
static Insertable<Tenant> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? businessCode,
|
|
Expression<String>? businessName,
|
|
Expression<String>? businessEmail,
|
|
Expression<String>? businessPhone,
|
|
Expression<String>? businessType,
|
|
Expression<String>? localLogoPath,
|
|
Expression<String>? serverLogoUrl,
|
|
Expression<String>? subdomain,
|
|
Expression<String>? onlinStoreName,
|
|
Expression<String>? onlineOpenTime,
|
|
Expression<String>? onlineCloseTime,
|
|
Expression<bool>? isCloseService,
|
|
Expression<int>? preparationTimeMinutes,
|
|
Expression<int>? orderIntervalMinutes,
|
|
Expression<bool>? allowCod,
|
|
Expression<double>? maxDeliveryRadiusKm,
|
|
Expression<String>? deliveryFeeType,
|
|
Expression<double>? deliveryFlatFee,
|
|
Expression<double>? deliveryFeePerKm,
|
|
Expression<double>? deliveryBaseFee,
|
|
Expression<String>? reviewDisplayType,
|
|
Expression<String>? reviewDisplayPolicy,
|
|
Expression<String>? subscriptionLevel,
|
|
Expression<int>? limitOutlet,
|
|
Expression<DateTime>? subscriptionExpiresAt,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (businessCode != null) 'business_code': businessCode,
|
|
if (businessName != null) 'business_name': businessName,
|
|
if (businessEmail != null) 'business_email': businessEmail,
|
|
if (businessPhone != null) 'business_phone': businessPhone,
|
|
if (businessType != null) 'business_type': businessType,
|
|
if (localLogoPath != null) 'local_logo_path': localLogoPath,
|
|
if (serverLogoUrl != null) 'server_logo_url': serverLogoUrl,
|
|
if (subdomain != null) 'subdomain': subdomain,
|
|
if (onlinStoreName != null) 'onlin_store_name': onlinStoreName,
|
|
if (onlineOpenTime != null) 'online_open_time': onlineOpenTime,
|
|
if (onlineCloseTime != null) 'online_close_time': onlineCloseTime,
|
|
if (isCloseService != null) 'is_close_service': isCloseService,
|
|
if (preparationTimeMinutes != null)
|
|
'preparation_time_minutes': preparationTimeMinutes,
|
|
if (orderIntervalMinutes != null)
|
|
'order_interval_minutes': orderIntervalMinutes,
|
|
if (allowCod != null) 'allow_cod': allowCod,
|
|
if (maxDeliveryRadiusKm != null)
|
|
'max_delivery_radius_km': maxDeliveryRadiusKm,
|
|
if (deliveryFeeType != null) 'delivery_fee_type': deliveryFeeType,
|
|
if (deliveryFlatFee != null) 'delivery_flat_fee': deliveryFlatFee,
|
|
if (deliveryFeePerKm != null) 'delivery_fee_per_km': deliveryFeePerKm,
|
|
if (deliveryBaseFee != null) 'delivery_base_fee': deliveryBaseFee,
|
|
if (reviewDisplayType != null) 'review_display_type': reviewDisplayType,
|
|
if (reviewDisplayPolicy != null)
|
|
'review_display_policy': reviewDisplayPolicy,
|
|
if (subscriptionLevel != null) 'subscription_level': subscriptionLevel,
|
|
if (limitOutlet != null) 'limit_outlet': limitOutlet,
|
|
if (subscriptionExpiresAt != null)
|
|
'subscription_expires_at': subscriptionExpiresAt,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
TenantsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? businessCode,
|
|
Value<String>? businessName,
|
|
Value<String?>? businessEmail,
|
|
Value<String?>? businessPhone,
|
|
Value<String?>? businessType,
|
|
Value<String?>? localLogoPath,
|
|
Value<String?>? serverLogoUrl,
|
|
Value<String?>? subdomain,
|
|
Value<String?>? onlinStoreName,
|
|
Value<String?>? onlineOpenTime,
|
|
Value<String?>? onlineCloseTime,
|
|
Value<bool>? isCloseService,
|
|
Value<int>? preparationTimeMinutes,
|
|
Value<int>? orderIntervalMinutes,
|
|
Value<bool>? allowCod,
|
|
Value<double>? maxDeliveryRadiusKm,
|
|
Value<String>? deliveryFeeType,
|
|
Value<double>? deliveryFlatFee,
|
|
Value<double>? deliveryFeePerKm,
|
|
Value<double>? deliveryBaseFee,
|
|
Value<String>? reviewDisplayType,
|
|
Value<String>? reviewDisplayPolicy,
|
|
Value<String>? subscriptionLevel,
|
|
Value<int>? limitOutlet,
|
|
Value<DateTime?>? subscriptionExpiresAt,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return TenantsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
businessCode: businessCode ?? this.businessCode,
|
|
businessName: businessName ?? this.businessName,
|
|
businessEmail: businessEmail ?? this.businessEmail,
|
|
businessPhone: businessPhone ?? this.businessPhone,
|
|
businessType: businessType ?? this.businessType,
|
|
localLogoPath: localLogoPath ?? this.localLogoPath,
|
|
serverLogoUrl: serverLogoUrl ?? this.serverLogoUrl,
|
|
subdomain: subdomain ?? this.subdomain,
|
|
onlinStoreName: onlinStoreName ?? this.onlinStoreName,
|
|
onlineOpenTime: onlineOpenTime ?? this.onlineOpenTime,
|
|
onlineCloseTime: onlineCloseTime ?? this.onlineCloseTime,
|
|
isCloseService: isCloseService ?? this.isCloseService,
|
|
preparationTimeMinutes:
|
|
preparationTimeMinutes ?? this.preparationTimeMinutes,
|
|
orderIntervalMinutes: orderIntervalMinutes ?? this.orderIntervalMinutes,
|
|
allowCod: allowCod ?? this.allowCod,
|
|
maxDeliveryRadiusKm: maxDeliveryRadiusKm ?? this.maxDeliveryRadiusKm,
|
|
deliveryFeeType: deliveryFeeType ?? this.deliveryFeeType,
|
|
deliveryFlatFee: deliveryFlatFee ?? this.deliveryFlatFee,
|
|
deliveryFeePerKm: deliveryFeePerKm ?? this.deliveryFeePerKm,
|
|
deliveryBaseFee: deliveryBaseFee ?? this.deliveryBaseFee,
|
|
reviewDisplayType: reviewDisplayType ?? this.reviewDisplayType,
|
|
reviewDisplayPolicy: reviewDisplayPolicy ?? this.reviewDisplayPolicy,
|
|
subscriptionLevel: subscriptionLevel ?? this.subscriptionLevel,
|
|
limitOutlet: limitOutlet ?? this.limitOutlet,
|
|
subscriptionExpiresAt:
|
|
subscriptionExpiresAt ?? this.subscriptionExpiresAt,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (businessCode.present) {
|
|
map['business_code'] = Variable<String>(businessCode.value);
|
|
}
|
|
if (businessName.present) {
|
|
map['business_name'] = Variable<String>(businessName.value);
|
|
}
|
|
if (businessEmail.present) {
|
|
map['business_email'] = Variable<String>(businessEmail.value);
|
|
}
|
|
if (businessPhone.present) {
|
|
map['business_phone'] = Variable<String>(businessPhone.value);
|
|
}
|
|
if (businessType.present) {
|
|
map['business_type'] = Variable<String>(businessType.value);
|
|
}
|
|
if (localLogoPath.present) {
|
|
map['local_logo_path'] = Variable<String>(localLogoPath.value);
|
|
}
|
|
if (serverLogoUrl.present) {
|
|
map['server_logo_url'] = Variable<String>(serverLogoUrl.value);
|
|
}
|
|
if (subdomain.present) {
|
|
map['subdomain'] = Variable<String>(subdomain.value);
|
|
}
|
|
if (onlinStoreName.present) {
|
|
map['onlin_store_name'] = Variable<String>(onlinStoreName.value);
|
|
}
|
|
if (onlineOpenTime.present) {
|
|
map['online_open_time'] = Variable<String>(onlineOpenTime.value);
|
|
}
|
|
if (onlineCloseTime.present) {
|
|
map['online_close_time'] = Variable<String>(onlineCloseTime.value);
|
|
}
|
|
if (isCloseService.present) {
|
|
map['is_close_service'] = Variable<bool>(isCloseService.value);
|
|
}
|
|
if (preparationTimeMinutes.present) {
|
|
map['preparation_time_minutes'] = Variable<int>(
|
|
preparationTimeMinutes.value,
|
|
);
|
|
}
|
|
if (orderIntervalMinutes.present) {
|
|
map['order_interval_minutes'] = Variable<int>(orderIntervalMinutes.value);
|
|
}
|
|
if (allowCod.present) {
|
|
map['allow_cod'] = Variable<bool>(allowCod.value);
|
|
}
|
|
if (maxDeliveryRadiusKm.present) {
|
|
map['max_delivery_radius_km'] = Variable<double>(
|
|
maxDeliveryRadiusKm.value,
|
|
);
|
|
}
|
|
if (deliveryFeeType.present) {
|
|
map['delivery_fee_type'] = Variable<String>(deliveryFeeType.value);
|
|
}
|
|
if (deliveryFlatFee.present) {
|
|
map['delivery_flat_fee'] = Variable<double>(deliveryFlatFee.value);
|
|
}
|
|
if (deliveryFeePerKm.present) {
|
|
map['delivery_fee_per_km'] = Variable<double>(deliveryFeePerKm.value);
|
|
}
|
|
if (deliveryBaseFee.present) {
|
|
map['delivery_base_fee'] = Variable<double>(deliveryBaseFee.value);
|
|
}
|
|
if (reviewDisplayType.present) {
|
|
map['review_display_type'] = Variable<String>(reviewDisplayType.value);
|
|
}
|
|
if (reviewDisplayPolicy.present) {
|
|
map['review_display_policy'] = Variable<String>(
|
|
reviewDisplayPolicy.value,
|
|
);
|
|
}
|
|
if (subscriptionLevel.present) {
|
|
map['subscription_level'] = Variable<String>(subscriptionLevel.value);
|
|
}
|
|
if (limitOutlet.present) {
|
|
map['limit_outlet'] = Variable<int>(limitOutlet.value);
|
|
}
|
|
if (subscriptionExpiresAt.present) {
|
|
map['subscription_expires_at'] = Variable<DateTime>(
|
|
subscriptionExpiresAt.value,
|
|
);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('TenantsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('businessCode: $businessCode, ')
|
|
..write('businessName: $businessName, ')
|
|
..write('businessEmail: $businessEmail, ')
|
|
..write('businessPhone: $businessPhone, ')
|
|
..write('businessType: $businessType, ')
|
|
..write('localLogoPath: $localLogoPath, ')
|
|
..write('serverLogoUrl: $serverLogoUrl, ')
|
|
..write('subdomain: $subdomain, ')
|
|
..write('onlinStoreName: $onlinStoreName, ')
|
|
..write('onlineOpenTime: $onlineOpenTime, ')
|
|
..write('onlineCloseTime: $onlineCloseTime, ')
|
|
..write('isCloseService: $isCloseService, ')
|
|
..write('preparationTimeMinutes: $preparationTimeMinutes, ')
|
|
..write('orderIntervalMinutes: $orderIntervalMinutes, ')
|
|
..write('allowCod: $allowCod, ')
|
|
..write('maxDeliveryRadiusKm: $maxDeliveryRadiusKm, ')
|
|
..write('deliveryFeeType: $deliveryFeeType, ')
|
|
..write('deliveryFlatFee: $deliveryFlatFee, ')
|
|
..write('deliveryFeePerKm: $deliveryFeePerKm, ')
|
|
..write('deliveryBaseFee: $deliveryBaseFee, ')
|
|
..write('reviewDisplayType: $reviewDisplayType, ')
|
|
..write('reviewDisplayPolicy: $reviewDisplayPolicy, ')
|
|
..write('subscriptionLevel: $subscriptionLevel, ')
|
|
..write('limitOutlet: $limitOutlet, ')
|
|
..write('subscriptionExpiresAt: $subscriptionExpiresAt, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $TenantPaymentMethodsTable extends TenantPaymentMethods
|
|
with TableInfo<$TenantPaymentMethodsTable, TenantPaymentMethod> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$TenantPaymentMethodsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _sourceNameMeta = const VerificationMeta(
|
|
'sourceName',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> sourceName = GeneratedColumn<String>(
|
|
'source_name',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _accountNumberMeta = const VerificationMeta(
|
|
'accountNumber',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> accountNumber = GeneratedColumn<String>(
|
|
'account_number',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _receipentNameMeta = const VerificationMeta(
|
|
'receipentName',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> receipentName = GeneratedColumn<String>(
|
|
'receipent_name',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
sourceName,
|
|
accountNumber,
|
|
receipentName,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'tenant_payment_methods';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<TenantPaymentMethod> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('source_name')) {
|
|
context.handle(
|
|
_sourceNameMeta,
|
|
sourceName.isAcceptableOrUnknown(data['source_name']!, _sourceNameMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('account_number')) {
|
|
context.handle(
|
|
_accountNumberMeta,
|
|
accountNumber.isAcceptableOrUnknown(
|
|
data['account_number']!,
|
|
_accountNumberMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('receipent_name')) {
|
|
context.handle(
|
|
_receipentNameMeta,
|
|
receipentName.isAcceptableOrUnknown(
|
|
data['receipent_name']!,
|
|
_receipentNameMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
TenantPaymentMethod map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return TenantPaymentMethod(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
sourceName: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}source_name'],
|
|
),
|
|
accountNumber: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}account_number'],
|
|
),
|
|
receipentName: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}receipent_name'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$TenantPaymentMethodsTable createAlias(String alias) {
|
|
return $TenantPaymentMethodsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class TenantPaymentMethod extends DataClass
|
|
implements Insertable<TenantPaymentMethod> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String? sourceName;
|
|
final String? accountNumber;
|
|
final String? receipentName;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const TenantPaymentMethod({
|
|
required this.localId,
|
|
this.serverId,
|
|
this.sourceName,
|
|
this.accountNumber,
|
|
this.receipentName,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
if (!nullToAbsent || sourceName != null) {
|
|
map['source_name'] = Variable<String>(sourceName);
|
|
}
|
|
if (!nullToAbsent || accountNumber != null) {
|
|
map['account_number'] = Variable<String>(accountNumber);
|
|
}
|
|
if (!nullToAbsent || receipentName != null) {
|
|
map['receipent_name'] = Variable<String>(receipentName);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
TenantPaymentMethodsCompanion toCompanion(bool nullToAbsent) {
|
|
return TenantPaymentMethodsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
sourceName: sourceName == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(sourceName),
|
|
accountNumber: accountNumber == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(accountNumber),
|
|
receipentName: receipentName == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(receipentName),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory TenantPaymentMethod.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return TenantPaymentMethod(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
sourceName: serializer.fromJson<String?>(json['sourceName']),
|
|
accountNumber: serializer.fromJson<String?>(json['accountNumber']),
|
|
receipentName: serializer.fromJson<String?>(json['receipentName']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'sourceName': serializer.toJson<String?>(sourceName),
|
|
'accountNumber': serializer.toJson<String?>(accountNumber),
|
|
'receipentName': serializer.toJson<String?>(receipentName),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
TenantPaymentMethod copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> sourceName = const Value.absent(),
|
|
Value<String?> accountNumber = const Value.absent(),
|
|
Value<String?> receipentName = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => TenantPaymentMethod(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
sourceName: sourceName.present ? sourceName.value : this.sourceName,
|
|
accountNumber: accountNumber.present
|
|
? accountNumber.value
|
|
: this.accountNumber,
|
|
receipentName: receipentName.present
|
|
? receipentName.value
|
|
: this.receipentName,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
TenantPaymentMethod copyWithCompanion(TenantPaymentMethodsCompanion data) {
|
|
return TenantPaymentMethod(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
sourceName: data.sourceName.present
|
|
? data.sourceName.value
|
|
: this.sourceName,
|
|
accountNumber: data.accountNumber.present
|
|
? data.accountNumber.value
|
|
: this.accountNumber,
|
|
receipentName: data.receipentName.present
|
|
? data.receipentName.value
|
|
: this.receipentName,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('TenantPaymentMethod(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('sourceName: $sourceName, ')
|
|
..write('accountNumber: $accountNumber, ')
|
|
..write('receipentName: $receipentName, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
sourceName,
|
|
accountNumber,
|
|
receipentName,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is TenantPaymentMethod &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.sourceName == this.sourceName &&
|
|
other.accountNumber == this.accountNumber &&
|
|
other.receipentName == this.receipentName &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class TenantPaymentMethodsCompanion
|
|
extends UpdateCompanion<TenantPaymentMethod> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String?> sourceName;
|
|
final Value<String?> accountNumber;
|
|
final Value<String?> receipentName;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const TenantPaymentMethodsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.sourceName = const Value.absent(),
|
|
this.accountNumber = const Value.absent(),
|
|
this.receipentName = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
TenantPaymentMethodsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.sourceName = const Value.absent(),
|
|
this.accountNumber = const Value.absent(),
|
|
this.receipentName = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
static Insertable<TenantPaymentMethod> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? sourceName,
|
|
Expression<String>? accountNumber,
|
|
Expression<String>? receipentName,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (sourceName != null) 'source_name': sourceName,
|
|
if (accountNumber != null) 'account_number': accountNumber,
|
|
if (receipentName != null) 'receipent_name': receipentName,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
TenantPaymentMethodsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String?>? sourceName,
|
|
Value<String?>? accountNumber,
|
|
Value<String?>? receipentName,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return TenantPaymentMethodsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
sourceName: sourceName ?? this.sourceName,
|
|
accountNumber: accountNumber ?? this.accountNumber,
|
|
receipentName: receipentName ?? this.receipentName,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (sourceName.present) {
|
|
map['source_name'] = Variable<String>(sourceName.value);
|
|
}
|
|
if (accountNumber.present) {
|
|
map['account_number'] = Variable<String>(accountNumber.value);
|
|
}
|
|
if (receipentName.present) {
|
|
map['receipent_name'] = Variable<String>(receipentName.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('TenantPaymentMethodsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('sourceName: $sourceName, ')
|
|
..write('accountNumber: $accountNumber, ')
|
|
..write('receipentName: $receipentName, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $OutletsTable extends Outlets with TableInfo<$OutletsTable, Outlet> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$OutletsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _emailMeta = const VerificationMeta('email');
|
|
@override
|
|
late final GeneratedColumn<String> email = GeneratedColumn<String>(
|
|
'email',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _phoneNumberMeta = const VerificationMeta(
|
|
'phoneNumber',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> phoneNumber = GeneratedColumn<String>(
|
|
'phone_number',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _fullAddressMeta = const VerificationMeta(
|
|
'fullAddress',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> fullAddress = GeneratedColumn<String>(
|
|
'full_address',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _latitudeMeta = const VerificationMeta(
|
|
'latitude',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> latitude = GeneratedColumn<double>(
|
|
'latitude',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _longitudeMeta = const VerificationMeta(
|
|
'longitude',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> longitude = GeneratedColumn<double>(
|
|
'longitude',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _localPhotoPathMeta = const VerificationMeta(
|
|
'localPhotoPath',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localPhotoPath = GeneratedColumn<String>(
|
|
'local_photo_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _localBannerPathMeta = const VerificationMeta(
|
|
'localBannerPath',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localBannerPath = GeneratedColumn<String>(
|
|
'local_banner_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _serverPhotoUrlMeta = const VerificationMeta(
|
|
'serverPhotoUrl',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverPhotoUrl = GeneratedColumn<String>(
|
|
'server_photo_url',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _serverBannerUrlMeta = const VerificationMeta(
|
|
'serverBannerUrl',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverBannerUrl = GeneratedColumn<String>(
|
|
'server_banner_url',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _isMainOutletMeta = const VerificationMeta(
|
|
'isMainOutlet',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isMainOutlet = GeneratedColumn<bool>(
|
|
'is_main_outlet',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_main_outlet" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _isActiveMeta = const VerificationMeta(
|
|
'isActive',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isActive = GeneratedColumn<bool>(
|
|
'is_active',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_active" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(true),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
name,
|
|
email,
|
|
phoneNumber,
|
|
fullAddress,
|
|
latitude,
|
|
longitude,
|
|
localPhotoPath,
|
|
localBannerPath,
|
|
serverPhotoUrl,
|
|
serverBannerUrl,
|
|
isMainOutlet,
|
|
isActive,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'outlets';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Outlet> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('email')) {
|
|
context.handle(
|
|
_emailMeta,
|
|
email.isAcceptableOrUnknown(data['email']!, _emailMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('phone_number')) {
|
|
context.handle(
|
|
_phoneNumberMeta,
|
|
phoneNumber.isAcceptableOrUnknown(
|
|
data['phone_number']!,
|
|
_phoneNumberMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('full_address')) {
|
|
context.handle(
|
|
_fullAddressMeta,
|
|
fullAddress.isAcceptableOrUnknown(
|
|
data['full_address']!,
|
|
_fullAddressMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('latitude')) {
|
|
context.handle(
|
|
_latitudeMeta,
|
|
latitude.isAcceptableOrUnknown(data['latitude']!, _latitudeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('longitude')) {
|
|
context.handle(
|
|
_longitudeMeta,
|
|
longitude.isAcceptableOrUnknown(data['longitude']!, _longitudeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('local_photo_path')) {
|
|
context.handle(
|
|
_localPhotoPathMeta,
|
|
localPhotoPath.isAcceptableOrUnknown(
|
|
data['local_photo_path']!,
|
|
_localPhotoPathMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('local_banner_path')) {
|
|
context.handle(
|
|
_localBannerPathMeta,
|
|
localBannerPath.isAcceptableOrUnknown(
|
|
data['local_banner_path']!,
|
|
_localBannerPathMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('server_photo_url')) {
|
|
context.handle(
|
|
_serverPhotoUrlMeta,
|
|
serverPhotoUrl.isAcceptableOrUnknown(
|
|
data['server_photo_url']!,
|
|
_serverPhotoUrlMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('server_banner_url')) {
|
|
context.handle(
|
|
_serverBannerUrlMeta,
|
|
serverBannerUrl.isAcceptableOrUnknown(
|
|
data['server_banner_url']!,
|
|
_serverBannerUrlMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('is_main_outlet')) {
|
|
context.handle(
|
|
_isMainOutletMeta,
|
|
isMainOutlet.isAcceptableOrUnknown(
|
|
data['is_main_outlet']!,
|
|
_isMainOutletMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('is_active')) {
|
|
context.handle(
|
|
_isActiveMeta,
|
|
isActive.isAcceptableOrUnknown(data['is_active']!, _isActiveMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Outlet map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Outlet(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
email: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}email'],
|
|
),
|
|
phoneNumber: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}phone_number'],
|
|
),
|
|
fullAddress: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}full_address'],
|
|
),
|
|
latitude: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}latitude'],
|
|
),
|
|
longitude: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}longitude'],
|
|
),
|
|
localPhotoPath: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_photo_path'],
|
|
),
|
|
localBannerPath: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_banner_path'],
|
|
),
|
|
serverPhotoUrl: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_photo_url'],
|
|
),
|
|
serverBannerUrl: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_banner_url'],
|
|
),
|
|
isMainOutlet: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_main_outlet'],
|
|
)!,
|
|
isActive: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_active'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$OutletsTable createAlias(String alias) {
|
|
return $OutletsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Outlet extends DataClass implements Insertable<Outlet> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String name;
|
|
final String? email;
|
|
final String? phoneNumber;
|
|
final String? fullAddress;
|
|
final double? latitude;
|
|
final double? longitude;
|
|
final String? localPhotoPath;
|
|
final String? localBannerPath;
|
|
final String? serverPhotoUrl;
|
|
final String? serverBannerUrl;
|
|
final bool isMainOutlet;
|
|
final bool isActive;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const Outlet({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.name,
|
|
this.email,
|
|
this.phoneNumber,
|
|
this.fullAddress,
|
|
this.latitude,
|
|
this.longitude,
|
|
this.localPhotoPath,
|
|
this.localBannerPath,
|
|
this.serverPhotoUrl,
|
|
this.serverBannerUrl,
|
|
required this.isMainOutlet,
|
|
required this.isActive,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || email != null) {
|
|
map['email'] = Variable<String>(email);
|
|
}
|
|
if (!nullToAbsent || phoneNumber != null) {
|
|
map['phone_number'] = Variable<String>(phoneNumber);
|
|
}
|
|
if (!nullToAbsent || fullAddress != null) {
|
|
map['full_address'] = Variable<String>(fullAddress);
|
|
}
|
|
if (!nullToAbsent || latitude != null) {
|
|
map['latitude'] = Variable<double>(latitude);
|
|
}
|
|
if (!nullToAbsent || longitude != null) {
|
|
map['longitude'] = Variable<double>(longitude);
|
|
}
|
|
if (!nullToAbsent || localPhotoPath != null) {
|
|
map['local_photo_path'] = Variable<String>(localPhotoPath);
|
|
}
|
|
if (!nullToAbsent || localBannerPath != null) {
|
|
map['local_banner_path'] = Variable<String>(localBannerPath);
|
|
}
|
|
if (!nullToAbsent || serverPhotoUrl != null) {
|
|
map['server_photo_url'] = Variable<String>(serverPhotoUrl);
|
|
}
|
|
if (!nullToAbsent || serverBannerUrl != null) {
|
|
map['server_banner_url'] = Variable<String>(serverBannerUrl);
|
|
}
|
|
map['is_main_outlet'] = Variable<bool>(isMainOutlet);
|
|
map['is_active'] = Variable<bool>(isActive);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
OutletsCompanion toCompanion(bool nullToAbsent) {
|
|
return OutletsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
name: Value(name),
|
|
email: email == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(email),
|
|
phoneNumber: phoneNumber == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(phoneNumber),
|
|
fullAddress: fullAddress == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(fullAddress),
|
|
latitude: latitude == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(latitude),
|
|
longitude: longitude == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(longitude),
|
|
localPhotoPath: localPhotoPath == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(localPhotoPath),
|
|
localBannerPath: localBannerPath == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(localBannerPath),
|
|
serverPhotoUrl: serverPhotoUrl == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverPhotoUrl),
|
|
serverBannerUrl: serverBannerUrl == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverBannerUrl),
|
|
isMainOutlet: Value(isMainOutlet),
|
|
isActive: Value(isActive),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory Outlet.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Outlet(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
email: serializer.fromJson<String?>(json['email']),
|
|
phoneNumber: serializer.fromJson<String?>(json['phoneNumber']),
|
|
fullAddress: serializer.fromJson<String?>(json['fullAddress']),
|
|
latitude: serializer.fromJson<double?>(json['latitude']),
|
|
longitude: serializer.fromJson<double?>(json['longitude']),
|
|
localPhotoPath: serializer.fromJson<String?>(json['localPhotoPath']),
|
|
localBannerPath: serializer.fromJson<String?>(json['localBannerPath']),
|
|
serverPhotoUrl: serializer.fromJson<String?>(json['serverPhotoUrl']),
|
|
serverBannerUrl: serializer.fromJson<String?>(json['serverBannerUrl']),
|
|
isMainOutlet: serializer.fromJson<bool>(json['isMainOutlet']),
|
|
isActive: serializer.fromJson<bool>(json['isActive']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'name': serializer.toJson<String>(name),
|
|
'email': serializer.toJson<String?>(email),
|
|
'phoneNumber': serializer.toJson<String?>(phoneNumber),
|
|
'fullAddress': serializer.toJson<String?>(fullAddress),
|
|
'latitude': serializer.toJson<double?>(latitude),
|
|
'longitude': serializer.toJson<double?>(longitude),
|
|
'localPhotoPath': serializer.toJson<String?>(localPhotoPath),
|
|
'localBannerPath': serializer.toJson<String?>(localBannerPath),
|
|
'serverPhotoUrl': serializer.toJson<String?>(serverPhotoUrl),
|
|
'serverBannerUrl': serializer.toJson<String?>(serverBannerUrl),
|
|
'isMainOutlet': serializer.toJson<bool>(isMainOutlet),
|
|
'isActive': serializer.toJson<bool>(isActive),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
Outlet copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? name,
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> fullAddress = const Value.absent(),
|
|
Value<double?> latitude = const Value.absent(),
|
|
Value<double?> longitude = const Value.absent(),
|
|
Value<String?> localPhotoPath = const Value.absent(),
|
|
Value<String?> localBannerPath = const Value.absent(),
|
|
Value<String?> serverPhotoUrl = const Value.absent(),
|
|
Value<String?> serverBannerUrl = const Value.absent(),
|
|
bool? isMainOutlet,
|
|
bool? isActive,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => Outlet(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
name: name ?? this.name,
|
|
email: email.present ? email.value : this.email,
|
|
phoneNumber: phoneNumber.present ? phoneNumber.value : this.phoneNumber,
|
|
fullAddress: fullAddress.present ? fullAddress.value : this.fullAddress,
|
|
latitude: latitude.present ? latitude.value : this.latitude,
|
|
longitude: longitude.present ? longitude.value : this.longitude,
|
|
localPhotoPath: localPhotoPath.present
|
|
? localPhotoPath.value
|
|
: this.localPhotoPath,
|
|
localBannerPath: localBannerPath.present
|
|
? localBannerPath.value
|
|
: this.localBannerPath,
|
|
serverPhotoUrl: serverPhotoUrl.present
|
|
? serverPhotoUrl.value
|
|
: this.serverPhotoUrl,
|
|
serverBannerUrl: serverBannerUrl.present
|
|
? serverBannerUrl.value
|
|
: this.serverBannerUrl,
|
|
isMainOutlet: isMainOutlet ?? this.isMainOutlet,
|
|
isActive: isActive ?? this.isActive,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
Outlet copyWithCompanion(OutletsCompanion data) {
|
|
return Outlet(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
email: data.email.present ? data.email.value : this.email,
|
|
phoneNumber: data.phoneNumber.present
|
|
? data.phoneNumber.value
|
|
: this.phoneNumber,
|
|
fullAddress: data.fullAddress.present
|
|
? data.fullAddress.value
|
|
: this.fullAddress,
|
|
latitude: data.latitude.present ? data.latitude.value : this.latitude,
|
|
longitude: data.longitude.present ? data.longitude.value : this.longitude,
|
|
localPhotoPath: data.localPhotoPath.present
|
|
? data.localPhotoPath.value
|
|
: this.localPhotoPath,
|
|
localBannerPath: data.localBannerPath.present
|
|
? data.localBannerPath.value
|
|
: this.localBannerPath,
|
|
serverPhotoUrl: data.serverPhotoUrl.present
|
|
? data.serverPhotoUrl.value
|
|
: this.serverPhotoUrl,
|
|
serverBannerUrl: data.serverBannerUrl.present
|
|
? data.serverBannerUrl.value
|
|
: this.serverBannerUrl,
|
|
isMainOutlet: data.isMainOutlet.present
|
|
? data.isMainOutlet.value
|
|
: this.isMainOutlet,
|
|
isActive: data.isActive.present ? data.isActive.value : this.isActive,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Outlet(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('name: $name, ')
|
|
..write('email: $email, ')
|
|
..write('phoneNumber: $phoneNumber, ')
|
|
..write('fullAddress: $fullAddress, ')
|
|
..write('latitude: $latitude, ')
|
|
..write('longitude: $longitude, ')
|
|
..write('localPhotoPath: $localPhotoPath, ')
|
|
..write('localBannerPath: $localBannerPath, ')
|
|
..write('serverPhotoUrl: $serverPhotoUrl, ')
|
|
..write('serverBannerUrl: $serverBannerUrl, ')
|
|
..write('isMainOutlet: $isMainOutlet, ')
|
|
..write('isActive: $isActive, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
name,
|
|
email,
|
|
phoneNumber,
|
|
fullAddress,
|
|
latitude,
|
|
longitude,
|
|
localPhotoPath,
|
|
localBannerPath,
|
|
serverPhotoUrl,
|
|
serverBannerUrl,
|
|
isMainOutlet,
|
|
isActive,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Outlet &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.name == this.name &&
|
|
other.email == this.email &&
|
|
other.phoneNumber == this.phoneNumber &&
|
|
other.fullAddress == this.fullAddress &&
|
|
other.latitude == this.latitude &&
|
|
other.longitude == this.longitude &&
|
|
other.localPhotoPath == this.localPhotoPath &&
|
|
other.localBannerPath == this.localBannerPath &&
|
|
other.serverPhotoUrl == this.serverPhotoUrl &&
|
|
other.serverBannerUrl == this.serverBannerUrl &&
|
|
other.isMainOutlet == this.isMainOutlet &&
|
|
other.isActive == this.isActive &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class OutletsCompanion extends UpdateCompanion<Outlet> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> name;
|
|
final Value<String?> email;
|
|
final Value<String?> phoneNumber;
|
|
final Value<String?> fullAddress;
|
|
final Value<double?> latitude;
|
|
final Value<double?> longitude;
|
|
final Value<String?> localPhotoPath;
|
|
final Value<String?> localBannerPath;
|
|
final Value<String?> serverPhotoUrl;
|
|
final Value<String?> serverBannerUrl;
|
|
final Value<bool> isMainOutlet;
|
|
final Value<bool> isActive;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const OutletsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.email = const Value.absent(),
|
|
this.phoneNumber = const Value.absent(),
|
|
this.fullAddress = const Value.absent(),
|
|
this.latitude = const Value.absent(),
|
|
this.longitude = const Value.absent(),
|
|
this.localPhotoPath = const Value.absent(),
|
|
this.localBannerPath = const Value.absent(),
|
|
this.serverPhotoUrl = const Value.absent(),
|
|
this.serverBannerUrl = const Value.absent(),
|
|
this.isMainOutlet = const Value.absent(),
|
|
this.isActive = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
OutletsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String name,
|
|
this.email = const Value.absent(),
|
|
this.phoneNumber = const Value.absent(),
|
|
this.fullAddress = const Value.absent(),
|
|
this.latitude = const Value.absent(),
|
|
this.longitude = const Value.absent(),
|
|
this.localPhotoPath = const Value.absent(),
|
|
this.localBannerPath = const Value.absent(),
|
|
this.serverPhotoUrl = const Value.absent(),
|
|
this.serverBannerUrl = const Value.absent(),
|
|
this.isMainOutlet = const Value.absent(),
|
|
this.isActive = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : name = Value(name);
|
|
static Insertable<Outlet> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? name,
|
|
Expression<String>? email,
|
|
Expression<String>? phoneNumber,
|
|
Expression<String>? fullAddress,
|
|
Expression<double>? latitude,
|
|
Expression<double>? longitude,
|
|
Expression<String>? localPhotoPath,
|
|
Expression<String>? localBannerPath,
|
|
Expression<String>? serverPhotoUrl,
|
|
Expression<String>? serverBannerUrl,
|
|
Expression<bool>? isMainOutlet,
|
|
Expression<bool>? isActive,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (name != null) 'name': name,
|
|
if (email != null) 'email': email,
|
|
if (phoneNumber != null) 'phone_number': phoneNumber,
|
|
if (fullAddress != null) 'full_address': fullAddress,
|
|
if (latitude != null) 'latitude': latitude,
|
|
if (longitude != null) 'longitude': longitude,
|
|
if (localPhotoPath != null) 'local_photo_path': localPhotoPath,
|
|
if (localBannerPath != null) 'local_banner_path': localBannerPath,
|
|
if (serverPhotoUrl != null) 'server_photo_url': serverPhotoUrl,
|
|
if (serverBannerUrl != null) 'server_banner_url': serverBannerUrl,
|
|
if (isMainOutlet != null) 'is_main_outlet': isMainOutlet,
|
|
if (isActive != null) 'is_active': isActive,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
OutletsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? name,
|
|
Value<String?>? email,
|
|
Value<String?>? phoneNumber,
|
|
Value<String?>? fullAddress,
|
|
Value<double?>? latitude,
|
|
Value<double?>? longitude,
|
|
Value<String?>? localPhotoPath,
|
|
Value<String?>? localBannerPath,
|
|
Value<String?>? serverPhotoUrl,
|
|
Value<String?>? serverBannerUrl,
|
|
Value<bool>? isMainOutlet,
|
|
Value<bool>? isActive,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return OutletsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
name: name ?? this.name,
|
|
email: email ?? this.email,
|
|
phoneNumber: phoneNumber ?? this.phoneNumber,
|
|
fullAddress: fullAddress ?? this.fullAddress,
|
|
latitude: latitude ?? this.latitude,
|
|
longitude: longitude ?? this.longitude,
|
|
localPhotoPath: localPhotoPath ?? this.localPhotoPath,
|
|
localBannerPath: localBannerPath ?? this.localBannerPath,
|
|
serverPhotoUrl: serverPhotoUrl ?? this.serverPhotoUrl,
|
|
serverBannerUrl: serverBannerUrl ?? this.serverBannerUrl,
|
|
isMainOutlet: isMainOutlet ?? this.isMainOutlet,
|
|
isActive: isActive ?? this.isActive,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (email.present) {
|
|
map['email'] = Variable<String>(email.value);
|
|
}
|
|
if (phoneNumber.present) {
|
|
map['phone_number'] = Variable<String>(phoneNumber.value);
|
|
}
|
|
if (fullAddress.present) {
|
|
map['full_address'] = Variable<String>(fullAddress.value);
|
|
}
|
|
if (latitude.present) {
|
|
map['latitude'] = Variable<double>(latitude.value);
|
|
}
|
|
if (longitude.present) {
|
|
map['longitude'] = Variable<double>(longitude.value);
|
|
}
|
|
if (localPhotoPath.present) {
|
|
map['local_photo_path'] = Variable<String>(localPhotoPath.value);
|
|
}
|
|
if (localBannerPath.present) {
|
|
map['local_banner_path'] = Variable<String>(localBannerPath.value);
|
|
}
|
|
if (serverPhotoUrl.present) {
|
|
map['server_photo_url'] = Variable<String>(serverPhotoUrl.value);
|
|
}
|
|
if (serverBannerUrl.present) {
|
|
map['server_banner_url'] = Variable<String>(serverBannerUrl.value);
|
|
}
|
|
if (isMainOutlet.present) {
|
|
map['is_main_outlet'] = Variable<bool>(isMainOutlet.value);
|
|
}
|
|
if (isActive.present) {
|
|
map['is_active'] = Variable<bool>(isActive.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('OutletsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('name: $name, ')
|
|
..write('email: $email, ')
|
|
..write('phoneNumber: $phoneNumber, ')
|
|
..write('fullAddress: $fullAddress, ')
|
|
..write('latitude: $latitude, ')
|
|
..write('longitude: $longitude, ')
|
|
..write('localPhotoPath: $localPhotoPath, ')
|
|
..write('localBannerPath: $localBannerPath, ')
|
|
..write('serverPhotoUrl: $serverPhotoUrl, ')
|
|
..write('serverBannerUrl: $serverBannerUrl, ')
|
|
..write('isMainOutlet: $isMainOutlet, ')
|
|
..write('isActive: $isActive, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $UsersTable extends Users with TableInfo<$UsersTable, User> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$UsersTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _outletIdMeta = const VerificationMeta(
|
|
'outletId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> outletId = GeneratedColumn<String>(
|
|
'outlet_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES outlets (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _emailMeta = const VerificationMeta('email');
|
|
@override
|
|
late final GeneratedColumn<String> email = GeneratedColumn<String>(
|
|
'email',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _phoneNumberMeta = const VerificationMeta(
|
|
'phoneNumber',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> phoneNumber = GeneratedColumn<String>(
|
|
'phone_number',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _passwordHashMeta = const VerificationMeta(
|
|
'passwordHash',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> passwordHash = GeneratedColumn<String>(
|
|
'password_hash',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _roleMeta = const VerificationMeta('role');
|
|
@override
|
|
late final GeneratedColumn<String> role = GeneratedColumn<String>(
|
|
'role',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _placeOfBirthMeta = const VerificationMeta(
|
|
'placeOfBirth',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> placeOfBirth = GeneratedColumn<String>(
|
|
'place_of_birth',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _dateOfBirthMeta = const VerificationMeta(
|
|
'dateOfBirth',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> dateOfBirth = GeneratedColumn<String>(
|
|
'date_of_birth',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _shiftNameMeta = const VerificationMeta(
|
|
'shiftName',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> shiftName = GeneratedColumn<String>(
|
|
'shift_name',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _shiftStartTimeMeta = const VerificationMeta(
|
|
'shiftStartTime',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> shiftStartTime = GeneratedColumn<String>(
|
|
'shift_start_time',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _shiftEndTimeMeta = const VerificationMeta(
|
|
'shiftEndTime',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> shiftEndTime = GeneratedColumn<String>(
|
|
'shift_end_time',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _isActiveMeta = const VerificationMeta(
|
|
'isActive',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isActive = GeneratedColumn<bool>(
|
|
'is_active',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_active" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(true),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
outletId,
|
|
name,
|
|
email,
|
|
phoneNumber,
|
|
passwordHash,
|
|
role,
|
|
placeOfBirth,
|
|
dateOfBirth,
|
|
shiftName,
|
|
shiftStartTime,
|
|
shiftEndTime,
|
|
isActive,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'users';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<User> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('outlet_id')) {
|
|
context.handle(
|
|
_outletIdMeta,
|
|
outletId.isAcceptableOrUnknown(data['outlet_id']!, _outletIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_outletIdMeta);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('email')) {
|
|
context.handle(
|
|
_emailMeta,
|
|
email.isAcceptableOrUnknown(data['email']!, _emailMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('phone_number')) {
|
|
context.handle(
|
|
_phoneNumberMeta,
|
|
phoneNumber.isAcceptableOrUnknown(
|
|
data['phone_number']!,
|
|
_phoneNumberMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('password_hash')) {
|
|
context.handle(
|
|
_passwordHashMeta,
|
|
passwordHash.isAcceptableOrUnknown(
|
|
data['password_hash']!,
|
|
_passwordHashMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('role')) {
|
|
context.handle(
|
|
_roleMeta,
|
|
role.isAcceptableOrUnknown(data['role']!, _roleMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_roleMeta);
|
|
}
|
|
if (data.containsKey('place_of_birth')) {
|
|
context.handle(
|
|
_placeOfBirthMeta,
|
|
placeOfBirth.isAcceptableOrUnknown(
|
|
data['place_of_birth']!,
|
|
_placeOfBirthMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('date_of_birth')) {
|
|
context.handle(
|
|
_dateOfBirthMeta,
|
|
dateOfBirth.isAcceptableOrUnknown(
|
|
data['date_of_birth']!,
|
|
_dateOfBirthMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('shift_name')) {
|
|
context.handle(
|
|
_shiftNameMeta,
|
|
shiftName.isAcceptableOrUnknown(data['shift_name']!, _shiftNameMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('shift_start_time')) {
|
|
context.handle(
|
|
_shiftStartTimeMeta,
|
|
shiftStartTime.isAcceptableOrUnknown(
|
|
data['shift_start_time']!,
|
|
_shiftStartTimeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('shift_end_time')) {
|
|
context.handle(
|
|
_shiftEndTimeMeta,
|
|
shiftEndTime.isAcceptableOrUnknown(
|
|
data['shift_end_time']!,
|
|
_shiftEndTimeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('is_active')) {
|
|
context.handle(
|
|
_isActiveMeta,
|
|
isActive.isAcceptableOrUnknown(data['is_active']!, _isActiveMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
User map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return User(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
outletId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_id'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
email: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}email'],
|
|
),
|
|
phoneNumber: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}phone_number'],
|
|
),
|
|
passwordHash: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}password_hash'],
|
|
),
|
|
role: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}role'],
|
|
)!,
|
|
placeOfBirth: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}place_of_birth'],
|
|
),
|
|
dateOfBirth: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}date_of_birth'],
|
|
),
|
|
shiftName: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}shift_name'],
|
|
),
|
|
shiftStartTime: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}shift_start_time'],
|
|
),
|
|
shiftEndTime: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}shift_end_time'],
|
|
),
|
|
isActive: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_active'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$UsersTable createAlias(String alias) {
|
|
return $UsersTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class User extends DataClass implements Insertable<User> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String outletId;
|
|
final String name;
|
|
final String? email;
|
|
final String? phoneNumber;
|
|
final String? passwordHash;
|
|
final String role;
|
|
final String? placeOfBirth;
|
|
final String? dateOfBirth;
|
|
final String? shiftName;
|
|
final String? shiftStartTime;
|
|
final String? shiftEndTime;
|
|
final bool isActive;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const User({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.outletId,
|
|
required this.name,
|
|
this.email,
|
|
this.phoneNumber,
|
|
this.passwordHash,
|
|
required this.role,
|
|
this.placeOfBirth,
|
|
this.dateOfBirth,
|
|
this.shiftName,
|
|
this.shiftStartTime,
|
|
this.shiftEndTime,
|
|
required this.isActive,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['outlet_id'] = Variable<String>(outletId);
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || email != null) {
|
|
map['email'] = Variable<String>(email);
|
|
}
|
|
if (!nullToAbsent || phoneNumber != null) {
|
|
map['phone_number'] = Variable<String>(phoneNumber);
|
|
}
|
|
if (!nullToAbsent || passwordHash != null) {
|
|
map['password_hash'] = Variable<String>(passwordHash);
|
|
}
|
|
map['role'] = Variable<String>(role);
|
|
if (!nullToAbsent || placeOfBirth != null) {
|
|
map['place_of_birth'] = Variable<String>(placeOfBirth);
|
|
}
|
|
if (!nullToAbsent || dateOfBirth != null) {
|
|
map['date_of_birth'] = Variable<String>(dateOfBirth);
|
|
}
|
|
if (!nullToAbsent || shiftName != null) {
|
|
map['shift_name'] = Variable<String>(shiftName);
|
|
}
|
|
if (!nullToAbsent || shiftStartTime != null) {
|
|
map['shift_start_time'] = Variable<String>(shiftStartTime);
|
|
}
|
|
if (!nullToAbsent || shiftEndTime != null) {
|
|
map['shift_end_time'] = Variable<String>(shiftEndTime);
|
|
}
|
|
map['is_active'] = Variable<bool>(isActive);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
UsersCompanion toCompanion(bool nullToAbsent) {
|
|
return UsersCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
outletId: Value(outletId),
|
|
name: Value(name),
|
|
email: email == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(email),
|
|
phoneNumber: phoneNumber == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(phoneNumber),
|
|
passwordHash: passwordHash == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(passwordHash),
|
|
role: Value(role),
|
|
placeOfBirth: placeOfBirth == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(placeOfBirth),
|
|
dateOfBirth: dateOfBirth == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(dateOfBirth),
|
|
shiftName: shiftName == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(shiftName),
|
|
shiftStartTime: shiftStartTime == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(shiftStartTime),
|
|
shiftEndTime: shiftEndTime == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(shiftEndTime),
|
|
isActive: Value(isActive),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory User.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return User(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
outletId: serializer.fromJson<String>(json['outletId']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
email: serializer.fromJson<String?>(json['email']),
|
|
phoneNumber: serializer.fromJson<String?>(json['phoneNumber']),
|
|
passwordHash: serializer.fromJson<String?>(json['passwordHash']),
|
|
role: serializer.fromJson<String>(json['role']),
|
|
placeOfBirth: serializer.fromJson<String?>(json['placeOfBirth']),
|
|
dateOfBirth: serializer.fromJson<String?>(json['dateOfBirth']),
|
|
shiftName: serializer.fromJson<String?>(json['shiftName']),
|
|
shiftStartTime: serializer.fromJson<String?>(json['shiftStartTime']),
|
|
shiftEndTime: serializer.fromJson<String?>(json['shiftEndTime']),
|
|
isActive: serializer.fromJson<bool>(json['isActive']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'outletId': serializer.toJson<String>(outletId),
|
|
'name': serializer.toJson<String>(name),
|
|
'email': serializer.toJson<String?>(email),
|
|
'phoneNumber': serializer.toJson<String?>(phoneNumber),
|
|
'passwordHash': serializer.toJson<String?>(passwordHash),
|
|
'role': serializer.toJson<String>(role),
|
|
'placeOfBirth': serializer.toJson<String?>(placeOfBirth),
|
|
'dateOfBirth': serializer.toJson<String?>(dateOfBirth),
|
|
'shiftName': serializer.toJson<String?>(shiftName),
|
|
'shiftStartTime': serializer.toJson<String?>(shiftStartTime),
|
|
'shiftEndTime': serializer.toJson<String?>(shiftEndTime),
|
|
'isActive': serializer.toJson<bool>(isActive),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
User copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? outletId,
|
|
String? name,
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> passwordHash = const Value.absent(),
|
|
String? role,
|
|
Value<String?> placeOfBirth = const Value.absent(),
|
|
Value<String?> dateOfBirth = const Value.absent(),
|
|
Value<String?> shiftName = const Value.absent(),
|
|
Value<String?> shiftStartTime = const Value.absent(),
|
|
Value<String?> shiftEndTime = const Value.absent(),
|
|
bool? isActive,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => User(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
outletId: outletId ?? this.outletId,
|
|
name: name ?? this.name,
|
|
email: email.present ? email.value : this.email,
|
|
phoneNumber: phoneNumber.present ? phoneNumber.value : this.phoneNumber,
|
|
passwordHash: passwordHash.present ? passwordHash.value : this.passwordHash,
|
|
role: role ?? this.role,
|
|
placeOfBirth: placeOfBirth.present ? placeOfBirth.value : this.placeOfBirth,
|
|
dateOfBirth: dateOfBirth.present ? dateOfBirth.value : this.dateOfBirth,
|
|
shiftName: shiftName.present ? shiftName.value : this.shiftName,
|
|
shiftStartTime: shiftStartTime.present
|
|
? shiftStartTime.value
|
|
: this.shiftStartTime,
|
|
shiftEndTime: shiftEndTime.present ? shiftEndTime.value : this.shiftEndTime,
|
|
isActive: isActive ?? this.isActive,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
User copyWithCompanion(UsersCompanion data) {
|
|
return User(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
outletId: data.outletId.present ? data.outletId.value : this.outletId,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
email: data.email.present ? data.email.value : this.email,
|
|
phoneNumber: data.phoneNumber.present
|
|
? data.phoneNumber.value
|
|
: this.phoneNumber,
|
|
passwordHash: data.passwordHash.present
|
|
? data.passwordHash.value
|
|
: this.passwordHash,
|
|
role: data.role.present ? data.role.value : this.role,
|
|
placeOfBirth: data.placeOfBirth.present
|
|
? data.placeOfBirth.value
|
|
: this.placeOfBirth,
|
|
dateOfBirth: data.dateOfBirth.present
|
|
? data.dateOfBirth.value
|
|
: this.dateOfBirth,
|
|
shiftName: data.shiftName.present ? data.shiftName.value : this.shiftName,
|
|
shiftStartTime: data.shiftStartTime.present
|
|
? data.shiftStartTime.value
|
|
: this.shiftStartTime,
|
|
shiftEndTime: data.shiftEndTime.present
|
|
? data.shiftEndTime.value
|
|
: this.shiftEndTime,
|
|
isActive: data.isActive.present ? data.isActive.value : this.isActive,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('User(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('name: $name, ')
|
|
..write('email: $email, ')
|
|
..write('phoneNumber: $phoneNumber, ')
|
|
..write('passwordHash: $passwordHash, ')
|
|
..write('role: $role, ')
|
|
..write('placeOfBirth: $placeOfBirth, ')
|
|
..write('dateOfBirth: $dateOfBirth, ')
|
|
..write('shiftName: $shiftName, ')
|
|
..write('shiftStartTime: $shiftStartTime, ')
|
|
..write('shiftEndTime: $shiftEndTime, ')
|
|
..write('isActive: $isActive, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
outletId,
|
|
name,
|
|
email,
|
|
phoneNumber,
|
|
passwordHash,
|
|
role,
|
|
placeOfBirth,
|
|
dateOfBirth,
|
|
shiftName,
|
|
shiftStartTime,
|
|
shiftEndTime,
|
|
isActive,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is User &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.outletId == this.outletId &&
|
|
other.name == this.name &&
|
|
other.email == this.email &&
|
|
other.phoneNumber == this.phoneNumber &&
|
|
other.passwordHash == this.passwordHash &&
|
|
other.role == this.role &&
|
|
other.placeOfBirth == this.placeOfBirth &&
|
|
other.dateOfBirth == this.dateOfBirth &&
|
|
other.shiftName == this.shiftName &&
|
|
other.shiftStartTime == this.shiftStartTime &&
|
|
other.shiftEndTime == this.shiftEndTime &&
|
|
other.isActive == this.isActive &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class UsersCompanion extends UpdateCompanion<User> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> outletId;
|
|
final Value<String> name;
|
|
final Value<String?> email;
|
|
final Value<String?> phoneNumber;
|
|
final Value<String?> passwordHash;
|
|
final Value<String> role;
|
|
final Value<String?> placeOfBirth;
|
|
final Value<String?> dateOfBirth;
|
|
final Value<String?> shiftName;
|
|
final Value<String?> shiftStartTime;
|
|
final Value<String?> shiftEndTime;
|
|
final Value<bool> isActive;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const UsersCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.outletId = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.email = const Value.absent(),
|
|
this.phoneNumber = const Value.absent(),
|
|
this.passwordHash = const Value.absent(),
|
|
this.role = const Value.absent(),
|
|
this.placeOfBirth = const Value.absent(),
|
|
this.dateOfBirth = const Value.absent(),
|
|
this.shiftName = const Value.absent(),
|
|
this.shiftStartTime = const Value.absent(),
|
|
this.shiftEndTime = const Value.absent(),
|
|
this.isActive = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
UsersCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String outletId,
|
|
required String name,
|
|
this.email = const Value.absent(),
|
|
this.phoneNumber = const Value.absent(),
|
|
this.passwordHash = const Value.absent(),
|
|
required String role,
|
|
this.placeOfBirth = const Value.absent(),
|
|
this.dateOfBirth = const Value.absent(),
|
|
this.shiftName = const Value.absent(),
|
|
this.shiftStartTime = const Value.absent(),
|
|
this.shiftEndTime = const Value.absent(),
|
|
this.isActive = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : outletId = Value(outletId),
|
|
name = Value(name),
|
|
role = Value(role);
|
|
static Insertable<User> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? outletId,
|
|
Expression<String>? name,
|
|
Expression<String>? email,
|
|
Expression<String>? phoneNumber,
|
|
Expression<String>? passwordHash,
|
|
Expression<String>? role,
|
|
Expression<String>? placeOfBirth,
|
|
Expression<String>? dateOfBirth,
|
|
Expression<String>? shiftName,
|
|
Expression<String>? shiftStartTime,
|
|
Expression<String>? shiftEndTime,
|
|
Expression<bool>? isActive,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (outletId != null) 'outlet_id': outletId,
|
|
if (name != null) 'name': name,
|
|
if (email != null) 'email': email,
|
|
if (phoneNumber != null) 'phone_number': phoneNumber,
|
|
if (passwordHash != null) 'password_hash': passwordHash,
|
|
if (role != null) 'role': role,
|
|
if (placeOfBirth != null) 'place_of_birth': placeOfBirth,
|
|
if (dateOfBirth != null) 'date_of_birth': dateOfBirth,
|
|
if (shiftName != null) 'shift_name': shiftName,
|
|
if (shiftStartTime != null) 'shift_start_time': shiftStartTime,
|
|
if (shiftEndTime != null) 'shift_end_time': shiftEndTime,
|
|
if (isActive != null) 'is_active': isActive,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
UsersCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? outletId,
|
|
Value<String>? name,
|
|
Value<String?>? email,
|
|
Value<String?>? phoneNumber,
|
|
Value<String?>? passwordHash,
|
|
Value<String>? role,
|
|
Value<String?>? placeOfBirth,
|
|
Value<String?>? dateOfBirth,
|
|
Value<String?>? shiftName,
|
|
Value<String?>? shiftStartTime,
|
|
Value<String?>? shiftEndTime,
|
|
Value<bool>? isActive,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return UsersCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
outletId: outletId ?? this.outletId,
|
|
name: name ?? this.name,
|
|
email: email ?? this.email,
|
|
phoneNumber: phoneNumber ?? this.phoneNumber,
|
|
passwordHash: passwordHash ?? this.passwordHash,
|
|
role: role ?? this.role,
|
|
placeOfBirth: placeOfBirth ?? this.placeOfBirth,
|
|
dateOfBirth: dateOfBirth ?? this.dateOfBirth,
|
|
shiftName: shiftName ?? this.shiftName,
|
|
shiftStartTime: shiftStartTime ?? this.shiftStartTime,
|
|
shiftEndTime: shiftEndTime ?? this.shiftEndTime,
|
|
isActive: isActive ?? this.isActive,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (outletId.present) {
|
|
map['outlet_id'] = Variable<String>(outletId.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (email.present) {
|
|
map['email'] = Variable<String>(email.value);
|
|
}
|
|
if (phoneNumber.present) {
|
|
map['phone_number'] = Variable<String>(phoneNumber.value);
|
|
}
|
|
if (passwordHash.present) {
|
|
map['password_hash'] = Variable<String>(passwordHash.value);
|
|
}
|
|
if (role.present) {
|
|
map['role'] = Variable<String>(role.value);
|
|
}
|
|
if (placeOfBirth.present) {
|
|
map['place_of_birth'] = Variable<String>(placeOfBirth.value);
|
|
}
|
|
if (dateOfBirth.present) {
|
|
map['date_of_birth'] = Variable<String>(dateOfBirth.value);
|
|
}
|
|
if (shiftName.present) {
|
|
map['shift_name'] = Variable<String>(shiftName.value);
|
|
}
|
|
if (shiftStartTime.present) {
|
|
map['shift_start_time'] = Variable<String>(shiftStartTime.value);
|
|
}
|
|
if (shiftEndTime.present) {
|
|
map['shift_end_time'] = Variable<String>(shiftEndTime.value);
|
|
}
|
|
if (isActive.present) {
|
|
map['is_active'] = Variable<bool>(isActive.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('UsersCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('name: $name, ')
|
|
..write('email: $email, ')
|
|
..write('phoneNumber: $phoneNumber, ')
|
|
..write('passwordHash: $passwordHash, ')
|
|
..write('role: $role, ')
|
|
..write('placeOfBirth: $placeOfBirth, ')
|
|
..write('dateOfBirth: $dateOfBirth, ')
|
|
..write('shiftName: $shiftName, ')
|
|
..write('shiftStartTime: $shiftStartTime, ')
|
|
..write('shiftEndTime: $shiftEndTime, ')
|
|
..write('isActive: $isActive, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $CustomersTable extends Customers
|
|
with TableInfo<$CustomersTable, Customer> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$CustomersTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _outletIdMeta = const VerificationMeta(
|
|
'outletId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> outletId = GeneratedColumn<String>(
|
|
'outlet_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES outlets (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _emailMeta = const VerificationMeta('email');
|
|
@override
|
|
late final GeneratedColumn<String> email = GeneratedColumn<String>(
|
|
'email',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _phoneNumberMeta = const VerificationMeta(
|
|
'phoneNumber',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> phoneNumber = GeneratedColumn<String>(
|
|
'phone_number',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _passwordHashMeta = const VerificationMeta(
|
|
'passwordHash',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> passwordHash = GeneratedColumn<String>(
|
|
'password_hash',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _sourceMeta = const VerificationMeta('source');
|
|
@override
|
|
late final GeneratedColumn<String> source = GeneratedColumn<String>(
|
|
'source',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
outletId,
|
|
name,
|
|
email,
|
|
phoneNumber,
|
|
passwordHash,
|
|
source,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'customers';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Customer> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('outlet_id')) {
|
|
context.handle(
|
|
_outletIdMeta,
|
|
outletId.isAcceptableOrUnknown(data['outlet_id']!, _outletIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_outletIdMeta);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('email')) {
|
|
context.handle(
|
|
_emailMeta,
|
|
email.isAcceptableOrUnknown(data['email']!, _emailMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('phone_number')) {
|
|
context.handle(
|
|
_phoneNumberMeta,
|
|
phoneNumber.isAcceptableOrUnknown(
|
|
data['phone_number']!,
|
|
_phoneNumberMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('password_hash')) {
|
|
context.handle(
|
|
_passwordHashMeta,
|
|
passwordHash.isAcceptableOrUnknown(
|
|
data['password_hash']!,
|
|
_passwordHashMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('source')) {
|
|
context.handle(
|
|
_sourceMeta,
|
|
source.isAcceptableOrUnknown(data['source']!, _sourceMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_sourceMeta);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Customer map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Customer(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
outletId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_id'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
email: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}email'],
|
|
),
|
|
phoneNumber: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}phone_number'],
|
|
),
|
|
passwordHash: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}password_hash'],
|
|
),
|
|
source: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}source'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$CustomersTable createAlias(String alias) {
|
|
return $CustomersTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Customer extends DataClass implements Insertable<Customer> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String outletId;
|
|
final String name;
|
|
final String? email;
|
|
final String? phoneNumber;
|
|
final String? passwordHash;
|
|
final String source;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const Customer({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.outletId,
|
|
required this.name,
|
|
this.email,
|
|
this.phoneNumber,
|
|
this.passwordHash,
|
|
required this.source,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['outlet_id'] = Variable<String>(outletId);
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || email != null) {
|
|
map['email'] = Variable<String>(email);
|
|
}
|
|
if (!nullToAbsent || phoneNumber != null) {
|
|
map['phone_number'] = Variable<String>(phoneNumber);
|
|
}
|
|
if (!nullToAbsent || passwordHash != null) {
|
|
map['password_hash'] = Variable<String>(passwordHash);
|
|
}
|
|
map['source'] = Variable<String>(source);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
CustomersCompanion toCompanion(bool nullToAbsent) {
|
|
return CustomersCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
outletId: Value(outletId),
|
|
name: Value(name),
|
|
email: email == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(email),
|
|
phoneNumber: phoneNumber == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(phoneNumber),
|
|
passwordHash: passwordHash == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(passwordHash),
|
|
source: Value(source),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory Customer.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Customer(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
outletId: serializer.fromJson<String>(json['outletId']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
email: serializer.fromJson<String?>(json['email']),
|
|
phoneNumber: serializer.fromJson<String?>(json['phoneNumber']),
|
|
passwordHash: serializer.fromJson<String?>(json['passwordHash']),
|
|
source: serializer.fromJson<String>(json['source']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'outletId': serializer.toJson<String>(outletId),
|
|
'name': serializer.toJson<String>(name),
|
|
'email': serializer.toJson<String?>(email),
|
|
'phoneNumber': serializer.toJson<String?>(phoneNumber),
|
|
'passwordHash': serializer.toJson<String?>(passwordHash),
|
|
'source': serializer.toJson<String>(source),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
Customer copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? outletId,
|
|
String? name,
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> passwordHash = const Value.absent(),
|
|
String? source,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => Customer(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
outletId: outletId ?? this.outletId,
|
|
name: name ?? this.name,
|
|
email: email.present ? email.value : this.email,
|
|
phoneNumber: phoneNumber.present ? phoneNumber.value : this.phoneNumber,
|
|
passwordHash: passwordHash.present ? passwordHash.value : this.passwordHash,
|
|
source: source ?? this.source,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
Customer copyWithCompanion(CustomersCompanion data) {
|
|
return Customer(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
outletId: data.outletId.present ? data.outletId.value : this.outletId,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
email: data.email.present ? data.email.value : this.email,
|
|
phoneNumber: data.phoneNumber.present
|
|
? data.phoneNumber.value
|
|
: this.phoneNumber,
|
|
passwordHash: data.passwordHash.present
|
|
? data.passwordHash.value
|
|
: this.passwordHash,
|
|
source: data.source.present ? data.source.value : this.source,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Customer(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('name: $name, ')
|
|
..write('email: $email, ')
|
|
..write('phoneNumber: $phoneNumber, ')
|
|
..write('passwordHash: $passwordHash, ')
|
|
..write('source: $source, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
outletId,
|
|
name,
|
|
email,
|
|
phoneNumber,
|
|
passwordHash,
|
|
source,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Customer &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.outletId == this.outletId &&
|
|
other.name == this.name &&
|
|
other.email == this.email &&
|
|
other.phoneNumber == this.phoneNumber &&
|
|
other.passwordHash == this.passwordHash &&
|
|
other.source == this.source &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class CustomersCompanion extends UpdateCompanion<Customer> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> outletId;
|
|
final Value<String> name;
|
|
final Value<String?> email;
|
|
final Value<String?> phoneNumber;
|
|
final Value<String?> passwordHash;
|
|
final Value<String> source;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const CustomersCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.outletId = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.email = const Value.absent(),
|
|
this.phoneNumber = const Value.absent(),
|
|
this.passwordHash = const Value.absent(),
|
|
this.source = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
CustomersCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String outletId,
|
|
required String name,
|
|
this.email = const Value.absent(),
|
|
this.phoneNumber = const Value.absent(),
|
|
this.passwordHash = const Value.absent(),
|
|
required String source,
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : outletId = Value(outletId),
|
|
name = Value(name),
|
|
source = Value(source);
|
|
static Insertable<Customer> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? outletId,
|
|
Expression<String>? name,
|
|
Expression<String>? email,
|
|
Expression<String>? phoneNumber,
|
|
Expression<String>? passwordHash,
|
|
Expression<String>? source,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (outletId != null) 'outlet_id': outletId,
|
|
if (name != null) 'name': name,
|
|
if (email != null) 'email': email,
|
|
if (phoneNumber != null) 'phone_number': phoneNumber,
|
|
if (passwordHash != null) 'password_hash': passwordHash,
|
|
if (source != null) 'source': source,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
CustomersCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? outletId,
|
|
Value<String>? name,
|
|
Value<String?>? email,
|
|
Value<String?>? phoneNumber,
|
|
Value<String?>? passwordHash,
|
|
Value<String>? source,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return CustomersCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
outletId: outletId ?? this.outletId,
|
|
name: name ?? this.name,
|
|
email: email ?? this.email,
|
|
phoneNumber: phoneNumber ?? this.phoneNumber,
|
|
passwordHash: passwordHash ?? this.passwordHash,
|
|
source: source ?? this.source,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (outletId.present) {
|
|
map['outlet_id'] = Variable<String>(outletId.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (email.present) {
|
|
map['email'] = Variable<String>(email.value);
|
|
}
|
|
if (phoneNumber.present) {
|
|
map['phone_number'] = Variable<String>(phoneNumber.value);
|
|
}
|
|
if (passwordHash.present) {
|
|
map['password_hash'] = Variable<String>(passwordHash.value);
|
|
}
|
|
if (source.present) {
|
|
map['source'] = Variable<String>(source.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('CustomersCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('name: $name, ')
|
|
..write('email: $email, ')
|
|
..write('phoneNumber: $phoneNumber, ')
|
|
..write('passwordHash: $passwordHash, ')
|
|
..write('source: $source, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $CustomerAddressesTable extends CustomerAddresses
|
|
with TableInfo<$CustomerAddressesTable, CustomerAddressesData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$CustomerAddressesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _customerIdMeta = const VerificationMeta(
|
|
'customerId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> customerId = GeneratedColumn<String>(
|
|
'customer_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES customers (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _labelMeta = const VerificationMeta('label');
|
|
@override
|
|
late final GeneratedColumn<String> label = GeneratedColumn<String>(
|
|
'label',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _fullAddressMeta = const VerificationMeta(
|
|
'fullAddress',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> fullAddress = GeneratedColumn<String>(
|
|
'full_address',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _latitudeMeta = const VerificationMeta(
|
|
'latitude',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> latitude = GeneratedColumn<double>(
|
|
'latitude',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _longitudeMeta = const VerificationMeta(
|
|
'longitude',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> longitude = GeneratedColumn<double>(
|
|
'longitude',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _notesMeta = const VerificationMeta('notes');
|
|
@override
|
|
late final GeneratedColumn<String> notes = GeneratedColumn<String>(
|
|
'notes',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
customerId,
|
|
label,
|
|
fullAddress,
|
|
latitude,
|
|
longitude,
|
|
notes,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'customer_addresses';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<CustomerAddressesData> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('customer_id')) {
|
|
context.handle(
|
|
_customerIdMeta,
|
|
customerId.isAcceptableOrUnknown(data['customer_id']!, _customerIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_customerIdMeta);
|
|
}
|
|
if (data.containsKey('label')) {
|
|
context.handle(
|
|
_labelMeta,
|
|
label.isAcceptableOrUnknown(data['label']!, _labelMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('full_address')) {
|
|
context.handle(
|
|
_fullAddressMeta,
|
|
fullAddress.isAcceptableOrUnknown(
|
|
data['full_address']!,
|
|
_fullAddressMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('latitude')) {
|
|
context.handle(
|
|
_latitudeMeta,
|
|
latitude.isAcceptableOrUnknown(data['latitude']!, _latitudeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('longitude')) {
|
|
context.handle(
|
|
_longitudeMeta,
|
|
longitude.isAcceptableOrUnknown(data['longitude']!, _longitudeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('notes')) {
|
|
context.handle(
|
|
_notesMeta,
|
|
notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
CustomerAddressesData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return CustomerAddressesData(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
customerId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}customer_id'],
|
|
)!,
|
|
label: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}label'],
|
|
),
|
|
fullAddress: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}full_address'],
|
|
),
|
|
latitude: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}latitude'],
|
|
),
|
|
longitude: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}longitude'],
|
|
),
|
|
notes: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}notes'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$CustomerAddressesTable createAlias(String alias) {
|
|
return $CustomerAddressesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class CustomerAddressesData extends DataClass
|
|
implements Insertable<CustomerAddressesData> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String customerId;
|
|
final String? label;
|
|
final String? fullAddress;
|
|
final double? latitude;
|
|
final double? longitude;
|
|
final String? notes;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const CustomerAddressesData({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.customerId,
|
|
this.label,
|
|
this.fullAddress,
|
|
this.latitude,
|
|
this.longitude,
|
|
this.notes,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['customer_id'] = Variable<String>(customerId);
|
|
if (!nullToAbsent || label != null) {
|
|
map['label'] = Variable<String>(label);
|
|
}
|
|
if (!nullToAbsent || fullAddress != null) {
|
|
map['full_address'] = Variable<String>(fullAddress);
|
|
}
|
|
if (!nullToAbsent || latitude != null) {
|
|
map['latitude'] = Variable<double>(latitude);
|
|
}
|
|
if (!nullToAbsent || longitude != null) {
|
|
map['longitude'] = Variable<double>(longitude);
|
|
}
|
|
if (!nullToAbsent || notes != null) {
|
|
map['notes'] = Variable<String>(notes);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
CustomerAddressesCompanion toCompanion(bool nullToAbsent) {
|
|
return CustomerAddressesCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
customerId: Value(customerId),
|
|
label: label == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(label),
|
|
fullAddress: fullAddress == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(fullAddress),
|
|
latitude: latitude == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(latitude),
|
|
longitude: longitude == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(longitude),
|
|
notes: notes == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(notes),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory CustomerAddressesData.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return CustomerAddressesData(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
customerId: serializer.fromJson<String>(json['customerId']),
|
|
label: serializer.fromJson<String?>(json['label']),
|
|
fullAddress: serializer.fromJson<String?>(json['fullAddress']),
|
|
latitude: serializer.fromJson<double?>(json['latitude']),
|
|
longitude: serializer.fromJson<double?>(json['longitude']),
|
|
notes: serializer.fromJson<String?>(json['notes']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'customerId': serializer.toJson<String>(customerId),
|
|
'label': serializer.toJson<String?>(label),
|
|
'fullAddress': serializer.toJson<String?>(fullAddress),
|
|
'latitude': serializer.toJson<double?>(latitude),
|
|
'longitude': serializer.toJson<double?>(longitude),
|
|
'notes': serializer.toJson<String?>(notes),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
CustomerAddressesData copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? customerId,
|
|
Value<String?> label = const Value.absent(),
|
|
Value<String?> fullAddress = const Value.absent(),
|
|
Value<double?> latitude = const Value.absent(),
|
|
Value<double?> longitude = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => CustomerAddressesData(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
customerId: customerId ?? this.customerId,
|
|
label: label.present ? label.value : this.label,
|
|
fullAddress: fullAddress.present ? fullAddress.value : this.fullAddress,
|
|
latitude: latitude.present ? latitude.value : this.latitude,
|
|
longitude: longitude.present ? longitude.value : this.longitude,
|
|
notes: notes.present ? notes.value : this.notes,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
CustomerAddressesData copyWithCompanion(CustomerAddressesCompanion data) {
|
|
return CustomerAddressesData(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
customerId: data.customerId.present
|
|
? data.customerId.value
|
|
: this.customerId,
|
|
label: data.label.present ? data.label.value : this.label,
|
|
fullAddress: data.fullAddress.present
|
|
? data.fullAddress.value
|
|
: this.fullAddress,
|
|
latitude: data.latitude.present ? data.latitude.value : this.latitude,
|
|
longitude: data.longitude.present ? data.longitude.value : this.longitude,
|
|
notes: data.notes.present ? data.notes.value : this.notes,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('CustomerAddressesData(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('customerId: $customerId, ')
|
|
..write('label: $label, ')
|
|
..write('fullAddress: $fullAddress, ')
|
|
..write('latitude: $latitude, ')
|
|
..write('longitude: $longitude, ')
|
|
..write('notes: $notes, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
customerId,
|
|
label,
|
|
fullAddress,
|
|
latitude,
|
|
longitude,
|
|
notes,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is CustomerAddressesData &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.customerId == this.customerId &&
|
|
other.label == this.label &&
|
|
other.fullAddress == this.fullAddress &&
|
|
other.latitude == this.latitude &&
|
|
other.longitude == this.longitude &&
|
|
other.notes == this.notes &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class CustomerAddressesCompanion
|
|
extends UpdateCompanion<CustomerAddressesData> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> customerId;
|
|
final Value<String?> label;
|
|
final Value<String?> fullAddress;
|
|
final Value<double?> latitude;
|
|
final Value<double?> longitude;
|
|
final Value<String?> notes;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const CustomerAddressesCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.customerId = const Value.absent(),
|
|
this.label = const Value.absent(),
|
|
this.fullAddress = const Value.absent(),
|
|
this.latitude = const Value.absent(),
|
|
this.longitude = const Value.absent(),
|
|
this.notes = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
CustomerAddressesCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String customerId,
|
|
this.label = const Value.absent(),
|
|
this.fullAddress = const Value.absent(),
|
|
this.latitude = const Value.absent(),
|
|
this.longitude = const Value.absent(),
|
|
this.notes = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : customerId = Value(customerId);
|
|
static Insertable<CustomerAddressesData> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? customerId,
|
|
Expression<String>? label,
|
|
Expression<String>? fullAddress,
|
|
Expression<double>? latitude,
|
|
Expression<double>? longitude,
|
|
Expression<String>? notes,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (customerId != null) 'customer_id': customerId,
|
|
if (label != null) 'label': label,
|
|
if (fullAddress != null) 'full_address': fullAddress,
|
|
if (latitude != null) 'latitude': latitude,
|
|
if (longitude != null) 'longitude': longitude,
|
|
if (notes != null) 'notes': notes,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
CustomerAddressesCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? customerId,
|
|
Value<String?>? label,
|
|
Value<String?>? fullAddress,
|
|
Value<double?>? latitude,
|
|
Value<double?>? longitude,
|
|
Value<String?>? notes,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return CustomerAddressesCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
customerId: customerId ?? this.customerId,
|
|
label: label ?? this.label,
|
|
fullAddress: fullAddress ?? this.fullAddress,
|
|
latitude: latitude ?? this.latitude,
|
|
longitude: longitude ?? this.longitude,
|
|
notes: notes ?? this.notes,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (customerId.present) {
|
|
map['customer_id'] = Variable<String>(customerId.value);
|
|
}
|
|
if (label.present) {
|
|
map['label'] = Variable<String>(label.value);
|
|
}
|
|
if (fullAddress.present) {
|
|
map['full_address'] = Variable<String>(fullAddress.value);
|
|
}
|
|
if (latitude.present) {
|
|
map['latitude'] = Variable<double>(latitude.value);
|
|
}
|
|
if (longitude.present) {
|
|
map['longitude'] = Variable<double>(longitude.value);
|
|
}
|
|
if (notes.present) {
|
|
map['notes'] = Variable<String>(notes.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('CustomerAddressesCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('customerId: $customerId, ')
|
|
..write('label: $label, ')
|
|
..write('fullAddress: $fullAddress, ')
|
|
..write('latitude: $latitude, ')
|
|
..write('longitude: $longitude, ')
|
|
..write('notes: $notes, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $CategoriesTable extends Categories
|
|
with TableInfo<$CategoriesTable, Category> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$CategoriesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _localImagePathMeta = const VerificationMeta(
|
|
'localImagePath',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localImagePath = GeneratedColumn<String>(
|
|
'local_image_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _serverImageUrlMeta = const VerificationMeta(
|
|
'serverImageUrl',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverImageUrl = GeneratedColumn<String>(
|
|
'server_image_url',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
name,
|
|
localImagePath,
|
|
serverImageUrl,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'categories';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Category> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('local_image_path')) {
|
|
context.handle(
|
|
_localImagePathMeta,
|
|
localImagePath.isAcceptableOrUnknown(
|
|
data['local_image_path']!,
|
|
_localImagePathMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('server_image_url')) {
|
|
context.handle(
|
|
_serverImageUrlMeta,
|
|
serverImageUrl.isAcceptableOrUnknown(
|
|
data['server_image_url']!,
|
|
_serverImageUrlMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Category map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Category(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
localImagePath: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_image_path'],
|
|
),
|
|
serverImageUrl: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_image_url'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$CategoriesTable createAlias(String alias) {
|
|
return $CategoriesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Category extends DataClass implements Insertable<Category> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String name;
|
|
final String? localImagePath;
|
|
final String? serverImageUrl;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const Category({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.name,
|
|
this.localImagePath,
|
|
this.serverImageUrl,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || localImagePath != null) {
|
|
map['local_image_path'] = Variable<String>(localImagePath);
|
|
}
|
|
if (!nullToAbsent || serverImageUrl != null) {
|
|
map['server_image_url'] = Variable<String>(serverImageUrl);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
CategoriesCompanion toCompanion(bool nullToAbsent) {
|
|
return CategoriesCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
name: Value(name),
|
|
localImagePath: localImagePath == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(localImagePath),
|
|
serverImageUrl: serverImageUrl == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverImageUrl),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory Category.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Category(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
localImagePath: serializer.fromJson<String?>(json['localImagePath']),
|
|
serverImageUrl: serializer.fromJson<String?>(json['serverImageUrl']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'name': serializer.toJson<String>(name),
|
|
'localImagePath': serializer.toJson<String?>(localImagePath),
|
|
'serverImageUrl': serializer.toJson<String?>(serverImageUrl),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
Category copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? name,
|
|
Value<String?> localImagePath = const Value.absent(),
|
|
Value<String?> serverImageUrl = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => Category(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
name: name ?? this.name,
|
|
localImagePath: localImagePath.present
|
|
? localImagePath.value
|
|
: this.localImagePath,
|
|
serverImageUrl: serverImageUrl.present
|
|
? serverImageUrl.value
|
|
: this.serverImageUrl,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
Category copyWithCompanion(CategoriesCompanion data) {
|
|
return Category(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
localImagePath: data.localImagePath.present
|
|
? data.localImagePath.value
|
|
: this.localImagePath,
|
|
serverImageUrl: data.serverImageUrl.present
|
|
? data.serverImageUrl.value
|
|
: this.serverImageUrl,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Category(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('name: $name, ')
|
|
..write('localImagePath: $localImagePath, ')
|
|
..write('serverImageUrl: $serverImageUrl, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
name,
|
|
localImagePath,
|
|
serverImageUrl,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Category &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.name == this.name &&
|
|
other.localImagePath == this.localImagePath &&
|
|
other.serverImageUrl == this.serverImageUrl &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class CategoriesCompanion extends UpdateCompanion<Category> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> name;
|
|
final Value<String?> localImagePath;
|
|
final Value<String?> serverImageUrl;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const CategoriesCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.localImagePath = const Value.absent(),
|
|
this.serverImageUrl = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
CategoriesCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String name,
|
|
this.localImagePath = const Value.absent(),
|
|
this.serverImageUrl = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : name = Value(name);
|
|
static Insertable<Category> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? name,
|
|
Expression<String>? localImagePath,
|
|
Expression<String>? serverImageUrl,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (name != null) 'name': name,
|
|
if (localImagePath != null) 'local_image_path': localImagePath,
|
|
if (serverImageUrl != null) 'server_image_url': serverImageUrl,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
CategoriesCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? name,
|
|
Value<String?>? localImagePath,
|
|
Value<String?>? serverImageUrl,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return CategoriesCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
name: name ?? this.name,
|
|
localImagePath: localImagePath ?? this.localImagePath,
|
|
serverImageUrl: serverImageUrl ?? this.serverImageUrl,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (localImagePath.present) {
|
|
map['local_image_path'] = Variable<String>(localImagePath.value);
|
|
}
|
|
if (serverImageUrl.present) {
|
|
map['server_image_url'] = Variable<String>(serverImageUrl.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('CategoriesCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('name: $name, ')
|
|
..write('localImagePath: $localImagePath, ')
|
|
..write('serverImageUrl: $serverImageUrl, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $UnitsTable extends Units with TableInfo<$UnitsTable, Unit> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$UnitsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
name,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'units';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Unit> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Unit map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Unit(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$UnitsTable createAlias(String alias) {
|
|
return $UnitsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Unit extends DataClass implements Insertable<Unit> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String name;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const Unit({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.name,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['name'] = Variable<String>(name);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
UnitsCompanion toCompanion(bool nullToAbsent) {
|
|
return UnitsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
name: Value(name),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory Unit.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Unit(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'name': serializer.toJson<String>(name),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
Unit copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? name,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => Unit(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
name: name ?? this.name,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
Unit copyWithCompanion(UnitsCompanion data) {
|
|
return Unit(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Unit(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('name: $name, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode =>
|
|
Object.hash(localId, serverId, name, syncStatus, createdAt, updatedAt);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Unit &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.name == this.name &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class UnitsCompanion extends UpdateCompanion<Unit> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> name;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const UnitsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
UnitsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String name,
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : name = Value(name);
|
|
static Insertable<Unit> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? name,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (name != null) 'name': name,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
UnitsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? name,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return UnitsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
name: name ?? this.name,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('UnitsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('name: $name, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $ProductsTable extends Products with TableInfo<$ProductsTable, Product> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$ProductsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _categoryIdMeta = const VerificationMeta(
|
|
'categoryId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> categoryId = GeneratedColumn<String>(
|
|
'category_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES categories (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _unitIdMeta = const VerificationMeta('unitId');
|
|
@override
|
|
late final GeneratedColumn<String> unitId = GeneratedColumn<String>(
|
|
'unit_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES units (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
@override
|
|
late final GeneratedColumnWithTypeConverter<List<String>?, String>
|
|
localImagePath = GeneratedColumn<String>(
|
|
'local_image_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
).withConverter<List<String>?>($ProductsTable.$converterlocalImagePathn);
|
|
@override
|
|
late final GeneratedColumnWithTypeConverter<List<String>?, String>
|
|
serverImageUrl = GeneratedColumn<String>(
|
|
'server_image_url',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
).withConverter<List<String>?>($ProductsTable.$converterserverImageUrln);
|
|
static const VerificationMeta _hasVariantMeta = const VerificationMeta(
|
|
'hasVariant',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> hasVariant = GeneratedColumn<bool>(
|
|
'has_variant',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("has_variant" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
categoryId,
|
|
unitId,
|
|
name,
|
|
localImagePath,
|
|
serverImageUrl,
|
|
hasVariant,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'products';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Product> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('category_id')) {
|
|
context.handle(
|
|
_categoryIdMeta,
|
|
categoryId.isAcceptableOrUnknown(data['category_id']!, _categoryIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_categoryIdMeta);
|
|
}
|
|
if (data.containsKey('unit_id')) {
|
|
context.handle(
|
|
_unitIdMeta,
|
|
unitId.isAcceptableOrUnknown(data['unit_id']!, _unitIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_unitIdMeta);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('has_variant')) {
|
|
context.handle(
|
|
_hasVariantMeta,
|
|
hasVariant.isAcceptableOrUnknown(data['has_variant']!, _hasVariantMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Product map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Product(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
categoryId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}category_id'],
|
|
)!,
|
|
unitId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}unit_id'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
localImagePath: $ProductsTable.$converterlocalImagePathn.fromSql(
|
|
attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_image_path'],
|
|
),
|
|
),
|
|
serverImageUrl: $ProductsTable.$converterserverImageUrln.fromSql(
|
|
attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_image_url'],
|
|
),
|
|
),
|
|
hasVariant: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}has_variant'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$ProductsTable createAlias(String alias) {
|
|
return $ProductsTable(attachedDatabase, alias);
|
|
}
|
|
|
|
static TypeConverter<List<String>, String> $converterlocalImagePath =
|
|
StringListConverter();
|
|
static TypeConverter<List<String>?, String?> $converterlocalImagePathn =
|
|
NullAwareTypeConverter.wrap($converterlocalImagePath);
|
|
static TypeConverter<List<String>, String> $converterserverImageUrl =
|
|
StringListConverter();
|
|
static TypeConverter<List<String>?, String?> $converterserverImageUrln =
|
|
NullAwareTypeConverter.wrap($converterserverImageUrl);
|
|
}
|
|
|
|
class Product extends DataClass implements Insertable<Product> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String categoryId;
|
|
final String unitId;
|
|
final String name;
|
|
final List<String>? localImagePath;
|
|
final List<String>? serverImageUrl;
|
|
final bool hasVariant;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const Product({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.categoryId,
|
|
required this.unitId,
|
|
required this.name,
|
|
this.localImagePath,
|
|
this.serverImageUrl,
|
|
required this.hasVariant,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['category_id'] = Variable<String>(categoryId);
|
|
map['unit_id'] = Variable<String>(unitId);
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || localImagePath != null) {
|
|
map['local_image_path'] = Variable<String>(
|
|
$ProductsTable.$converterlocalImagePathn.toSql(localImagePath),
|
|
);
|
|
}
|
|
if (!nullToAbsent || serverImageUrl != null) {
|
|
map['server_image_url'] = Variable<String>(
|
|
$ProductsTable.$converterserverImageUrln.toSql(serverImageUrl),
|
|
);
|
|
}
|
|
map['has_variant'] = Variable<bool>(hasVariant);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
ProductsCompanion toCompanion(bool nullToAbsent) {
|
|
return ProductsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
categoryId: Value(categoryId),
|
|
unitId: Value(unitId),
|
|
name: Value(name),
|
|
localImagePath: localImagePath == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(localImagePath),
|
|
serverImageUrl: serverImageUrl == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverImageUrl),
|
|
hasVariant: Value(hasVariant),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory Product.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Product(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
categoryId: serializer.fromJson<String>(json['categoryId']),
|
|
unitId: serializer.fromJson<String>(json['unitId']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
localImagePath: serializer.fromJson<List<String>?>(
|
|
json['localImagePath'],
|
|
),
|
|
serverImageUrl: serializer.fromJson<List<String>?>(
|
|
json['serverImageUrl'],
|
|
),
|
|
hasVariant: serializer.fromJson<bool>(json['hasVariant']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'categoryId': serializer.toJson<String>(categoryId),
|
|
'unitId': serializer.toJson<String>(unitId),
|
|
'name': serializer.toJson<String>(name),
|
|
'localImagePath': serializer.toJson<List<String>?>(localImagePath),
|
|
'serverImageUrl': serializer.toJson<List<String>?>(serverImageUrl),
|
|
'hasVariant': serializer.toJson<bool>(hasVariant),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
Product copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? categoryId,
|
|
String? unitId,
|
|
String? name,
|
|
Value<List<String>?> localImagePath = const Value.absent(),
|
|
Value<List<String>?> serverImageUrl = const Value.absent(),
|
|
bool? hasVariant,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => Product(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
categoryId: categoryId ?? this.categoryId,
|
|
unitId: unitId ?? this.unitId,
|
|
name: name ?? this.name,
|
|
localImagePath: localImagePath.present
|
|
? localImagePath.value
|
|
: this.localImagePath,
|
|
serverImageUrl: serverImageUrl.present
|
|
? serverImageUrl.value
|
|
: this.serverImageUrl,
|
|
hasVariant: hasVariant ?? this.hasVariant,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
Product copyWithCompanion(ProductsCompanion data) {
|
|
return Product(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
categoryId: data.categoryId.present
|
|
? data.categoryId.value
|
|
: this.categoryId,
|
|
unitId: data.unitId.present ? data.unitId.value : this.unitId,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
localImagePath: data.localImagePath.present
|
|
? data.localImagePath.value
|
|
: this.localImagePath,
|
|
serverImageUrl: data.serverImageUrl.present
|
|
? data.serverImageUrl.value
|
|
: this.serverImageUrl,
|
|
hasVariant: data.hasVariant.present
|
|
? data.hasVariant.value
|
|
: this.hasVariant,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Product(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('categoryId: $categoryId, ')
|
|
..write('unitId: $unitId, ')
|
|
..write('name: $name, ')
|
|
..write('localImagePath: $localImagePath, ')
|
|
..write('serverImageUrl: $serverImageUrl, ')
|
|
..write('hasVariant: $hasVariant, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
categoryId,
|
|
unitId,
|
|
name,
|
|
localImagePath,
|
|
serverImageUrl,
|
|
hasVariant,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Product &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.categoryId == this.categoryId &&
|
|
other.unitId == this.unitId &&
|
|
other.name == this.name &&
|
|
other.localImagePath == this.localImagePath &&
|
|
other.serverImageUrl == this.serverImageUrl &&
|
|
other.hasVariant == this.hasVariant &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class ProductsCompanion extends UpdateCompanion<Product> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> categoryId;
|
|
final Value<String> unitId;
|
|
final Value<String> name;
|
|
final Value<List<String>?> localImagePath;
|
|
final Value<List<String>?> serverImageUrl;
|
|
final Value<bool> hasVariant;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const ProductsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.categoryId = const Value.absent(),
|
|
this.unitId = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.localImagePath = const Value.absent(),
|
|
this.serverImageUrl = const Value.absent(),
|
|
this.hasVariant = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
ProductsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String categoryId,
|
|
required String unitId,
|
|
required String name,
|
|
this.localImagePath = const Value.absent(),
|
|
this.serverImageUrl = const Value.absent(),
|
|
this.hasVariant = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : categoryId = Value(categoryId),
|
|
unitId = Value(unitId),
|
|
name = Value(name);
|
|
static Insertable<Product> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? categoryId,
|
|
Expression<String>? unitId,
|
|
Expression<String>? name,
|
|
Expression<String>? localImagePath,
|
|
Expression<String>? serverImageUrl,
|
|
Expression<bool>? hasVariant,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (categoryId != null) 'category_id': categoryId,
|
|
if (unitId != null) 'unit_id': unitId,
|
|
if (name != null) 'name': name,
|
|
if (localImagePath != null) 'local_image_path': localImagePath,
|
|
if (serverImageUrl != null) 'server_image_url': serverImageUrl,
|
|
if (hasVariant != null) 'has_variant': hasVariant,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
ProductsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? categoryId,
|
|
Value<String>? unitId,
|
|
Value<String>? name,
|
|
Value<List<String>?>? localImagePath,
|
|
Value<List<String>?>? serverImageUrl,
|
|
Value<bool>? hasVariant,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return ProductsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
categoryId: categoryId ?? this.categoryId,
|
|
unitId: unitId ?? this.unitId,
|
|
name: name ?? this.name,
|
|
localImagePath: localImagePath ?? this.localImagePath,
|
|
serverImageUrl: serverImageUrl ?? this.serverImageUrl,
|
|
hasVariant: hasVariant ?? this.hasVariant,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (categoryId.present) {
|
|
map['category_id'] = Variable<String>(categoryId.value);
|
|
}
|
|
if (unitId.present) {
|
|
map['unit_id'] = Variable<String>(unitId.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (localImagePath.present) {
|
|
map['local_image_path'] = Variable<String>(
|
|
$ProductsTable.$converterlocalImagePathn.toSql(localImagePath.value),
|
|
);
|
|
}
|
|
if (serverImageUrl.present) {
|
|
map['server_image_url'] = Variable<String>(
|
|
$ProductsTable.$converterserverImageUrln.toSql(serverImageUrl.value),
|
|
);
|
|
}
|
|
if (hasVariant.present) {
|
|
map['has_variant'] = Variable<bool>(hasVariant.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ProductsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('categoryId: $categoryId, ')
|
|
..write('unitId: $unitId, ')
|
|
..write('name: $name, ')
|
|
..write('localImagePath: $localImagePath, ')
|
|
..write('serverImageUrl: $serverImageUrl, ')
|
|
..write('hasVariant: $hasVariant, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $ProductVariantsTable extends ProductVariants
|
|
with TableInfo<$ProductVariantsTable, ProductVariant> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$ProductVariantsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _productIdMeta = const VerificationMeta(
|
|
'productId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> productId = GeneratedColumn<String>(
|
|
'product_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES products (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _localImagePathMeta = const VerificationMeta(
|
|
'localImagePath',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localImagePath = GeneratedColumn<String>(
|
|
'local_image_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _serverImageUrlMeta = const VerificationMeta(
|
|
'serverImageUrl',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverImageUrl = GeneratedColumn<String>(
|
|
'server_image_url',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _isVisibleOnlineMeta = const VerificationMeta(
|
|
'isVisibleOnline',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isVisibleOnline = GeneratedColumn<bool>(
|
|
'is_visible_online',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_visible_online" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _totalRatingMeta = const VerificationMeta(
|
|
'totalRating',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> totalRating = GeneratedColumn<int>(
|
|
'total_rating',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _averageRatingMeta = const VerificationMeta(
|
|
'averageRating',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> averageRating = GeneratedColumn<double>(
|
|
'average_rating',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _totalSoldMeta = const VerificationMeta(
|
|
'totalSold',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> totalSold = GeneratedColumn<double>(
|
|
'total_sold',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _isProductVariantMeta = const VerificationMeta(
|
|
'isProductVariant',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isProductVariant = GeneratedColumn<bool>(
|
|
'is_product_variant',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_product_variant" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
productId,
|
|
name,
|
|
localImagePath,
|
|
serverImageUrl,
|
|
isVisibleOnline,
|
|
totalRating,
|
|
averageRating,
|
|
totalSold,
|
|
isProductVariant,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'product_variants';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<ProductVariant> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('product_id')) {
|
|
context.handle(
|
|
_productIdMeta,
|
|
productId.isAcceptableOrUnknown(data['product_id']!, _productIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_productIdMeta);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('local_image_path')) {
|
|
context.handle(
|
|
_localImagePathMeta,
|
|
localImagePath.isAcceptableOrUnknown(
|
|
data['local_image_path']!,
|
|
_localImagePathMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('server_image_url')) {
|
|
context.handle(
|
|
_serverImageUrlMeta,
|
|
serverImageUrl.isAcceptableOrUnknown(
|
|
data['server_image_url']!,
|
|
_serverImageUrlMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('is_visible_online')) {
|
|
context.handle(
|
|
_isVisibleOnlineMeta,
|
|
isVisibleOnline.isAcceptableOrUnknown(
|
|
data['is_visible_online']!,
|
|
_isVisibleOnlineMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('total_rating')) {
|
|
context.handle(
|
|
_totalRatingMeta,
|
|
totalRating.isAcceptableOrUnknown(
|
|
data['total_rating']!,
|
|
_totalRatingMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('average_rating')) {
|
|
context.handle(
|
|
_averageRatingMeta,
|
|
averageRating.isAcceptableOrUnknown(
|
|
data['average_rating']!,
|
|
_averageRatingMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('total_sold')) {
|
|
context.handle(
|
|
_totalSoldMeta,
|
|
totalSold.isAcceptableOrUnknown(data['total_sold']!, _totalSoldMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('is_product_variant')) {
|
|
context.handle(
|
|
_isProductVariantMeta,
|
|
isProductVariant.isAcceptableOrUnknown(
|
|
data['is_product_variant']!,
|
|
_isProductVariantMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
ProductVariant map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return ProductVariant(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
productId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}product_id'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
localImagePath: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_image_path'],
|
|
),
|
|
serverImageUrl: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_image_url'],
|
|
),
|
|
isVisibleOnline: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_visible_online'],
|
|
)!,
|
|
totalRating: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}total_rating'],
|
|
)!,
|
|
averageRating: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}average_rating'],
|
|
)!,
|
|
totalSold: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}total_sold'],
|
|
)!,
|
|
isProductVariant: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_product_variant'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$ProductVariantsTable createAlias(String alias) {
|
|
return $ProductVariantsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class ProductVariant extends DataClass implements Insertable<ProductVariant> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String productId;
|
|
final String name;
|
|
final String? localImagePath;
|
|
final String? serverImageUrl;
|
|
final bool isVisibleOnline;
|
|
final int totalRating;
|
|
final double averageRating;
|
|
final double totalSold;
|
|
final bool isProductVariant;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const ProductVariant({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.productId,
|
|
required this.name,
|
|
this.localImagePath,
|
|
this.serverImageUrl,
|
|
required this.isVisibleOnline,
|
|
required this.totalRating,
|
|
required this.averageRating,
|
|
required this.totalSold,
|
|
required this.isProductVariant,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['product_id'] = Variable<String>(productId);
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || localImagePath != null) {
|
|
map['local_image_path'] = Variable<String>(localImagePath);
|
|
}
|
|
if (!nullToAbsent || serverImageUrl != null) {
|
|
map['server_image_url'] = Variable<String>(serverImageUrl);
|
|
}
|
|
map['is_visible_online'] = Variable<bool>(isVisibleOnline);
|
|
map['total_rating'] = Variable<int>(totalRating);
|
|
map['average_rating'] = Variable<double>(averageRating);
|
|
map['total_sold'] = Variable<double>(totalSold);
|
|
map['is_product_variant'] = Variable<bool>(isProductVariant);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
ProductVariantsCompanion toCompanion(bool nullToAbsent) {
|
|
return ProductVariantsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
productId: Value(productId),
|
|
name: Value(name),
|
|
localImagePath: localImagePath == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(localImagePath),
|
|
serverImageUrl: serverImageUrl == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverImageUrl),
|
|
isVisibleOnline: Value(isVisibleOnline),
|
|
totalRating: Value(totalRating),
|
|
averageRating: Value(averageRating),
|
|
totalSold: Value(totalSold),
|
|
isProductVariant: Value(isProductVariant),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory ProductVariant.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return ProductVariant(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
productId: serializer.fromJson<String>(json['productId']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
localImagePath: serializer.fromJson<String?>(json['localImagePath']),
|
|
serverImageUrl: serializer.fromJson<String?>(json['serverImageUrl']),
|
|
isVisibleOnline: serializer.fromJson<bool>(json['isVisibleOnline']),
|
|
totalRating: serializer.fromJson<int>(json['totalRating']),
|
|
averageRating: serializer.fromJson<double>(json['averageRating']),
|
|
totalSold: serializer.fromJson<double>(json['totalSold']),
|
|
isProductVariant: serializer.fromJson<bool>(json['isProductVariant']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'productId': serializer.toJson<String>(productId),
|
|
'name': serializer.toJson<String>(name),
|
|
'localImagePath': serializer.toJson<String?>(localImagePath),
|
|
'serverImageUrl': serializer.toJson<String?>(serverImageUrl),
|
|
'isVisibleOnline': serializer.toJson<bool>(isVisibleOnline),
|
|
'totalRating': serializer.toJson<int>(totalRating),
|
|
'averageRating': serializer.toJson<double>(averageRating),
|
|
'totalSold': serializer.toJson<double>(totalSold),
|
|
'isProductVariant': serializer.toJson<bool>(isProductVariant),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
ProductVariant copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? productId,
|
|
String? name,
|
|
Value<String?> localImagePath = const Value.absent(),
|
|
Value<String?> serverImageUrl = const Value.absent(),
|
|
bool? isVisibleOnline,
|
|
int? totalRating,
|
|
double? averageRating,
|
|
double? totalSold,
|
|
bool? isProductVariant,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => ProductVariant(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
productId: productId ?? this.productId,
|
|
name: name ?? this.name,
|
|
localImagePath: localImagePath.present
|
|
? localImagePath.value
|
|
: this.localImagePath,
|
|
serverImageUrl: serverImageUrl.present
|
|
? serverImageUrl.value
|
|
: this.serverImageUrl,
|
|
isVisibleOnline: isVisibleOnline ?? this.isVisibleOnline,
|
|
totalRating: totalRating ?? this.totalRating,
|
|
averageRating: averageRating ?? this.averageRating,
|
|
totalSold: totalSold ?? this.totalSold,
|
|
isProductVariant: isProductVariant ?? this.isProductVariant,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
ProductVariant copyWithCompanion(ProductVariantsCompanion data) {
|
|
return ProductVariant(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
productId: data.productId.present ? data.productId.value : this.productId,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
localImagePath: data.localImagePath.present
|
|
? data.localImagePath.value
|
|
: this.localImagePath,
|
|
serverImageUrl: data.serverImageUrl.present
|
|
? data.serverImageUrl.value
|
|
: this.serverImageUrl,
|
|
isVisibleOnline: data.isVisibleOnline.present
|
|
? data.isVisibleOnline.value
|
|
: this.isVisibleOnline,
|
|
totalRating: data.totalRating.present
|
|
? data.totalRating.value
|
|
: this.totalRating,
|
|
averageRating: data.averageRating.present
|
|
? data.averageRating.value
|
|
: this.averageRating,
|
|
totalSold: data.totalSold.present ? data.totalSold.value : this.totalSold,
|
|
isProductVariant: data.isProductVariant.present
|
|
? data.isProductVariant.value
|
|
: this.isProductVariant,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ProductVariant(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('productId: $productId, ')
|
|
..write('name: $name, ')
|
|
..write('localImagePath: $localImagePath, ')
|
|
..write('serverImageUrl: $serverImageUrl, ')
|
|
..write('isVisibleOnline: $isVisibleOnline, ')
|
|
..write('totalRating: $totalRating, ')
|
|
..write('averageRating: $averageRating, ')
|
|
..write('totalSold: $totalSold, ')
|
|
..write('isProductVariant: $isProductVariant, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
productId,
|
|
name,
|
|
localImagePath,
|
|
serverImageUrl,
|
|
isVisibleOnline,
|
|
totalRating,
|
|
averageRating,
|
|
totalSold,
|
|
isProductVariant,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is ProductVariant &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.productId == this.productId &&
|
|
other.name == this.name &&
|
|
other.localImagePath == this.localImagePath &&
|
|
other.serverImageUrl == this.serverImageUrl &&
|
|
other.isVisibleOnline == this.isVisibleOnline &&
|
|
other.totalRating == this.totalRating &&
|
|
other.averageRating == this.averageRating &&
|
|
other.totalSold == this.totalSold &&
|
|
other.isProductVariant == this.isProductVariant &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class ProductVariantsCompanion extends UpdateCompanion<ProductVariant> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> productId;
|
|
final Value<String> name;
|
|
final Value<String?> localImagePath;
|
|
final Value<String?> serverImageUrl;
|
|
final Value<bool> isVisibleOnline;
|
|
final Value<int> totalRating;
|
|
final Value<double> averageRating;
|
|
final Value<double> totalSold;
|
|
final Value<bool> isProductVariant;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const ProductVariantsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.productId = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.localImagePath = const Value.absent(),
|
|
this.serverImageUrl = const Value.absent(),
|
|
this.isVisibleOnline = const Value.absent(),
|
|
this.totalRating = const Value.absent(),
|
|
this.averageRating = const Value.absent(),
|
|
this.totalSold = const Value.absent(),
|
|
this.isProductVariant = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
ProductVariantsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String productId,
|
|
required String name,
|
|
this.localImagePath = const Value.absent(),
|
|
this.serverImageUrl = const Value.absent(),
|
|
this.isVisibleOnline = const Value.absent(),
|
|
this.totalRating = const Value.absent(),
|
|
this.averageRating = const Value.absent(),
|
|
this.totalSold = const Value.absent(),
|
|
this.isProductVariant = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : productId = Value(productId),
|
|
name = Value(name);
|
|
static Insertable<ProductVariant> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? productId,
|
|
Expression<String>? name,
|
|
Expression<String>? localImagePath,
|
|
Expression<String>? serverImageUrl,
|
|
Expression<bool>? isVisibleOnline,
|
|
Expression<int>? totalRating,
|
|
Expression<double>? averageRating,
|
|
Expression<double>? totalSold,
|
|
Expression<bool>? isProductVariant,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (productId != null) 'product_id': productId,
|
|
if (name != null) 'name': name,
|
|
if (localImagePath != null) 'local_image_path': localImagePath,
|
|
if (serverImageUrl != null) 'server_image_url': serverImageUrl,
|
|
if (isVisibleOnline != null) 'is_visible_online': isVisibleOnline,
|
|
if (totalRating != null) 'total_rating': totalRating,
|
|
if (averageRating != null) 'average_rating': averageRating,
|
|
if (totalSold != null) 'total_sold': totalSold,
|
|
if (isProductVariant != null) 'is_product_variant': isProductVariant,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
ProductVariantsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? productId,
|
|
Value<String>? name,
|
|
Value<String?>? localImagePath,
|
|
Value<String?>? serverImageUrl,
|
|
Value<bool>? isVisibleOnline,
|
|
Value<int>? totalRating,
|
|
Value<double>? averageRating,
|
|
Value<double>? totalSold,
|
|
Value<bool>? isProductVariant,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return ProductVariantsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
productId: productId ?? this.productId,
|
|
name: name ?? this.name,
|
|
localImagePath: localImagePath ?? this.localImagePath,
|
|
serverImageUrl: serverImageUrl ?? this.serverImageUrl,
|
|
isVisibleOnline: isVisibleOnline ?? this.isVisibleOnline,
|
|
totalRating: totalRating ?? this.totalRating,
|
|
averageRating: averageRating ?? this.averageRating,
|
|
totalSold: totalSold ?? this.totalSold,
|
|
isProductVariant: isProductVariant ?? this.isProductVariant,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (productId.present) {
|
|
map['product_id'] = Variable<String>(productId.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (localImagePath.present) {
|
|
map['local_image_path'] = Variable<String>(localImagePath.value);
|
|
}
|
|
if (serverImageUrl.present) {
|
|
map['server_image_url'] = Variable<String>(serverImageUrl.value);
|
|
}
|
|
if (isVisibleOnline.present) {
|
|
map['is_visible_online'] = Variable<bool>(isVisibleOnline.value);
|
|
}
|
|
if (totalRating.present) {
|
|
map['total_rating'] = Variable<int>(totalRating.value);
|
|
}
|
|
if (averageRating.present) {
|
|
map['average_rating'] = Variable<double>(averageRating.value);
|
|
}
|
|
if (totalSold.present) {
|
|
map['total_sold'] = Variable<double>(totalSold.value);
|
|
}
|
|
if (isProductVariant.present) {
|
|
map['is_product_variant'] = Variable<bool>(isProductVariant.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ProductVariantsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('productId: $productId, ')
|
|
..write('name: $name, ')
|
|
..write('localImagePath: $localImagePath, ')
|
|
..write('serverImageUrl: $serverImageUrl, ')
|
|
..write('isVisibleOnline: $isVisibleOnline, ')
|
|
..write('totalRating: $totalRating, ')
|
|
..write('averageRating: $averageRating, ')
|
|
..write('totalSold: $totalSold, ')
|
|
..write('isProductVariant: $isProductVariant, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $ProductReviewsTable extends ProductReviews
|
|
with TableInfo<$ProductReviewsTable, ProductReview> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$ProductReviewsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _customerIdMeta = const VerificationMeta(
|
|
'customerId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> customerId = GeneratedColumn<String>(
|
|
'customer_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES customers (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _productVariantIdMeta = const VerificationMeta(
|
|
'productVariantId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> productVariantId = GeneratedColumn<String>(
|
|
'product_variant_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES product_variants (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _customerNameSnapshotMeta =
|
|
const VerificationMeta('customerNameSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> customerNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'customer_name_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _ratingMeta = const VerificationMeta('rating');
|
|
@override
|
|
late final GeneratedColumn<int> rating = GeneratedColumn<int>(
|
|
'rating',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _commentMeta = const VerificationMeta(
|
|
'comment',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> comment = GeneratedColumn<String>(
|
|
'comment',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
customerId,
|
|
productVariantId,
|
|
customerNameSnapshot,
|
|
rating,
|
|
comment,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'product_reviews';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<ProductReview> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('customer_id')) {
|
|
context.handle(
|
|
_customerIdMeta,
|
|
customerId.isAcceptableOrUnknown(data['customer_id']!, _customerIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('product_variant_id')) {
|
|
context.handle(
|
|
_productVariantIdMeta,
|
|
productVariantId.isAcceptableOrUnknown(
|
|
data['product_variant_id']!,
|
|
_productVariantIdMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_productVariantIdMeta);
|
|
}
|
|
if (data.containsKey('customer_name_snapshot')) {
|
|
context.handle(
|
|
_customerNameSnapshotMeta,
|
|
customerNameSnapshot.isAcceptableOrUnknown(
|
|
data['customer_name_snapshot']!,
|
|
_customerNameSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('rating')) {
|
|
context.handle(
|
|
_ratingMeta,
|
|
rating.isAcceptableOrUnknown(data['rating']!, _ratingMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('comment')) {
|
|
context.handle(
|
|
_commentMeta,
|
|
comment.isAcceptableOrUnknown(data['comment']!, _commentMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
ProductReview map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return ProductReview(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
customerId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}customer_id'],
|
|
),
|
|
productVariantId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}product_variant_id'],
|
|
)!,
|
|
customerNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}customer_name_snapshot'],
|
|
),
|
|
rating: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}rating'],
|
|
)!,
|
|
comment: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}comment'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$ProductReviewsTable createAlias(String alias) {
|
|
return $ProductReviewsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class ProductReview extends DataClass implements Insertable<ProductReview> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String? customerId;
|
|
final String productVariantId;
|
|
final String? customerNameSnapshot;
|
|
final int rating;
|
|
final String? comment;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const ProductReview({
|
|
required this.localId,
|
|
this.serverId,
|
|
this.customerId,
|
|
required this.productVariantId,
|
|
this.customerNameSnapshot,
|
|
required this.rating,
|
|
this.comment,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
if (!nullToAbsent || customerId != null) {
|
|
map['customer_id'] = Variable<String>(customerId);
|
|
}
|
|
map['product_variant_id'] = Variable<String>(productVariantId);
|
|
if (!nullToAbsent || customerNameSnapshot != null) {
|
|
map['customer_name_snapshot'] = Variable<String>(customerNameSnapshot);
|
|
}
|
|
map['rating'] = Variable<int>(rating);
|
|
if (!nullToAbsent || comment != null) {
|
|
map['comment'] = Variable<String>(comment);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
ProductReviewsCompanion toCompanion(bool nullToAbsent) {
|
|
return ProductReviewsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
customerId: customerId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(customerId),
|
|
productVariantId: Value(productVariantId),
|
|
customerNameSnapshot: customerNameSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(customerNameSnapshot),
|
|
rating: Value(rating),
|
|
comment: comment == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(comment),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory ProductReview.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return ProductReview(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
customerId: serializer.fromJson<String?>(json['customerId']),
|
|
productVariantId: serializer.fromJson<String>(json['productVariantId']),
|
|
customerNameSnapshot: serializer.fromJson<String?>(
|
|
json['customerNameSnapshot'],
|
|
),
|
|
rating: serializer.fromJson<int>(json['rating']),
|
|
comment: serializer.fromJson<String?>(json['comment']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'customerId': serializer.toJson<String?>(customerId),
|
|
'productVariantId': serializer.toJson<String>(productVariantId),
|
|
'customerNameSnapshot': serializer.toJson<String?>(customerNameSnapshot),
|
|
'rating': serializer.toJson<int>(rating),
|
|
'comment': serializer.toJson<String?>(comment),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
ProductReview copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> customerId = const Value.absent(),
|
|
String? productVariantId,
|
|
Value<String?> customerNameSnapshot = const Value.absent(),
|
|
int? rating,
|
|
Value<String?> comment = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => ProductReview(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
customerId: customerId.present ? customerId.value : this.customerId,
|
|
productVariantId: productVariantId ?? this.productVariantId,
|
|
customerNameSnapshot: customerNameSnapshot.present
|
|
? customerNameSnapshot.value
|
|
: this.customerNameSnapshot,
|
|
rating: rating ?? this.rating,
|
|
comment: comment.present ? comment.value : this.comment,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
ProductReview copyWithCompanion(ProductReviewsCompanion data) {
|
|
return ProductReview(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
customerId: data.customerId.present
|
|
? data.customerId.value
|
|
: this.customerId,
|
|
productVariantId: data.productVariantId.present
|
|
? data.productVariantId.value
|
|
: this.productVariantId,
|
|
customerNameSnapshot: data.customerNameSnapshot.present
|
|
? data.customerNameSnapshot.value
|
|
: this.customerNameSnapshot,
|
|
rating: data.rating.present ? data.rating.value : this.rating,
|
|
comment: data.comment.present ? data.comment.value : this.comment,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ProductReview(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('customerId: $customerId, ')
|
|
..write('productVariantId: $productVariantId, ')
|
|
..write('customerNameSnapshot: $customerNameSnapshot, ')
|
|
..write('rating: $rating, ')
|
|
..write('comment: $comment, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
customerId,
|
|
productVariantId,
|
|
customerNameSnapshot,
|
|
rating,
|
|
comment,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is ProductReview &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.customerId == this.customerId &&
|
|
other.productVariantId == this.productVariantId &&
|
|
other.customerNameSnapshot == this.customerNameSnapshot &&
|
|
other.rating == this.rating &&
|
|
other.comment == this.comment &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class ProductReviewsCompanion extends UpdateCompanion<ProductReview> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String?> customerId;
|
|
final Value<String> productVariantId;
|
|
final Value<String?> customerNameSnapshot;
|
|
final Value<int> rating;
|
|
final Value<String?> comment;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const ProductReviewsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.customerId = const Value.absent(),
|
|
this.productVariantId = const Value.absent(),
|
|
this.customerNameSnapshot = const Value.absent(),
|
|
this.rating = const Value.absent(),
|
|
this.comment = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
ProductReviewsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.customerId = const Value.absent(),
|
|
required String productVariantId,
|
|
this.customerNameSnapshot = const Value.absent(),
|
|
this.rating = const Value.absent(),
|
|
this.comment = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : productVariantId = Value(productVariantId);
|
|
static Insertable<ProductReview> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? customerId,
|
|
Expression<String>? productVariantId,
|
|
Expression<String>? customerNameSnapshot,
|
|
Expression<int>? rating,
|
|
Expression<String>? comment,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (customerId != null) 'customer_id': customerId,
|
|
if (productVariantId != null) 'product_variant_id': productVariantId,
|
|
if (customerNameSnapshot != null)
|
|
'customer_name_snapshot': customerNameSnapshot,
|
|
if (rating != null) 'rating': rating,
|
|
if (comment != null) 'comment': comment,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
ProductReviewsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String?>? customerId,
|
|
Value<String>? productVariantId,
|
|
Value<String?>? customerNameSnapshot,
|
|
Value<int>? rating,
|
|
Value<String?>? comment,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return ProductReviewsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
customerId: customerId ?? this.customerId,
|
|
productVariantId: productVariantId ?? this.productVariantId,
|
|
customerNameSnapshot: customerNameSnapshot ?? this.customerNameSnapshot,
|
|
rating: rating ?? this.rating,
|
|
comment: comment ?? this.comment,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (customerId.present) {
|
|
map['customer_id'] = Variable<String>(customerId.value);
|
|
}
|
|
if (productVariantId.present) {
|
|
map['product_variant_id'] = Variable<String>(productVariantId.value);
|
|
}
|
|
if (customerNameSnapshot.present) {
|
|
map['customer_name_snapshot'] = Variable<String>(
|
|
customerNameSnapshot.value,
|
|
);
|
|
}
|
|
if (rating.present) {
|
|
map['rating'] = Variable<int>(rating.value);
|
|
}
|
|
if (comment.present) {
|
|
map['comment'] = Variable<String>(comment.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ProductReviewsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('customerId: $customerId, ')
|
|
..write('productVariantId: $productVariantId, ')
|
|
..write('customerNameSnapshot: $customerNameSnapshot, ')
|
|
..write('rating: $rating, ')
|
|
..write('comment: $comment, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $ProductLikesTable extends ProductLikes
|
|
with TableInfo<$ProductLikesTable, ProductLike> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$ProductLikesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _customerIdMeta = const VerificationMeta(
|
|
'customerId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> customerId = GeneratedColumn<String>(
|
|
'customer_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES customers (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _productIdMeta = const VerificationMeta(
|
|
'productId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> productId = GeneratedColumn<String>(
|
|
'product_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES products (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _isLikeMeta = const VerificationMeta('isLike');
|
|
@override
|
|
late final GeneratedColumn<bool> isLike = GeneratedColumn<bool>(
|
|
'is_like',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_like" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
customerId,
|
|
productId,
|
|
isLike,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'product_likes';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<ProductLike> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('customer_id')) {
|
|
context.handle(
|
|
_customerIdMeta,
|
|
customerId.isAcceptableOrUnknown(data['customer_id']!, _customerIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('product_id')) {
|
|
context.handle(
|
|
_productIdMeta,
|
|
productId.isAcceptableOrUnknown(data['product_id']!, _productIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_productIdMeta);
|
|
}
|
|
if (data.containsKey('is_like')) {
|
|
context.handle(
|
|
_isLikeMeta,
|
|
isLike.isAcceptableOrUnknown(data['is_like']!, _isLikeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
ProductLike map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return ProductLike(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
customerId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}customer_id'],
|
|
),
|
|
productId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}product_id'],
|
|
)!,
|
|
isLike: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_like'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$ProductLikesTable createAlias(String alias) {
|
|
return $ProductLikesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class ProductLike extends DataClass implements Insertable<ProductLike> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String? customerId;
|
|
final String productId;
|
|
final bool isLike;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const ProductLike({
|
|
required this.localId,
|
|
this.serverId,
|
|
this.customerId,
|
|
required this.productId,
|
|
required this.isLike,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
if (!nullToAbsent || customerId != null) {
|
|
map['customer_id'] = Variable<String>(customerId);
|
|
}
|
|
map['product_id'] = Variable<String>(productId);
|
|
map['is_like'] = Variable<bool>(isLike);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
ProductLikesCompanion toCompanion(bool nullToAbsent) {
|
|
return ProductLikesCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
customerId: customerId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(customerId),
|
|
productId: Value(productId),
|
|
isLike: Value(isLike),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory ProductLike.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return ProductLike(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
customerId: serializer.fromJson<String?>(json['customerId']),
|
|
productId: serializer.fromJson<String>(json['productId']),
|
|
isLike: serializer.fromJson<bool>(json['isLike']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'customerId': serializer.toJson<String?>(customerId),
|
|
'productId': serializer.toJson<String>(productId),
|
|
'isLike': serializer.toJson<bool>(isLike),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
ProductLike copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> customerId = const Value.absent(),
|
|
String? productId,
|
|
bool? isLike,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => ProductLike(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
customerId: customerId.present ? customerId.value : this.customerId,
|
|
productId: productId ?? this.productId,
|
|
isLike: isLike ?? this.isLike,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
ProductLike copyWithCompanion(ProductLikesCompanion data) {
|
|
return ProductLike(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
customerId: data.customerId.present
|
|
? data.customerId.value
|
|
: this.customerId,
|
|
productId: data.productId.present ? data.productId.value : this.productId,
|
|
isLike: data.isLike.present ? data.isLike.value : this.isLike,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ProductLike(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('customerId: $customerId, ')
|
|
..write('productId: $productId, ')
|
|
..write('isLike: $isLike, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
customerId,
|
|
productId,
|
|
isLike,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is ProductLike &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.customerId == this.customerId &&
|
|
other.productId == this.productId &&
|
|
other.isLike == this.isLike &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class ProductLikesCompanion extends UpdateCompanion<ProductLike> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String?> customerId;
|
|
final Value<String> productId;
|
|
final Value<bool> isLike;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const ProductLikesCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.customerId = const Value.absent(),
|
|
this.productId = const Value.absent(),
|
|
this.isLike = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
ProductLikesCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.customerId = const Value.absent(),
|
|
required String productId,
|
|
this.isLike = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : productId = Value(productId);
|
|
static Insertable<ProductLike> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? customerId,
|
|
Expression<String>? productId,
|
|
Expression<bool>? isLike,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (customerId != null) 'customer_id': customerId,
|
|
if (productId != null) 'product_id': productId,
|
|
if (isLike != null) 'is_like': isLike,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
ProductLikesCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String?>? customerId,
|
|
Value<String>? productId,
|
|
Value<bool>? isLike,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return ProductLikesCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
customerId: customerId ?? this.customerId,
|
|
productId: productId ?? this.productId,
|
|
isLike: isLike ?? this.isLike,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (customerId.present) {
|
|
map['customer_id'] = Variable<String>(customerId.value);
|
|
}
|
|
if (productId.present) {
|
|
map['product_id'] = Variable<String>(productId.value);
|
|
}
|
|
if (isLike.present) {
|
|
map['is_like'] = Variable<bool>(isLike.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ProductLikesCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('customerId: $customerId, ')
|
|
..write('productId: $productId, ')
|
|
..write('isLike: $isLike, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $RawMaterialsTable extends RawMaterials
|
|
with TableInfo<$RawMaterialsTable, RawMaterial> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$RawMaterialsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _unitIdMeta = const VerificationMeta('unitId');
|
|
@override
|
|
late final GeneratedColumn<String> unitId = GeneratedColumn<String>(
|
|
'unit_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES units (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
unitId,
|
|
name,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'raw_materials';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<RawMaterial> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('unit_id')) {
|
|
context.handle(
|
|
_unitIdMeta,
|
|
unitId.isAcceptableOrUnknown(data['unit_id']!, _unitIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_unitIdMeta);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
RawMaterial map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return RawMaterial(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
unitId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}unit_id'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$RawMaterialsTable createAlias(String alias) {
|
|
return $RawMaterialsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class RawMaterial extends DataClass implements Insertable<RawMaterial> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String unitId;
|
|
final String name;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const RawMaterial({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.unitId,
|
|
required this.name,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['unit_id'] = Variable<String>(unitId);
|
|
map['name'] = Variable<String>(name);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
RawMaterialsCompanion toCompanion(bool nullToAbsent) {
|
|
return RawMaterialsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
unitId: Value(unitId),
|
|
name: Value(name),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory RawMaterial.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return RawMaterial(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
unitId: serializer.fromJson<String>(json['unitId']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'unitId': serializer.toJson<String>(unitId),
|
|
'name': serializer.toJson<String>(name),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
RawMaterial copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? unitId,
|
|
String? name,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => RawMaterial(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
unitId: unitId ?? this.unitId,
|
|
name: name ?? this.name,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
RawMaterial copyWithCompanion(RawMaterialsCompanion data) {
|
|
return RawMaterial(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
unitId: data.unitId.present ? data.unitId.value : this.unitId,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('RawMaterial(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('unitId: $unitId, ')
|
|
..write('name: $name, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
unitId,
|
|
name,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is RawMaterial &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.unitId == this.unitId &&
|
|
other.name == this.name &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class RawMaterialsCompanion extends UpdateCompanion<RawMaterial> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> unitId;
|
|
final Value<String> name;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const RawMaterialsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.unitId = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
RawMaterialsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String unitId,
|
|
required String name,
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : unitId = Value(unitId),
|
|
name = Value(name);
|
|
static Insertable<RawMaterial> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? unitId,
|
|
Expression<String>? name,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (unitId != null) 'unit_id': unitId,
|
|
if (name != null) 'name': name,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
RawMaterialsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? unitId,
|
|
Value<String>? name,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return RawMaterialsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
unitId: unitId ?? this.unitId,
|
|
name: name ?? this.name,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (unitId.present) {
|
|
map['unit_id'] = Variable<String>(unitId.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('RawMaterialsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('unitId: $unitId, ')
|
|
..write('name: $name, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $OutletInventoriesTable extends OutletInventories
|
|
with TableInfo<$OutletInventoriesTable, OutletInventory> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$OutletInventoriesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _outletIdMeta = const VerificationMeta(
|
|
'outletId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> outletId = GeneratedColumn<String>(
|
|
'outlet_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES outlets (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _itemTypeMeta = const VerificationMeta(
|
|
'itemType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> itemType = GeneratedColumn<String>(
|
|
'item_type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _itemIdMeta = const VerificationMeta('itemId');
|
|
@override
|
|
late final GeneratedColumn<String> itemId = GeneratedColumn<String>(
|
|
'item_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _stockTypeMeta = const VerificationMeta(
|
|
'stockType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> stockType = GeneratedColumn<String>(
|
|
'stock_type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant("fixed"),
|
|
);
|
|
static const VerificationMeta _stockMeta = const VerificationMeta('stock');
|
|
@override
|
|
late final GeneratedColumn<double> stock = GeneratedColumn<double>(
|
|
'stock',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _sellingPriceMeta = const VerificationMeta(
|
|
'sellingPrice',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> sellingPrice = GeneratedColumn<double>(
|
|
'selling_price',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _costPriceMeta = const VerificationMeta(
|
|
'costPrice',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> costPrice = GeneratedColumn<double>(
|
|
'cost_price',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _purchasePriceMeta = const VerificationMeta(
|
|
'purchasePrice',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> purchasePrice = GeneratedColumn<double>(
|
|
'purchase_price',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _isDeleteByOwnerMeta = const VerificationMeta(
|
|
'isDeleteByOwner',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isDeleteByOwner = GeneratedColumn<bool>(
|
|
'is_delete_by_owner',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_delete_by_owner" IN (0, 1))',
|
|
),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant("dirty"),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
outletId,
|
|
itemType,
|
|
itemId,
|
|
stockType,
|
|
stock,
|
|
sellingPrice,
|
|
costPrice,
|
|
purchasePrice,
|
|
isDeleteByOwner,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'outlet_inventories';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<OutletInventory> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('outlet_id')) {
|
|
context.handle(
|
|
_outletIdMeta,
|
|
outletId.isAcceptableOrUnknown(data['outlet_id']!, _outletIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_outletIdMeta);
|
|
}
|
|
if (data.containsKey('item_type')) {
|
|
context.handle(
|
|
_itemTypeMeta,
|
|
itemType.isAcceptableOrUnknown(data['item_type']!, _itemTypeMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_itemTypeMeta);
|
|
}
|
|
if (data.containsKey('item_id')) {
|
|
context.handle(
|
|
_itemIdMeta,
|
|
itemId.isAcceptableOrUnknown(data['item_id']!, _itemIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_itemIdMeta);
|
|
}
|
|
if (data.containsKey('stock_type')) {
|
|
context.handle(
|
|
_stockTypeMeta,
|
|
stockType.isAcceptableOrUnknown(data['stock_type']!, _stockTypeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('stock')) {
|
|
context.handle(
|
|
_stockMeta,
|
|
stock.isAcceptableOrUnknown(data['stock']!, _stockMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('selling_price')) {
|
|
context.handle(
|
|
_sellingPriceMeta,
|
|
sellingPrice.isAcceptableOrUnknown(
|
|
data['selling_price']!,
|
|
_sellingPriceMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('cost_price')) {
|
|
context.handle(
|
|
_costPriceMeta,
|
|
costPrice.isAcceptableOrUnknown(data['cost_price']!, _costPriceMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('purchase_price')) {
|
|
context.handle(
|
|
_purchasePriceMeta,
|
|
purchasePrice.isAcceptableOrUnknown(
|
|
data['purchase_price']!,
|
|
_purchasePriceMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('is_delete_by_owner')) {
|
|
context.handle(
|
|
_isDeleteByOwnerMeta,
|
|
isDeleteByOwner.isAcceptableOrUnknown(
|
|
data['is_delete_by_owner']!,
|
|
_isDeleteByOwnerMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
OutletInventory map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return OutletInventory(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
outletId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_id'],
|
|
)!,
|
|
itemType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}item_type'],
|
|
)!,
|
|
itemId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}item_id'],
|
|
)!,
|
|
stockType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}stock_type'],
|
|
)!,
|
|
stock: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}stock'],
|
|
)!,
|
|
sellingPrice: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}selling_price'],
|
|
)!,
|
|
costPrice: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}cost_price'],
|
|
)!,
|
|
purchasePrice: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}purchase_price'],
|
|
)!,
|
|
isDeleteByOwner: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_delete_by_owner'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$OutletInventoriesTable createAlias(String alias) {
|
|
return $OutletInventoriesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class OutletInventory extends DataClass implements Insertable<OutletInventory> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String outletId;
|
|
final String itemType;
|
|
final String itemId;
|
|
final String stockType;
|
|
final double stock;
|
|
final double sellingPrice;
|
|
final double costPrice;
|
|
final double purchasePrice;
|
|
final bool? isDeleteByOwner;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const OutletInventory({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.outletId,
|
|
required this.itemType,
|
|
required this.itemId,
|
|
required this.stockType,
|
|
required this.stock,
|
|
required this.sellingPrice,
|
|
required this.costPrice,
|
|
required this.purchasePrice,
|
|
this.isDeleteByOwner,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['outlet_id'] = Variable<String>(outletId);
|
|
map['item_type'] = Variable<String>(itemType);
|
|
map['item_id'] = Variable<String>(itemId);
|
|
map['stock_type'] = Variable<String>(stockType);
|
|
map['stock'] = Variable<double>(stock);
|
|
map['selling_price'] = Variable<double>(sellingPrice);
|
|
map['cost_price'] = Variable<double>(costPrice);
|
|
map['purchase_price'] = Variable<double>(purchasePrice);
|
|
if (!nullToAbsent || isDeleteByOwner != null) {
|
|
map['is_delete_by_owner'] = Variable<bool>(isDeleteByOwner);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
OutletInventoriesCompanion toCompanion(bool nullToAbsent) {
|
|
return OutletInventoriesCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
outletId: Value(outletId),
|
|
itemType: Value(itemType),
|
|
itemId: Value(itemId),
|
|
stockType: Value(stockType),
|
|
stock: Value(stock),
|
|
sellingPrice: Value(sellingPrice),
|
|
costPrice: Value(costPrice),
|
|
purchasePrice: Value(purchasePrice),
|
|
isDeleteByOwner: isDeleteByOwner == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(isDeleteByOwner),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory OutletInventory.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return OutletInventory(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
outletId: serializer.fromJson<String>(json['outletId']),
|
|
itemType: serializer.fromJson<String>(json['itemType']),
|
|
itemId: serializer.fromJson<String>(json['itemId']),
|
|
stockType: serializer.fromJson<String>(json['stockType']),
|
|
stock: serializer.fromJson<double>(json['stock']),
|
|
sellingPrice: serializer.fromJson<double>(json['sellingPrice']),
|
|
costPrice: serializer.fromJson<double>(json['costPrice']),
|
|
purchasePrice: serializer.fromJson<double>(json['purchasePrice']),
|
|
isDeleteByOwner: serializer.fromJson<bool?>(json['isDeleteByOwner']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'outletId': serializer.toJson<String>(outletId),
|
|
'itemType': serializer.toJson<String>(itemType),
|
|
'itemId': serializer.toJson<String>(itemId),
|
|
'stockType': serializer.toJson<String>(stockType),
|
|
'stock': serializer.toJson<double>(stock),
|
|
'sellingPrice': serializer.toJson<double>(sellingPrice),
|
|
'costPrice': serializer.toJson<double>(costPrice),
|
|
'purchasePrice': serializer.toJson<double>(purchasePrice),
|
|
'isDeleteByOwner': serializer.toJson<bool?>(isDeleteByOwner),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
OutletInventory copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? outletId,
|
|
String? itemType,
|
|
String? itemId,
|
|
String? stockType,
|
|
double? stock,
|
|
double? sellingPrice,
|
|
double? costPrice,
|
|
double? purchasePrice,
|
|
Value<bool?> isDeleteByOwner = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => OutletInventory(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
outletId: outletId ?? this.outletId,
|
|
itemType: itemType ?? this.itemType,
|
|
itemId: itemId ?? this.itemId,
|
|
stockType: stockType ?? this.stockType,
|
|
stock: stock ?? this.stock,
|
|
sellingPrice: sellingPrice ?? this.sellingPrice,
|
|
costPrice: costPrice ?? this.costPrice,
|
|
purchasePrice: purchasePrice ?? this.purchasePrice,
|
|
isDeleteByOwner: isDeleteByOwner.present
|
|
? isDeleteByOwner.value
|
|
: this.isDeleteByOwner,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
OutletInventory copyWithCompanion(OutletInventoriesCompanion data) {
|
|
return OutletInventory(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
outletId: data.outletId.present ? data.outletId.value : this.outletId,
|
|
itemType: data.itemType.present ? data.itemType.value : this.itemType,
|
|
itemId: data.itemId.present ? data.itemId.value : this.itemId,
|
|
stockType: data.stockType.present ? data.stockType.value : this.stockType,
|
|
stock: data.stock.present ? data.stock.value : this.stock,
|
|
sellingPrice: data.sellingPrice.present
|
|
? data.sellingPrice.value
|
|
: this.sellingPrice,
|
|
costPrice: data.costPrice.present ? data.costPrice.value : this.costPrice,
|
|
purchasePrice: data.purchasePrice.present
|
|
? data.purchasePrice.value
|
|
: this.purchasePrice,
|
|
isDeleteByOwner: data.isDeleteByOwner.present
|
|
? data.isDeleteByOwner.value
|
|
: this.isDeleteByOwner,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('OutletInventory(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('itemType: $itemType, ')
|
|
..write('itemId: $itemId, ')
|
|
..write('stockType: $stockType, ')
|
|
..write('stock: $stock, ')
|
|
..write('sellingPrice: $sellingPrice, ')
|
|
..write('costPrice: $costPrice, ')
|
|
..write('purchasePrice: $purchasePrice, ')
|
|
..write('isDeleteByOwner: $isDeleteByOwner, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
outletId,
|
|
itemType,
|
|
itemId,
|
|
stockType,
|
|
stock,
|
|
sellingPrice,
|
|
costPrice,
|
|
purchasePrice,
|
|
isDeleteByOwner,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is OutletInventory &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.outletId == this.outletId &&
|
|
other.itemType == this.itemType &&
|
|
other.itemId == this.itemId &&
|
|
other.stockType == this.stockType &&
|
|
other.stock == this.stock &&
|
|
other.sellingPrice == this.sellingPrice &&
|
|
other.costPrice == this.costPrice &&
|
|
other.purchasePrice == this.purchasePrice &&
|
|
other.isDeleteByOwner == this.isDeleteByOwner &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class OutletInventoriesCompanion extends UpdateCompanion<OutletInventory> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> outletId;
|
|
final Value<String> itemType;
|
|
final Value<String> itemId;
|
|
final Value<String> stockType;
|
|
final Value<double> stock;
|
|
final Value<double> sellingPrice;
|
|
final Value<double> costPrice;
|
|
final Value<double> purchasePrice;
|
|
final Value<bool?> isDeleteByOwner;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const OutletInventoriesCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.outletId = const Value.absent(),
|
|
this.itemType = const Value.absent(),
|
|
this.itemId = const Value.absent(),
|
|
this.stockType = const Value.absent(),
|
|
this.stock = const Value.absent(),
|
|
this.sellingPrice = const Value.absent(),
|
|
this.costPrice = const Value.absent(),
|
|
this.purchasePrice = const Value.absent(),
|
|
this.isDeleteByOwner = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
OutletInventoriesCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String outletId,
|
|
required String itemType,
|
|
required String itemId,
|
|
this.stockType = const Value.absent(),
|
|
this.stock = const Value.absent(),
|
|
this.sellingPrice = const Value.absent(),
|
|
this.costPrice = const Value.absent(),
|
|
this.purchasePrice = const Value.absent(),
|
|
this.isDeleteByOwner = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : outletId = Value(outletId),
|
|
itemType = Value(itemType),
|
|
itemId = Value(itemId);
|
|
static Insertable<OutletInventory> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? outletId,
|
|
Expression<String>? itemType,
|
|
Expression<String>? itemId,
|
|
Expression<String>? stockType,
|
|
Expression<double>? stock,
|
|
Expression<double>? sellingPrice,
|
|
Expression<double>? costPrice,
|
|
Expression<double>? purchasePrice,
|
|
Expression<bool>? isDeleteByOwner,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (outletId != null) 'outlet_id': outletId,
|
|
if (itemType != null) 'item_type': itemType,
|
|
if (itemId != null) 'item_id': itemId,
|
|
if (stockType != null) 'stock_type': stockType,
|
|
if (stock != null) 'stock': stock,
|
|
if (sellingPrice != null) 'selling_price': sellingPrice,
|
|
if (costPrice != null) 'cost_price': costPrice,
|
|
if (purchasePrice != null) 'purchase_price': purchasePrice,
|
|
if (isDeleteByOwner != null) 'is_delete_by_owner': isDeleteByOwner,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
OutletInventoriesCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? outletId,
|
|
Value<String>? itemType,
|
|
Value<String>? itemId,
|
|
Value<String>? stockType,
|
|
Value<double>? stock,
|
|
Value<double>? sellingPrice,
|
|
Value<double>? costPrice,
|
|
Value<double>? purchasePrice,
|
|
Value<bool?>? isDeleteByOwner,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return OutletInventoriesCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
outletId: outletId ?? this.outletId,
|
|
itemType: itemType ?? this.itemType,
|
|
itemId: itemId ?? this.itemId,
|
|
stockType: stockType ?? this.stockType,
|
|
stock: stock ?? this.stock,
|
|
sellingPrice: sellingPrice ?? this.sellingPrice,
|
|
costPrice: costPrice ?? this.costPrice,
|
|
purchasePrice: purchasePrice ?? this.purchasePrice,
|
|
isDeleteByOwner: isDeleteByOwner ?? this.isDeleteByOwner,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (outletId.present) {
|
|
map['outlet_id'] = Variable<String>(outletId.value);
|
|
}
|
|
if (itemType.present) {
|
|
map['item_type'] = Variable<String>(itemType.value);
|
|
}
|
|
if (itemId.present) {
|
|
map['item_id'] = Variable<String>(itemId.value);
|
|
}
|
|
if (stockType.present) {
|
|
map['stock_type'] = Variable<String>(stockType.value);
|
|
}
|
|
if (stock.present) {
|
|
map['stock'] = Variable<double>(stock.value);
|
|
}
|
|
if (sellingPrice.present) {
|
|
map['selling_price'] = Variable<double>(sellingPrice.value);
|
|
}
|
|
if (costPrice.present) {
|
|
map['cost_price'] = Variable<double>(costPrice.value);
|
|
}
|
|
if (purchasePrice.present) {
|
|
map['purchase_price'] = Variable<double>(purchasePrice.value);
|
|
}
|
|
if (isDeleteByOwner.present) {
|
|
map['is_delete_by_owner'] = Variable<bool>(isDeleteByOwner.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('OutletInventoriesCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('itemType: $itemType, ')
|
|
..write('itemId: $itemId, ')
|
|
..write('stockType: $stockType, ')
|
|
..write('stock: $stock, ')
|
|
..write('sellingPrice: $sellingPrice, ')
|
|
..write('costPrice: $costPrice, ')
|
|
..write('purchasePrice: $purchasePrice, ')
|
|
..write('isDeleteByOwner: $isDeleteByOwner, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $ReceiptItemsTable extends ReceiptItems
|
|
with TableInfo<$ReceiptItemsTable, ReceiptItem> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$ReceiptItemsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _productVariantIdMeta = const VerificationMeta(
|
|
'productVariantId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> productVariantId = GeneratedColumn<String>(
|
|
'product_variant_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES product_variants (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _rawMaterialIdMeta = const VerificationMeta(
|
|
'rawMaterialId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> rawMaterialId = GeneratedColumn<String>(
|
|
'raw_material_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES raw_materials (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _quantityMeta = const VerificationMeta(
|
|
'quantity',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> quantity = GeneratedColumn<double>(
|
|
'quantity',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
productVariantId,
|
|
rawMaterialId,
|
|
quantity,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'receipt_items';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<ReceiptItem> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('product_variant_id')) {
|
|
context.handle(
|
|
_productVariantIdMeta,
|
|
productVariantId.isAcceptableOrUnknown(
|
|
data['product_variant_id']!,
|
|
_productVariantIdMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('raw_material_id')) {
|
|
context.handle(
|
|
_rawMaterialIdMeta,
|
|
rawMaterialId.isAcceptableOrUnknown(
|
|
data['raw_material_id']!,
|
|
_rawMaterialIdMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('quantity')) {
|
|
context.handle(
|
|
_quantityMeta,
|
|
quantity.isAcceptableOrUnknown(data['quantity']!, _quantityMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
ReceiptItem map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return ReceiptItem(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
productVariantId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}product_variant_id'],
|
|
),
|
|
rawMaterialId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}raw_material_id'],
|
|
),
|
|
quantity: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}quantity'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$ReceiptItemsTable createAlias(String alias) {
|
|
return $ReceiptItemsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class ReceiptItem extends DataClass implements Insertable<ReceiptItem> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String? productVariantId;
|
|
final String? rawMaterialId;
|
|
final double quantity;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const ReceiptItem({
|
|
required this.localId,
|
|
this.serverId,
|
|
this.productVariantId,
|
|
this.rawMaterialId,
|
|
required this.quantity,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
if (!nullToAbsent || productVariantId != null) {
|
|
map['product_variant_id'] = Variable<String>(productVariantId);
|
|
}
|
|
if (!nullToAbsent || rawMaterialId != null) {
|
|
map['raw_material_id'] = Variable<String>(rawMaterialId);
|
|
}
|
|
map['quantity'] = Variable<double>(quantity);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
ReceiptItemsCompanion toCompanion(bool nullToAbsent) {
|
|
return ReceiptItemsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
productVariantId: productVariantId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(productVariantId),
|
|
rawMaterialId: rawMaterialId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(rawMaterialId),
|
|
quantity: Value(quantity),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory ReceiptItem.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return ReceiptItem(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
productVariantId: serializer.fromJson<String?>(json['productVariantId']),
|
|
rawMaterialId: serializer.fromJson<String?>(json['rawMaterialId']),
|
|
quantity: serializer.fromJson<double>(json['quantity']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'productVariantId': serializer.toJson<String?>(productVariantId),
|
|
'rawMaterialId': serializer.toJson<String?>(rawMaterialId),
|
|
'quantity': serializer.toJson<double>(quantity),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
ReceiptItem copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> productVariantId = const Value.absent(),
|
|
Value<String?> rawMaterialId = const Value.absent(),
|
|
double? quantity,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => ReceiptItem(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
productVariantId: productVariantId.present
|
|
? productVariantId.value
|
|
: this.productVariantId,
|
|
rawMaterialId: rawMaterialId.present
|
|
? rawMaterialId.value
|
|
: this.rawMaterialId,
|
|
quantity: quantity ?? this.quantity,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
ReceiptItem copyWithCompanion(ReceiptItemsCompanion data) {
|
|
return ReceiptItem(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
productVariantId: data.productVariantId.present
|
|
? data.productVariantId.value
|
|
: this.productVariantId,
|
|
rawMaterialId: data.rawMaterialId.present
|
|
? data.rawMaterialId.value
|
|
: this.rawMaterialId,
|
|
quantity: data.quantity.present ? data.quantity.value : this.quantity,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ReceiptItem(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('productVariantId: $productVariantId, ')
|
|
..write('rawMaterialId: $rawMaterialId, ')
|
|
..write('quantity: $quantity, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
productVariantId,
|
|
rawMaterialId,
|
|
quantity,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is ReceiptItem &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.productVariantId == this.productVariantId &&
|
|
other.rawMaterialId == this.rawMaterialId &&
|
|
other.quantity == this.quantity &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class ReceiptItemsCompanion extends UpdateCompanion<ReceiptItem> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String?> productVariantId;
|
|
final Value<String?> rawMaterialId;
|
|
final Value<double> quantity;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const ReceiptItemsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.productVariantId = const Value.absent(),
|
|
this.rawMaterialId = const Value.absent(),
|
|
this.quantity = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
ReceiptItemsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.productVariantId = const Value.absent(),
|
|
this.rawMaterialId = const Value.absent(),
|
|
this.quantity = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
static Insertable<ReceiptItem> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? productVariantId,
|
|
Expression<String>? rawMaterialId,
|
|
Expression<double>? quantity,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (productVariantId != null) 'product_variant_id': productVariantId,
|
|
if (rawMaterialId != null) 'raw_material_id': rawMaterialId,
|
|
if (quantity != null) 'quantity': quantity,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
ReceiptItemsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String?>? productVariantId,
|
|
Value<String?>? rawMaterialId,
|
|
Value<double>? quantity,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return ReceiptItemsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
productVariantId: productVariantId ?? this.productVariantId,
|
|
rawMaterialId: rawMaterialId ?? this.rawMaterialId,
|
|
quantity: quantity ?? this.quantity,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (productVariantId.present) {
|
|
map['product_variant_id'] = Variable<String>(productVariantId.value);
|
|
}
|
|
if (rawMaterialId.present) {
|
|
map['raw_material_id'] = Variable<String>(rawMaterialId.value);
|
|
}
|
|
if (quantity.present) {
|
|
map['quantity'] = Variable<double>(quantity.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ReceiptItemsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('productVariantId: $productVariantId, ')
|
|
..write('rawMaterialId: $rawMaterialId, ')
|
|
..write('quantity: $quantity, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $StockCardsTable extends StockCards
|
|
with TableInfo<$StockCardsTable, StockCard> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$StockCardsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _outletInventoryIdMeta = const VerificationMeta(
|
|
'outletInventoryId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> outletInventoryId =
|
|
GeneratedColumn<String>(
|
|
'outlet_inventory_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES outlet_inventories (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
|
|
@override
|
|
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
|
|
'user_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES users (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _typeMeta = const VerificationMeta('type');
|
|
@override
|
|
late final GeneratedColumn<String> type = GeneratedColumn<String>(
|
|
'type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _receiveFromIdMeta = const VerificationMeta(
|
|
'receiveFromId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> receiveFromId = GeneratedColumn<String>(
|
|
'receive_from_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES outlets (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _qtyChangeMeta = const VerificationMeta(
|
|
'qtyChange',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> qtyChange = GeneratedColumn<double>(
|
|
'qty_change',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _currentStockMeta = const VerificationMeta(
|
|
'currentStock',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> currentStock = GeneratedColumn<double>(
|
|
'current_stock',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _stockTypeMeta = const VerificationMeta(
|
|
'stockType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> stockType = GeneratedColumn<String>(
|
|
'stock_type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant("fixed"),
|
|
);
|
|
static const VerificationMeta _modeChangeMeta = const VerificationMeta(
|
|
'modeChange',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> modeChange = GeneratedColumn<bool>(
|
|
'mode_change',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("mode_change" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _modeBeforeChangeMeta = const VerificationMeta(
|
|
'modeBeforeChange',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> modeBeforeChange = GeneratedColumn<String>(
|
|
'mode_before_change',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _modeAfterChangeMeta = const VerificationMeta(
|
|
'modeAfterChange',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> modeAfterChange = GeneratedColumn<String>(
|
|
'mode_after_change',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _costPriceMeta = const VerificationMeta(
|
|
'costPrice',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> costPrice = GeneratedColumn<double>(
|
|
'cost_price',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _referenceIdMeta = const VerificationMeta(
|
|
'referenceId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> referenceId = GeneratedColumn<String>(
|
|
'reference_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _documentNumberMeta = const VerificationMeta(
|
|
'documentNumber',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> documentNumber = GeneratedColumn<String>(
|
|
'document_number',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _notesMeta = const VerificationMeta('notes');
|
|
@override
|
|
late final GeneratedColumn<String> notes = GeneratedColumn<String>(
|
|
'notes',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant("dirty"),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
outletInventoryId,
|
|
userId,
|
|
type,
|
|
receiveFromId,
|
|
qtyChange,
|
|
currentStock,
|
|
stockType,
|
|
modeChange,
|
|
modeBeforeChange,
|
|
modeAfterChange,
|
|
costPrice,
|
|
referenceId,
|
|
documentNumber,
|
|
notes,
|
|
syncStatus,
|
|
createdAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'stock_cards';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<StockCard> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('outlet_inventory_id')) {
|
|
context.handle(
|
|
_outletInventoryIdMeta,
|
|
outletInventoryId.isAcceptableOrUnknown(
|
|
data['outlet_inventory_id']!,
|
|
_outletInventoryIdMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_outletInventoryIdMeta);
|
|
}
|
|
if (data.containsKey('user_id')) {
|
|
context.handle(
|
|
_userIdMeta,
|
|
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_userIdMeta);
|
|
}
|
|
if (data.containsKey('type')) {
|
|
context.handle(
|
|
_typeMeta,
|
|
type.isAcceptableOrUnknown(data['type']!, _typeMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_typeMeta);
|
|
}
|
|
if (data.containsKey('receive_from_id')) {
|
|
context.handle(
|
|
_receiveFromIdMeta,
|
|
receiveFromId.isAcceptableOrUnknown(
|
|
data['receive_from_id']!,
|
|
_receiveFromIdMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('qty_change')) {
|
|
context.handle(
|
|
_qtyChangeMeta,
|
|
qtyChange.isAcceptableOrUnknown(data['qty_change']!, _qtyChangeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('current_stock')) {
|
|
context.handle(
|
|
_currentStockMeta,
|
|
currentStock.isAcceptableOrUnknown(
|
|
data['current_stock']!,
|
|
_currentStockMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('stock_type')) {
|
|
context.handle(
|
|
_stockTypeMeta,
|
|
stockType.isAcceptableOrUnknown(data['stock_type']!, _stockTypeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('mode_change')) {
|
|
context.handle(
|
|
_modeChangeMeta,
|
|
modeChange.isAcceptableOrUnknown(data['mode_change']!, _modeChangeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('mode_before_change')) {
|
|
context.handle(
|
|
_modeBeforeChangeMeta,
|
|
modeBeforeChange.isAcceptableOrUnknown(
|
|
data['mode_before_change']!,
|
|
_modeBeforeChangeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('mode_after_change')) {
|
|
context.handle(
|
|
_modeAfterChangeMeta,
|
|
modeAfterChange.isAcceptableOrUnknown(
|
|
data['mode_after_change']!,
|
|
_modeAfterChangeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('cost_price')) {
|
|
context.handle(
|
|
_costPriceMeta,
|
|
costPrice.isAcceptableOrUnknown(data['cost_price']!, _costPriceMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('reference_id')) {
|
|
context.handle(
|
|
_referenceIdMeta,
|
|
referenceId.isAcceptableOrUnknown(
|
|
data['reference_id']!,
|
|
_referenceIdMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('document_number')) {
|
|
context.handle(
|
|
_documentNumberMeta,
|
|
documentNumber.isAcceptableOrUnknown(
|
|
data['document_number']!,
|
|
_documentNumberMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('notes')) {
|
|
context.handle(
|
|
_notesMeta,
|
|
notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
StockCard map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return StockCard(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
outletInventoryId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_inventory_id'],
|
|
)!,
|
|
userId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}user_id'],
|
|
)!,
|
|
type: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}type'],
|
|
)!,
|
|
receiveFromId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}receive_from_id'],
|
|
),
|
|
qtyChange: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}qty_change'],
|
|
)!,
|
|
currentStock: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}current_stock'],
|
|
)!,
|
|
stockType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}stock_type'],
|
|
)!,
|
|
modeChange: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}mode_change'],
|
|
)!,
|
|
modeBeforeChange: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}mode_before_change'],
|
|
),
|
|
modeAfterChange: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}mode_after_change'],
|
|
),
|
|
costPrice: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}cost_price'],
|
|
)!,
|
|
referenceId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}reference_id'],
|
|
),
|
|
documentNumber: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}document_number'],
|
|
),
|
|
notes: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}notes'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$StockCardsTable createAlias(String alias) {
|
|
return $StockCardsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class StockCard extends DataClass implements Insertable<StockCard> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String outletInventoryId;
|
|
final String userId;
|
|
final String type;
|
|
final String? receiveFromId;
|
|
final double qtyChange;
|
|
final double currentStock;
|
|
final String stockType;
|
|
final bool modeChange;
|
|
final String? modeBeforeChange;
|
|
final String? modeAfterChange;
|
|
final double costPrice;
|
|
final String? referenceId;
|
|
final String? documentNumber;
|
|
final String? notes;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
const StockCard({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.outletInventoryId,
|
|
required this.userId,
|
|
required this.type,
|
|
this.receiveFromId,
|
|
required this.qtyChange,
|
|
required this.currentStock,
|
|
required this.stockType,
|
|
required this.modeChange,
|
|
this.modeBeforeChange,
|
|
this.modeAfterChange,
|
|
required this.costPrice,
|
|
this.referenceId,
|
|
this.documentNumber,
|
|
this.notes,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['outlet_inventory_id'] = Variable<String>(outletInventoryId);
|
|
map['user_id'] = Variable<String>(userId);
|
|
map['type'] = Variable<String>(type);
|
|
if (!nullToAbsent || receiveFromId != null) {
|
|
map['receive_from_id'] = Variable<String>(receiveFromId);
|
|
}
|
|
map['qty_change'] = Variable<double>(qtyChange);
|
|
map['current_stock'] = Variable<double>(currentStock);
|
|
map['stock_type'] = Variable<String>(stockType);
|
|
map['mode_change'] = Variable<bool>(modeChange);
|
|
if (!nullToAbsent || modeBeforeChange != null) {
|
|
map['mode_before_change'] = Variable<String>(modeBeforeChange);
|
|
}
|
|
if (!nullToAbsent || modeAfterChange != null) {
|
|
map['mode_after_change'] = Variable<String>(modeAfterChange);
|
|
}
|
|
map['cost_price'] = Variable<double>(costPrice);
|
|
if (!nullToAbsent || referenceId != null) {
|
|
map['reference_id'] = Variable<String>(referenceId);
|
|
}
|
|
if (!nullToAbsent || documentNumber != null) {
|
|
map['document_number'] = Variable<String>(documentNumber);
|
|
}
|
|
if (!nullToAbsent || notes != null) {
|
|
map['notes'] = Variable<String>(notes);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
return map;
|
|
}
|
|
|
|
StockCardsCompanion toCompanion(bool nullToAbsent) {
|
|
return StockCardsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
outletInventoryId: Value(outletInventoryId),
|
|
userId: Value(userId),
|
|
type: Value(type),
|
|
receiveFromId: receiveFromId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(receiveFromId),
|
|
qtyChange: Value(qtyChange),
|
|
currentStock: Value(currentStock),
|
|
stockType: Value(stockType),
|
|
modeChange: Value(modeChange),
|
|
modeBeforeChange: modeBeforeChange == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(modeBeforeChange),
|
|
modeAfterChange: modeAfterChange == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(modeAfterChange),
|
|
costPrice: Value(costPrice),
|
|
referenceId: referenceId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(referenceId),
|
|
documentNumber: documentNumber == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(documentNumber),
|
|
notes: notes == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(notes),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
);
|
|
}
|
|
|
|
factory StockCard.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return StockCard(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
outletInventoryId: serializer.fromJson<String>(json['outletInventoryId']),
|
|
userId: serializer.fromJson<String>(json['userId']),
|
|
type: serializer.fromJson<String>(json['type']),
|
|
receiveFromId: serializer.fromJson<String?>(json['receiveFromId']),
|
|
qtyChange: serializer.fromJson<double>(json['qtyChange']),
|
|
currentStock: serializer.fromJson<double>(json['currentStock']),
|
|
stockType: serializer.fromJson<String>(json['stockType']),
|
|
modeChange: serializer.fromJson<bool>(json['modeChange']),
|
|
modeBeforeChange: serializer.fromJson<String?>(json['modeBeforeChange']),
|
|
modeAfterChange: serializer.fromJson<String?>(json['modeAfterChange']),
|
|
costPrice: serializer.fromJson<double>(json['costPrice']),
|
|
referenceId: serializer.fromJson<String?>(json['referenceId']),
|
|
documentNumber: serializer.fromJson<String?>(json['documentNumber']),
|
|
notes: serializer.fromJson<String?>(json['notes']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'outletInventoryId': serializer.toJson<String>(outletInventoryId),
|
|
'userId': serializer.toJson<String>(userId),
|
|
'type': serializer.toJson<String>(type),
|
|
'receiveFromId': serializer.toJson<String?>(receiveFromId),
|
|
'qtyChange': serializer.toJson<double>(qtyChange),
|
|
'currentStock': serializer.toJson<double>(currentStock),
|
|
'stockType': serializer.toJson<String>(stockType),
|
|
'modeChange': serializer.toJson<bool>(modeChange),
|
|
'modeBeforeChange': serializer.toJson<String?>(modeBeforeChange),
|
|
'modeAfterChange': serializer.toJson<String?>(modeAfterChange),
|
|
'costPrice': serializer.toJson<double>(costPrice),
|
|
'referenceId': serializer.toJson<String?>(referenceId),
|
|
'documentNumber': serializer.toJson<String?>(documentNumber),
|
|
'notes': serializer.toJson<String?>(notes),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
};
|
|
}
|
|
|
|
StockCard copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? outletInventoryId,
|
|
String? userId,
|
|
String? type,
|
|
Value<String?> receiveFromId = const Value.absent(),
|
|
double? qtyChange,
|
|
double? currentStock,
|
|
String? stockType,
|
|
bool? modeChange,
|
|
Value<String?> modeBeforeChange = const Value.absent(),
|
|
Value<String?> modeAfterChange = const Value.absent(),
|
|
double? costPrice,
|
|
Value<String?> referenceId = const Value.absent(),
|
|
Value<String?> documentNumber = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
}) => StockCard(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
outletInventoryId: outletInventoryId ?? this.outletInventoryId,
|
|
userId: userId ?? this.userId,
|
|
type: type ?? this.type,
|
|
receiveFromId: receiveFromId.present
|
|
? receiveFromId.value
|
|
: this.receiveFromId,
|
|
qtyChange: qtyChange ?? this.qtyChange,
|
|
currentStock: currentStock ?? this.currentStock,
|
|
stockType: stockType ?? this.stockType,
|
|
modeChange: modeChange ?? this.modeChange,
|
|
modeBeforeChange: modeBeforeChange.present
|
|
? modeBeforeChange.value
|
|
: this.modeBeforeChange,
|
|
modeAfterChange: modeAfterChange.present
|
|
? modeAfterChange.value
|
|
: this.modeAfterChange,
|
|
costPrice: costPrice ?? this.costPrice,
|
|
referenceId: referenceId.present ? referenceId.value : this.referenceId,
|
|
documentNumber: documentNumber.present
|
|
? documentNumber.value
|
|
: this.documentNumber,
|
|
notes: notes.present ? notes.value : this.notes,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
);
|
|
StockCard copyWithCompanion(StockCardsCompanion data) {
|
|
return StockCard(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
outletInventoryId: data.outletInventoryId.present
|
|
? data.outletInventoryId.value
|
|
: this.outletInventoryId,
|
|
userId: data.userId.present ? data.userId.value : this.userId,
|
|
type: data.type.present ? data.type.value : this.type,
|
|
receiveFromId: data.receiveFromId.present
|
|
? data.receiveFromId.value
|
|
: this.receiveFromId,
|
|
qtyChange: data.qtyChange.present ? data.qtyChange.value : this.qtyChange,
|
|
currentStock: data.currentStock.present
|
|
? data.currentStock.value
|
|
: this.currentStock,
|
|
stockType: data.stockType.present ? data.stockType.value : this.stockType,
|
|
modeChange: data.modeChange.present
|
|
? data.modeChange.value
|
|
: this.modeChange,
|
|
modeBeforeChange: data.modeBeforeChange.present
|
|
? data.modeBeforeChange.value
|
|
: this.modeBeforeChange,
|
|
modeAfterChange: data.modeAfterChange.present
|
|
? data.modeAfterChange.value
|
|
: this.modeAfterChange,
|
|
costPrice: data.costPrice.present ? data.costPrice.value : this.costPrice,
|
|
referenceId: data.referenceId.present
|
|
? data.referenceId.value
|
|
: this.referenceId,
|
|
documentNumber: data.documentNumber.present
|
|
? data.documentNumber.value
|
|
: this.documentNumber,
|
|
notes: data.notes.present ? data.notes.value : this.notes,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('StockCard(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletInventoryId: $outletInventoryId, ')
|
|
..write('userId: $userId, ')
|
|
..write('type: $type, ')
|
|
..write('receiveFromId: $receiveFromId, ')
|
|
..write('qtyChange: $qtyChange, ')
|
|
..write('currentStock: $currentStock, ')
|
|
..write('stockType: $stockType, ')
|
|
..write('modeChange: $modeChange, ')
|
|
..write('modeBeforeChange: $modeBeforeChange, ')
|
|
..write('modeAfterChange: $modeAfterChange, ')
|
|
..write('costPrice: $costPrice, ')
|
|
..write('referenceId: $referenceId, ')
|
|
..write('documentNumber: $documentNumber, ')
|
|
..write('notes: $notes, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
outletInventoryId,
|
|
userId,
|
|
type,
|
|
receiveFromId,
|
|
qtyChange,
|
|
currentStock,
|
|
stockType,
|
|
modeChange,
|
|
modeBeforeChange,
|
|
modeAfterChange,
|
|
costPrice,
|
|
referenceId,
|
|
documentNumber,
|
|
notes,
|
|
syncStatus,
|
|
createdAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is StockCard &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.outletInventoryId == this.outletInventoryId &&
|
|
other.userId == this.userId &&
|
|
other.type == this.type &&
|
|
other.receiveFromId == this.receiveFromId &&
|
|
other.qtyChange == this.qtyChange &&
|
|
other.currentStock == this.currentStock &&
|
|
other.stockType == this.stockType &&
|
|
other.modeChange == this.modeChange &&
|
|
other.modeBeforeChange == this.modeBeforeChange &&
|
|
other.modeAfterChange == this.modeAfterChange &&
|
|
other.costPrice == this.costPrice &&
|
|
other.referenceId == this.referenceId &&
|
|
other.documentNumber == this.documentNumber &&
|
|
other.notes == this.notes &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt);
|
|
}
|
|
|
|
class StockCardsCompanion extends UpdateCompanion<StockCard> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> outletInventoryId;
|
|
final Value<String> userId;
|
|
final Value<String> type;
|
|
final Value<String?> receiveFromId;
|
|
final Value<double> qtyChange;
|
|
final Value<double> currentStock;
|
|
final Value<String> stockType;
|
|
final Value<bool> modeChange;
|
|
final Value<String?> modeBeforeChange;
|
|
final Value<String?> modeAfterChange;
|
|
final Value<double> costPrice;
|
|
final Value<String?> referenceId;
|
|
final Value<String?> documentNumber;
|
|
final Value<String?> notes;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<int> rowid;
|
|
const StockCardsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.outletInventoryId = const Value.absent(),
|
|
this.userId = const Value.absent(),
|
|
this.type = const Value.absent(),
|
|
this.receiveFromId = const Value.absent(),
|
|
this.qtyChange = const Value.absent(),
|
|
this.currentStock = const Value.absent(),
|
|
this.stockType = const Value.absent(),
|
|
this.modeChange = const Value.absent(),
|
|
this.modeBeforeChange = const Value.absent(),
|
|
this.modeAfterChange = const Value.absent(),
|
|
this.costPrice = const Value.absent(),
|
|
this.referenceId = const Value.absent(),
|
|
this.documentNumber = const Value.absent(),
|
|
this.notes = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
StockCardsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String outletInventoryId,
|
|
required String userId,
|
|
required String type,
|
|
this.receiveFromId = const Value.absent(),
|
|
this.qtyChange = const Value.absent(),
|
|
this.currentStock = const Value.absent(),
|
|
this.stockType = const Value.absent(),
|
|
this.modeChange = const Value.absent(),
|
|
this.modeBeforeChange = const Value.absent(),
|
|
this.modeAfterChange = const Value.absent(),
|
|
this.costPrice = const Value.absent(),
|
|
this.referenceId = const Value.absent(),
|
|
this.documentNumber = const Value.absent(),
|
|
this.notes = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : outletInventoryId = Value(outletInventoryId),
|
|
userId = Value(userId),
|
|
type = Value(type);
|
|
static Insertable<StockCard> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? outletInventoryId,
|
|
Expression<String>? userId,
|
|
Expression<String>? type,
|
|
Expression<String>? receiveFromId,
|
|
Expression<double>? qtyChange,
|
|
Expression<double>? currentStock,
|
|
Expression<String>? stockType,
|
|
Expression<bool>? modeChange,
|
|
Expression<String>? modeBeforeChange,
|
|
Expression<String>? modeAfterChange,
|
|
Expression<double>? costPrice,
|
|
Expression<String>? referenceId,
|
|
Expression<String>? documentNumber,
|
|
Expression<String>? notes,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (outletInventoryId != null) 'outlet_inventory_id': outletInventoryId,
|
|
if (userId != null) 'user_id': userId,
|
|
if (type != null) 'type': type,
|
|
if (receiveFromId != null) 'receive_from_id': receiveFromId,
|
|
if (qtyChange != null) 'qty_change': qtyChange,
|
|
if (currentStock != null) 'current_stock': currentStock,
|
|
if (stockType != null) 'stock_type': stockType,
|
|
if (modeChange != null) 'mode_change': modeChange,
|
|
if (modeBeforeChange != null) 'mode_before_change': modeBeforeChange,
|
|
if (modeAfterChange != null) 'mode_after_change': modeAfterChange,
|
|
if (costPrice != null) 'cost_price': costPrice,
|
|
if (referenceId != null) 'reference_id': referenceId,
|
|
if (documentNumber != null) 'document_number': documentNumber,
|
|
if (notes != null) 'notes': notes,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
StockCardsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? outletInventoryId,
|
|
Value<String>? userId,
|
|
Value<String>? type,
|
|
Value<String?>? receiveFromId,
|
|
Value<double>? qtyChange,
|
|
Value<double>? currentStock,
|
|
Value<String>? stockType,
|
|
Value<bool>? modeChange,
|
|
Value<String?>? modeBeforeChange,
|
|
Value<String?>? modeAfterChange,
|
|
Value<double>? costPrice,
|
|
Value<String?>? referenceId,
|
|
Value<String?>? documentNumber,
|
|
Value<String?>? notes,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return StockCardsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
outletInventoryId: outletInventoryId ?? this.outletInventoryId,
|
|
userId: userId ?? this.userId,
|
|
type: type ?? this.type,
|
|
receiveFromId: receiveFromId ?? this.receiveFromId,
|
|
qtyChange: qtyChange ?? this.qtyChange,
|
|
currentStock: currentStock ?? this.currentStock,
|
|
stockType: stockType ?? this.stockType,
|
|
modeChange: modeChange ?? this.modeChange,
|
|
modeBeforeChange: modeBeforeChange ?? this.modeBeforeChange,
|
|
modeAfterChange: modeAfterChange ?? this.modeAfterChange,
|
|
costPrice: costPrice ?? this.costPrice,
|
|
referenceId: referenceId ?? this.referenceId,
|
|
documentNumber: documentNumber ?? this.documentNumber,
|
|
notes: notes ?? this.notes,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (outletInventoryId.present) {
|
|
map['outlet_inventory_id'] = Variable<String>(outletInventoryId.value);
|
|
}
|
|
if (userId.present) {
|
|
map['user_id'] = Variable<String>(userId.value);
|
|
}
|
|
if (type.present) {
|
|
map['type'] = Variable<String>(type.value);
|
|
}
|
|
if (receiveFromId.present) {
|
|
map['receive_from_id'] = Variable<String>(receiveFromId.value);
|
|
}
|
|
if (qtyChange.present) {
|
|
map['qty_change'] = Variable<double>(qtyChange.value);
|
|
}
|
|
if (currentStock.present) {
|
|
map['current_stock'] = Variable<double>(currentStock.value);
|
|
}
|
|
if (stockType.present) {
|
|
map['stock_type'] = Variable<String>(stockType.value);
|
|
}
|
|
if (modeChange.present) {
|
|
map['mode_change'] = Variable<bool>(modeChange.value);
|
|
}
|
|
if (modeBeforeChange.present) {
|
|
map['mode_before_change'] = Variable<String>(modeBeforeChange.value);
|
|
}
|
|
if (modeAfterChange.present) {
|
|
map['mode_after_change'] = Variable<String>(modeAfterChange.value);
|
|
}
|
|
if (costPrice.present) {
|
|
map['cost_price'] = Variable<double>(costPrice.value);
|
|
}
|
|
if (referenceId.present) {
|
|
map['reference_id'] = Variable<String>(referenceId.value);
|
|
}
|
|
if (documentNumber.present) {
|
|
map['document_number'] = Variable<String>(documentNumber.value);
|
|
}
|
|
if (notes.present) {
|
|
map['notes'] = Variable<String>(notes.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('StockCardsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletInventoryId: $outletInventoryId, ')
|
|
..write('userId: $userId, ')
|
|
..write('type: $type, ')
|
|
..write('receiveFromId: $receiveFromId, ')
|
|
..write('qtyChange: $qtyChange, ')
|
|
..write('currentStock: $currentStock, ')
|
|
..write('stockType: $stockType, ')
|
|
..write('modeChange: $modeChange, ')
|
|
..write('modeBeforeChange: $modeBeforeChange, ')
|
|
..write('modeAfterChange: $modeAfterChange, ')
|
|
..write('costPrice: $costPrice, ')
|
|
..write('referenceId: $referenceId, ')
|
|
..write('documentNumber: $documentNumber, ')
|
|
..write('notes: $notes, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $OrdersTable extends Orders with TableInfo<$OrdersTable, Order> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$OrdersTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _orderNumberMeta = const VerificationMeta(
|
|
'orderNumber',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> orderNumber = GeneratedColumn<String>(
|
|
'order_number',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _outletIdMeta = const VerificationMeta(
|
|
'outletId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> outletId = GeneratedColumn<String>(
|
|
'outlet_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES outlets (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _outletNameSnapshotMeta =
|
|
const VerificationMeta('outletNameSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> outletNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'outlet_name_snapshot',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _customerIdMeta = const VerificationMeta(
|
|
'customerId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> customerId = GeneratedColumn<String>(
|
|
'customer_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES customers (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _customerNameSnapshotMeta =
|
|
const VerificationMeta('customerNameSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> customerNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'customer_name_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _customerEmailSnapshotMeta =
|
|
const VerificationMeta('customerEmailSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> customerEmailSnapshot =
|
|
GeneratedColumn<String>(
|
|
'customer_email_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _customerPhoneNumberSnapshotMeta =
|
|
const VerificationMeta('customerPhoneNumberSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> customerPhoneNumberSnapshot =
|
|
GeneratedColumn<String>(
|
|
'customer_phone_number_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
|
|
@override
|
|
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
|
|
'user_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES users (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _adminNameSnapshotMeta = const VerificationMeta(
|
|
'adminNameSnapshot',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> adminNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'admin_name_snapshot',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _sourceMeta = const VerificationMeta('source');
|
|
@override
|
|
late final GeneratedColumn<String> source = GeneratedColumn<String>(
|
|
'source',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _alreadyReadMeta = const VerificationMeta(
|
|
'alreadyRead',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> alreadyRead = GeneratedColumn<bool>(
|
|
'already_read',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("already_read" IN (0, 1))',
|
|
),
|
|
);
|
|
static const VerificationMeta _orderStatusMeta = const VerificationMeta(
|
|
'orderStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> orderStatus = GeneratedColumn<String>(
|
|
'order_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _isCancellationMeta = const VerificationMeta(
|
|
'isCancellation',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isCancellation = GeneratedColumn<bool>(
|
|
'is_cancellation',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_cancellation" IN (0, 1))',
|
|
),
|
|
);
|
|
static const VerificationMeta _cancellationAcceptedMeta =
|
|
const VerificationMeta('cancellationAccepted');
|
|
@override
|
|
late final GeneratedColumn<bool> cancellationAccepted = GeneratedColumn<bool>(
|
|
'cancellation_accepted',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("cancellation_accepted" IN (0, 1))',
|
|
),
|
|
);
|
|
static const VerificationMeta _approvalProccessMeta = const VerificationMeta(
|
|
'approvalProccess',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> approvalProccess = GeneratedColumn<String>(
|
|
'approval_proccess',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _canceledByMeta = const VerificationMeta(
|
|
'canceledBy',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> canceledBy = GeneratedColumn<String>(
|
|
'canceled_by',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _deliveryTypeMeta = const VerificationMeta(
|
|
'deliveryType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> deliveryType = GeneratedColumn<String>(
|
|
'delivery_type',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _deliveryPrefrenceMeta = const VerificationMeta(
|
|
'deliveryPrefrence',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> deliveryPrefrence =
|
|
GeneratedColumn<String>(
|
|
'delivery_prefrence',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _shippingCostMeta = const VerificationMeta(
|
|
'shippingCost',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> shippingCost = GeneratedColumn<double>(
|
|
'shipping_cost',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _totalOrderMeta = const VerificationMeta(
|
|
'totalOrder',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> totalOrder = GeneratedColumn<double>(
|
|
'total_order',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _discountMeta = const VerificationMeta(
|
|
'discount',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> discount = GeneratedColumn<double>(
|
|
'discount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _taxMeta = const VerificationMeta('tax');
|
|
@override
|
|
late final GeneratedColumn<double> tax = GeneratedColumn<double>(
|
|
'tax',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _totalAmountMeta = const VerificationMeta(
|
|
'totalAmount',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> totalAmount = GeneratedColumn<double>(
|
|
'total_amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _amountPaidMeta = const VerificationMeta(
|
|
'amountPaid',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> amountPaid = GeneratedColumn<double>(
|
|
'amount_paid',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _changeAmountMeta = const VerificationMeta(
|
|
'changeAmount',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> changeAmount = GeneratedColumn<double>(
|
|
'change_amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _notesMeta = const VerificationMeta('notes');
|
|
@override
|
|
late final GeneratedColumn<String> notes = GeneratedColumn<String>(
|
|
'notes',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _paymentProofPathMeta = const VerificationMeta(
|
|
'paymentProofPath',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> paymentProofPath = GeneratedColumn<String>(
|
|
'payment_proof_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _paymentProofUrlMeta = const VerificationMeta(
|
|
'paymentProofUrl',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> paymentProofUrl = GeneratedColumn<String>(
|
|
'payment_proof_url',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _paymentMethodMeta = const VerificationMeta(
|
|
'paymentMethod',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> paymentMethod = GeneratedColumn<String>(
|
|
'payment_method',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
late final GeneratedColumnWithTypeConverter<Map<String, dynamic>?, String>
|
|
customerAddressSnapshot =
|
|
GeneratedColumn<String>(
|
|
'customer_address_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
).withConverter<Map<String, dynamic>?>(
|
|
$OrdersTable.$convertercustomerAddressSnapshotn,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
orderNumber,
|
|
outletId,
|
|
outletNameSnapshot,
|
|
customerId,
|
|
customerNameSnapshot,
|
|
customerEmailSnapshot,
|
|
customerPhoneNumberSnapshot,
|
|
userId,
|
|
adminNameSnapshot,
|
|
source,
|
|
alreadyRead,
|
|
orderStatus,
|
|
isCancellation,
|
|
cancellationAccepted,
|
|
approvalProccess,
|
|
canceledBy,
|
|
deliveryType,
|
|
deliveryPrefrence,
|
|
shippingCost,
|
|
totalOrder,
|
|
discount,
|
|
tax,
|
|
totalAmount,
|
|
amountPaid,
|
|
changeAmount,
|
|
notes,
|
|
paymentProofPath,
|
|
paymentProofUrl,
|
|
paymentMethod,
|
|
customerAddressSnapshot,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'orders';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Order> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('order_number')) {
|
|
context.handle(
|
|
_orderNumberMeta,
|
|
orderNumber.isAcceptableOrUnknown(
|
|
data['order_number']!,
|
|
_orderNumberMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_orderNumberMeta);
|
|
}
|
|
if (data.containsKey('outlet_id')) {
|
|
context.handle(
|
|
_outletIdMeta,
|
|
outletId.isAcceptableOrUnknown(data['outlet_id']!, _outletIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_outletIdMeta);
|
|
}
|
|
if (data.containsKey('outlet_name_snapshot')) {
|
|
context.handle(
|
|
_outletNameSnapshotMeta,
|
|
outletNameSnapshot.isAcceptableOrUnknown(
|
|
data['outlet_name_snapshot']!,
|
|
_outletNameSnapshotMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_outletNameSnapshotMeta);
|
|
}
|
|
if (data.containsKey('customer_id')) {
|
|
context.handle(
|
|
_customerIdMeta,
|
|
customerId.isAcceptableOrUnknown(data['customer_id']!, _customerIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('customer_name_snapshot')) {
|
|
context.handle(
|
|
_customerNameSnapshotMeta,
|
|
customerNameSnapshot.isAcceptableOrUnknown(
|
|
data['customer_name_snapshot']!,
|
|
_customerNameSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('customer_email_snapshot')) {
|
|
context.handle(
|
|
_customerEmailSnapshotMeta,
|
|
customerEmailSnapshot.isAcceptableOrUnknown(
|
|
data['customer_email_snapshot']!,
|
|
_customerEmailSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('customer_phone_number_snapshot')) {
|
|
context.handle(
|
|
_customerPhoneNumberSnapshotMeta,
|
|
customerPhoneNumberSnapshot.isAcceptableOrUnknown(
|
|
data['customer_phone_number_snapshot']!,
|
|
_customerPhoneNumberSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('user_id')) {
|
|
context.handle(
|
|
_userIdMeta,
|
|
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_userIdMeta);
|
|
}
|
|
if (data.containsKey('admin_name_snapshot')) {
|
|
context.handle(
|
|
_adminNameSnapshotMeta,
|
|
adminNameSnapshot.isAcceptableOrUnknown(
|
|
data['admin_name_snapshot']!,
|
|
_adminNameSnapshotMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_adminNameSnapshotMeta);
|
|
}
|
|
if (data.containsKey('source')) {
|
|
context.handle(
|
|
_sourceMeta,
|
|
source.isAcceptableOrUnknown(data['source']!, _sourceMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_sourceMeta);
|
|
}
|
|
if (data.containsKey('already_read')) {
|
|
context.handle(
|
|
_alreadyReadMeta,
|
|
alreadyRead.isAcceptableOrUnknown(
|
|
data['already_read']!,
|
|
_alreadyReadMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('order_status')) {
|
|
context.handle(
|
|
_orderStatusMeta,
|
|
orderStatus.isAcceptableOrUnknown(
|
|
data['order_status']!,
|
|
_orderStatusMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_orderStatusMeta);
|
|
}
|
|
if (data.containsKey('is_cancellation')) {
|
|
context.handle(
|
|
_isCancellationMeta,
|
|
isCancellation.isAcceptableOrUnknown(
|
|
data['is_cancellation']!,
|
|
_isCancellationMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('cancellation_accepted')) {
|
|
context.handle(
|
|
_cancellationAcceptedMeta,
|
|
cancellationAccepted.isAcceptableOrUnknown(
|
|
data['cancellation_accepted']!,
|
|
_cancellationAcceptedMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('approval_proccess')) {
|
|
context.handle(
|
|
_approvalProccessMeta,
|
|
approvalProccess.isAcceptableOrUnknown(
|
|
data['approval_proccess']!,
|
|
_approvalProccessMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('canceled_by')) {
|
|
context.handle(
|
|
_canceledByMeta,
|
|
canceledBy.isAcceptableOrUnknown(data['canceled_by']!, _canceledByMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('delivery_type')) {
|
|
context.handle(
|
|
_deliveryTypeMeta,
|
|
deliveryType.isAcceptableOrUnknown(
|
|
data['delivery_type']!,
|
|
_deliveryTypeMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('delivery_prefrence')) {
|
|
context.handle(
|
|
_deliveryPrefrenceMeta,
|
|
deliveryPrefrence.isAcceptableOrUnknown(
|
|
data['delivery_prefrence']!,
|
|
_deliveryPrefrenceMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('shipping_cost')) {
|
|
context.handle(
|
|
_shippingCostMeta,
|
|
shippingCost.isAcceptableOrUnknown(
|
|
data['shipping_cost']!,
|
|
_shippingCostMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('total_order')) {
|
|
context.handle(
|
|
_totalOrderMeta,
|
|
totalOrder.isAcceptableOrUnknown(data['total_order']!, _totalOrderMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('discount')) {
|
|
context.handle(
|
|
_discountMeta,
|
|
discount.isAcceptableOrUnknown(data['discount']!, _discountMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('tax')) {
|
|
context.handle(
|
|
_taxMeta,
|
|
tax.isAcceptableOrUnknown(data['tax']!, _taxMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('total_amount')) {
|
|
context.handle(
|
|
_totalAmountMeta,
|
|
totalAmount.isAcceptableOrUnknown(
|
|
data['total_amount']!,
|
|
_totalAmountMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('amount_paid')) {
|
|
context.handle(
|
|
_amountPaidMeta,
|
|
amountPaid.isAcceptableOrUnknown(data['amount_paid']!, _amountPaidMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('change_amount')) {
|
|
context.handle(
|
|
_changeAmountMeta,
|
|
changeAmount.isAcceptableOrUnknown(
|
|
data['change_amount']!,
|
|
_changeAmountMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('notes')) {
|
|
context.handle(
|
|
_notesMeta,
|
|
notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('payment_proof_path')) {
|
|
context.handle(
|
|
_paymentProofPathMeta,
|
|
paymentProofPath.isAcceptableOrUnknown(
|
|
data['payment_proof_path']!,
|
|
_paymentProofPathMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('payment_proof_url')) {
|
|
context.handle(
|
|
_paymentProofUrlMeta,
|
|
paymentProofUrl.isAcceptableOrUnknown(
|
|
data['payment_proof_url']!,
|
|
_paymentProofUrlMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('payment_method')) {
|
|
context.handle(
|
|
_paymentMethodMeta,
|
|
paymentMethod.isAcceptableOrUnknown(
|
|
data['payment_method']!,
|
|
_paymentMethodMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Order map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Order(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
orderNumber: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}order_number'],
|
|
)!,
|
|
outletId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_id'],
|
|
)!,
|
|
outletNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_name_snapshot'],
|
|
)!,
|
|
customerId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}customer_id'],
|
|
),
|
|
customerNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}customer_name_snapshot'],
|
|
),
|
|
customerEmailSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}customer_email_snapshot'],
|
|
),
|
|
customerPhoneNumberSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}customer_phone_number_snapshot'],
|
|
),
|
|
userId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}user_id'],
|
|
)!,
|
|
adminNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}admin_name_snapshot'],
|
|
)!,
|
|
source: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}source'],
|
|
)!,
|
|
alreadyRead: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}already_read'],
|
|
),
|
|
orderStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}order_status'],
|
|
)!,
|
|
isCancellation: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_cancellation'],
|
|
),
|
|
cancellationAccepted: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}cancellation_accepted'],
|
|
),
|
|
approvalProccess: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}approval_proccess'],
|
|
),
|
|
canceledBy: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}canceled_by'],
|
|
),
|
|
deliveryType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}delivery_type'],
|
|
),
|
|
deliveryPrefrence: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}delivery_prefrence'],
|
|
),
|
|
shippingCost: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}shipping_cost'],
|
|
)!,
|
|
totalOrder: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}total_order'],
|
|
)!,
|
|
discount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}discount'],
|
|
)!,
|
|
tax: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}tax'],
|
|
)!,
|
|
totalAmount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}total_amount'],
|
|
)!,
|
|
amountPaid: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}amount_paid'],
|
|
)!,
|
|
changeAmount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}change_amount'],
|
|
)!,
|
|
notes: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}notes'],
|
|
),
|
|
paymentProofPath: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}payment_proof_path'],
|
|
),
|
|
paymentProofUrl: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}payment_proof_url'],
|
|
),
|
|
paymentMethod: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}payment_method'],
|
|
),
|
|
customerAddressSnapshot: $OrdersTable.$convertercustomerAddressSnapshotn
|
|
.fromSql(
|
|
attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}customer_address_snapshot'],
|
|
),
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$OrdersTable createAlias(String alias) {
|
|
return $OrdersTable(attachedDatabase, alias);
|
|
}
|
|
|
|
static TypeConverter<Map<String, dynamic>, String>
|
|
$convertercustomerAddressSnapshot = StringMapConverter();
|
|
static TypeConverter<Map<String, dynamic>?, String?>
|
|
$convertercustomerAddressSnapshotn = NullAwareTypeConverter.wrap(
|
|
$convertercustomerAddressSnapshot,
|
|
);
|
|
}
|
|
|
|
class Order extends DataClass implements Insertable<Order> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String orderNumber;
|
|
final String outletId;
|
|
final String outletNameSnapshot;
|
|
final String? customerId;
|
|
final String? customerNameSnapshot;
|
|
final String? customerEmailSnapshot;
|
|
final String? customerPhoneNumberSnapshot;
|
|
final String userId;
|
|
final String adminNameSnapshot;
|
|
final String source;
|
|
final bool? alreadyRead;
|
|
final String orderStatus;
|
|
final bool? isCancellation;
|
|
final bool? cancellationAccepted;
|
|
final String? approvalProccess;
|
|
final String? canceledBy;
|
|
final String? deliveryType;
|
|
final String? deliveryPrefrence;
|
|
final double shippingCost;
|
|
final double totalOrder;
|
|
final double discount;
|
|
final double tax;
|
|
final double totalAmount;
|
|
final double amountPaid;
|
|
final double changeAmount;
|
|
final String? notes;
|
|
final String? paymentProofPath;
|
|
final String? paymentProofUrl;
|
|
final String? paymentMethod;
|
|
final Map<String, dynamic>? customerAddressSnapshot;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const Order({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.orderNumber,
|
|
required this.outletId,
|
|
required this.outletNameSnapshot,
|
|
this.customerId,
|
|
this.customerNameSnapshot,
|
|
this.customerEmailSnapshot,
|
|
this.customerPhoneNumberSnapshot,
|
|
required this.userId,
|
|
required this.adminNameSnapshot,
|
|
required this.source,
|
|
this.alreadyRead,
|
|
required this.orderStatus,
|
|
this.isCancellation,
|
|
this.cancellationAccepted,
|
|
this.approvalProccess,
|
|
this.canceledBy,
|
|
this.deliveryType,
|
|
this.deliveryPrefrence,
|
|
required this.shippingCost,
|
|
required this.totalOrder,
|
|
required this.discount,
|
|
required this.tax,
|
|
required this.totalAmount,
|
|
required this.amountPaid,
|
|
required this.changeAmount,
|
|
this.notes,
|
|
this.paymentProofPath,
|
|
this.paymentProofUrl,
|
|
this.paymentMethod,
|
|
this.customerAddressSnapshot,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['order_number'] = Variable<String>(orderNumber);
|
|
map['outlet_id'] = Variable<String>(outletId);
|
|
map['outlet_name_snapshot'] = Variable<String>(outletNameSnapshot);
|
|
if (!nullToAbsent || customerId != null) {
|
|
map['customer_id'] = Variable<String>(customerId);
|
|
}
|
|
if (!nullToAbsent || customerNameSnapshot != null) {
|
|
map['customer_name_snapshot'] = Variable<String>(customerNameSnapshot);
|
|
}
|
|
if (!nullToAbsent || customerEmailSnapshot != null) {
|
|
map['customer_email_snapshot'] = Variable<String>(customerEmailSnapshot);
|
|
}
|
|
if (!nullToAbsent || customerPhoneNumberSnapshot != null) {
|
|
map['customer_phone_number_snapshot'] = Variable<String>(
|
|
customerPhoneNumberSnapshot,
|
|
);
|
|
}
|
|
map['user_id'] = Variable<String>(userId);
|
|
map['admin_name_snapshot'] = Variable<String>(adminNameSnapshot);
|
|
map['source'] = Variable<String>(source);
|
|
if (!nullToAbsent || alreadyRead != null) {
|
|
map['already_read'] = Variable<bool>(alreadyRead);
|
|
}
|
|
map['order_status'] = Variable<String>(orderStatus);
|
|
if (!nullToAbsent || isCancellation != null) {
|
|
map['is_cancellation'] = Variable<bool>(isCancellation);
|
|
}
|
|
if (!nullToAbsent || cancellationAccepted != null) {
|
|
map['cancellation_accepted'] = Variable<bool>(cancellationAccepted);
|
|
}
|
|
if (!nullToAbsent || approvalProccess != null) {
|
|
map['approval_proccess'] = Variable<String>(approvalProccess);
|
|
}
|
|
if (!nullToAbsent || canceledBy != null) {
|
|
map['canceled_by'] = Variable<String>(canceledBy);
|
|
}
|
|
if (!nullToAbsent || deliveryType != null) {
|
|
map['delivery_type'] = Variable<String>(deliveryType);
|
|
}
|
|
if (!nullToAbsent || deliveryPrefrence != null) {
|
|
map['delivery_prefrence'] = Variable<String>(deliveryPrefrence);
|
|
}
|
|
map['shipping_cost'] = Variable<double>(shippingCost);
|
|
map['total_order'] = Variable<double>(totalOrder);
|
|
map['discount'] = Variable<double>(discount);
|
|
map['tax'] = Variable<double>(tax);
|
|
map['total_amount'] = Variable<double>(totalAmount);
|
|
map['amount_paid'] = Variable<double>(amountPaid);
|
|
map['change_amount'] = Variable<double>(changeAmount);
|
|
if (!nullToAbsent || notes != null) {
|
|
map['notes'] = Variable<String>(notes);
|
|
}
|
|
if (!nullToAbsent || paymentProofPath != null) {
|
|
map['payment_proof_path'] = Variable<String>(paymentProofPath);
|
|
}
|
|
if (!nullToAbsent || paymentProofUrl != null) {
|
|
map['payment_proof_url'] = Variable<String>(paymentProofUrl);
|
|
}
|
|
if (!nullToAbsent || paymentMethod != null) {
|
|
map['payment_method'] = Variable<String>(paymentMethod);
|
|
}
|
|
if (!nullToAbsent || customerAddressSnapshot != null) {
|
|
map['customer_address_snapshot'] = Variable<String>(
|
|
$OrdersTable.$convertercustomerAddressSnapshotn.toSql(
|
|
customerAddressSnapshot,
|
|
),
|
|
);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
OrdersCompanion toCompanion(bool nullToAbsent) {
|
|
return OrdersCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
orderNumber: Value(orderNumber),
|
|
outletId: Value(outletId),
|
|
outletNameSnapshot: Value(outletNameSnapshot),
|
|
customerId: customerId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(customerId),
|
|
customerNameSnapshot: customerNameSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(customerNameSnapshot),
|
|
customerEmailSnapshot: customerEmailSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(customerEmailSnapshot),
|
|
customerPhoneNumberSnapshot:
|
|
customerPhoneNumberSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(customerPhoneNumberSnapshot),
|
|
userId: Value(userId),
|
|
adminNameSnapshot: Value(adminNameSnapshot),
|
|
source: Value(source),
|
|
alreadyRead: alreadyRead == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(alreadyRead),
|
|
orderStatus: Value(orderStatus),
|
|
isCancellation: isCancellation == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(isCancellation),
|
|
cancellationAccepted: cancellationAccepted == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(cancellationAccepted),
|
|
approvalProccess: approvalProccess == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(approvalProccess),
|
|
canceledBy: canceledBy == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(canceledBy),
|
|
deliveryType: deliveryType == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deliveryType),
|
|
deliveryPrefrence: deliveryPrefrence == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deliveryPrefrence),
|
|
shippingCost: Value(shippingCost),
|
|
totalOrder: Value(totalOrder),
|
|
discount: Value(discount),
|
|
tax: Value(tax),
|
|
totalAmount: Value(totalAmount),
|
|
amountPaid: Value(amountPaid),
|
|
changeAmount: Value(changeAmount),
|
|
notes: notes == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(notes),
|
|
paymentProofPath: paymentProofPath == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(paymentProofPath),
|
|
paymentProofUrl: paymentProofUrl == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(paymentProofUrl),
|
|
paymentMethod: paymentMethod == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(paymentMethod),
|
|
customerAddressSnapshot: customerAddressSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(customerAddressSnapshot),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory Order.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Order(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
orderNumber: serializer.fromJson<String>(json['orderNumber']),
|
|
outletId: serializer.fromJson<String>(json['outletId']),
|
|
outletNameSnapshot: serializer.fromJson<String>(
|
|
json['outletNameSnapshot'],
|
|
),
|
|
customerId: serializer.fromJson<String?>(json['customerId']),
|
|
customerNameSnapshot: serializer.fromJson<String?>(
|
|
json['customerNameSnapshot'],
|
|
),
|
|
customerEmailSnapshot: serializer.fromJson<String?>(
|
|
json['customerEmailSnapshot'],
|
|
),
|
|
customerPhoneNumberSnapshot: serializer.fromJson<String?>(
|
|
json['customerPhoneNumberSnapshot'],
|
|
),
|
|
userId: serializer.fromJson<String>(json['userId']),
|
|
adminNameSnapshot: serializer.fromJson<String>(json['adminNameSnapshot']),
|
|
source: serializer.fromJson<String>(json['source']),
|
|
alreadyRead: serializer.fromJson<bool?>(json['alreadyRead']),
|
|
orderStatus: serializer.fromJson<String>(json['orderStatus']),
|
|
isCancellation: serializer.fromJson<bool?>(json['isCancellation']),
|
|
cancellationAccepted: serializer.fromJson<bool?>(
|
|
json['cancellationAccepted'],
|
|
),
|
|
approvalProccess: serializer.fromJson<String?>(json['approvalProccess']),
|
|
canceledBy: serializer.fromJson<String?>(json['canceledBy']),
|
|
deliveryType: serializer.fromJson<String?>(json['deliveryType']),
|
|
deliveryPrefrence: serializer.fromJson<String?>(
|
|
json['deliveryPrefrence'],
|
|
),
|
|
shippingCost: serializer.fromJson<double>(json['shippingCost']),
|
|
totalOrder: serializer.fromJson<double>(json['totalOrder']),
|
|
discount: serializer.fromJson<double>(json['discount']),
|
|
tax: serializer.fromJson<double>(json['tax']),
|
|
totalAmount: serializer.fromJson<double>(json['totalAmount']),
|
|
amountPaid: serializer.fromJson<double>(json['amountPaid']),
|
|
changeAmount: serializer.fromJson<double>(json['changeAmount']),
|
|
notes: serializer.fromJson<String?>(json['notes']),
|
|
paymentProofPath: serializer.fromJson<String?>(json['paymentProofPath']),
|
|
paymentProofUrl: serializer.fromJson<String?>(json['paymentProofUrl']),
|
|
paymentMethod: serializer.fromJson<String?>(json['paymentMethod']),
|
|
customerAddressSnapshot: serializer.fromJson<Map<String, dynamic>?>(
|
|
json['customerAddressSnapshot'],
|
|
),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'orderNumber': serializer.toJson<String>(orderNumber),
|
|
'outletId': serializer.toJson<String>(outletId),
|
|
'outletNameSnapshot': serializer.toJson<String>(outletNameSnapshot),
|
|
'customerId': serializer.toJson<String?>(customerId),
|
|
'customerNameSnapshot': serializer.toJson<String?>(customerNameSnapshot),
|
|
'customerEmailSnapshot': serializer.toJson<String?>(
|
|
customerEmailSnapshot,
|
|
),
|
|
'customerPhoneNumberSnapshot': serializer.toJson<String?>(
|
|
customerPhoneNumberSnapshot,
|
|
),
|
|
'userId': serializer.toJson<String>(userId),
|
|
'adminNameSnapshot': serializer.toJson<String>(adminNameSnapshot),
|
|
'source': serializer.toJson<String>(source),
|
|
'alreadyRead': serializer.toJson<bool?>(alreadyRead),
|
|
'orderStatus': serializer.toJson<String>(orderStatus),
|
|
'isCancellation': serializer.toJson<bool?>(isCancellation),
|
|
'cancellationAccepted': serializer.toJson<bool?>(cancellationAccepted),
|
|
'approvalProccess': serializer.toJson<String?>(approvalProccess),
|
|
'canceledBy': serializer.toJson<String?>(canceledBy),
|
|
'deliveryType': serializer.toJson<String?>(deliveryType),
|
|
'deliveryPrefrence': serializer.toJson<String?>(deliveryPrefrence),
|
|
'shippingCost': serializer.toJson<double>(shippingCost),
|
|
'totalOrder': serializer.toJson<double>(totalOrder),
|
|
'discount': serializer.toJson<double>(discount),
|
|
'tax': serializer.toJson<double>(tax),
|
|
'totalAmount': serializer.toJson<double>(totalAmount),
|
|
'amountPaid': serializer.toJson<double>(amountPaid),
|
|
'changeAmount': serializer.toJson<double>(changeAmount),
|
|
'notes': serializer.toJson<String?>(notes),
|
|
'paymentProofPath': serializer.toJson<String?>(paymentProofPath),
|
|
'paymentProofUrl': serializer.toJson<String?>(paymentProofUrl),
|
|
'paymentMethod': serializer.toJson<String?>(paymentMethod),
|
|
'customerAddressSnapshot': serializer.toJson<Map<String, dynamic>?>(
|
|
customerAddressSnapshot,
|
|
),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
Order copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? orderNumber,
|
|
String? outletId,
|
|
String? outletNameSnapshot,
|
|
Value<String?> customerId = const Value.absent(),
|
|
Value<String?> customerNameSnapshot = const Value.absent(),
|
|
Value<String?> customerEmailSnapshot = const Value.absent(),
|
|
Value<String?> customerPhoneNumberSnapshot = const Value.absent(),
|
|
String? userId,
|
|
String? adminNameSnapshot,
|
|
String? source,
|
|
Value<bool?> alreadyRead = const Value.absent(),
|
|
String? orderStatus,
|
|
Value<bool?> isCancellation = const Value.absent(),
|
|
Value<bool?> cancellationAccepted = const Value.absent(),
|
|
Value<String?> approvalProccess = const Value.absent(),
|
|
Value<String?> canceledBy = const Value.absent(),
|
|
Value<String?> deliveryType = const Value.absent(),
|
|
Value<String?> deliveryPrefrence = const Value.absent(),
|
|
double? shippingCost,
|
|
double? totalOrder,
|
|
double? discount,
|
|
double? tax,
|
|
double? totalAmount,
|
|
double? amountPaid,
|
|
double? changeAmount,
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<String?> paymentProofPath = const Value.absent(),
|
|
Value<String?> paymentProofUrl = const Value.absent(),
|
|
Value<String?> paymentMethod = const Value.absent(),
|
|
Value<Map<String, dynamic>?> customerAddressSnapshot = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => Order(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
orderNumber: orderNumber ?? this.orderNumber,
|
|
outletId: outletId ?? this.outletId,
|
|
outletNameSnapshot: outletNameSnapshot ?? this.outletNameSnapshot,
|
|
customerId: customerId.present ? customerId.value : this.customerId,
|
|
customerNameSnapshot: customerNameSnapshot.present
|
|
? customerNameSnapshot.value
|
|
: this.customerNameSnapshot,
|
|
customerEmailSnapshot: customerEmailSnapshot.present
|
|
? customerEmailSnapshot.value
|
|
: this.customerEmailSnapshot,
|
|
customerPhoneNumberSnapshot: customerPhoneNumberSnapshot.present
|
|
? customerPhoneNumberSnapshot.value
|
|
: this.customerPhoneNumberSnapshot,
|
|
userId: userId ?? this.userId,
|
|
adminNameSnapshot: adminNameSnapshot ?? this.adminNameSnapshot,
|
|
source: source ?? this.source,
|
|
alreadyRead: alreadyRead.present ? alreadyRead.value : this.alreadyRead,
|
|
orderStatus: orderStatus ?? this.orderStatus,
|
|
isCancellation: isCancellation.present
|
|
? isCancellation.value
|
|
: this.isCancellation,
|
|
cancellationAccepted: cancellationAccepted.present
|
|
? cancellationAccepted.value
|
|
: this.cancellationAccepted,
|
|
approvalProccess: approvalProccess.present
|
|
? approvalProccess.value
|
|
: this.approvalProccess,
|
|
canceledBy: canceledBy.present ? canceledBy.value : this.canceledBy,
|
|
deliveryType: deliveryType.present ? deliveryType.value : this.deliveryType,
|
|
deliveryPrefrence: deliveryPrefrence.present
|
|
? deliveryPrefrence.value
|
|
: this.deliveryPrefrence,
|
|
shippingCost: shippingCost ?? this.shippingCost,
|
|
totalOrder: totalOrder ?? this.totalOrder,
|
|
discount: discount ?? this.discount,
|
|
tax: tax ?? this.tax,
|
|
totalAmount: totalAmount ?? this.totalAmount,
|
|
amountPaid: amountPaid ?? this.amountPaid,
|
|
changeAmount: changeAmount ?? this.changeAmount,
|
|
notes: notes.present ? notes.value : this.notes,
|
|
paymentProofPath: paymentProofPath.present
|
|
? paymentProofPath.value
|
|
: this.paymentProofPath,
|
|
paymentProofUrl: paymentProofUrl.present
|
|
? paymentProofUrl.value
|
|
: this.paymentProofUrl,
|
|
paymentMethod: paymentMethod.present
|
|
? paymentMethod.value
|
|
: this.paymentMethod,
|
|
customerAddressSnapshot: customerAddressSnapshot.present
|
|
? customerAddressSnapshot.value
|
|
: this.customerAddressSnapshot,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
Order copyWithCompanion(OrdersCompanion data) {
|
|
return Order(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
orderNumber: data.orderNumber.present
|
|
? data.orderNumber.value
|
|
: this.orderNumber,
|
|
outletId: data.outletId.present ? data.outletId.value : this.outletId,
|
|
outletNameSnapshot: data.outletNameSnapshot.present
|
|
? data.outletNameSnapshot.value
|
|
: this.outletNameSnapshot,
|
|
customerId: data.customerId.present
|
|
? data.customerId.value
|
|
: this.customerId,
|
|
customerNameSnapshot: data.customerNameSnapshot.present
|
|
? data.customerNameSnapshot.value
|
|
: this.customerNameSnapshot,
|
|
customerEmailSnapshot: data.customerEmailSnapshot.present
|
|
? data.customerEmailSnapshot.value
|
|
: this.customerEmailSnapshot,
|
|
customerPhoneNumberSnapshot: data.customerPhoneNumberSnapshot.present
|
|
? data.customerPhoneNumberSnapshot.value
|
|
: this.customerPhoneNumberSnapshot,
|
|
userId: data.userId.present ? data.userId.value : this.userId,
|
|
adminNameSnapshot: data.adminNameSnapshot.present
|
|
? data.adminNameSnapshot.value
|
|
: this.adminNameSnapshot,
|
|
source: data.source.present ? data.source.value : this.source,
|
|
alreadyRead: data.alreadyRead.present
|
|
? data.alreadyRead.value
|
|
: this.alreadyRead,
|
|
orderStatus: data.orderStatus.present
|
|
? data.orderStatus.value
|
|
: this.orderStatus,
|
|
isCancellation: data.isCancellation.present
|
|
? data.isCancellation.value
|
|
: this.isCancellation,
|
|
cancellationAccepted: data.cancellationAccepted.present
|
|
? data.cancellationAccepted.value
|
|
: this.cancellationAccepted,
|
|
approvalProccess: data.approvalProccess.present
|
|
? data.approvalProccess.value
|
|
: this.approvalProccess,
|
|
canceledBy: data.canceledBy.present
|
|
? data.canceledBy.value
|
|
: this.canceledBy,
|
|
deliveryType: data.deliveryType.present
|
|
? data.deliveryType.value
|
|
: this.deliveryType,
|
|
deliveryPrefrence: data.deliveryPrefrence.present
|
|
? data.deliveryPrefrence.value
|
|
: this.deliveryPrefrence,
|
|
shippingCost: data.shippingCost.present
|
|
? data.shippingCost.value
|
|
: this.shippingCost,
|
|
totalOrder: data.totalOrder.present
|
|
? data.totalOrder.value
|
|
: this.totalOrder,
|
|
discount: data.discount.present ? data.discount.value : this.discount,
|
|
tax: data.tax.present ? data.tax.value : this.tax,
|
|
totalAmount: data.totalAmount.present
|
|
? data.totalAmount.value
|
|
: this.totalAmount,
|
|
amountPaid: data.amountPaid.present
|
|
? data.amountPaid.value
|
|
: this.amountPaid,
|
|
changeAmount: data.changeAmount.present
|
|
? data.changeAmount.value
|
|
: this.changeAmount,
|
|
notes: data.notes.present ? data.notes.value : this.notes,
|
|
paymentProofPath: data.paymentProofPath.present
|
|
? data.paymentProofPath.value
|
|
: this.paymentProofPath,
|
|
paymentProofUrl: data.paymentProofUrl.present
|
|
? data.paymentProofUrl.value
|
|
: this.paymentProofUrl,
|
|
paymentMethod: data.paymentMethod.present
|
|
? data.paymentMethod.value
|
|
: this.paymentMethod,
|
|
customerAddressSnapshot: data.customerAddressSnapshot.present
|
|
? data.customerAddressSnapshot.value
|
|
: this.customerAddressSnapshot,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Order(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('orderNumber: $orderNumber, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('outletNameSnapshot: $outletNameSnapshot, ')
|
|
..write('customerId: $customerId, ')
|
|
..write('customerNameSnapshot: $customerNameSnapshot, ')
|
|
..write('customerEmailSnapshot: $customerEmailSnapshot, ')
|
|
..write('customerPhoneNumberSnapshot: $customerPhoneNumberSnapshot, ')
|
|
..write('userId: $userId, ')
|
|
..write('adminNameSnapshot: $adminNameSnapshot, ')
|
|
..write('source: $source, ')
|
|
..write('alreadyRead: $alreadyRead, ')
|
|
..write('orderStatus: $orderStatus, ')
|
|
..write('isCancellation: $isCancellation, ')
|
|
..write('cancellationAccepted: $cancellationAccepted, ')
|
|
..write('approvalProccess: $approvalProccess, ')
|
|
..write('canceledBy: $canceledBy, ')
|
|
..write('deliveryType: $deliveryType, ')
|
|
..write('deliveryPrefrence: $deliveryPrefrence, ')
|
|
..write('shippingCost: $shippingCost, ')
|
|
..write('totalOrder: $totalOrder, ')
|
|
..write('discount: $discount, ')
|
|
..write('tax: $tax, ')
|
|
..write('totalAmount: $totalAmount, ')
|
|
..write('amountPaid: $amountPaid, ')
|
|
..write('changeAmount: $changeAmount, ')
|
|
..write('notes: $notes, ')
|
|
..write('paymentProofPath: $paymentProofPath, ')
|
|
..write('paymentProofUrl: $paymentProofUrl, ')
|
|
..write('paymentMethod: $paymentMethod, ')
|
|
..write('customerAddressSnapshot: $customerAddressSnapshot, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hashAll([
|
|
localId,
|
|
serverId,
|
|
orderNumber,
|
|
outletId,
|
|
outletNameSnapshot,
|
|
customerId,
|
|
customerNameSnapshot,
|
|
customerEmailSnapshot,
|
|
customerPhoneNumberSnapshot,
|
|
userId,
|
|
adminNameSnapshot,
|
|
source,
|
|
alreadyRead,
|
|
orderStatus,
|
|
isCancellation,
|
|
cancellationAccepted,
|
|
approvalProccess,
|
|
canceledBy,
|
|
deliveryType,
|
|
deliveryPrefrence,
|
|
shippingCost,
|
|
totalOrder,
|
|
discount,
|
|
tax,
|
|
totalAmount,
|
|
amountPaid,
|
|
changeAmount,
|
|
notes,
|
|
paymentProofPath,
|
|
paymentProofUrl,
|
|
paymentMethod,
|
|
customerAddressSnapshot,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
]);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Order &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.orderNumber == this.orderNumber &&
|
|
other.outletId == this.outletId &&
|
|
other.outletNameSnapshot == this.outletNameSnapshot &&
|
|
other.customerId == this.customerId &&
|
|
other.customerNameSnapshot == this.customerNameSnapshot &&
|
|
other.customerEmailSnapshot == this.customerEmailSnapshot &&
|
|
other.customerPhoneNumberSnapshot ==
|
|
this.customerPhoneNumberSnapshot &&
|
|
other.userId == this.userId &&
|
|
other.adminNameSnapshot == this.adminNameSnapshot &&
|
|
other.source == this.source &&
|
|
other.alreadyRead == this.alreadyRead &&
|
|
other.orderStatus == this.orderStatus &&
|
|
other.isCancellation == this.isCancellation &&
|
|
other.cancellationAccepted == this.cancellationAccepted &&
|
|
other.approvalProccess == this.approvalProccess &&
|
|
other.canceledBy == this.canceledBy &&
|
|
other.deliveryType == this.deliveryType &&
|
|
other.deliveryPrefrence == this.deliveryPrefrence &&
|
|
other.shippingCost == this.shippingCost &&
|
|
other.totalOrder == this.totalOrder &&
|
|
other.discount == this.discount &&
|
|
other.tax == this.tax &&
|
|
other.totalAmount == this.totalAmount &&
|
|
other.amountPaid == this.amountPaid &&
|
|
other.changeAmount == this.changeAmount &&
|
|
other.notes == this.notes &&
|
|
other.paymentProofPath == this.paymentProofPath &&
|
|
other.paymentProofUrl == this.paymentProofUrl &&
|
|
other.paymentMethod == this.paymentMethod &&
|
|
other.customerAddressSnapshot == this.customerAddressSnapshot &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class OrdersCompanion extends UpdateCompanion<Order> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> orderNumber;
|
|
final Value<String> outletId;
|
|
final Value<String> outletNameSnapshot;
|
|
final Value<String?> customerId;
|
|
final Value<String?> customerNameSnapshot;
|
|
final Value<String?> customerEmailSnapshot;
|
|
final Value<String?> customerPhoneNumberSnapshot;
|
|
final Value<String> userId;
|
|
final Value<String> adminNameSnapshot;
|
|
final Value<String> source;
|
|
final Value<bool?> alreadyRead;
|
|
final Value<String> orderStatus;
|
|
final Value<bool?> isCancellation;
|
|
final Value<bool?> cancellationAccepted;
|
|
final Value<String?> approvalProccess;
|
|
final Value<String?> canceledBy;
|
|
final Value<String?> deliveryType;
|
|
final Value<String?> deliveryPrefrence;
|
|
final Value<double> shippingCost;
|
|
final Value<double> totalOrder;
|
|
final Value<double> discount;
|
|
final Value<double> tax;
|
|
final Value<double> totalAmount;
|
|
final Value<double> amountPaid;
|
|
final Value<double> changeAmount;
|
|
final Value<String?> notes;
|
|
final Value<String?> paymentProofPath;
|
|
final Value<String?> paymentProofUrl;
|
|
final Value<String?> paymentMethod;
|
|
final Value<Map<String, dynamic>?> customerAddressSnapshot;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const OrdersCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.orderNumber = const Value.absent(),
|
|
this.outletId = const Value.absent(),
|
|
this.outletNameSnapshot = const Value.absent(),
|
|
this.customerId = const Value.absent(),
|
|
this.customerNameSnapshot = const Value.absent(),
|
|
this.customerEmailSnapshot = const Value.absent(),
|
|
this.customerPhoneNumberSnapshot = const Value.absent(),
|
|
this.userId = const Value.absent(),
|
|
this.adminNameSnapshot = const Value.absent(),
|
|
this.source = const Value.absent(),
|
|
this.alreadyRead = const Value.absent(),
|
|
this.orderStatus = const Value.absent(),
|
|
this.isCancellation = const Value.absent(),
|
|
this.cancellationAccepted = const Value.absent(),
|
|
this.approvalProccess = const Value.absent(),
|
|
this.canceledBy = const Value.absent(),
|
|
this.deliveryType = const Value.absent(),
|
|
this.deliveryPrefrence = const Value.absent(),
|
|
this.shippingCost = const Value.absent(),
|
|
this.totalOrder = const Value.absent(),
|
|
this.discount = const Value.absent(),
|
|
this.tax = const Value.absent(),
|
|
this.totalAmount = const Value.absent(),
|
|
this.amountPaid = const Value.absent(),
|
|
this.changeAmount = const Value.absent(),
|
|
this.notes = const Value.absent(),
|
|
this.paymentProofPath = const Value.absent(),
|
|
this.paymentProofUrl = const Value.absent(),
|
|
this.paymentMethod = const Value.absent(),
|
|
this.customerAddressSnapshot = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
OrdersCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String orderNumber,
|
|
required String outletId,
|
|
required String outletNameSnapshot,
|
|
this.customerId = const Value.absent(),
|
|
this.customerNameSnapshot = const Value.absent(),
|
|
this.customerEmailSnapshot = const Value.absent(),
|
|
this.customerPhoneNumberSnapshot = const Value.absent(),
|
|
required String userId,
|
|
required String adminNameSnapshot,
|
|
required String source,
|
|
this.alreadyRead = const Value.absent(),
|
|
required String orderStatus,
|
|
this.isCancellation = const Value.absent(),
|
|
this.cancellationAccepted = const Value.absent(),
|
|
this.approvalProccess = const Value.absent(),
|
|
this.canceledBy = const Value.absent(),
|
|
this.deliveryType = const Value.absent(),
|
|
this.deliveryPrefrence = const Value.absent(),
|
|
this.shippingCost = const Value.absent(),
|
|
this.totalOrder = const Value.absent(),
|
|
this.discount = const Value.absent(),
|
|
this.tax = const Value.absent(),
|
|
this.totalAmount = const Value.absent(),
|
|
this.amountPaid = const Value.absent(),
|
|
this.changeAmount = const Value.absent(),
|
|
this.notes = const Value.absent(),
|
|
this.paymentProofPath = const Value.absent(),
|
|
this.paymentProofUrl = const Value.absent(),
|
|
this.paymentMethod = const Value.absent(),
|
|
this.customerAddressSnapshot = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : orderNumber = Value(orderNumber),
|
|
outletId = Value(outletId),
|
|
outletNameSnapshot = Value(outletNameSnapshot),
|
|
userId = Value(userId),
|
|
adminNameSnapshot = Value(adminNameSnapshot),
|
|
source = Value(source),
|
|
orderStatus = Value(orderStatus);
|
|
static Insertable<Order> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? orderNumber,
|
|
Expression<String>? outletId,
|
|
Expression<String>? outletNameSnapshot,
|
|
Expression<String>? customerId,
|
|
Expression<String>? customerNameSnapshot,
|
|
Expression<String>? customerEmailSnapshot,
|
|
Expression<String>? customerPhoneNumberSnapshot,
|
|
Expression<String>? userId,
|
|
Expression<String>? adminNameSnapshot,
|
|
Expression<String>? source,
|
|
Expression<bool>? alreadyRead,
|
|
Expression<String>? orderStatus,
|
|
Expression<bool>? isCancellation,
|
|
Expression<bool>? cancellationAccepted,
|
|
Expression<String>? approvalProccess,
|
|
Expression<String>? canceledBy,
|
|
Expression<String>? deliveryType,
|
|
Expression<String>? deliveryPrefrence,
|
|
Expression<double>? shippingCost,
|
|
Expression<double>? totalOrder,
|
|
Expression<double>? discount,
|
|
Expression<double>? tax,
|
|
Expression<double>? totalAmount,
|
|
Expression<double>? amountPaid,
|
|
Expression<double>? changeAmount,
|
|
Expression<String>? notes,
|
|
Expression<String>? paymentProofPath,
|
|
Expression<String>? paymentProofUrl,
|
|
Expression<String>? paymentMethod,
|
|
Expression<String>? customerAddressSnapshot,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (orderNumber != null) 'order_number': orderNumber,
|
|
if (outletId != null) 'outlet_id': outletId,
|
|
if (outletNameSnapshot != null)
|
|
'outlet_name_snapshot': outletNameSnapshot,
|
|
if (customerId != null) 'customer_id': customerId,
|
|
if (customerNameSnapshot != null)
|
|
'customer_name_snapshot': customerNameSnapshot,
|
|
if (customerEmailSnapshot != null)
|
|
'customer_email_snapshot': customerEmailSnapshot,
|
|
if (customerPhoneNumberSnapshot != null)
|
|
'customer_phone_number_snapshot': customerPhoneNumberSnapshot,
|
|
if (userId != null) 'user_id': userId,
|
|
if (adminNameSnapshot != null) 'admin_name_snapshot': adminNameSnapshot,
|
|
if (source != null) 'source': source,
|
|
if (alreadyRead != null) 'already_read': alreadyRead,
|
|
if (orderStatus != null) 'order_status': orderStatus,
|
|
if (isCancellation != null) 'is_cancellation': isCancellation,
|
|
if (cancellationAccepted != null)
|
|
'cancellation_accepted': cancellationAccepted,
|
|
if (approvalProccess != null) 'approval_proccess': approvalProccess,
|
|
if (canceledBy != null) 'canceled_by': canceledBy,
|
|
if (deliveryType != null) 'delivery_type': deliveryType,
|
|
if (deliveryPrefrence != null) 'delivery_prefrence': deliveryPrefrence,
|
|
if (shippingCost != null) 'shipping_cost': shippingCost,
|
|
if (totalOrder != null) 'total_order': totalOrder,
|
|
if (discount != null) 'discount': discount,
|
|
if (tax != null) 'tax': tax,
|
|
if (totalAmount != null) 'total_amount': totalAmount,
|
|
if (amountPaid != null) 'amount_paid': amountPaid,
|
|
if (changeAmount != null) 'change_amount': changeAmount,
|
|
if (notes != null) 'notes': notes,
|
|
if (paymentProofPath != null) 'payment_proof_path': paymentProofPath,
|
|
if (paymentProofUrl != null) 'payment_proof_url': paymentProofUrl,
|
|
if (paymentMethod != null) 'payment_method': paymentMethod,
|
|
if (customerAddressSnapshot != null)
|
|
'customer_address_snapshot': customerAddressSnapshot,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
OrdersCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? orderNumber,
|
|
Value<String>? outletId,
|
|
Value<String>? outletNameSnapshot,
|
|
Value<String?>? customerId,
|
|
Value<String?>? customerNameSnapshot,
|
|
Value<String?>? customerEmailSnapshot,
|
|
Value<String?>? customerPhoneNumberSnapshot,
|
|
Value<String>? userId,
|
|
Value<String>? adminNameSnapshot,
|
|
Value<String>? source,
|
|
Value<bool?>? alreadyRead,
|
|
Value<String>? orderStatus,
|
|
Value<bool?>? isCancellation,
|
|
Value<bool?>? cancellationAccepted,
|
|
Value<String?>? approvalProccess,
|
|
Value<String?>? canceledBy,
|
|
Value<String?>? deliveryType,
|
|
Value<String?>? deliveryPrefrence,
|
|
Value<double>? shippingCost,
|
|
Value<double>? totalOrder,
|
|
Value<double>? discount,
|
|
Value<double>? tax,
|
|
Value<double>? totalAmount,
|
|
Value<double>? amountPaid,
|
|
Value<double>? changeAmount,
|
|
Value<String?>? notes,
|
|
Value<String?>? paymentProofPath,
|
|
Value<String?>? paymentProofUrl,
|
|
Value<String?>? paymentMethod,
|
|
Value<Map<String, dynamic>?>? customerAddressSnapshot,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return OrdersCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
orderNumber: orderNumber ?? this.orderNumber,
|
|
outletId: outletId ?? this.outletId,
|
|
outletNameSnapshot: outletNameSnapshot ?? this.outletNameSnapshot,
|
|
customerId: customerId ?? this.customerId,
|
|
customerNameSnapshot: customerNameSnapshot ?? this.customerNameSnapshot,
|
|
customerEmailSnapshot:
|
|
customerEmailSnapshot ?? this.customerEmailSnapshot,
|
|
customerPhoneNumberSnapshot:
|
|
customerPhoneNumberSnapshot ?? this.customerPhoneNumberSnapshot,
|
|
userId: userId ?? this.userId,
|
|
adminNameSnapshot: adminNameSnapshot ?? this.adminNameSnapshot,
|
|
source: source ?? this.source,
|
|
alreadyRead: alreadyRead ?? this.alreadyRead,
|
|
orderStatus: orderStatus ?? this.orderStatus,
|
|
isCancellation: isCancellation ?? this.isCancellation,
|
|
cancellationAccepted: cancellationAccepted ?? this.cancellationAccepted,
|
|
approvalProccess: approvalProccess ?? this.approvalProccess,
|
|
canceledBy: canceledBy ?? this.canceledBy,
|
|
deliveryType: deliveryType ?? this.deliveryType,
|
|
deliveryPrefrence: deliveryPrefrence ?? this.deliveryPrefrence,
|
|
shippingCost: shippingCost ?? this.shippingCost,
|
|
totalOrder: totalOrder ?? this.totalOrder,
|
|
discount: discount ?? this.discount,
|
|
tax: tax ?? this.tax,
|
|
totalAmount: totalAmount ?? this.totalAmount,
|
|
amountPaid: amountPaid ?? this.amountPaid,
|
|
changeAmount: changeAmount ?? this.changeAmount,
|
|
notes: notes ?? this.notes,
|
|
paymentProofPath: paymentProofPath ?? this.paymentProofPath,
|
|
paymentProofUrl: paymentProofUrl ?? this.paymentProofUrl,
|
|
paymentMethod: paymentMethod ?? this.paymentMethod,
|
|
customerAddressSnapshot:
|
|
customerAddressSnapshot ?? this.customerAddressSnapshot,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (orderNumber.present) {
|
|
map['order_number'] = Variable<String>(orderNumber.value);
|
|
}
|
|
if (outletId.present) {
|
|
map['outlet_id'] = Variable<String>(outletId.value);
|
|
}
|
|
if (outletNameSnapshot.present) {
|
|
map['outlet_name_snapshot'] = Variable<String>(outletNameSnapshot.value);
|
|
}
|
|
if (customerId.present) {
|
|
map['customer_id'] = Variable<String>(customerId.value);
|
|
}
|
|
if (customerNameSnapshot.present) {
|
|
map['customer_name_snapshot'] = Variable<String>(
|
|
customerNameSnapshot.value,
|
|
);
|
|
}
|
|
if (customerEmailSnapshot.present) {
|
|
map['customer_email_snapshot'] = Variable<String>(
|
|
customerEmailSnapshot.value,
|
|
);
|
|
}
|
|
if (customerPhoneNumberSnapshot.present) {
|
|
map['customer_phone_number_snapshot'] = Variable<String>(
|
|
customerPhoneNumberSnapshot.value,
|
|
);
|
|
}
|
|
if (userId.present) {
|
|
map['user_id'] = Variable<String>(userId.value);
|
|
}
|
|
if (adminNameSnapshot.present) {
|
|
map['admin_name_snapshot'] = Variable<String>(adminNameSnapshot.value);
|
|
}
|
|
if (source.present) {
|
|
map['source'] = Variable<String>(source.value);
|
|
}
|
|
if (alreadyRead.present) {
|
|
map['already_read'] = Variable<bool>(alreadyRead.value);
|
|
}
|
|
if (orderStatus.present) {
|
|
map['order_status'] = Variable<String>(orderStatus.value);
|
|
}
|
|
if (isCancellation.present) {
|
|
map['is_cancellation'] = Variable<bool>(isCancellation.value);
|
|
}
|
|
if (cancellationAccepted.present) {
|
|
map['cancellation_accepted'] = Variable<bool>(cancellationAccepted.value);
|
|
}
|
|
if (approvalProccess.present) {
|
|
map['approval_proccess'] = Variable<String>(approvalProccess.value);
|
|
}
|
|
if (canceledBy.present) {
|
|
map['canceled_by'] = Variable<String>(canceledBy.value);
|
|
}
|
|
if (deliveryType.present) {
|
|
map['delivery_type'] = Variable<String>(deliveryType.value);
|
|
}
|
|
if (deliveryPrefrence.present) {
|
|
map['delivery_prefrence'] = Variable<String>(deliveryPrefrence.value);
|
|
}
|
|
if (shippingCost.present) {
|
|
map['shipping_cost'] = Variable<double>(shippingCost.value);
|
|
}
|
|
if (totalOrder.present) {
|
|
map['total_order'] = Variable<double>(totalOrder.value);
|
|
}
|
|
if (discount.present) {
|
|
map['discount'] = Variable<double>(discount.value);
|
|
}
|
|
if (tax.present) {
|
|
map['tax'] = Variable<double>(tax.value);
|
|
}
|
|
if (totalAmount.present) {
|
|
map['total_amount'] = Variable<double>(totalAmount.value);
|
|
}
|
|
if (amountPaid.present) {
|
|
map['amount_paid'] = Variable<double>(amountPaid.value);
|
|
}
|
|
if (changeAmount.present) {
|
|
map['change_amount'] = Variable<double>(changeAmount.value);
|
|
}
|
|
if (notes.present) {
|
|
map['notes'] = Variable<String>(notes.value);
|
|
}
|
|
if (paymentProofPath.present) {
|
|
map['payment_proof_path'] = Variable<String>(paymentProofPath.value);
|
|
}
|
|
if (paymentProofUrl.present) {
|
|
map['payment_proof_url'] = Variable<String>(paymentProofUrl.value);
|
|
}
|
|
if (paymentMethod.present) {
|
|
map['payment_method'] = Variable<String>(paymentMethod.value);
|
|
}
|
|
if (customerAddressSnapshot.present) {
|
|
map['customer_address_snapshot'] = Variable<String>(
|
|
$OrdersTable.$convertercustomerAddressSnapshotn.toSql(
|
|
customerAddressSnapshot.value,
|
|
),
|
|
);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('OrdersCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('orderNumber: $orderNumber, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('outletNameSnapshot: $outletNameSnapshot, ')
|
|
..write('customerId: $customerId, ')
|
|
..write('customerNameSnapshot: $customerNameSnapshot, ')
|
|
..write('customerEmailSnapshot: $customerEmailSnapshot, ')
|
|
..write('customerPhoneNumberSnapshot: $customerPhoneNumberSnapshot, ')
|
|
..write('userId: $userId, ')
|
|
..write('adminNameSnapshot: $adminNameSnapshot, ')
|
|
..write('source: $source, ')
|
|
..write('alreadyRead: $alreadyRead, ')
|
|
..write('orderStatus: $orderStatus, ')
|
|
..write('isCancellation: $isCancellation, ')
|
|
..write('cancellationAccepted: $cancellationAccepted, ')
|
|
..write('approvalProccess: $approvalProccess, ')
|
|
..write('canceledBy: $canceledBy, ')
|
|
..write('deliveryType: $deliveryType, ')
|
|
..write('deliveryPrefrence: $deliveryPrefrence, ')
|
|
..write('shippingCost: $shippingCost, ')
|
|
..write('totalOrder: $totalOrder, ')
|
|
..write('discount: $discount, ')
|
|
..write('tax: $tax, ')
|
|
..write('totalAmount: $totalAmount, ')
|
|
..write('amountPaid: $amountPaid, ')
|
|
..write('changeAmount: $changeAmount, ')
|
|
..write('notes: $notes, ')
|
|
..write('paymentProofPath: $paymentProofPath, ')
|
|
..write('paymentProofUrl: $paymentProofUrl, ')
|
|
..write('paymentMethod: $paymentMethod, ')
|
|
..write('customerAddressSnapshot: $customerAddressSnapshot, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $OrderItemsTable extends OrderItems
|
|
with TableInfo<$OrderItemsTable, OrderItem> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$OrderItemsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _orderIdMeta = const VerificationMeta(
|
|
'orderId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> orderId = GeneratedColumn<String>(
|
|
'order_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES orders (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _productVariantIdMeta = const VerificationMeta(
|
|
'productVariantId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> productVariantId = GeneratedColumn<String>(
|
|
'product_variant_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES product_variants (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _quantityMeta = const VerificationMeta(
|
|
'quantity',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> quantity = GeneratedColumn<double>(
|
|
'quantity',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _productImageSnapshotMeta =
|
|
const VerificationMeta('productImageSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> productImageSnapshot =
|
|
GeneratedColumn<String>(
|
|
'product_image_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _productImageUrlSnapshotMeta =
|
|
const VerificationMeta('productImageUrlSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> productImageUrlSnapshot =
|
|
GeneratedColumn<String>(
|
|
'product_image_url_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _productNameSnapshotMeta =
|
|
const VerificationMeta('productNameSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> productNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'product_name_snapshot',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _productVariantNameSnapshotMeta =
|
|
const VerificationMeta('productVariantNameSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> productVariantNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'product_variant_name_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _sellingPriceSnapshotMeta =
|
|
const VerificationMeta('sellingPriceSnapshot');
|
|
@override
|
|
late final GeneratedColumn<double> sellingPriceSnapshot =
|
|
GeneratedColumn<double>(
|
|
'selling_price_snapshot',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _subtotalMeta = const VerificationMeta(
|
|
'subtotal',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> subtotal = GeneratedColumn<double>(
|
|
'subtotal',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
orderId,
|
|
productVariantId,
|
|
quantity,
|
|
productImageSnapshot,
|
|
productImageUrlSnapshot,
|
|
productNameSnapshot,
|
|
productVariantNameSnapshot,
|
|
sellingPriceSnapshot,
|
|
subtotal,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'order_items';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<OrderItem> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('order_id')) {
|
|
context.handle(
|
|
_orderIdMeta,
|
|
orderId.isAcceptableOrUnknown(data['order_id']!, _orderIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_orderIdMeta);
|
|
}
|
|
if (data.containsKey('product_variant_id')) {
|
|
context.handle(
|
|
_productVariantIdMeta,
|
|
productVariantId.isAcceptableOrUnknown(
|
|
data['product_variant_id']!,
|
|
_productVariantIdMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_productVariantIdMeta);
|
|
}
|
|
if (data.containsKey('quantity')) {
|
|
context.handle(
|
|
_quantityMeta,
|
|
quantity.isAcceptableOrUnknown(data['quantity']!, _quantityMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('product_image_snapshot')) {
|
|
context.handle(
|
|
_productImageSnapshotMeta,
|
|
productImageSnapshot.isAcceptableOrUnknown(
|
|
data['product_image_snapshot']!,
|
|
_productImageSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('product_image_url_snapshot')) {
|
|
context.handle(
|
|
_productImageUrlSnapshotMeta,
|
|
productImageUrlSnapshot.isAcceptableOrUnknown(
|
|
data['product_image_url_snapshot']!,
|
|
_productImageUrlSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('product_name_snapshot')) {
|
|
context.handle(
|
|
_productNameSnapshotMeta,
|
|
productNameSnapshot.isAcceptableOrUnknown(
|
|
data['product_name_snapshot']!,
|
|
_productNameSnapshotMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_productNameSnapshotMeta);
|
|
}
|
|
if (data.containsKey('product_variant_name_snapshot')) {
|
|
context.handle(
|
|
_productVariantNameSnapshotMeta,
|
|
productVariantNameSnapshot.isAcceptableOrUnknown(
|
|
data['product_variant_name_snapshot']!,
|
|
_productVariantNameSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('selling_price_snapshot')) {
|
|
context.handle(
|
|
_sellingPriceSnapshotMeta,
|
|
sellingPriceSnapshot.isAcceptableOrUnknown(
|
|
data['selling_price_snapshot']!,
|
|
_sellingPriceSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('subtotal')) {
|
|
context.handle(
|
|
_subtotalMeta,
|
|
subtotal.isAcceptableOrUnknown(data['subtotal']!, _subtotalMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
OrderItem map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return OrderItem(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
orderId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}order_id'],
|
|
)!,
|
|
productVariantId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}product_variant_id'],
|
|
)!,
|
|
quantity: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}quantity'],
|
|
)!,
|
|
productImageSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}product_image_snapshot'],
|
|
),
|
|
productImageUrlSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}product_image_url_snapshot'],
|
|
),
|
|
productNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}product_name_snapshot'],
|
|
)!,
|
|
productVariantNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}product_variant_name_snapshot'],
|
|
),
|
|
sellingPriceSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}selling_price_snapshot'],
|
|
)!,
|
|
subtotal: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}subtotal'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$OrderItemsTable createAlias(String alias) {
|
|
return $OrderItemsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class OrderItem extends DataClass implements Insertable<OrderItem> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String orderId;
|
|
final String productVariantId;
|
|
final double quantity;
|
|
final String? productImageSnapshot;
|
|
final String? productImageUrlSnapshot;
|
|
final String productNameSnapshot;
|
|
final String? productVariantNameSnapshot;
|
|
final double sellingPriceSnapshot;
|
|
final double subtotal;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const OrderItem({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.orderId,
|
|
required this.productVariantId,
|
|
required this.quantity,
|
|
this.productImageSnapshot,
|
|
this.productImageUrlSnapshot,
|
|
required this.productNameSnapshot,
|
|
this.productVariantNameSnapshot,
|
|
required this.sellingPriceSnapshot,
|
|
required this.subtotal,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['order_id'] = Variable<String>(orderId);
|
|
map['product_variant_id'] = Variable<String>(productVariantId);
|
|
map['quantity'] = Variable<double>(quantity);
|
|
if (!nullToAbsent || productImageSnapshot != null) {
|
|
map['product_image_snapshot'] = Variable<String>(productImageSnapshot);
|
|
}
|
|
if (!nullToAbsent || productImageUrlSnapshot != null) {
|
|
map['product_image_url_snapshot'] = Variable<String>(
|
|
productImageUrlSnapshot,
|
|
);
|
|
}
|
|
map['product_name_snapshot'] = Variable<String>(productNameSnapshot);
|
|
if (!nullToAbsent || productVariantNameSnapshot != null) {
|
|
map['product_variant_name_snapshot'] = Variable<String>(
|
|
productVariantNameSnapshot,
|
|
);
|
|
}
|
|
map['selling_price_snapshot'] = Variable<double>(sellingPriceSnapshot);
|
|
map['subtotal'] = Variable<double>(subtotal);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
OrderItemsCompanion toCompanion(bool nullToAbsent) {
|
|
return OrderItemsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
orderId: Value(orderId),
|
|
productVariantId: Value(productVariantId),
|
|
quantity: Value(quantity),
|
|
productImageSnapshot: productImageSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(productImageSnapshot),
|
|
productImageUrlSnapshot: productImageUrlSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(productImageUrlSnapshot),
|
|
productNameSnapshot: Value(productNameSnapshot),
|
|
productVariantNameSnapshot:
|
|
productVariantNameSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(productVariantNameSnapshot),
|
|
sellingPriceSnapshot: Value(sellingPriceSnapshot),
|
|
subtotal: Value(subtotal),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory OrderItem.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return OrderItem(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
orderId: serializer.fromJson<String>(json['orderId']),
|
|
productVariantId: serializer.fromJson<String>(json['productVariantId']),
|
|
quantity: serializer.fromJson<double>(json['quantity']),
|
|
productImageSnapshot: serializer.fromJson<String?>(
|
|
json['productImageSnapshot'],
|
|
),
|
|
productImageUrlSnapshot: serializer.fromJson<String?>(
|
|
json['productImageUrlSnapshot'],
|
|
),
|
|
productNameSnapshot: serializer.fromJson<String>(
|
|
json['productNameSnapshot'],
|
|
),
|
|
productVariantNameSnapshot: serializer.fromJson<String?>(
|
|
json['productVariantNameSnapshot'],
|
|
),
|
|
sellingPriceSnapshot: serializer.fromJson<double>(
|
|
json['sellingPriceSnapshot'],
|
|
),
|
|
subtotal: serializer.fromJson<double>(json['subtotal']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'orderId': serializer.toJson<String>(orderId),
|
|
'productVariantId': serializer.toJson<String>(productVariantId),
|
|
'quantity': serializer.toJson<double>(quantity),
|
|
'productImageSnapshot': serializer.toJson<String?>(productImageSnapshot),
|
|
'productImageUrlSnapshot': serializer.toJson<String?>(
|
|
productImageUrlSnapshot,
|
|
),
|
|
'productNameSnapshot': serializer.toJson<String>(productNameSnapshot),
|
|
'productVariantNameSnapshot': serializer.toJson<String?>(
|
|
productVariantNameSnapshot,
|
|
),
|
|
'sellingPriceSnapshot': serializer.toJson<double>(sellingPriceSnapshot),
|
|
'subtotal': serializer.toJson<double>(subtotal),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
OrderItem copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? orderId,
|
|
String? productVariantId,
|
|
double? quantity,
|
|
Value<String?> productImageSnapshot = const Value.absent(),
|
|
Value<String?> productImageUrlSnapshot = const Value.absent(),
|
|
String? productNameSnapshot,
|
|
Value<String?> productVariantNameSnapshot = const Value.absent(),
|
|
double? sellingPriceSnapshot,
|
|
double? subtotal,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => OrderItem(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
orderId: orderId ?? this.orderId,
|
|
productVariantId: productVariantId ?? this.productVariantId,
|
|
quantity: quantity ?? this.quantity,
|
|
productImageSnapshot: productImageSnapshot.present
|
|
? productImageSnapshot.value
|
|
: this.productImageSnapshot,
|
|
productImageUrlSnapshot: productImageUrlSnapshot.present
|
|
? productImageUrlSnapshot.value
|
|
: this.productImageUrlSnapshot,
|
|
productNameSnapshot: productNameSnapshot ?? this.productNameSnapshot,
|
|
productVariantNameSnapshot: productVariantNameSnapshot.present
|
|
? productVariantNameSnapshot.value
|
|
: this.productVariantNameSnapshot,
|
|
sellingPriceSnapshot: sellingPriceSnapshot ?? this.sellingPriceSnapshot,
|
|
subtotal: subtotal ?? this.subtotal,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
OrderItem copyWithCompanion(OrderItemsCompanion data) {
|
|
return OrderItem(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
orderId: data.orderId.present ? data.orderId.value : this.orderId,
|
|
productVariantId: data.productVariantId.present
|
|
? data.productVariantId.value
|
|
: this.productVariantId,
|
|
quantity: data.quantity.present ? data.quantity.value : this.quantity,
|
|
productImageSnapshot: data.productImageSnapshot.present
|
|
? data.productImageSnapshot.value
|
|
: this.productImageSnapshot,
|
|
productImageUrlSnapshot: data.productImageUrlSnapshot.present
|
|
? data.productImageUrlSnapshot.value
|
|
: this.productImageUrlSnapshot,
|
|
productNameSnapshot: data.productNameSnapshot.present
|
|
? data.productNameSnapshot.value
|
|
: this.productNameSnapshot,
|
|
productVariantNameSnapshot: data.productVariantNameSnapshot.present
|
|
? data.productVariantNameSnapshot.value
|
|
: this.productVariantNameSnapshot,
|
|
sellingPriceSnapshot: data.sellingPriceSnapshot.present
|
|
? data.sellingPriceSnapshot.value
|
|
: this.sellingPriceSnapshot,
|
|
subtotal: data.subtotal.present ? data.subtotal.value : this.subtotal,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('OrderItem(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('orderId: $orderId, ')
|
|
..write('productVariantId: $productVariantId, ')
|
|
..write('quantity: $quantity, ')
|
|
..write('productImageSnapshot: $productImageSnapshot, ')
|
|
..write('productImageUrlSnapshot: $productImageUrlSnapshot, ')
|
|
..write('productNameSnapshot: $productNameSnapshot, ')
|
|
..write('productVariantNameSnapshot: $productVariantNameSnapshot, ')
|
|
..write('sellingPriceSnapshot: $sellingPriceSnapshot, ')
|
|
..write('subtotal: $subtotal, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
orderId,
|
|
productVariantId,
|
|
quantity,
|
|
productImageSnapshot,
|
|
productImageUrlSnapshot,
|
|
productNameSnapshot,
|
|
productVariantNameSnapshot,
|
|
sellingPriceSnapshot,
|
|
subtotal,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is OrderItem &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.orderId == this.orderId &&
|
|
other.productVariantId == this.productVariantId &&
|
|
other.quantity == this.quantity &&
|
|
other.productImageSnapshot == this.productImageSnapshot &&
|
|
other.productImageUrlSnapshot == this.productImageUrlSnapshot &&
|
|
other.productNameSnapshot == this.productNameSnapshot &&
|
|
other.productVariantNameSnapshot == this.productVariantNameSnapshot &&
|
|
other.sellingPriceSnapshot == this.sellingPriceSnapshot &&
|
|
other.subtotal == this.subtotal &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class OrderItemsCompanion extends UpdateCompanion<OrderItem> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> orderId;
|
|
final Value<String> productVariantId;
|
|
final Value<double> quantity;
|
|
final Value<String?> productImageSnapshot;
|
|
final Value<String?> productImageUrlSnapshot;
|
|
final Value<String> productNameSnapshot;
|
|
final Value<String?> productVariantNameSnapshot;
|
|
final Value<double> sellingPriceSnapshot;
|
|
final Value<double> subtotal;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const OrderItemsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.orderId = const Value.absent(),
|
|
this.productVariantId = const Value.absent(),
|
|
this.quantity = const Value.absent(),
|
|
this.productImageSnapshot = const Value.absent(),
|
|
this.productImageUrlSnapshot = const Value.absent(),
|
|
this.productNameSnapshot = const Value.absent(),
|
|
this.productVariantNameSnapshot = const Value.absent(),
|
|
this.sellingPriceSnapshot = const Value.absent(),
|
|
this.subtotal = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
OrderItemsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String orderId,
|
|
required String productVariantId,
|
|
this.quantity = const Value.absent(),
|
|
this.productImageSnapshot = const Value.absent(),
|
|
this.productImageUrlSnapshot = const Value.absent(),
|
|
required String productNameSnapshot,
|
|
this.productVariantNameSnapshot = const Value.absent(),
|
|
this.sellingPriceSnapshot = const Value.absent(),
|
|
this.subtotal = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : orderId = Value(orderId),
|
|
productVariantId = Value(productVariantId),
|
|
productNameSnapshot = Value(productNameSnapshot);
|
|
static Insertable<OrderItem> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? orderId,
|
|
Expression<String>? productVariantId,
|
|
Expression<double>? quantity,
|
|
Expression<String>? productImageSnapshot,
|
|
Expression<String>? productImageUrlSnapshot,
|
|
Expression<String>? productNameSnapshot,
|
|
Expression<String>? productVariantNameSnapshot,
|
|
Expression<double>? sellingPriceSnapshot,
|
|
Expression<double>? subtotal,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (orderId != null) 'order_id': orderId,
|
|
if (productVariantId != null) 'product_variant_id': productVariantId,
|
|
if (quantity != null) 'quantity': quantity,
|
|
if (productImageSnapshot != null)
|
|
'product_image_snapshot': productImageSnapshot,
|
|
if (productImageUrlSnapshot != null)
|
|
'product_image_url_snapshot': productImageUrlSnapshot,
|
|
if (productNameSnapshot != null)
|
|
'product_name_snapshot': productNameSnapshot,
|
|
if (productVariantNameSnapshot != null)
|
|
'product_variant_name_snapshot': productVariantNameSnapshot,
|
|
if (sellingPriceSnapshot != null)
|
|
'selling_price_snapshot': sellingPriceSnapshot,
|
|
if (subtotal != null) 'subtotal': subtotal,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
OrderItemsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? orderId,
|
|
Value<String>? productVariantId,
|
|
Value<double>? quantity,
|
|
Value<String?>? productImageSnapshot,
|
|
Value<String?>? productImageUrlSnapshot,
|
|
Value<String>? productNameSnapshot,
|
|
Value<String?>? productVariantNameSnapshot,
|
|
Value<double>? sellingPriceSnapshot,
|
|
Value<double>? subtotal,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return OrderItemsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
orderId: orderId ?? this.orderId,
|
|
productVariantId: productVariantId ?? this.productVariantId,
|
|
quantity: quantity ?? this.quantity,
|
|
productImageSnapshot: productImageSnapshot ?? this.productImageSnapshot,
|
|
productImageUrlSnapshot:
|
|
productImageUrlSnapshot ?? this.productImageUrlSnapshot,
|
|
productNameSnapshot: productNameSnapshot ?? this.productNameSnapshot,
|
|
productVariantNameSnapshot:
|
|
productVariantNameSnapshot ?? this.productVariantNameSnapshot,
|
|
sellingPriceSnapshot: sellingPriceSnapshot ?? this.sellingPriceSnapshot,
|
|
subtotal: subtotal ?? this.subtotal,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (orderId.present) {
|
|
map['order_id'] = Variable<String>(orderId.value);
|
|
}
|
|
if (productVariantId.present) {
|
|
map['product_variant_id'] = Variable<String>(productVariantId.value);
|
|
}
|
|
if (quantity.present) {
|
|
map['quantity'] = Variable<double>(quantity.value);
|
|
}
|
|
if (productImageSnapshot.present) {
|
|
map['product_image_snapshot'] = Variable<String>(
|
|
productImageSnapshot.value,
|
|
);
|
|
}
|
|
if (productImageUrlSnapshot.present) {
|
|
map['product_image_url_snapshot'] = Variable<String>(
|
|
productImageUrlSnapshot.value,
|
|
);
|
|
}
|
|
if (productNameSnapshot.present) {
|
|
map['product_name_snapshot'] = Variable<String>(
|
|
productNameSnapshot.value,
|
|
);
|
|
}
|
|
if (productVariantNameSnapshot.present) {
|
|
map['product_variant_name_snapshot'] = Variable<String>(
|
|
productVariantNameSnapshot.value,
|
|
);
|
|
}
|
|
if (sellingPriceSnapshot.present) {
|
|
map['selling_price_snapshot'] = Variable<double>(
|
|
sellingPriceSnapshot.value,
|
|
);
|
|
}
|
|
if (subtotal.present) {
|
|
map['subtotal'] = Variable<double>(subtotal.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('OrderItemsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('orderId: $orderId, ')
|
|
..write('productVariantId: $productVariantId, ')
|
|
..write('quantity: $quantity, ')
|
|
..write('productImageSnapshot: $productImageSnapshot, ')
|
|
..write('productImageUrlSnapshot: $productImageUrlSnapshot, ')
|
|
..write('productNameSnapshot: $productNameSnapshot, ')
|
|
..write('productVariantNameSnapshot: $productVariantNameSnapshot, ')
|
|
..write('sellingPriceSnapshot: $sellingPriceSnapshot, ')
|
|
..write('subtotal: $subtotal, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $SuppliersTable extends Suppliers
|
|
with TableInfo<$SuppliersTable, Supplier> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$SuppliersTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _emailMeta = const VerificationMeta('email');
|
|
@override
|
|
late final GeneratedColumn<String> email = GeneratedColumn<String>(
|
|
'email',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _phoneNumberMeta = const VerificationMeta(
|
|
'phoneNumber',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> phoneNumber = GeneratedColumn<String>(
|
|
'phone_number',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _addressMeta = const VerificationMeta(
|
|
'address',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> address = GeneratedColumn<String>(
|
|
'address',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
name,
|
|
email,
|
|
phoneNumber,
|
|
address,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'suppliers';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Supplier> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('email')) {
|
|
context.handle(
|
|
_emailMeta,
|
|
email.isAcceptableOrUnknown(data['email']!, _emailMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('phone_number')) {
|
|
context.handle(
|
|
_phoneNumberMeta,
|
|
phoneNumber.isAcceptableOrUnknown(
|
|
data['phone_number']!,
|
|
_phoneNumberMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('address')) {
|
|
context.handle(
|
|
_addressMeta,
|
|
address.isAcceptableOrUnknown(data['address']!, _addressMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Supplier map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Supplier(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
email: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}email'],
|
|
),
|
|
phoneNumber: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}phone_number'],
|
|
),
|
|
address: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}address'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$SuppliersTable createAlias(String alias) {
|
|
return $SuppliersTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Supplier extends DataClass implements Insertable<Supplier> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String name;
|
|
final String? email;
|
|
final String? phoneNumber;
|
|
final String? address;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const Supplier({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.name,
|
|
this.email,
|
|
this.phoneNumber,
|
|
this.address,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || email != null) {
|
|
map['email'] = Variable<String>(email);
|
|
}
|
|
if (!nullToAbsent || phoneNumber != null) {
|
|
map['phone_number'] = Variable<String>(phoneNumber);
|
|
}
|
|
if (!nullToAbsent || address != null) {
|
|
map['address'] = Variable<String>(address);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
SuppliersCompanion toCompanion(bool nullToAbsent) {
|
|
return SuppliersCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
name: Value(name),
|
|
email: email == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(email),
|
|
phoneNumber: phoneNumber == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(phoneNumber),
|
|
address: address == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(address),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory Supplier.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Supplier(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
email: serializer.fromJson<String?>(json['email']),
|
|
phoneNumber: serializer.fromJson<String?>(json['phoneNumber']),
|
|
address: serializer.fromJson<String?>(json['address']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'name': serializer.toJson<String>(name),
|
|
'email': serializer.toJson<String?>(email),
|
|
'phoneNumber': serializer.toJson<String?>(phoneNumber),
|
|
'address': serializer.toJson<String?>(address),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
Supplier copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? name,
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> address = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => Supplier(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
name: name ?? this.name,
|
|
email: email.present ? email.value : this.email,
|
|
phoneNumber: phoneNumber.present ? phoneNumber.value : this.phoneNumber,
|
|
address: address.present ? address.value : this.address,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
Supplier copyWithCompanion(SuppliersCompanion data) {
|
|
return Supplier(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
email: data.email.present ? data.email.value : this.email,
|
|
phoneNumber: data.phoneNumber.present
|
|
? data.phoneNumber.value
|
|
: this.phoneNumber,
|
|
address: data.address.present ? data.address.value : this.address,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Supplier(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('name: $name, ')
|
|
..write('email: $email, ')
|
|
..write('phoneNumber: $phoneNumber, ')
|
|
..write('address: $address, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
name,
|
|
email,
|
|
phoneNumber,
|
|
address,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Supplier &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.name == this.name &&
|
|
other.email == this.email &&
|
|
other.phoneNumber == this.phoneNumber &&
|
|
other.address == this.address &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class SuppliersCompanion extends UpdateCompanion<Supplier> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> name;
|
|
final Value<String?> email;
|
|
final Value<String?> phoneNumber;
|
|
final Value<String?> address;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const SuppliersCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.email = const Value.absent(),
|
|
this.phoneNumber = const Value.absent(),
|
|
this.address = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
SuppliersCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String name,
|
|
this.email = const Value.absent(),
|
|
this.phoneNumber = const Value.absent(),
|
|
this.address = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : name = Value(name);
|
|
static Insertable<Supplier> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? name,
|
|
Expression<String>? email,
|
|
Expression<String>? phoneNumber,
|
|
Expression<String>? address,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (name != null) 'name': name,
|
|
if (email != null) 'email': email,
|
|
if (phoneNumber != null) 'phone_number': phoneNumber,
|
|
if (address != null) 'address': address,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
SuppliersCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? name,
|
|
Value<String?>? email,
|
|
Value<String?>? phoneNumber,
|
|
Value<String?>? address,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return SuppliersCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
name: name ?? this.name,
|
|
email: email ?? this.email,
|
|
phoneNumber: phoneNumber ?? this.phoneNumber,
|
|
address: address ?? this.address,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (email.present) {
|
|
map['email'] = Variable<String>(email.value);
|
|
}
|
|
if (phoneNumber.present) {
|
|
map['phone_number'] = Variable<String>(phoneNumber.value);
|
|
}
|
|
if (address.present) {
|
|
map['address'] = Variable<String>(address.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('SuppliersCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('name: $name, ')
|
|
..write('email: $email, ')
|
|
..write('phoneNumber: $phoneNumber, ')
|
|
..write('address: $address, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $PurchasesTable extends Purchases
|
|
with TableInfo<$PurchasesTable, Purchase> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$PurchasesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _purchaseNumberMeta = const VerificationMeta(
|
|
'purchaseNumber',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> purchaseNumber = GeneratedColumn<String>(
|
|
'purchase_number',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _outletIdMeta = const VerificationMeta(
|
|
'outletId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> outletId = GeneratedColumn<String>(
|
|
'outlet_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES outlets (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _outletNameSnapshotMeta =
|
|
const VerificationMeta('outletNameSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> outletNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'outlet_name_snapshot',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _supplierIdMeta = const VerificationMeta(
|
|
'supplierId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> supplierId = GeneratedColumn<String>(
|
|
'supplier_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES suppliers (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _supplierNameSnapshotMeta =
|
|
const VerificationMeta('supplierNameSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> supplierNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'supplier_name_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _supplierEmailSnapshotMeta =
|
|
const VerificationMeta('supplierEmailSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> supplierEmailSnapshot =
|
|
GeneratedColumn<String>(
|
|
'supplier_email_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _supplierPhoneNumberSnapshotMeta =
|
|
const VerificationMeta('supplierPhoneNumberSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> supplierPhoneNumberSnapshot =
|
|
GeneratedColumn<String>(
|
|
'supplier_phone_number_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
|
|
@override
|
|
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
|
|
'user_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES users (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _adminNameSnapshotMeta = const VerificationMeta(
|
|
'adminNameSnapshot',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> adminNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'admin_name_snapshot',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _purchaseStatusMeta = const VerificationMeta(
|
|
'purchaseStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> purchaseStatus = GeneratedColumn<String>(
|
|
'purchase_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _totalPurchaseMeta = const VerificationMeta(
|
|
'totalPurchase',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> totalPurchase = GeneratedColumn<double>(
|
|
'total_purchase',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _discountMeta = const VerificationMeta(
|
|
'discount',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> discount = GeneratedColumn<double>(
|
|
'discount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _taxMeta = const VerificationMeta('tax');
|
|
@override
|
|
late final GeneratedColumn<double> tax = GeneratedColumn<double>(
|
|
'tax',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _paymentStatusMeta = const VerificationMeta(
|
|
'paymentStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> paymentStatus = GeneratedColumn<String>(
|
|
'payment_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _totalAmountMeta = const VerificationMeta(
|
|
'totalAmount',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> totalAmount = GeneratedColumn<double>(
|
|
'total_amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _amountPaidMeta = const VerificationMeta(
|
|
'amountPaid',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> amountPaid = GeneratedColumn<double>(
|
|
'amount_paid',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _changeAmountMeta = const VerificationMeta(
|
|
'changeAmount',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> changeAmount = GeneratedColumn<double>(
|
|
'change_amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _underPaymentAmountMeta =
|
|
const VerificationMeta('underPaymentAmount');
|
|
@override
|
|
late final GeneratedColumn<double> underPaymentAmount =
|
|
GeneratedColumn<double>(
|
|
'under_payment_amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _debtAmountMeta = const VerificationMeta(
|
|
'debtAmount',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> debtAmount = GeneratedColumn<double>(
|
|
'debt_amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _paymentProofPathMeta = const VerificationMeta(
|
|
'paymentProofPath',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> paymentProofPath = GeneratedColumn<String>(
|
|
'payment_proof_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _paymentProofUrlMeta = const VerificationMeta(
|
|
'paymentProofUrl',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> paymentProofUrl = GeneratedColumn<String>(
|
|
'payment_proof_url',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _notesMeta = const VerificationMeta('notes');
|
|
@override
|
|
late final GeneratedColumn<String> notes = GeneratedColumn<String>(
|
|
'notes',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
purchaseNumber,
|
|
outletId,
|
|
outletNameSnapshot,
|
|
supplierId,
|
|
supplierNameSnapshot,
|
|
supplierEmailSnapshot,
|
|
supplierPhoneNumberSnapshot,
|
|
userId,
|
|
adminNameSnapshot,
|
|
purchaseStatus,
|
|
totalPurchase,
|
|
discount,
|
|
tax,
|
|
paymentStatus,
|
|
totalAmount,
|
|
amountPaid,
|
|
changeAmount,
|
|
underPaymentAmount,
|
|
debtAmount,
|
|
paymentProofPath,
|
|
paymentProofUrl,
|
|
notes,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'purchases';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Purchase> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('purchase_number')) {
|
|
context.handle(
|
|
_purchaseNumberMeta,
|
|
purchaseNumber.isAcceptableOrUnknown(
|
|
data['purchase_number']!,
|
|
_purchaseNumberMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_purchaseNumberMeta);
|
|
}
|
|
if (data.containsKey('outlet_id')) {
|
|
context.handle(
|
|
_outletIdMeta,
|
|
outletId.isAcceptableOrUnknown(data['outlet_id']!, _outletIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_outletIdMeta);
|
|
}
|
|
if (data.containsKey('outlet_name_snapshot')) {
|
|
context.handle(
|
|
_outletNameSnapshotMeta,
|
|
outletNameSnapshot.isAcceptableOrUnknown(
|
|
data['outlet_name_snapshot']!,
|
|
_outletNameSnapshotMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_outletNameSnapshotMeta);
|
|
}
|
|
if (data.containsKey('supplier_id')) {
|
|
context.handle(
|
|
_supplierIdMeta,
|
|
supplierId.isAcceptableOrUnknown(data['supplier_id']!, _supplierIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('supplier_name_snapshot')) {
|
|
context.handle(
|
|
_supplierNameSnapshotMeta,
|
|
supplierNameSnapshot.isAcceptableOrUnknown(
|
|
data['supplier_name_snapshot']!,
|
|
_supplierNameSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('supplier_email_snapshot')) {
|
|
context.handle(
|
|
_supplierEmailSnapshotMeta,
|
|
supplierEmailSnapshot.isAcceptableOrUnknown(
|
|
data['supplier_email_snapshot']!,
|
|
_supplierEmailSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('supplier_phone_number_snapshot')) {
|
|
context.handle(
|
|
_supplierPhoneNumberSnapshotMeta,
|
|
supplierPhoneNumberSnapshot.isAcceptableOrUnknown(
|
|
data['supplier_phone_number_snapshot']!,
|
|
_supplierPhoneNumberSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('user_id')) {
|
|
context.handle(
|
|
_userIdMeta,
|
|
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_userIdMeta);
|
|
}
|
|
if (data.containsKey('admin_name_snapshot')) {
|
|
context.handle(
|
|
_adminNameSnapshotMeta,
|
|
adminNameSnapshot.isAcceptableOrUnknown(
|
|
data['admin_name_snapshot']!,
|
|
_adminNameSnapshotMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_adminNameSnapshotMeta);
|
|
}
|
|
if (data.containsKey('purchase_status')) {
|
|
context.handle(
|
|
_purchaseStatusMeta,
|
|
purchaseStatus.isAcceptableOrUnknown(
|
|
data['purchase_status']!,
|
|
_purchaseStatusMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_purchaseStatusMeta);
|
|
}
|
|
if (data.containsKey('total_purchase')) {
|
|
context.handle(
|
|
_totalPurchaseMeta,
|
|
totalPurchase.isAcceptableOrUnknown(
|
|
data['total_purchase']!,
|
|
_totalPurchaseMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('discount')) {
|
|
context.handle(
|
|
_discountMeta,
|
|
discount.isAcceptableOrUnknown(data['discount']!, _discountMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('tax')) {
|
|
context.handle(
|
|
_taxMeta,
|
|
tax.isAcceptableOrUnknown(data['tax']!, _taxMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('payment_status')) {
|
|
context.handle(
|
|
_paymentStatusMeta,
|
|
paymentStatus.isAcceptableOrUnknown(
|
|
data['payment_status']!,
|
|
_paymentStatusMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_paymentStatusMeta);
|
|
}
|
|
if (data.containsKey('total_amount')) {
|
|
context.handle(
|
|
_totalAmountMeta,
|
|
totalAmount.isAcceptableOrUnknown(
|
|
data['total_amount']!,
|
|
_totalAmountMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('amount_paid')) {
|
|
context.handle(
|
|
_amountPaidMeta,
|
|
amountPaid.isAcceptableOrUnknown(data['amount_paid']!, _amountPaidMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('change_amount')) {
|
|
context.handle(
|
|
_changeAmountMeta,
|
|
changeAmount.isAcceptableOrUnknown(
|
|
data['change_amount']!,
|
|
_changeAmountMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('under_payment_amount')) {
|
|
context.handle(
|
|
_underPaymentAmountMeta,
|
|
underPaymentAmount.isAcceptableOrUnknown(
|
|
data['under_payment_amount']!,
|
|
_underPaymentAmountMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('debt_amount')) {
|
|
context.handle(
|
|
_debtAmountMeta,
|
|
debtAmount.isAcceptableOrUnknown(data['debt_amount']!, _debtAmountMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('payment_proof_path')) {
|
|
context.handle(
|
|
_paymentProofPathMeta,
|
|
paymentProofPath.isAcceptableOrUnknown(
|
|
data['payment_proof_path']!,
|
|
_paymentProofPathMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('payment_proof_url')) {
|
|
context.handle(
|
|
_paymentProofUrlMeta,
|
|
paymentProofUrl.isAcceptableOrUnknown(
|
|
data['payment_proof_url']!,
|
|
_paymentProofUrlMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('notes')) {
|
|
context.handle(
|
|
_notesMeta,
|
|
notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Purchase map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Purchase(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
purchaseNumber: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}purchase_number'],
|
|
)!,
|
|
outletId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_id'],
|
|
)!,
|
|
outletNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_name_snapshot'],
|
|
)!,
|
|
supplierId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}supplier_id'],
|
|
),
|
|
supplierNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}supplier_name_snapshot'],
|
|
),
|
|
supplierEmailSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}supplier_email_snapshot'],
|
|
),
|
|
supplierPhoneNumberSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}supplier_phone_number_snapshot'],
|
|
),
|
|
userId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}user_id'],
|
|
)!,
|
|
adminNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}admin_name_snapshot'],
|
|
)!,
|
|
purchaseStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}purchase_status'],
|
|
)!,
|
|
totalPurchase: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}total_purchase'],
|
|
)!,
|
|
discount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}discount'],
|
|
)!,
|
|
tax: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}tax'],
|
|
)!,
|
|
paymentStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}payment_status'],
|
|
)!,
|
|
totalAmount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}total_amount'],
|
|
)!,
|
|
amountPaid: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}amount_paid'],
|
|
)!,
|
|
changeAmount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}change_amount'],
|
|
)!,
|
|
underPaymentAmount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}under_payment_amount'],
|
|
)!,
|
|
debtAmount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}debt_amount'],
|
|
)!,
|
|
paymentProofPath: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}payment_proof_path'],
|
|
),
|
|
paymentProofUrl: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}payment_proof_url'],
|
|
),
|
|
notes: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}notes'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$PurchasesTable createAlias(String alias) {
|
|
return $PurchasesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Purchase extends DataClass implements Insertable<Purchase> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String purchaseNumber;
|
|
final String outletId;
|
|
final String outletNameSnapshot;
|
|
final String? supplierId;
|
|
final String? supplierNameSnapshot;
|
|
final String? supplierEmailSnapshot;
|
|
final String? supplierPhoneNumberSnapshot;
|
|
final String userId;
|
|
final String adminNameSnapshot;
|
|
final String purchaseStatus;
|
|
final double totalPurchase;
|
|
final double discount;
|
|
final double tax;
|
|
final String paymentStatus;
|
|
final double totalAmount;
|
|
final double amountPaid;
|
|
final double changeAmount;
|
|
final double underPaymentAmount;
|
|
final double debtAmount;
|
|
final String? paymentProofPath;
|
|
final String? paymentProofUrl;
|
|
final String? notes;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const Purchase({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.purchaseNumber,
|
|
required this.outletId,
|
|
required this.outletNameSnapshot,
|
|
this.supplierId,
|
|
this.supplierNameSnapshot,
|
|
this.supplierEmailSnapshot,
|
|
this.supplierPhoneNumberSnapshot,
|
|
required this.userId,
|
|
required this.adminNameSnapshot,
|
|
required this.purchaseStatus,
|
|
required this.totalPurchase,
|
|
required this.discount,
|
|
required this.tax,
|
|
required this.paymentStatus,
|
|
required this.totalAmount,
|
|
required this.amountPaid,
|
|
required this.changeAmount,
|
|
required this.underPaymentAmount,
|
|
required this.debtAmount,
|
|
this.paymentProofPath,
|
|
this.paymentProofUrl,
|
|
this.notes,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['purchase_number'] = Variable<String>(purchaseNumber);
|
|
map['outlet_id'] = Variable<String>(outletId);
|
|
map['outlet_name_snapshot'] = Variable<String>(outletNameSnapshot);
|
|
if (!nullToAbsent || supplierId != null) {
|
|
map['supplier_id'] = Variable<String>(supplierId);
|
|
}
|
|
if (!nullToAbsent || supplierNameSnapshot != null) {
|
|
map['supplier_name_snapshot'] = Variable<String>(supplierNameSnapshot);
|
|
}
|
|
if (!nullToAbsent || supplierEmailSnapshot != null) {
|
|
map['supplier_email_snapshot'] = Variable<String>(supplierEmailSnapshot);
|
|
}
|
|
if (!nullToAbsent || supplierPhoneNumberSnapshot != null) {
|
|
map['supplier_phone_number_snapshot'] = Variable<String>(
|
|
supplierPhoneNumberSnapshot,
|
|
);
|
|
}
|
|
map['user_id'] = Variable<String>(userId);
|
|
map['admin_name_snapshot'] = Variable<String>(adminNameSnapshot);
|
|
map['purchase_status'] = Variable<String>(purchaseStatus);
|
|
map['total_purchase'] = Variable<double>(totalPurchase);
|
|
map['discount'] = Variable<double>(discount);
|
|
map['tax'] = Variable<double>(tax);
|
|
map['payment_status'] = Variable<String>(paymentStatus);
|
|
map['total_amount'] = Variable<double>(totalAmount);
|
|
map['amount_paid'] = Variable<double>(amountPaid);
|
|
map['change_amount'] = Variable<double>(changeAmount);
|
|
map['under_payment_amount'] = Variable<double>(underPaymentAmount);
|
|
map['debt_amount'] = Variable<double>(debtAmount);
|
|
if (!nullToAbsent || paymentProofPath != null) {
|
|
map['payment_proof_path'] = Variable<String>(paymentProofPath);
|
|
}
|
|
if (!nullToAbsent || paymentProofUrl != null) {
|
|
map['payment_proof_url'] = Variable<String>(paymentProofUrl);
|
|
}
|
|
if (!nullToAbsent || notes != null) {
|
|
map['notes'] = Variable<String>(notes);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
PurchasesCompanion toCompanion(bool nullToAbsent) {
|
|
return PurchasesCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
purchaseNumber: Value(purchaseNumber),
|
|
outletId: Value(outletId),
|
|
outletNameSnapshot: Value(outletNameSnapshot),
|
|
supplierId: supplierId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(supplierId),
|
|
supplierNameSnapshot: supplierNameSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(supplierNameSnapshot),
|
|
supplierEmailSnapshot: supplierEmailSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(supplierEmailSnapshot),
|
|
supplierPhoneNumberSnapshot:
|
|
supplierPhoneNumberSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(supplierPhoneNumberSnapshot),
|
|
userId: Value(userId),
|
|
adminNameSnapshot: Value(adminNameSnapshot),
|
|
purchaseStatus: Value(purchaseStatus),
|
|
totalPurchase: Value(totalPurchase),
|
|
discount: Value(discount),
|
|
tax: Value(tax),
|
|
paymentStatus: Value(paymentStatus),
|
|
totalAmount: Value(totalAmount),
|
|
amountPaid: Value(amountPaid),
|
|
changeAmount: Value(changeAmount),
|
|
underPaymentAmount: Value(underPaymentAmount),
|
|
debtAmount: Value(debtAmount),
|
|
paymentProofPath: paymentProofPath == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(paymentProofPath),
|
|
paymentProofUrl: paymentProofUrl == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(paymentProofUrl),
|
|
notes: notes == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(notes),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory Purchase.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Purchase(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
purchaseNumber: serializer.fromJson<String>(json['purchaseNumber']),
|
|
outletId: serializer.fromJson<String>(json['outletId']),
|
|
outletNameSnapshot: serializer.fromJson<String>(
|
|
json['outletNameSnapshot'],
|
|
),
|
|
supplierId: serializer.fromJson<String?>(json['supplierId']),
|
|
supplierNameSnapshot: serializer.fromJson<String?>(
|
|
json['supplierNameSnapshot'],
|
|
),
|
|
supplierEmailSnapshot: serializer.fromJson<String?>(
|
|
json['supplierEmailSnapshot'],
|
|
),
|
|
supplierPhoneNumberSnapshot: serializer.fromJson<String?>(
|
|
json['supplierPhoneNumberSnapshot'],
|
|
),
|
|
userId: serializer.fromJson<String>(json['userId']),
|
|
adminNameSnapshot: serializer.fromJson<String>(json['adminNameSnapshot']),
|
|
purchaseStatus: serializer.fromJson<String>(json['purchaseStatus']),
|
|
totalPurchase: serializer.fromJson<double>(json['totalPurchase']),
|
|
discount: serializer.fromJson<double>(json['discount']),
|
|
tax: serializer.fromJson<double>(json['tax']),
|
|
paymentStatus: serializer.fromJson<String>(json['paymentStatus']),
|
|
totalAmount: serializer.fromJson<double>(json['totalAmount']),
|
|
amountPaid: serializer.fromJson<double>(json['amountPaid']),
|
|
changeAmount: serializer.fromJson<double>(json['changeAmount']),
|
|
underPaymentAmount: serializer.fromJson<double>(
|
|
json['underPaymentAmount'],
|
|
),
|
|
debtAmount: serializer.fromJson<double>(json['debtAmount']),
|
|
paymentProofPath: serializer.fromJson<String?>(json['paymentProofPath']),
|
|
paymentProofUrl: serializer.fromJson<String?>(json['paymentProofUrl']),
|
|
notes: serializer.fromJson<String?>(json['notes']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'purchaseNumber': serializer.toJson<String>(purchaseNumber),
|
|
'outletId': serializer.toJson<String>(outletId),
|
|
'outletNameSnapshot': serializer.toJson<String>(outletNameSnapshot),
|
|
'supplierId': serializer.toJson<String?>(supplierId),
|
|
'supplierNameSnapshot': serializer.toJson<String?>(supplierNameSnapshot),
|
|
'supplierEmailSnapshot': serializer.toJson<String?>(
|
|
supplierEmailSnapshot,
|
|
),
|
|
'supplierPhoneNumberSnapshot': serializer.toJson<String?>(
|
|
supplierPhoneNumberSnapshot,
|
|
),
|
|
'userId': serializer.toJson<String>(userId),
|
|
'adminNameSnapshot': serializer.toJson<String>(adminNameSnapshot),
|
|
'purchaseStatus': serializer.toJson<String>(purchaseStatus),
|
|
'totalPurchase': serializer.toJson<double>(totalPurchase),
|
|
'discount': serializer.toJson<double>(discount),
|
|
'tax': serializer.toJson<double>(tax),
|
|
'paymentStatus': serializer.toJson<String>(paymentStatus),
|
|
'totalAmount': serializer.toJson<double>(totalAmount),
|
|
'amountPaid': serializer.toJson<double>(amountPaid),
|
|
'changeAmount': serializer.toJson<double>(changeAmount),
|
|
'underPaymentAmount': serializer.toJson<double>(underPaymentAmount),
|
|
'debtAmount': serializer.toJson<double>(debtAmount),
|
|
'paymentProofPath': serializer.toJson<String?>(paymentProofPath),
|
|
'paymentProofUrl': serializer.toJson<String?>(paymentProofUrl),
|
|
'notes': serializer.toJson<String?>(notes),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
Purchase copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? purchaseNumber,
|
|
String? outletId,
|
|
String? outletNameSnapshot,
|
|
Value<String?> supplierId = const Value.absent(),
|
|
Value<String?> supplierNameSnapshot = const Value.absent(),
|
|
Value<String?> supplierEmailSnapshot = const Value.absent(),
|
|
Value<String?> supplierPhoneNumberSnapshot = const Value.absent(),
|
|
String? userId,
|
|
String? adminNameSnapshot,
|
|
String? purchaseStatus,
|
|
double? totalPurchase,
|
|
double? discount,
|
|
double? tax,
|
|
String? paymentStatus,
|
|
double? totalAmount,
|
|
double? amountPaid,
|
|
double? changeAmount,
|
|
double? underPaymentAmount,
|
|
double? debtAmount,
|
|
Value<String?> paymentProofPath = const Value.absent(),
|
|
Value<String?> paymentProofUrl = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => Purchase(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
purchaseNumber: purchaseNumber ?? this.purchaseNumber,
|
|
outletId: outletId ?? this.outletId,
|
|
outletNameSnapshot: outletNameSnapshot ?? this.outletNameSnapshot,
|
|
supplierId: supplierId.present ? supplierId.value : this.supplierId,
|
|
supplierNameSnapshot: supplierNameSnapshot.present
|
|
? supplierNameSnapshot.value
|
|
: this.supplierNameSnapshot,
|
|
supplierEmailSnapshot: supplierEmailSnapshot.present
|
|
? supplierEmailSnapshot.value
|
|
: this.supplierEmailSnapshot,
|
|
supplierPhoneNumberSnapshot: supplierPhoneNumberSnapshot.present
|
|
? supplierPhoneNumberSnapshot.value
|
|
: this.supplierPhoneNumberSnapshot,
|
|
userId: userId ?? this.userId,
|
|
adminNameSnapshot: adminNameSnapshot ?? this.adminNameSnapshot,
|
|
purchaseStatus: purchaseStatus ?? this.purchaseStatus,
|
|
totalPurchase: totalPurchase ?? this.totalPurchase,
|
|
discount: discount ?? this.discount,
|
|
tax: tax ?? this.tax,
|
|
paymentStatus: paymentStatus ?? this.paymentStatus,
|
|
totalAmount: totalAmount ?? this.totalAmount,
|
|
amountPaid: amountPaid ?? this.amountPaid,
|
|
changeAmount: changeAmount ?? this.changeAmount,
|
|
underPaymentAmount: underPaymentAmount ?? this.underPaymentAmount,
|
|
debtAmount: debtAmount ?? this.debtAmount,
|
|
paymentProofPath: paymentProofPath.present
|
|
? paymentProofPath.value
|
|
: this.paymentProofPath,
|
|
paymentProofUrl: paymentProofUrl.present
|
|
? paymentProofUrl.value
|
|
: this.paymentProofUrl,
|
|
notes: notes.present ? notes.value : this.notes,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
Purchase copyWithCompanion(PurchasesCompanion data) {
|
|
return Purchase(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
purchaseNumber: data.purchaseNumber.present
|
|
? data.purchaseNumber.value
|
|
: this.purchaseNumber,
|
|
outletId: data.outletId.present ? data.outletId.value : this.outletId,
|
|
outletNameSnapshot: data.outletNameSnapshot.present
|
|
? data.outletNameSnapshot.value
|
|
: this.outletNameSnapshot,
|
|
supplierId: data.supplierId.present
|
|
? data.supplierId.value
|
|
: this.supplierId,
|
|
supplierNameSnapshot: data.supplierNameSnapshot.present
|
|
? data.supplierNameSnapshot.value
|
|
: this.supplierNameSnapshot,
|
|
supplierEmailSnapshot: data.supplierEmailSnapshot.present
|
|
? data.supplierEmailSnapshot.value
|
|
: this.supplierEmailSnapshot,
|
|
supplierPhoneNumberSnapshot: data.supplierPhoneNumberSnapshot.present
|
|
? data.supplierPhoneNumberSnapshot.value
|
|
: this.supplierPhoneNumberSnapshot,
|
|
userId: data.userId.present ? data.userId.value : this.userId,
|
|
adminNameSnapshot: data.adminNameSnapshot.present
|
|
? data.adminNameSnapshot.value
|
|
: this.adminNameSnapshot,
|
|
purchaseStatus: data.purchaseStatus.present
|
|
? data.purchaseStatus.value
|
|
: this.purchaseStatus,
|
|
totalPurchase: data.totalPurchase.present
|
|
? data.totalPurchase.value
|
|
: this.totalPurchase,
|
|
discount: data.discount.present ? data.discount.value : this.discount,
|
|
tax: data.tax.present ? data.tax.value : this.tax,
|
|
paymentStatus: data.paymentStatus.present
|
|
? data.paymentStatus.value
|
|
: this.paymentStatus,
|
|
totalAmount: data.totalAmount.present
|
|
? data.totalAmount.value
|
|
: this.totalAmount,
|
|
amountPaid: data.amountPaid.present
|
|
? data.amountPaid.value
|
|
: this.amountPaid,
|
|
changeAmount: data.changeAmount.present
|
|
? data.changeAmount.value
|
|
: this.changeAmount,
|
|
underPaymentAmount: data.underPaymentAmount.present
|
|
? data.underPaymentAmount.value
|
|
: this.underPaymentAmount,
|
|
debtAmount: data.debtAmount.present
|
|
? data.debtAmount.value
|
|
: this.debtAmount,
|
|
paymentProofPath: data.paymentProofPath.present
|
|
? data.paymentProofPath.value
|
|
: this.paymentProofPath,
|
|
paymentProofUrl: data.paymentProofUrl.present
|
|
? data.paymentProofUrl.value
|
|
: this.paymentProofUrl,
|
|
notes: data.notes.present ? data.notes.value : this.notes,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Purchase(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('purchaseNumber: $purchaseNumber, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('outletNameSnapshot: $outletNameSnapshot, ')
|
|
..write('supplierId: $supplierId, ')
|
|
..write('supplierNameSnapshot: $supplierNameSnapshot, ')
|
|
..write('supplierEmailSnapshot: $supplierEmailSnapshot, ')
|
|
..write('supplierPhoneNumberSnapshot: $supplierPhoneNumberSnapshot, ')
|
|
..write('userId: $userId, ')
|
|
..write('adminNameSnapshot: $adminNameSnapshot, ')
|
|
..write('purchaseStatus: $purchaseStatus, ')
|
|
..write('totalPurchase: $totalPurchase, ')
|
|
..write('discount: $discount, ')
|
|
..write('tax: $tax, ')
|
|
..write('paymentStatus: $paymentStatus, ')
|
|
..write('totalAmount: $totalAmount, ')
|
|
..write('amountPaid: $amountPaid, ')
|
|
..write('changeAmount: $changeAmount, ')
|
|
..write('underPaymentAmount: $underPaymentAmount, ')
|
|
..write('debtAmount: $debtAmount, ')
|
|
..write('paymentProofPath: $paymentProofPath, ')
|
|
..write('paymentProofUrl: $paymentProofUrl, ')
|
|
..write('notes: $notes, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hashAll([
|
|
localId,
|
|
serverId,
|
|
purchaseNumber,
|
|
outletId,
|
|
outletNameSnapshot,
|
|
supplierId,
|
|
supplierNameSnapshot,
|
|
supplierEmailSnapshot,
|
|
supplierPhoneNumberSnapshot,
|
|
userId,
|
|
adminNameSnapshot,
|
|
purchaseStatus,
|
|
totalPurchase,
|
|
discount,
|
|
tax,
|
|
paymentStatus,
|
|
totalAmount,
|
|
amountPaid,
|
|
changeAmount,
|
|
underPaymentAmount,
|
|
debtAmount,
|
|
paymentProofPath,
|
|
paymentProofUrl,
|
|
notes,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
]);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Purchase &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.purchaseNumber == this.purchaseNumber &&
|
|
other.outletId == this.outletId &&
|
|
other.outletNameSnapshot == this.outletNameSnapshot &&
|
|
other.supplierId == this.supplierId &&
|
|
other.supplierNameSnapshot == this.supplierNameSnapshot &&
|
|
other.supplierEmailSnapshot == this.supplierEmailSnapshot &&
|
|
other.supplierPhoneNumberSnapshot ==
|
|
this.supplierPhoneNumberSnapshot &&
|
|
other.userId == this.userId &&
|
|
other.adminNameSnapshot == this.adminNameSnapshot &&
|
|
other.purchaseStatus == this.purchaseStatus &&
|
|
other.totalPurchase == this.totalPurchase &&
|
|
other.discount == this.discount &&
|
|
other.tax == this.tax &&
|
|
other.paymentStatus == this.paymentStatus &&
|
|
other.totalAmount == this.totalAmount &&
|
|
other.amountPaid == this.amountPaid &&
|
|
other.changeAmount == this.changeAmount &&
|
|
other.underPaymentAmount == this.underPaymentAmount &&
|
|
other.debtAmount == this.debtAmount &&
|
|
other.paymentProofPath == this.paymentProofPath &&
|
|
other.paymentProofUrl == this.paymentProofUrl &&
|
|
other.notes == this.notes &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class PurchasesCompanion extends UpdateCompanion<Purchase> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> purchaseNumber;
|
|
final Value<String> outletId;
|
|
final Value<String> outletNameSnapshot;
|
|
final Value<String?> supplierId;
|
|
final Value<String?> supplierNameSnapshot;
|
|
final Value<String?> supplierEmailSnapshot;
|
|
final Value<String?> supplierPhoneNumberSnapshot;
|
|
final Value<String> userId;
|
|
final Value<String> adminNameSnapshot;
|
|
final Value<String> purchaseStatus;
|
|
final Value<double> totalPurchase;
|
|
final Value<double> discount;
|
|
final Value<double> tax;
|
|
final Value<String> paymentStatus;
|
|
final Value<double> totalAmount;
|
|
final Value<double> amountPaid;
|
|
final Value<double> changeAmount;
|
|
final Value<double> underPaymentAmount;
|
|
final Value<double> debtAmount;
|
|
final Value<String?> paymentProofPath;
|
|
final Value<String?> paymentProofUrl;
|
|
final Value<String?> notes;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const PurchasesCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.purchaseNumber = const Value.absent(),
|
|
this.outletId = const Value.absent(),
|
|
this.outletNameSnapshot = const Value.absent(),
|
|
this.supplierId = const Value.absent(),
|
|
this.supplierNameSnapshot = const Value.absent(),
|
|
this.supplierEmailSnapshot = const Value.absent(),
|
|
this.supplierPhoneNumberSnapshot = const Value.absent(),
|
|
this.userId = const Value.absent(),
|
|
this.adminNameSnapshot = const Value.absent(),
|
|
this.purchaseStatus = const Value.absent(),
|
|
this.totalPurchase = const Value.absent(),
|
|
this.discount = const Value.absent(),
|
|
this.tax = const Value.absent(),
|
|
this.paymentStatus = const Value.absent(),
|
|
this.totalAmount = const Value.absent(),
|
|
this.amountPaid = const Value.absent(),
|
|
this.changeAmount = const Value.absent(),
|
|
this.underPaymentAmount = const Value.absent(),
|
|
this.debtAmount = const Value.absent(),
|
|
this.paymentProofPath = const Value.absent(),
|
|
this.paymentProofUrl = const Value.absent(),
|
|
this.notes = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
PurchasesCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String purchaseNumber,
|
|
required String outletId,
|
|
required String outletNameSnapshot,
|
|
this.supplierId = const Value.absent(),
|
|
this.supplierNameSnapshot = const Value.absent(),
|
|
this.supplierEmailSnapshot = const Value.absent(),
|
|
this.supplierPhoneNumberSnapshot = const Value.absent(),
|
|
required String userId,
|
|
required String adminNameSnapshot,
|
|
required String purchaseStatus,
|
|
this.totalPurchase = const Value.absent(),
|
|
this.discount = const Value.absent(),
|
|
this.tax = const Value.absent(),
|
|
required String paymentStatus,
|
|
this.totalAmount = const Value.absent(),
|
|
this.amountPaid = const Value.absent(),
|
|
this.changeAmount = const Value.absent(),
|
|
this.underPaymentAmount = const Value.absent(),
|
|
this.debtAmount = const Value.absent(),
|
|
this.paymentProofPath = const Value.absent(),
|
|
this.paymentProofUrl = const Value.absent(),
|
|
this.notes = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : purchaseNumber = Value(purchaseNumber),
|
|
outletId = Value(outletId),
|
|
outletNameSnapshot = Value(outletNameSnapshot),
|
|
userId = Value(userId),
|
|
adminNameSnapshot = Value(adminNameSnapshot),
|
|
purchaseStatus = Value(purchaseStatus),
|
|
paymentStatus = Value(paymentStatus);
|
|
static Insertable<Purchase> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? purchaseNumber,
|
|
Expression<String>? outletId,
|
|
Expression<String>? outletNameSnapshot,
|
|
Expression<String>? supplierId,
|
|
Expression<String>? supplierNameSnapshot,
|
|
Expression<String>? supplierEmailSnapshot,
|
|
Expression<String>? supplierPhoneNumberSnapshot,
|
|
Expression<String>? userId,
|
|
Expression<String>? adminNameSnapshot,
|
|
Expression<String>? purchaseStatus,
|
|
Expression<double>? totalPurchase,
|
|
Expression<double>? discount,
|
|
Expression<double>? tax,
|
|
Expression<String>? paymentStatus,
|
|
Expression<double>? totalAmount,
|
|
Expression<double>? amountPaid,
|
|
Expression<double>? changeAmount,
|
|
Expression<double>? underPaymentAmount,
|
|
Expression<double>? debtAmount,
|
|
Expression<String>? paymentProofPath,
|
|
Expression<String>? paymentProofUrl,
|
|
Expression<String>? notes,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (purchaseNumber != null) 'purchase_number': purchaseNumber,
|
|
if (outletId != null) 'outlet_id': outletId,
|
|
if (outletNameSnapshot != null)
|
|
'outlet_name_snapshot': outletNameSnapshot,
|
|
if (supplierId != null) 'supplier_id': supplierId,
|
|
if (supplierNameSnapshot != null)
|
|
'supplier_name_snapshot': supplierNameSnapshot,
|
|
if (supplierEmailSnapshot != null)
|
|
'supplier_email_snapshot': supplierEmailSnapshot,
|
|
if (supplierPhoneNumberSnapshot != null)
|
|
'supplier_phone_number_snapshot': supplierPhoneNumberSnapshot,
|
|
if (userId != null) 'user_id': userId,
|
|
if (adminNameSnapshot != null) 'admin_name_snapshot': adminNameSnapshot,
|
|
if (purchaseStatus != null) 'purchase_status': purchaseStatus,
|
|
if (totalPurchase != null) 'total_purchase': totalPurchase,
|
|
if (discount != null) 'discount': discount,
|
|
if (tax != null) 'tax': tax,
|
|
if (paymentStatus != null) 'payment_status': paymentStatus,
|
|
if (totalAmount != null) 'total_amount': totalAmount,
|
|
if (amountPaid != null) 'amount_paid': amountPaid,
|
|
if (changeAmount != null) 'change_amount': changeAmount,
|
|
if (underPaymentAmount != null)
|
|
'under_payment_amount': underPaymentAmount,
|
|
if (debtAmount != null) 'debt_amount': debtAmount,
|
|
if (paymentProofPath != null) 'payment_proof_path': paymentProofPath,
|
|
if (paymentProofUrl != null) 'payment_proof_url': paymentProofUrl,
|
|
if (notes != null) 'notes': notes,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
PurchasesCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? purchaseNumber,
|
|
Value<String>? outletId,
|
|
Value<String>? outletNameSnapshot,
|
|
Value<String?>? supplierId,
|
|
Value<String?>? supplierNameSnapshot,
|
|
Value<String?>? supplierEmailSnapshot,
|
|
Value<String?>? supplierPhoneNumberSnapshot,
|
|
Value<String>? userId,
|
|
Value<String>? adminNameSnapshot,
|
|
Value<String>? purchaseStatus,
|
|
Value<double>? totalPurchase,
|
|
Value<double>? discount,
|
|
Value<double>? tax,
|
|
Value<String>? paymentStatus,
|
|
Value<double>? totalAmount,
|
|
Value<double>? amountPaid,
|
|
Value<double>? changeAmount,
|
|
Value<double>? underPaymentAmount,
|
|
Value<double>? debtAmount,
|
|
Value<String?>? paymentProofPath,
|
|
Value<String?>? paymentProofUrl,
|
|
Value<String?>? notes,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return PurchasesCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
purchaseNumber: purchaseNumber ?? this.purchaseNumber,
|
|
outletId: outletId ?? this.outletId,
|
|
outletNameSnapshot: outletNameSnapshot ?? this.outletNameSnapshot,
|
|
supplierId: supplierId ?? this.supplierId,
|
|
supplierNameSnapshot: supplierNameSnapshot ?? this.supplierNameSnapshot,
|
|
supplierEmailSnapshot:
|
|
supplierEmailSnapshot ?? this.supplierEmailSnapshot,
|
|
supplierPhoneNumberSnapshot:
|
|
supplierPhoneNumberSnapshot ?? this.supplierPhoneNumberSnapshot,
|
|
userId: userId ?? this.userId,
|
|
adminNameSnapshot: adminNameSnapshot ?? this.adminNameSnapshot,
|
|
purchaseStatus: purchaseStatus ?? this.purchaseStatus,
|
|
totalPurchase: totalPurchase ?? this.totalPurchase,
|
|
discount: discount ?? this.discount,
|
|
tax: tax ?? this.tax,
|
|
paymentStatus: paymentStatus ?? this.paymentStatus,
|
|
totalAmount: totalAmount ?? this.totalAmount,
|
|
amountPaid: amountPaid ?? this.amountPaid,
|
|
changeAmount: changeAmount ?? this.changeAmount,
|
|
underPaymentAmount: underPaymentAmount ?? this.underPaymentAmount,
|
|
debtAmount: debtAmount ?? this.debtAmount,
|
|
paymentProofPath: paymentProofPath ?? this.paymentProofPath,
|
|
paymentProofUrl: paymentProofUrl ?? this.paymentProofUrl,
|
|
notes: notes ?? this.notes,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (purchaseNumber.present) {
|
|
map['purchase_number'] = Variable<String>(purchaseNumber.value);
|
|
}
|
|
if (outletId.present) {
|
|
map['outlet_id'] = Variable<String>(outletId.value);
|
|
}
|
|
if (outletNameSnapshot.present) {
|
|
map['outlet_name_snapshot'] = Variable<String>(outletNameSnapshot.value);
|
|
}
|
|
if (supplierId.present) {
|
|
map['supplier_id'] = Variable<String>(supplierId.value);
|
|
}
|
|
if (supplierNameSnapshot.present) {
|
|
map['supplier_name_snapshot'] = Variable<String>(
|
|
supplierNameSnapshot.value,
|
|
);
|
|
}
|
|
if (supplierEmailSnapshot.present) {
|
|
map['supplier_email_snapshot'] = Variable<String>(
|
|
supplierEmailSnapshot.value,
|
|
);
|
|
}
|
|
if (supplierPhoneNumberSnapshot.present) {
|
|
map['supplier_phone_number_snapshot'] = Variable<String>(
|
|
supplierPhoneNumberSnapshot.value,
|
|
);
|
|
}
|
|
if (userId.present) {
|
|
map['user_id'] = Variable<String>(userId.value);
|
|
}
|
|
if (adminNameSnapshot.present) {
|
|
map['admin_name_snapshot'] = Variable<String>(adminNameSnapshot.value);
|
|
}
|
|
if (purchaseStatus.present) {
|
|
map['purchase_status'] = Variable<String>(purchaseStatus.value);
|
|
}
|
|
if (totalPurchase.present) {
|
|
map['total_purchase'] = Variable<double>(totalPurchase.value);
|
|
}
|
|
if (discount.present) {
|
|
map['discount'] = Variable<double>(discount.value);
|
|
}
|
|
if (tax.present) {
|
|
map['tax'] = Variable<double>(tax.value);
|
|
}
|
|
if (paymentStatus.present) {
|
|
map['payment_status'] = Variable<String>(paymentStatus.value);
|
|
}
|
|
if (totalAmount.present) {
|
|
map['total_amount'] = Variable<double>(totalAmount.value);
|
|
}
|
|
if (amountPaid.present) {
|
|
map['amount_paid'] = Variable<double>(amountPaid.value);
|
|
}
|
|
if (changeAmount.present) {
|
|
map['change_amount'] = Variable<double>(changeAmount.value);
|
|
}
|
|
if (underPaymentAmount.present) {
|
|
map['under_payment_amount'] = Variable<double>(underPaymentAmount.value);
|
|
}
|
|
if (debtAmount.present) {
|
|
map['debt_amount'] = Variable<double>(debtAmount.value);
|
|
}
|
|
if (paymentProofPath.present) {
|
|
map['payment_proof_path'] = Variable<String>(paymentProofPath.value);
|
|
}
|
|
if (paymentProofUrl.present) {
|
|
map['payment_proof_url'] = Variable<String>(paymentProofUrl.value);
|
|
}
|
|
if (notes.present) {
|
|
map['notes'] = Variable<String>(notes.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('PurchasesCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('purchaseNumber: $purchaseNumber, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('outletNameSnapshot: $outletNameSnapshot, ')
|
|
..write('supplierId: $supplierId, ')
|
|
..write('supplierNameSnapshot: $supplierNameSnapshot, ')
|
|
..write('supplierEmailSnapshot: $supplierEmailSnapshot, ')
|
|
..write('supplierPhoneNumberSnapshot: $supplierPhoneNumberSnapshot, ')
|
|
..write('userId: $userId, ')
|
|
..write('adminNameSnapshot: $adminNameSnapshot, ')
|
|
..write('purchaseStatus: $purchaseStatus, ')
|
|
..write('totalPurchase: $totalPurchase, ')
|
|
..write('discount: $discount, ')
|
|
..write('tax: $tax, ')
|
|
..write('paymentStatus: $paymentStatus, ')
|
|
..write('totalAmount: $totalAmount, ')
|
|
..write('amountPaid: $amountPaid, ')
|
|
..write('changeAmount: $changeAmount, ')
|
|
..write('underPaymentAmount: $underPaymentAmount, ')
|
|
..write('debtAmount: $debtAmount, ')
|
|
..write('paymentProofPath: $paymentProofPath, ')
|
|
..write('paymentProofUrl: $paymentProofUrl, ')
|
|
..write('notes: $notes, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $PurchaseItemsTable extends PurchaseItems
|
|
with TableInfo<$PurchaseItemsTable, PurchaseItem> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$PurchaseItemsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _purchaseIdMeta = const VerificationMeta(
|
|
'purchaseId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> purchaseId = GeneratedColumn<String>(
|
|
'purchase_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES purchases (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _itemTypeMeta = const VerificationMeta(
|
|
'itemType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> itemType = GeneratedColumn<String>(
|
|
'item_type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _itemIdMeta = const VerificationMeta('itemId');
|
|
@override
|
|
late final GeneratedColumn<String> itemId = GeneratedColumn<String>(
|
|
'item_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _quantityMeta = const VerificationMeta(
|
|
'quantity',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> quantity = GeneratedColumn<double>(
|
|
'quantity',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _itemImageSnapshotMeta = const VerificationMeta(
|
|
'itemImageSnapshot',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> itemImageSnapshot =
|
|
GeneratedColumn<String>(
|
|
'item_image_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _itemImageUrlSnapshotMeta =
|
|
const VerificationMeta('itemImageUrlSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> itemImageUrlSnapshot =
|
|
GeneratedColumn<String>(
|
|
'item_image_url_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _itemNameSnapshotMeta = const VerificationMeta(
|
|
'itemNameSnapshot',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> itemNameSnapshot = GeneratedColumn<String>(
|
|
'item_name_snapshot',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _itemVariantNameSnapshotMeta =
|
|
const VerificationMeta('itemVariantNameSnapshot');
|
|
@override
|
|
late final GeneratedColumn<String> itemVariantNameSnapshot =
|
|
GeneratedColumn<String>(
|
|
'item_variant_name_snapshot',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _purchasePriceSnaphotMeta =
|
|
const VerificationMeta('purchasePriceSnaphot');
|
|
@override
|
|
late final GeneratedColumn<double> purchasePriceSnaphot =
|
|
GeneratedColumn<double>(
|
|
'purchase_price_snaphot',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _subtotalMeta = const VerificationMeta(
|
|
'subtotal',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> subtotal = GeneratedColumn<double>(
|
|
'subtotal',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
purchaseId,
|
|
itemType,
|
|
itemId,
|
|
quantity,
|
|
itemImageSnapshot,
|
|
itemImageUrlSnapshot,
|
|
itemNameSnapshot,
|
|
itemVariantNameSnapshot,
|
|
purchasePriceSnaphot,
|
|
subtotal,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'purchase_items';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<PurchaseItem> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('purchase_id')) {
|
|
context.handle(
|
|
_purchaseIdMeta,
|
|
purchaseId.isAcceptableOrUnknown(data['purchase_id']!, _purchaseIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_purchaseIdMeta);
|
|
}
|
|
if (data.containsKey('item_type')) {
|
|
context.handle(
|
|
_itemTypeMeta,
|
|
itemType.isAcceptableOrUnknown(data['item_type']!, _itemTypeMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_itemTypeMeta);
|
|
}
|
|
if (data.containsKey('item_id')) {
|
|
context.handle(
|
|
_itemIdMeta,
|
|
itemId.isAcceptableOrUnknown(data['item_id']!, _itemIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_itemIdMeta);
|
|
}
|
|
if (data.containsKey('quantity')) {
|
|
context.handle(
|
|
_quantityMeta,
|
|
quantity.isAcceptableOrUnknown(data['quantity']!, _quantityMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('item_image_snapshot')) {
|
|
context.handle(
|
|
_itemImageSnapshotMeta,
|
|
itemImageSnapshot.isAcceptableOrUnknown(
|
|
data['item_image_snapshot']!,
|
|
_itemImageSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('item_image_url_snapshot')) {
|
|
context.handle(
|
|
_itemImageUrlSnapshotMeta,
|
|
itemImageUrlSnapshot.isAcceptableOrUnknown(
|
|
data['item_image_url_snapshot']!,
|
|
_itemImageUrlSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('item_name_snapshot')) {
|
|
context.handle(
|
|
_itemNameSnapshotMeta,
|
|
itemNameSnapshot.isAcceptableOrUnknown(
|
|
data['item_name_snapshot']!,
|
|
_itemNameSnapshotMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_itemNameSnapshotMeta);
|
|
}
|
|
if (data.containsKey('item_variant_name_snapshot')) {
|
|
context.handle(
|
|
_itemVariantNameSnapshotMeta,
|
|
itemVariantNameSnapshot.isAcceptableOrUnknown(
|
|
data['item_variant_name_snapshot']!,
|
|
_itemVariantNameSnapshotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('purchase_price_snaphot')) {
|
|
context.handle(
|
|
_purchasePriceSnaphotMeta,
|
|
purchasePriceSnaphot.isAcceptableOrUnknown(
|
|
data['purchase_price_snaphot']!,
|
|
_purchasePriceSnaphotMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('subtotal')) {
|
|
context.handle(
|
|
_subtotalMeta,
|
|
subtotal.isAcceptableOrUnknown(data['subtotal']!, _subtotalMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
PurchaseItem map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return PurchaseItem(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
purchaseId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}purchase_id'],
|
|
)!,
|
|
itemType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}item_type'],
|
|
)!,
|
|
itemId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}item_id'],
|
|
)!,
|
|
quantity: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}quantity'],
|
|
)!,
|
|
itemImageSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}item_image_snapshot'],
|
|
),
|
|
itemImageUrlSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}item_image_url_snapshot'],
|
|
),
|
|
itemNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}item_name_snapshot'],
|
|
)!,
|
|
itemVariantNameSnapshot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}item_variant_name_snapshot'],
|
|
),
|
|
purchasePriceSnaphot: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}purchase_price_snaphot'],
|
|
)!,
|
|
subtotal: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}subtotal'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$PurchaseItemsTable createAlias(String alias) {
|
|
return $PurchaseItemsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class PurchaseItem extends DataClass implements Insertable<PurchaseItem> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String purchaseId;
|
|
final String itemType;
|
|
final String itemId;
|
|
final double quantity;
|
|
final String? itemImageSnapshot;
|
|
final String? itemImageUrlSnapshot;
|
|
final String itemNameSnapshot;
|
|
final String? itemVariantNameSnapshot;
|
|
final double purchasePriceSnaphot;
|
|
final double subtotal;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const PurchaseItem({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.purchaseId,
|
|
required this.itemType,
|
|
required this.itemId,
|
|
required this.quantity,
|
|
this.itemImageSnapshot,
|
|
this.itemImageUrlSnapshot,
|
|
required this.itemNameSnapshot,
|
|
this.itemVariantNameSnapshot,
|
|
required this.purchasePriceSnaphot,
|
|
required this.subtotal,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['purchase_id'] = Variable<String>(purchaseId);
|
|
map['item_type'] = Variable<String>(itemType);
|
|
map['item_id'] = Variable<String>(itemId);
|
|
map['quantity'] = Variable<double>(quantity);
|
|
if (!nullToAbsent || itemImageSnapshot != null) {
|
|
map['item_image_snapshot'] = Variable<String>(itemImageSnapshot);
|
|
}
|
|
if (!nullToAbsent || itemImageUrlSnapshot != null) {
|
|
map['item_image_url_snapshot'] = Variable<String>(itemImageUrlSnapshot);
|
|
}
|
|
map['item_name_snapshot'] = Variable<String>(itemNameSnapshot);
|
|
if (!nullToAbsent || itemVariantNameSnapshot != null) {
|
|
map['item_variant_name_snapshot'] = Variable<String>(
|
|
itemVariantNameSnapshot,
|
|
);
|
|
}
|
|
map['purchase_price_snaphot'] = Variable<double>(purchasePriceSnaphot);
|
|
map['subtotal'] = Variable<double>(subtotal);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
PurchaseItemsCompanion toCompanion(bool nullToAbsent) {
|
|
return PurchaseItemsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
purchaseId: Value(purchaseId),
|
|
itemType: Value(itemType),
|
|
itemId: Value(itemId),
|
|
quantity: Value(quantity),
|
|
itemImageSnapshot: itemImageSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(itemImageSnapshot),
|
|
itemImageUrlSnapshot: itemImageUrlSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(itemImageUrlSnapshot),
|
|
itemNameSnapshot: Value(itemNameSnapshot),
|
|
itemVariantNameSnapshot: itemVariantNameSnapshot == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(itemVariantNameSnapshot),
|
|
purchasePriceSnaphot: Value(purchasePriceSnaphot),
|
|
subtotal: Value(subtotal),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory PurchaseItem.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return PurchaseItem(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
purchaseId: serializer.fromJson<String>(json['purchaseId']),
|
|
itemType: serializer.fromJson<String>(json['itemType']),
|
|
itemId: serializer.fromJson<String>(json['itemId']),
|
|
quantity: serializer.fromJson<double>(json['quantity']),
|
|
itemImageSnapshot: serializer.fromJson<String?>(
|
|
json['itemImageSnapshot'],
|
|
),
|
|
itemImageUrlSnapshot: serializer.fromJson<String?>(
|
|
json['itemImageUrlSnapshot'],
|
|
),
|
|
itemNameSnapshot: serializer.fromJson<String>(json['itemNameSnapshot']),
|
|
itemVariantNameSnapshot: serializer.fromJson<String?>(
|
|
json['itemVariantNameSnapshot'],
|
|
),
|
|
purchasePriceSnaphot: serializer.fromJson<double>(
|
|
json['purchasePriceSnaphot'],
|
|
),
|
|
subtotal: serializer.fromJson<double>(json['subtotal']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'purchaseId': serializer.toJson<String>(purchaseId),
|
|
'itemType': serializer.toJson<String>(itemType),
|
|
'itemId': serializer.toJson<String>(itemId),
|
|
'quantity': serializer.toJson<double>(quantity),
|
|
'itemImageSnapshot': serializer.toJson<String?>(itemImageSnapshot),
|
|
'itemImageUrlSnapshot': serializer.toJson<String?>(itemImageUrlSnapshot),
|
|
'itemNameSnapshot': serializer.toJson<String>(itemNameSnapshot),
|
|
'itemVariantNameSnapshot': serializer.toJson<String?>(
|
|
itemVariantNameSnapshot,
|
|
),
|
|
'purchasePriceSnaphot': serializer.toJson<double>(purchasePriceSnaphot),
|
|
'subtotal': serializer.toJson<double>(subtotal),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
PurchaseItem copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? purchaseId,
|
|
String? itemType,
|
|
String? itemId,
|
|
double? quantity,
|
|
Value<String?> itemImageSnapshot = const Value.absent(),
|
|
Value<String?> itemImageUrlSnapshot = const Value.absent(),
|
|
String? itemNameSnapshot,
|
|
Value<String?> itemVariantNameSnapshot = const Value.absent(),
|
|
double? purchasePriceSnaphot,
|
|
double? subtotal,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => PurchaseItem(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
purchaseId: purchaseId ?? this.purchaseId,
|
|
itemType: itemType ?? this.itemType,
|
|
itemId: itemId ?? this.itemId,
|
|
quantity: quantity ?? this.quantity,
|
|
itemImageSnapshot: itemImageSnapshot.present
|
|
? itemImageSnapshot.value
|
|
: this.itemImageSnapshot,
|
|
itemImageUrlSnapshot: itemImageUrlSnapshot.present
|
|
? itemImageUrlSnapshot.value
|
|
: this.itemImageUrlSnapshot,
|
|
itemNameSnapshot: itemNameSnapshot ?? this.itemNameSnapshot,
|
|
itemVariantNameSnapshot: itemVariantNameSnapshot.present
|
|
? itemVariantNameSnapshot.value
|
|
: this.itemVariantNameSnapshot,
|
|
purchasePriceSnaphot: purchasePriceSnaphot ?? this.purchasePriceSnaphot,
|
|
subtotal: subtotal ?? this.subtotal,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
PurchaseItem copyWithCompanion(PurchaseItemsCompanion data) {
|
|
return PurchaseItem(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
purchaseId: data.purchaseId.present
|
|
? data.purchaseId.value
|
|
: this.purchaseId,
|
|
itemType: data.itemType.present ? data.itemType.value : this.itemType,
|
|
itemId: data.itemId.present ? data.itemId.value : this.itemId,
|
|
quantity: data.quantity.present ? data.quantity.value : this.quantity,
|
|
itemImageSnapshot: data.itemImageSnapshot.present
|
|
? data.itemImageSnapshot.value
|
|
: this.itemImageSnapshot,
|
|
itemImageUrlSnapshot: data.itemImageUrlSnapshot.present
|
|
? data.itemImageUrlSnapshot.value
|
|
: this.itemImageUrlSnapshot,
|
|
itemNameSnapshot: data.itemNameSnapshot.present
|
|
? data.itemNameSnapshot.value
|
|
: this.itemNameSnapshot,
|
|
itemVariantNameSnapshot: data.itemVariantNameSnapshot.present
|
|
? data.itemVariantNameSnapshot.value
|
|
: this.itemVariantNameSnapshot,
|
|
purchasePriceSnaphot: data.purchasePriceSnaphot.present
|
|
? data.purchasePriceSnaphot.value
|
|
: this.purchasePriceSnaphot,
|
|
subtotal: data.subtotal.present ? data.subtotal.value : this.subtotal,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('PurchaseItem(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('purchaseId: $purchaseId, ')
|
|
..write('itemType: $itemType, ')
|
|
..write('itemId: $itemId, ')
|
|
..write('quantity: $quantity, ')
|
|
..write('itemImageSnapshot: $itemImageSnapshot, ')
|
|
..write('itemImageUrlSnapshot: $itemImageUrlSnapshot, ')
|
|
..write('itemNameSnapshot: $itemNameSnapshot, ')
|
|
..write('itemVariantNameSnapshot: $itemVariantNameSnapshot, ')
|
|
..write('purchasePriceSnaphot: $purchasePriceSnaphot, ')
|
|
..write('subtotal: $subtotal, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
purchaseId,
|
|
itemType,
|
|
itemId,
|
|
quantity,
|
|
itemImageSnapshot,
|
|
itemImageUrlSnapshot,
|
|
itemNameSnapshot,
|
|
itemVariantNameSnapshot,
|
|
purchasePriceSnaphot,
|
|
subtotal,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is PurchaseItem &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.purchaseId == this.purchaseId &&
|
|
other.itemType == this.itemType &&
|
|
other.itemId == this.itemId &&
|
|
other.quantity == this.quantity &&
|
|
other.itemImageSnapshot == this.itemImageSnapshot &&
|
|
other.itemImageUrlSnapshot == this.itemImageUrlSnapshot &&
|
|
other.itemNameSnapshot == this.itemNameSnapshot &&
|
|
other.itemVariantNameSnapshot == this.itemVariantNameSnapshot &&
|
|
other.purchasePriceSnaphot == this.purchasePriceSnaphot &&
|
|
other.subtotal == this.subtotal &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class PurchaseItemsCompanion extends UpdateCompanion<PurchaseItem> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> purchaseId;
|
|
final Value<String> itemType;
|
|
final Value<String> itemId;
|
|
final Value<double> quantity;
|
|
final Value<String?> itemImageSnapshot;
|
|
final Value<String?> itemImageUrlSnapshot;
|
|
final Value<String> itemNameSnapshot;
|
|
final Value<String?> itemVariantNameSnapshot;
|
|
final Value<double> purchasePriceSnaphot;
|
|
final Value<double> subtotal;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const PurchaseItemsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.purchaseId = const Value.absent(),
|
|
this.itemType = const Value.absent(),
|
|
this.itemId = const Value.absent(),
|
|
this.quantity = const Value.absent(),
|
|
this.itemImageSnapshot = const Value.absent(),
|
|
this.itemImageUrlSnapshot = const Value.absent(),
|
|
this.itemNameSnapshot = const Value.absent(),
|
|
this.itemVariantNameSnapshot = const Value.absent(),
|
|
this.purchasePriceSnaphot = const Value.absent(),
|
|
this.subtotal = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
PurchaseItemsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String purchaseId,
|
|
required String itemType,
|
|
required String itemId,
|
|
this.quantity = const Value.absent(),
|
|
this.itemImageSnapshot = const Value.absent(),
|
|
this.itemImageUrlSnapshot = const Value.absent(),
|
|
required String itemNameSnapshot,
|
|
this.itemVariantNameSnapshot = const Value.absent(),
|
|
this.purchasePriceSnaphot = const Value.absent(),
|
|
this.subtotal = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : purchaseId = Value(purchaseId),
|
|
itemType = Value(itemType),
|
|
itemId = Value(itemId),
|
|
itemNameSnapshot = Value(itemNameSnapshot);
|
|
static Insertable<PurchaseItem> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? purchaseId,
|
|
Expression<String>? itemType,
|
|
Expression<String>? itemId,
|
|
Expression<double>? quantity,
|
|
Expression<String>? itemImageSnapshot,
|
|
Expression<String>? itemImageUrlSnapshot,
|
|
Expression<String>? itemNameSnapshot,
|
|
Expression<String>? itemVariantNameSnapshot,
|
|
Expression<double>? purchasePriceSnaphot,
|
|
Expression<double>? subtotal,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (purchaseId != null) 'purchase_id': purchaseId,
|
|
if (itemType != null) 'item_type': itemType,
|
|
if (itemId != null) 'item_id': itemId,
|
|
if (quantity != null) 'quantity': quantity,
|
|
if (itemImageSnapshot != null) 'item_image_snapshot': itemImageSnapshot,
|
|
if (itemImageUrlSnapshot != null)
|
|
'item_image_url_snapshot': itemImageUrlSnapshot,
|
|
if (itemNameSnapshot != null) 'item_name_snapshot': itemNameSnapshot,
|
|
if (itemVariantNameSnapshot != null)
|
|
'item_variant_name_snapshot': itemVariantNameSnapshot,
|
|
if (purchasePriceSnaphot != null)
|
|
'purchase_price_snaphot': purchasePriceSnaphot,
|
|
if (subtotal != null) 'subtotal': subtotal,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
PurchaseItemsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? purchaseId,
|
|
Value<String>? itemType,
|
|
Value<String>? itemId,
|
|
Value<double>? quantity,
|
|
Value<String?>? itemImageSnapshot,
|
|
Value<String?>? itemImageUrlSnapshot,
|
|
Value<String>? itemNameSnapshot,
|
|
Value<String?>? itemVariantNameSnapshot,
|
|
Value<double>? purchasePriceSnaphot,
|
|
Value<double>? subtotal,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return PurchaseItemsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
purchaseId: purchaseId ?? this.purchaseId,
|
|
itemType: itemType ?? this.itemType,
|
|
itemId: itemId ?? this.itemId,
|
|
quantity: quantity ?? this.quantity,
|
|
itemImageSnapshot: itemImageSnapshot ?? this.itemImageSnapshot,
|
|
itemImageUrlSnapshot: itemImageUrlSnapshot ?? this.itemImageUrlSnapshot,
|
|
itemNameSnapshot: itemNameSnapshot ?? this.itemNameSnapshot,
|
|
itemVariantNameSnapshot:
|
|
itemVariantNameSnapshot ?? this.itemVariantNameSnapshot,
|
|
purchasePriceSnaphot: purchasePriceSnaphot ?? this.purchasePriceSnaphot,
|
|
subtotal: subtotal ?? this.subtotal,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (purchaseId.present) {
|
|
map['purchase_id'] = Variable<String>(purchaseId.value);
|
|
}
|
|
if (itemType.present) {
|
|
map['item_type'] = Variable<String>(itemType.value);
|
|
}
|
|
if (itemId.present) {
|
|
map['item_id'] = Variable<String>(itemId.value);
|
|
}
|
|
if (quantity.present) {
|
|
map['quantity'] = Variable<double>(quantity.value);
|
|
}
|
|
if (itemImageSnapshot.present) {
|
|
map['item_image_snapshot'] = Variable<String>(itemImageSnapshot.value);
|
|
}
|
|
if (itemImageUrlSnapshot.present) {
|
|
map['item_image_url_snapshot'] = Variable<String>(
|
|
itemImageUrlSnapshot.value,
|
|
);
|
|
}
|
|
if (itemNameSnapshot.present) {
|
|
map['item_name_snapshot'] = Variable<String>(itemNameSnapshot.value);
|
|
}
|
|
if (itemVariantNameSnapshot.present) {
|
|
map['item_variant_name_snapshot'] = Variable<String>(
|
|
itemVariantNameSnapshot.value,
|
|
);
|
|
}
|
|
if (purchasePriceSnaphot.present) {
|
|
map['purchase_price_snaphot'] = Variable<double>(
|
|
purchasePriceSnaphot.value,
|
|
);
|
|
}
|
|
if (subtotal.present) {
|
|
map['subtotal'] = Variable<double>(subtotal.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('PurchaseItemsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('purchaseId: $purchaseId, ')
|
|
..write('itemType: $itemType, ')
|
|
..write('itemId: $itemId, ')
|
|
..write('quantity: $quantity, ')
|
|
..write('itemImageSnapshot: $itemImageSnapshot, ')
|
|
..write('itemImageUrlSnapshot: $itemImageUrlSnapshot, ')
|
|
..write('itemNameSnapshot: $itemNameSnapshot, ')
|
|
..write('itemVariantNameSnapshot: $itemVariantNameSnapshot, ')
|
|
..write('purchasePriceSnaphot: $purchasePriceSnaphot, ')
|
|
..write('subtotal: $subtotal, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $TransactionsTable extends Transactions
|
|
with TableInfo<$TransactionsTable, Transaction> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$TransactionsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _outletIdMeta = const VerificationMeta(
|
|
'outletId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> outletId = GeneratedColumn<String>(
|
|
'outlet_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES outlets (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
|
|
@override
|
|
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
|
|
'user_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES users (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _referenceTypeMeta = const VerificationMeta(
|
|
'referenceType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> referenceType = GeneratedColumn<String>(
|
|
'reference_type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _referenceIdMeta = const VerificationMeta(
|
|
'referenceId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> referenceId = GeneratedColumn<String>(
|
|
'reference_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _referenceNumberMeta = const VerificationMeta(
|
|
'referenceNumber',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> referenceNumber = GeneratedColumn<String>(
|
|
'reference_number',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _stakeholderMeta = const VerificationMeta(
|
|
'stakeholder',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> stakeholder = GeneratedColumn<String>(
|
|
'stakeholder',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _transactionTypeMeta = const VerificationMeta(
|
|
'transactionType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> transactionType = GeneratedColumn<String>(
|
|
'transaction_type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _categoryMeta = const VerificationMeta(
|
|
'category',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> category = GeneratedColumn<String>(
|
|
'category',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _amountMeta = const VerificationMeta('amount');
|
|
@override
|
|
late final GeneratedColumn<double> amount = GeneratedColumn<double>(
|
|
'amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _noteMeta = const VerificationMeta('note');
|
|
@override
|
|
late final GeneratedColumn<String> note = GeneratedColumn<String>(
|
|
'note',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
outletId,
|
|
userId,
|
|
referenceType,
|
|
referenceId,
|
|
referenceNumber,
|
|
stakeholder,
|
|
transactionType,
|
|
category,
|
|
amount,
|
|
note,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'transactions';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Transaction> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('outlet_id')) {
|
|
context.handle(
|
|
_outletIdMeta,
|
|
outletId.isAcceptableOrUnknown(data['outlet_id']!, _outletIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_outletIdMeta);
|
|
}
|
|
if (data.containsKey('user_id')) {
|
|
context.handle(
|
|
_userIdMeta,
|
|
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_userIdMeta);
|
|
}
|
|
if (data.containsKey('reference_type')) {
|
|
context.handle(
|
|
_referenceTypeMeta,
|
|
referenceType.isAcceptableOrUnknown(
|
|
data['reference_type']!,
|
|
_referenceTypeMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_referenceTypeMeta);
|
|
}
|
|
if (data.containsKey('reference_id')) {
|
|
context.handle(
|
|
_referenceIdMeta,
|
|
referenceId.isAcceptableOrUnknown(
|
|
data['reference_id']!,
|
|
_referenceIdMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_referenceIdMeta);
|
|
}
|
|
if (data.containsKey('reference_number')) {
|
|
context.handle(
|
|
_referenceNumberMeta,
|
|
referenceNumber.isAcceptableOrUnknown(
|
|
data['reference_number']!,
|
|
_referenceNumberMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_referenceNumberMeta);
|
|
}
|
|
if (data.containsKey('stakeholder')) {
|
|
context.handle(
|
|
_stakeholderMeta,
|
|
stakeholder.isAcceptableOrUnknown(
|
|
data['stakeholder']!,
|
|
_stakeholderMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('transaction_type')) {
|
|
context.handle(
|
|
_transactionTypeMeta,
|
|
transactionType.isAcceptableOrUnknown(
|
|
data['transaction_type']!,
|
|
_transactionTypeMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_transactionTypeMeta);
|
|
}
|
|
if (data.containsKey('category')) {
|
|
context.handle(
|
|
_categoryMeta,
|
|
category.isAcceptableOrUnknown(data['category']!, _categoryMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_categoryMeta);
|
|
}
|
|
if (data.containsKey('amount')) {
|
|
context.handle(
|
|
_amountMeta,
|
|
amount.isAcceptableOrUnknown(data['amount']!, _amountMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('note')) {
|
|
context.handle(
|
|
_noteMeta,
|
|
note.isAcceptableOrUnknown(data['note']!, _noteMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Transaction map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Transaction(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
outletId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_id'],
|
|
)!,
|
|
userId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}user_id'],
|
|
)!,
|
|
referenceType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}reference_type'],
|
|
)!,
|
|
referenceId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}reference_id'],
|
|
)!,
|
|
referenceNumber: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}reference_number'],
|
|
)!,
|
|
stakeholder: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}stakeholder'],
|
|
),
|
|
transactionType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}transaction_type'],
|
|
)!,
|
|
category: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}category'],
|
|
)!,
|
|
amount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}amount'],
|
|
)!,
|
|
note: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}note'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$TransactionsTable createAlias(String alias) {
|
|
return $TransactionsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Transaction extends DataClass implements Insertable<Transaction> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String outletId;
|
|
final String userId;
|
|
final String referenceType;
|
|
final String referenceId;
|
|
final String referenceNumber;
|
|
final String? stakeholder;
|
|
final String transactionType;
|
|
final String category;
|
|
final double amount;
|
|
final String? note;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
const Transaction({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.outletId,
|
|
required this.userId,
|
|
required this.referenceType,
|
|
required this.referenceId,
|
|
required this.referenceNumber,
|
|
this.stakeholder,
|
|
required this.transactionType,
|
|
required this.category,
|
|
required this.amount,
|
|
this.note,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['outlet_id'] = Variable<String>(outletId);
|
|
map['user_id'] = Variable<String>(userId);
|
|
map['reference_type'] = Variable<String>(referenceType);
|
|
map['reference_id'] = Variable<String>(referenceId);
|
|
map['reference_number'] = Variable<String>(referenceNumber);
|
|
if (!nullToAbsent || stakeholder != null) {
|
|
map['stakeholder'] = Variable<String>(stakeholder);
|
|
}
|
|
map['transaction_type'] = Variable<String>(transactionType);
|
|
map['category'] = Variable<String>(category);
|
|
map['amount'] = Variable<double>(amount);
|
|
if (!nullToAbsent || note != null) {
|
|
map['note'] = Variable<String>(note);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
TransactionsCompanion toCompanion(bool nullToAbsent) {
|
|
return TransactionsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
outletId: Value(outletId),
|
|
userId: Value(userId),
|
|
referenceType: Value(referenceType),
|
|
referenceId: Value(referenceId),
|
|
referenceNumber: Value(referenceNumber),
|
|
stakeholder: stakeholder == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(stakeholder),
|
|
transactionType: Value(transactionType),
|
|
category: Value(category),
|
|
amount: Value(amount),
|
|
note: note == null && nullToAbsent ? const Value.absent() : Value(note),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory Transaction.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Transaction(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
outletId: serializer.fromJson<String>(json['outletId']),
|
|
userId: serializer.fromJson<String>(json['userId']),
|
|
referenceType: serializer.fromJson<String>(json['referenceType']),
|
|
referenceId: serializer.fromJson<String>(json['referenceId']),
|
|
referenceNumber: serializer.fromJson<String>(json['referenceNumber']),
|
|
stakeholder: serializer.fromJson<String?>(json['stakeholder']),
|
|
transactionType: serializer.fromJson<String>(json['transactionType']),
|
|
category: serializer.fromJson<String>(json['category']),
|
|
amount: serializer.fromJson<double>(json['amount']),
|
|
note: serializer.fromJson<String?>(json['note']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'outletId': serializer.toJson<String>(outletId),
|
|
'userId': serializer.toJson<String>(userId),
|
|
'referenceType': serializer.toJson<String>(referenceType),
|
|
'referenceId': serializer.toJson<String>(referenceId),
|
|
'referenceNumber': serializer.toJson<String>(referenceNumber),
|
|
'stakeholder': serializer.toJson<String?>(stakeholder),
|
|
'transactionType': serializer.toJson<String>(transactionType),
|
|
'category': serializer.toJson<String>(category),
|
|
'amount': serializer.toJson<double>(amount),
|
|
'note': serializer.toJson<String?>(note),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
Transaction copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? outletId,
|
|
String? userId,
|
|
String? referenceType,
|
|
String? referenceId,
|
|
String? referenceNumber,
|
|
Value<String?> stakeholder = const Value.absent(),
|
|
String? transactionType,
|
|
String? category,
|
|
double? amount,
|
|
Value<String?> note = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
}) => Transaction(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
outletId: outletId ?? this.outletId,
|
|
userId: userId ?? this.userId,
|
|
referenceType: referenceType ?? this.referenceType,
|
|
referenceId: referenceId ?? this.referenceId,
|
|
referenceNumber: referenceNumber ?? this.referenceNumber,
|
|
stakeholder: stakeholder.present ? stakeholder.value : this.stakeholder,
|
|
transactionType: transactionType ?? this.transactionType,
|
|
category: category ?? this.category,
|
|
amount: amount ?? this.amount,
|
|
note: note.present ? note.value : this.note,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
Transaction copyWithCompanion(TransactionsCompanion data) {
|
|
return Transaction(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
outletId: data.outletId.present ? data.outletId.value : this.outletId,
|
|
userId: data.userId.present ? data.userId.value : this.userId,
|
|
referenceType: data.referenceType.present
|
|
? data.referenceType.value
|
|
: this.referenceType,
|
|
referenceId: data.referenceId.present
|
|
? data.referenceId.value
|
|
: this.referenceId,
|
|
referenceNumber: data.referenceNumber.present
|
|
? data.referenceNumber.value
|
|
: this.referenceNumber,
|
|
stakeholder: data.stakeholder.present
|
|
? data.stakeholder.value
|
|
: this.stakeholder,
|
|
transactionType: data.transactionType.present
|
|
? data.transactionType.value
|
|
: this.transactionType,
|
|
category: data.category.present ? data.category.value : this.category,
|
|
amount: data.amount.present ? data.amount.value : this.amount,
|
|
note: data.note.present ? data.note.value : this.note,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Transaction(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('userId: $userId, ')
|
|
..write('referenceType: $referenceType, ')
|
|
..write('referenceId: $referenceId, ')
|
|
..write('referenceNumber: $referenceNumber, ')
|
|
..write('stakeholder: $stakeholder, ')
|
|
..write('transactionType: $transactionType, ')
|
|
..write('category: $category, ')
|
|
..write('amount: $amount, ')
|
|
..write('note: $note, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
outletId,
|
|
userId,
|
|
referenceType,
|
|
referenceId,
|
|
referenceNumber,
|
|
stakeholder,
|
|
transactionType,
|
|
category,
|
|
amount,
|
|
note,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Transaction &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.outletId == this.outletId &&
|
|
other.userId == this.userId &&
|
|
other.referenceType == this.referenceType &&
|
|
other.referenceId == this.referenceId &&
|
|
other.referenceNumber == this.referenceNumber &&
|
|
other.stakeholder == this.stakeholder &&
|
|
other.transactionType == this.transactionType &&
|
|
other.category == this.category &&
|
|
other.amount == this.amount &&
|
|
other.note == this.note &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class TransactionsCompanion extends UpdateCompanion<Transaction> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> outletId;
|
|
final Value<String> userId;
|
|
final Value<String> referenceType;
|
|
final Value<String> referenceId;
|
|
final Value<String> referenceNumber;
|
|
final Value<String?> stakeholder;
|
|
final Value<String> transactionType;
|
|
final Value<String> category;
|
|
final Value<double> amount;
|
|
final Value<String?> note;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<int> rowid;
|
|
const TransactionsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.outletId = const Value.absent(),
|
|
this.userId = const Value.absent(),
|
|
this.referenceType = const Value.absent(),
|
|
this.referenceId = const Value.absent(),
|
|
this.referenceNumber = const Value.absent(),
|
|
this.stakeholder = const Value.absent(),
|
|
this.transactionType = const Value.absent(),
|
|
this.category = const Value.absent(),
|
|
this.amount = const Value.absent(),
|
|
this.note = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
TransactionsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String outletId,
|
|
required String userId,
|
|
required String referenceType,
|
|
required String referenceId,
|
|
required String referenceNumber,
|
|
this.stakeholder = const Value.absent(),
|
|
required String transactionType,
|
|
required String category,
|
|
this.amount = const Value.absent(),
|
|
this.note = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : outletId = Value(outletId),
|
|
userId = Value(userId),
|
|
referenceType = Value(referenceType),
|
|
referenceId = Value(referenceId),
|
|
referenceNumber = Value(referenceNumber),
|
|
transactionType = Value(transactionType),
|
|
category = Value(category);
|
|
static Insertable<Transaction> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? outletId,
|
|
Expression<String>? userId,
|
|
Expression<String>? referenceType,
|
|
Expression<String>? referenceId,
|
|
Expression<String>? referenceNumber,
|
|
Expression<String>? stakeholder,
|
|
Expression<String>? transactionType,
|
|
Expression<String>? category,
|
|
Expression<double>? amount,
|
|
Expression<String>? note,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (outletId != null) 'outlet_id': outletId,
|
|
if (userId != null) 'user_id': userId,
|
|
if (referenceType != null) 'reference_type': referenceType,
|
|
if (referenceId != null) 'reference_id': referenceId,
|
|
if (referenceNumber != null) 'reference_number': referenceNumber,
|
|
if (stakeholder != null) 'stakeholder': stakeholder,
|
|
if (transactionType != null) 'transaction_type': transactionType,
|
|
if (category != null) 'category': category,
|
|
if (amount != null) 'amount': amount,
|
|
if (note != null) 'note': note,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
TransactionsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? outletId,
|
|
Value<String>? userId,
|
|
Value<String>? referenceType,
|
|
Value<String>? referenceId,
|
|
Value<String>? referenceNumber,
|
|
Value<String?>? stakeholder,
|
|
Value<String>? transactionType,
|
|
Value<String>? category,
|
|
Value<double>? amount,
|
|
Value<String?>? note,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return TransactionsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
outletId: outletId ?? this.outletId,
|
|
userId: userId ?? this.userId,
|
|
referenceType: referenceType ?? this.referenceType,
|
|
referenceId: referenceId ?? this.referenceId,
|
|
referenceNumber: referenceNumber ?? this.referenceNumber,
|
|
stakeholder: stakeholder ?? this.stakeholder,
|
|
transactionType: transactionType ?? this.transactionType,
|
|
category: category ?? this.category,
|
|
amount: amount ?? this.amount,
|
|
note: note ?? this.note,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (outletId.present) {
|
|
map['outlet_id'] = Variable<String>(outletId.value);
|
|
}
|
|
if (userId.present) {
|
|
map['user_id'] = Variable<String>(userId.value);
|
|
}
|
|
if (referenceType.present) {
|
|
map['reference_type'] = Variable<String>(referenceType.value);
|
|
}
|
|
if (referenceId.present) {
|
|
map['reference_id'] = Variable<String>(referenceId.value);
|
|
}
|
|
if (referenceNumber.present) {
|
|
map['reference_number'] = Variable<String>(referenceNumber.value);
|
|
}
|
|
if (stakeholder.present) {
|
|
map['stakeholder'] = Variable<String>(stakeholder.value);
|
|
}
|
|
if (transactionType.present) {
|
|
map['transaction_type'] = Variable<String>(transactionType.value);
|
|
}
|
|
if (category.present) {
|
|
map['category'] = Variable<String>(category.value);
|
|
}
|
|
if (amount.present) {
|
|
map['amount'] = Variable<double>(amount.value);
|
|
}
|
|
if (note.present) {
|
|
map['note'] = Variable<String>(note.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('TransactionsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('userId: $userId, ')
|
|
..write('referenceType: $referenceType, ')
|
|
..write('referenceId: $referenceId, ')
|
|
..write('referenceNumber: $referenceNumber, ')
|
|
..write('stakeholder: $stakeholder, ')
|
|
..write('transactionType: $transactionType, ')
|
|
..write('category: $category, ')
|
|
..write('amount: $amount, ')
|
|
..write('note: $note, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $CampaignsTable extends Campaigns
|
|
with TableInfo<$CampaignsTable, Campaign> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$CampaignsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _titleMeta = const VerificationMeta('title');
|
|
@override
|
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
|
'title',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _localBannerPathMeta = const VerificationMeta(
|
|
'localBannerPath',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localBannerPath = GeneratedColumn<String>(
|
|
'local_banner_path',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _serverBannerUrlMeta = const VerificationMeta(
|
|
'serverBannerUrl',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverBannerUrl = GeneratedColumn<String>(
|
|
'server_banner_url',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _startDateMeta = const VerificationMeta(
|
|
'startDate',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> startDate = GeneratedColumn<DateTime>(
|
|
'start_date',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _endDateMeta = const VerificationMeta(
|
|
'endDate',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> endDate = GeneratedColumn<DateTime>(
|
|
'end_date',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _actionTypeMeta = const VerificationMeta(
|
|
'actionType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> actionType = GeneratedColumn<String>(
|
|
'action_type',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _actionReferenceIdMeta = const VerificationMeta(
|
|
'actionReferenceId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> actionReferenceId =
|
|
GeneratedColumn<String>(
|
|
'action_reference_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _isActiveMeta = const VerificationMeta(
|
|
'isActive',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isActive = GeneratedColumn<bool>(
|
|
'is_active',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_active" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(true),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
title,
|
|
localBannerPath,
|
|
serverBannerUrl,
|
|
startDate,
|
|
endDate,
|
|
actionType,
|
|
actionReferenceId,
|
|
isActive,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'campaigns';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Campaign> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('title')) {
|
|
context.handle(
|
|
_titleMeta,
|
|
title.isAcceptableOrUnknown(data['title']!, _titleMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_titleMeta);
|
|
}
|
|
if (data.containsKey('local_banner_path')) {
|
|
context.handle(
|
|
_localBannerPathMeta,
|
|
localBannerPath.isAcceptableOrUnknown(
|
|
data['local_banner_path']!,
|
|
_localBannerPathMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_localBannerPathMeta);
|
|
}
|
|
if (data.containsKey('server_banner_url')) {
|
|
context.handle(
|
|
_serverBannerUrlMeta,
|
|
serverBannerUrl.isAcceptableOrUnknown(
|
|
data['server_banner_url']!,
|
|
_serverBannerUrlMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('start_date')) {
|
|
context.handle(
|
|
_startDateMeta,
|
|
startDate.isAcceptableOrUnknown(data['start_date']!, _startDateMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('end_date')) {
|
|
context.handle(
|
|
_endDateMeta,
|
|
endDate.isAcceptableOrUnknown(data['end_date']!, _endDateMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('action_type')) {
|
|
context.handle(
|
|
_actionTypeMeta,
|
|
actionType.isAcceptableOrUnknown(data['action_type']!, _actionTypeMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('action_reference_id')) {
|
|
context.handle(
|
|
_actionReferenceIdMeta,
|
|
actionReferenceId.isAcceptableOrUnknown(
|
|
data['action_reference_id']!,
|
|
_actionReferenceIdMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('is_active')) {
|
|
context.handle(
|
|
_isActiveMeta,
|
|
isActive.isAcceptableOrUnknown(data['is_active']!, _isActiveMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
Campaign map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Campaign(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
title: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}title'],
|
|
)!,
|
|
localBannerPath: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_banner_path'],
|
|
)!,
|
|
serverBannerUrl: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_banner_url'],
|
|
),
|
|
startDate: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}start_date'],
|
|
),
|
|
endDate: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}end_date'],
|
|
),
|
|
actionType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}action_type'],
|
|
),
|
|
actionReferenceId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}action_reference_id'],
|
|
),
|
|
isActive: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_active'],
|
|
)!,
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$CampaignsTable createAlias(String alias) {
|
|
return $CampaignsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Campaign extends DataClass implements Insertable<Campaign> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String title;
|
|
final String localBannerPath;
|
|
final String? serverBannerUrl;
|
|
final DateTime? startDate;
|
|
final DateTime? endDate;
|
|
final String? actionType;
|
|
final String? actionReferenceId;
|
|
final bool isActive;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const Campaign({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.title,
|
|
required this.localBannerPath,
|
|
this.serverBannerUrl,
|
|
this.startDate,
|
|
this.endDate,
|
|
this.actionType,
|
|
this.actionReferenceId,
|
|
required this.isActive,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['title'] = Variable<String>(title);
|
|
map['local_banner_path'] = Variable<String>(localBannerPath);
|
|
if (!nullToAbsent || serverBannerUrl != null) {
|
|
map['server_banner_url'] = Variable<String>(serverBannerUrl);
|
|
}
|
|
if (!nullToAbsent || startDate != null) {
|
|
map['start_date'] = Variable<DateTime>(startDate);
|
|
}
|
|
if (!nullToAbsent || endDate != null) {
|
|
map['end_date'] = Variable<DateTime>(endDate);
|
|
}
|
|
if (!nullToAbsent || actionType != null) {
|
|
map['action_type'] = Variable<String>(actionType);
|
|
}
|
|
if (!nullToAbsent || actionReferenceId != null) {
|
|
map['action_reference_id'] = Variable<String>(actionReferenceId);
|
|
}
|
|
map['is_active'] = Variable<bool>(isActive);
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
CampaignsCompanion toCompanion(bool nullToAbsent) {
|
|
return CampaignsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
title: Value(title),
|
|
localBannerPath: Value(localBannerPath),
|
|
serverBannerUrl: serverBannerUrl == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverBannerUrl),
|
|
startDate: startDate == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(startDate),
|
|
endDate: endDate == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(endDate),
|
|
actionType: actionType == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(actionType),
|
|
actionReferenceId: actionReferenceId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(actionReferenceId),
|
|
isActive: Value(isActive),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory Campaign.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Campaign(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
title: serializer.fromJson<String>(json['title']),
|
|
localBannerPath: serializer.fromJson<String>(json['localBannerPath']),
|
|
serverBannerUrl: serializer.fromJson<String?>(json['serverBannerUrl']),
|
|
startDate: serializer.fromJson<DateTime?>(json['startDate']),
|
|
endDate: serializer.fromJson<DateTime?>(json['endDate']),
|
|
actionType: serializer.fromJson<String?>(json['actionType']),
|
|
actionReferenceId: serializer.fromJson<String?>(
|
|
json['actionReferenceId'],
|
|
),
|
|
isActive: serializer.fromJson<bool>(json['isActive']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'title': serializer.toJson<String>(title),
|
|
'localBannerPath': serializer.toJson<String>(localBannerPath),
|
|
'serverBannerUrl': serializer.toJson<String?>(serverBannerUrl),
|
|
'startDate': serializer.toJson<DateTime?>(startDate),
|
|
'endDate': serializer.toJson<DateTime?>(endDate),
|
|
'actionType': serializer.toJson<String?>(actionType),
|
|
'actionReferenceId': serializer.toJson<String?>(actionReferenceId),
|
|
'isActive': serializer.toJson<bool>(isActive),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
Campaign copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? title,
|
|
String? localBannerPath,
|
|
Value<String?> serverBannerUrl = const Value.absent(),
|
|
Value<DateTime?> startDate = const Value.absent(),
|
|
Value<DateTime?> endDate = const Value.absent(),
|
|
Value<String?> actionType = const Value.absent(),
|
|
Value<String?> actionReferenceId = const Value.absent(),
|
|
bool? isActive,
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => Campaign(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
title: title ?? this.title,
|
|
localBannerPath: localBannerPath ?? this.localBannerPath,
|
|
serverBannerUrl: serverBannerUrl.present
|
|
? serverBannerUrl.value
|
|
: this.serverBannerUrl,
|
|
startDate: startDate.present ? startDate.value : this.startDate,
|
|
endDate: endDate.present ? endDate.value : this.endDate,
|
|
actionType: actionType.present ? actionType.value : this.actionType,
|
|
actionReferenceId: actionReferenceId.present
|
|
? actionReferenceId.value
|
|
: this.actionReferenceId,
|
|
isActive: isActive ?? this.isActive,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
Campaign copyWithCompanion(CampaignsCompanion data) {
|
|
return Campaign(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
title: data.title.present ? data.title.value : this.title,
|
|
localBannerPath: data.localBannerPath.present
|
|
? data.localBannerPath.value
|
|
: this.localBannerPath,
|
|
serverBannerUrl: data.serverBannerUrl.present
|
|
? data.serverBannerUrl.value
|
|
: this.serverBannerUrl,
|
|
startDate: data.startDate.present ? data.startDate.value : this.startDate,
|
|
endDate: data.endDate.present ? data.endDate.value : this.endDate,
|
|
actionType: data.actionType.present
|
|
? data.actionType.value
|
|
: this.actionType,
|
|
actionReferenceId: data.actionReferenceId.present
|
|
? data.actionReferenceId.value
|
|
: this.actionReferenceId,
|
|
isActive: data.isActive.present ? data.isActive.value : this.isActive,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Campaign(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('title: $title, ')
|
|
..write('localBannerPath: $localBannerPath, ')
|
|
..write('serverBannerUrl: $serverBannerUrl, ')
|
|
..write('startDate: $startDate, ')
|
|
..write('endDate: $endDate, ')
|
|
..write('actionType: $actionType, ')
|
|
..write('actionReferenceId: $actionReferenceId, ')
|
|
..write('isActive: $isActive, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
title,
|
|
localBannerPath,
|
|
serverBannerUrl,
|
|
startDate,
|
|
endDate,
|
|
actionType,
|
|
actionReferenceId,
|
|
isActive,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Campaign &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.title == this.title &&
|
|
other.localBannerPath == this.localBannerPath &&
|
|
other.serverBannerUrl == this.serverBannerUrl &&
|
|
other.startDate == this.startDate &&
|
|
other.endDate == this.endDate &&
|
|
other.actionType == this.actionType &&
|
|
other.actionReferenceId == this.actionReferenceId &&
|
|
other.isActive == this.isActive &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class CampaignsCompanion extends UpdateCompanion<Campaign> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> title;
|
|
final Value<String> localBannerPath;
|
|
final Value<String?> serverBannerUrl;
|
|
final Value<DateTime?> startDate;
|
|
final Value<DateTime?> endDate;
|
|
final Value<String?> actionType;
|
|
final Value<String?> actionReferenceId;
|
|
final Value<bool> isActive;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const CampaignsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.title = const Value.absent(),
|
|
this.localBannerPath = const Value.absent(),
|
|
this.serverBannerUrl = const Value.absent(),
|
|
this.startDate = const Value.absent(),
|
|
this.endDate = const Value.absent(),
|
|
this.actionType = const Value.absent(),
|
|
this.actionReferenceId = const Value.absent(),
|
|
this.isActive = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
CampaignsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String title,
|
|
required String localBannerPath,
|
|
this.serverBannerUrl = const Value.absent(),
|
|
this.startDate = const Value.absent(),
|
|
this.endDate = const Value.absent(),
|
|
this.actionType = const Value.absent(),
|
|
this.actionReferenceId = const Value.absent(),
|
|
this.isActive = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : title = Value(title),
|
|
localBannerPath = Value(localBannerPath);
|
|
static Insertable<Campaign> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? title,
|
|
Expression<String>? localBannerPath,
|
|
Expression<String>? serverBannerUrl,
|
|
Expression<DateTime>? startDate,
|
|
Expression<DateTime>? endDate,
|
|
Expression<String>? actionType,
|
|
Expression<String>? actionReferenceId,
|
|
Expression<bool>? isActive,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (title != null) 'title': title,
|
|
if (localBannerPath != null) 'local_banner_path': localBannerPath,
|
|
if (serverBannerUrl != null) 'server_banner_url': serverBannerUrl,
|
|
if (startDate != null) 'start_date': startDate,
|
|
if (endDate != null) 'end_date': endDate,
|
|
if (actionType != null) 'action_type': actionType,
|
|
if (actionReferenceId != null) 'action_reference_id': actionReferenceId,
|
|
if (isActive != null) 'is_active': isActive,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
CampaignsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? title,
|
|
Value<String>? localBannerPath,
|
|
Value<String?>? serverBannerUrl,
|
|
Value<DateTime?>? startDate,
|
|
Value<DateTime?>? endDate,
|
|
Value<String?>? actionType,
|
|
Value<String?>? actionReferenceId,
|
|
Value<bool>? isActive,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return CampaignsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
title: title ?? this.title,
|
|
localBannerPath: localBannerPath ?? this.localBannerPath,
|
|
serverBannerUrl: serverBannerUrl ?? this.serverBannerUrl,
|
|
startDate: startDate ?? this.startDate,
|
|
endDate: endDate ?? this.endDate,
|
|
actionType: actionType ?? this.actionType,
|
|
actionReferenceId: actionReferenceId ?? this.actionReferenceId,
|
|
isActive: isActive ?? this.isActive,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (title.present) {
|
|
map['title'] = Variable<String>(title.value);
|
|
}
|
|
if (localBannerPath.present) {
|
|
map['local_banner_path'] = Variable<String>(localBannerPath.value);
|
|
}
|
|
if (serverBannerUrl.present) {
|
|
map['server_banner_url'] = Variable<String>(serverBannerUrl.value);
|
|
}
|
|
if (startDate.present) {
|
|
map['start_date'] = Variable<DateTime>(startDate.value);
|
|
}
|
|
if (endDate.present) {
|
|
map['end_date'] = Variable<DateTime>(endDate.value);
|
|
}
|
|
if (actionType.present) {
|
|
map['action_type'] = Variable<String>(actionType.value);
|
|
}
|
|
if (actionReferenceId.present) {
|
|
map['action_reference_id'] = Variable<String>(actionReferenceId.value);
|
|
}
|
|
if (isActive.present) {
|
|
map['is_active'] = Variable<bool>(isActive.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('CampaignsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('title: $title, ')
|
|
..write('localBannerPath: $localBannerPath, ')
|
|
..write('serverBannerUrl: $serverBannerUrl, ')
|
|
..write('startDate: $startDate, ')
|
|
..write('endDate: $endDate, ')
|
|
..write('actionType: $actionType, ')
|
|
..write('actionReferenceId: $actionReferenceId, ')
|
|
..write('isActive: $isActive, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $OutletCampaignsTable extends OutletCampaigns
|
|
with TableInfo<$OutletCampaignsTable, OutletCampaign> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$OutletCampaignsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _localIdMeta = const VerificationMeta(
|
|
'localId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> localId = GeneratedColumn<String>(
|
|
'local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
clientDefault: () => const Uuid().v7().toString(),
|
|
);
|
|
static const VerificationMeta _serverIdMeta = const VerificationMeta(
|
|
'serverId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
|
|
'server_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _campaignIdMeta = const VerificationMeta(
|
|
'campaignId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> campaignId = GeneratedColumn<String>(
|
|
'campaign_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES campaigns (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _outletIdMeta = const VerificationMeta(
|
|
'outletId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> outletId = GeneratedColumn<String>(
|
|
'outlet_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES outlets (local_id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _syncStatusMeta = const VerificationMeta(
|
|
'syncStatus',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> syncStatus = GeneratedColumn<String>(
|
|
'sync_status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('dirty'),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
|
|
'deletedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
|
|
'deleted_at',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
localId,
|
|
serverId,
|
|
campaignId,
|
|
outletId,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'outlet_campaigns';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<OutletCampaign> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('local_id')) {
|
|
context.handle(
|
|
_localIdMeta,
|
|
localId.isAcceptableOrUnknown(data['local_id']!, _localIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('server_id')) {
|
|
context.handle(
|
|
_serverIdMeta,
|
|
serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('campaign_id')) {
|
|
context.handle(
|
|
_campaignIdMeta,
|
|
campaignId.isAcceptableOrUnknown(data['campaign_id']!, _campaignIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_campaignIdMeta);
|
|
}
|
|
if (data.containsKey('outlet_id')) {
|
|
context.handle(
|
|
_outletIdMeta,
|
|
outletId.isAcceptableOrUnknown(data['outlet_id']!, _outletIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sync_status')) {
|
|
context.handle(
|
|
_syncStatusMeta,
|
|
syncStatus.isAcceptableOrUnknown(data['sync_status']!, _syncStatusMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('deleted_at')) {
|
|
context.handle(
|
|
_deletedAtMeta,
|
|
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {localId};
|
|
@override
|
|
OutletCampaign map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return OutletCampaign(
|
|
localId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}local_id'],
|
|
)!,
|
|
serverId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}server_id'],
|
|
),
|
|
campaignId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}campaign_id'],
|
|
)!,
|
|
outletId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}outlet_id'],
|
|
),
|
|
syncStatus: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}sync_status'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
deletedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}deleted_at'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$OutletCampaignsTable createAlias(String alias) {
|
|
return $OutletCampaignsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class OutletCampaign extends DataClass implements Insertable<OutletCampaign> {
|
|
final String localId;
|
|
final String? serverId;
|
|
final String campaignId;
|
|
final String? outletId;
|
|
final String syncStatus;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final DateTime? deletedAt;
|
|
const OutletCampaign({
|
|
required this.localId,
|
|
this.serverId,
|
|
required this.campaignId,
|
|
this.outletId,
|
|
required this.syncStatus,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.deletedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['local_id'] = Variable<String>(localId);
|
|
if (!nullToAbsent || serverId != null) {
|
|
map['server_id'] = Variable<String>(serverId);
|
|
}
|
|
map['campaign_id'] = Variable<String>(campaignId);
|
|
if (!nullToAbsent || outletId != null) {
|
|
map['outlet_id'] = Variable<String>(outletId);
|
|
}
|
|
map['sync_status'] = Variable<String>(syncStatus);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
if (!nullToAbsent || deletedAt != null) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
OutletCampaignsCompanion toCompanion(bool nullToAbsent) {
|
|
return OutletCampaignsCompanion(
|
|
localId: Value(localId),
|
|
serverId: serverId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(serverId),
|
|
campaignId: Value(campaignId),
|
|
outletId: outletId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(outletId),
|
|
syncStatus: Value(syncStatus),
|
|
createdAt: Value(createdAt),
|
|
updatedAt: Value(updatedAt),
|
|
deletedAt: deletedAt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deletedAt),
|
|
);
|
|
}
|
|
|
|
factory OutletCampaign.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return OutletCampaign(
|
|
localId: serializer.fromJson<String>(json['localId']),
|
|
serverId: serializer.fromJson<String?>(json['serverId']),
|
|
campaignId: serializer.fromJson<String>(json['campaignId']),
|
|
outletId: serializer.fromJson<String?>(json['outletId']),
|
|
syncStatus: serializer.fromJson<String>(json['syncStatus']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'localId': serializer.toJson<String>(localId),
|
|
'serverId': serializer.toJson<String?>(serverId),
|
|
'campaignId': serializer.toJson<String>(campaignId),
|
|
'outletId': serializer.toJson<String?>(outletId),
|
|
'syncStatus': serializer.toJson<String>(syncStatus),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
'deletedAt': serializer.toJson<DateTime?>(deletedAt),
|
|
};
|
|
}
|
|
|
|
OutletCampaign copyWith({
|
|
String? localId,
|
|
Value<String?> serverId = const Value.absent(),
|
|
String? campaignId,
|
|
Value<String?> outletId = const Value.absent(),
|
|
String? syncStatus,
|
|
DateTime? createdAt,
|
|
DateTime? updatedAt,
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
}) => OutletCampaign(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId.present ? serverId.value : this.serverId,
|
|
campaignId: campaignId ?? this.campaignId,
|
|
outletId: outletId.present ? outletId.value : this.outletId,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
|
|
);
|
|
OutletCampaign copyWithCompanion(OutletCampaignsCompanion data) {
|
|
return OutletCampaign(
|
|
localId: data.localId.present ? data.localId.value : this.localId,
|
|
serverId: data.serverId.present ? data.serverId.value : this.serverId,
|
|
campaignId: data.campaignId.present
|
|
? data.campaignId.value
|
|
: this.campaignId,
|
|
outletId: data.outletId.present ? data.outletId.value : this.outletId,
|
|
syncStatus: data.syncStatus.present
|
|
? data.syncStatus.value
|
|
: this.syncStatus,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('OutletCampaign(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('campaignId: $campaignId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
localId,
|
|
serverId,
|
|
campaignId,
|
|
outletId,
|
|
syncStatus,
|
|
createdAt,
|
|
updatedAt,
|
|
deletedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is OutletCampaign &&
|
|
other.localId == this.localId &&
|
|
other.serverId == this.serverId &&
|
|
other.campaignId == this.campaignId &&
|
|
other.outletId == this.outletId &&
|
|
other.syncStatus == this.syncStatus &&
|
|
other.createdAt == this.createdAt &&
|
|
other.updatedAt == this.updatedAt &&
|
|
other.deletedAt == this.deletedAt);
|
|
}
|
|
|
|
class OutletCampaignsCompanion extends UpdateCompanion<OutletCampaign> {
|
|
final Value<String> localId;
|
|
final Value<String?> serverId;
|
|
final Value<String> campaignId;
|
|
final Value<String?> outletId;
|
|
final Value<String> syncStatus;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime> updatedAt;
|
|
final Value<DateTime?> deletedAt;
|
|
final Value<int> rowid;
|
|
const OutletCampaignsCompanion({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
this.campaignId = const Value.absent(),
|
|
this.outletId = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
OutletCampaignsCompanion.insert({
|
|
this.localId = const Value.absent(),
|
|
this.serverId = const Value.absent(),
|
|
required String campaignId,
|
|
this.outletId = const Value.absent(),
|
|
this.syncStatus = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
this.deletedAt = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : campaignId = Value(campaignId);
|
|
static Insertable<OutletCampaign> custom({
|
|
Expression<String>? localId,
|
|
Expression<String>? serverId,
|
|
Expression<String>? campaignId,
|
|
Expression<String>? outletId,
|
|
Expression<String>? syncStatus,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? updatedAt,
|
|
Expression<DateTime>? deletedAt,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (localId != null) 'local_id': localId,
|
|
if (serverId != null) 'server_id': serverId,
|
|
if (campaignId != null) 'campaign_id': campaignId,
|
|
if (outletId != null) 'outlet_id': outletId,
|
|
if (syncStatus != null) 'sync_status': syncStatus,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
if (deletedAt != null) 'deleted_at': deletedAt,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
OutletCampaignsCompanion copyWith({
|
|
Value<String>? localId,
|
|
Value<String?>? serverId,
|
|
Value<String>? campaignId,
|
|
Value<String?>? outletId,
|
|
Value<String>? syncStatus,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime>? updatedAt,
|
|
Value<DateTime?>? deletedAt,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return OutletCampaignsCompanion(
|
|
localId: localId ?? this.localId,
|
|
serverId: serverId ?? this.serverId,
|
|
campaignId: campaignId ?? this.campaignId,
|
|
outletId: outletId ?? this.outletId,
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
deletedAt: deletedAt ?? this.deletedAt,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (localId.present) {
|
|
map['local_id'] = Variable<String>(localId.value);
|
|
}
|
|
if (serverId.present) {
|
|
map['server_id'] = Variable<String>(serverId.value);
|
|
}
|
|
if (campaignId.present) {
|
|
map['campaign_id'] = Variable<String>(campaignId.value);
|
|
}
|
|
if (outletId.present) {
|
|
map['outlet_id'] = Variable<String>(outletId.value);
|
|
}
|
|
if (syncStatus.present) {
|
|
map['sync_status'] = Variable<String>(syncStatus.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
if (deletedAt.present) {
|
|
map['deleted_at'] = Variable<DateTime>(deletedAt.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('OutletCampaignsCompanion(')
|
|
..write('localId: $localId, ')
|
|
..write('serverId: $serverId, ')
|
|
..write('campaignId: $campaignId, ')
|
|
..write('outletId: $outletId, ')
|
|
..write('syncStatus: $syncStatus, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('updatedAt: $updatedAt, ')
|
|
..write('deletedAt: $deletedAt, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $SyncQueuesTable extends SyncQueues
|
|
with TableInfo<$SyncQueuesTable, SyncQueue> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$SyncQueuesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id',
|
|
aliasedName,
|
|
false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'PRIMARY KEY AUTOINCREMENT',
|
|
),
|
|
);
|
|
static const VerificationMeta _tableTypeMeta = const VerificationMeta(
|
|
'tableType',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> tableType = GeneratedColumn<String>(
|
|
'table_type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _tableLocalIdMeta = const VerificationMeta(
|
|
'tableLocalId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> tableLocalId = GeneratedColumn<String>(
|
|
'table_local_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _actionMeta = const VerificationMeta('action');
|
|
@override
|
|
late final GeneratedColumn<String> action = GeneratedColumn<String>(
|
|
'action',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _statusMeta = const VerificationMeta('status');
|
|
@override
|
|
late final GeneratedColumn<String> status = GeneratedColumn<String>(
|
|
'status',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
@override
|
|
late final GeneratedColumnWithTypeConverter<Map<String, dynamic>, String>
|
|
payload = GeneratedColumn<String>(
|
|
'payload',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
).withConverter<Map<String, dynamic>>($SyncQueuesTable.$converterpayload);
|
|
static const VerificationMeta _batchIdMeta = const VerificationMeta(
|
|
'batchId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> batchId = GeneratedColumn<String>(
|
|
'batch_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _lastErrorMeta = const VerificationMeta(
|
|
'lastError',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> lastError = GeneratedColumn<String>(
|
|
'last_error',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _retryCountMeta = const VerificationMeta(
|
|
'retryCount',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> retryCount = GeneratedColumn<int>(
|
|
'retry_count',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
|
'createdAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
|
'created_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
static const VerificationMeta _lastAttemptMeta = const VerificationMeta(
|
|
'lastAttempt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> lastAttempt = GeneratedColumn<DateTime>(
|
|
'last_attempt',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
tableType,
|
|
tableLocalId,
|
|
action,
|
|
status,
|
|
payload,
|
|
batchId,
|
|
lastError,
|
|
retryCount,
|
|
createdAt,
|
|
lastAttempt,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'sync_queues';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<SyncQueue> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('table_type')) {
|
|
context.handle(
|
|
_tableTypeMeta,
|
|
tableType.isAcceptableOrUnknown(data['table_type']!, _tableTypeMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_tableTypeMeta);
|
|
}
|
|
if (data.containsKey('table_local_id')) {
|
|
context.handle(
|
|
_tableLocalIdMeta,
|
|
tableLocalId.isAcceptableOrUnknown(
|
|
data['table_local_id']!,
|
|
_tableLocalIdMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_tableLocalIdMeta);
|
|
}
|
|
if (data.containsKey('action')) {
|
|
context.handle(
|
|
_actionMeta,
|
|
action.isAcceptableOrUnknown(data['action']!, _actionMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_actionMeta);
|
|
}
|
|
if (data.containsKey('status')) {
|
|
context.handle(
|
|
_statusMeta,
|
|
status.isAcceptableOrUnknown(data['status']!, _statusMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_statusMeta);
|
|
}
|
|
if (data.containsKey('batch_id')) {
|
|
context.handle(
|
|
_batchIdMeta,
|
|
batchId.isAcceptableOrUnknown(data['batch_id']!, _batchIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('last_error')) {
|
|
context.handle(
|
|
_lastErrorMeta,
|
|
lastError.isAcceptableOrUnknown(data['last_error']!, _lastErrorMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('retry_count')) {
|
|
context.handle(
|
|
_retryCountMeta,
|
|
retryCount.isAcceptableOrUnknown(data['retry_count']!, _retryCountMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at')) {
|
|
context.handle(
|
|
_createdAtMeta,
|
|
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('last_attempt')) {
|
|
context.handle(
|
|
_lastAttemptMeta,
|
|
lastAttempt.isAcceptableOrUnknown(
|
|
data['last_attempt']!,
|
|
_lastAttemptMeta,
|
|
),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
SyncQueue map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return SyncQueue(
|
|
id: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}id'],
|
|
)!,
|
|
tableType: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}table_type'],
|
|
)!,
|
|
tableLocalId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}table_local_id'],
|
|
)!,
|
|
action: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}action'],
|
|
)!,
|
|
status: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}status'],
|
|
)!,
|
|
payload: $SyncQueuesTable.$converterpayload.fromSql(
|
|
attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}payload'],
|
|
)!,
|
|
),
|
|
batchId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}batch_id'],
|
|
),
|
|
lastError: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}last_error'],
|
|
),
|
|
retryCount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}retry_count'],
|
|
)!,
|
|
createdAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}created_at'],
|
|
)!,
|
|
lastAttempt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}last_attempt'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$SyncQueuesTable createAlias(String alias) {
|
|
return $SyncQueuesTable(attachedDatabase, alias);
|
|
}
|
|
|
|
static TypeConverter<Map<String, dynamic>, String> $converterpayload =
|
|
StringMapConverter();
|
|
}
|
|
|
|
class SyncQueue extends DataClass implements Insertable<SyncQueue> {
|
|
final int id;
|
|
final String tableType;
|
|
final String tableLocalId;
|
|
final String action;
|
|
final String status;
|
|
final Map<String, dynamic> payload;
|
|
final String? batchId;
|
|
final String? lastError;
|
|
final int retryCount;
|
|
final DateTime createdAt;
|
|
final DateTime? lastAttempt;
|
|
const SyncQueue({
|
|
required this.id,
|
|
required this.tableType,
|
|
required this.tableLocalId,
|
|
required this.action,
|
|
required this.status,
|
|
required this.payload,
|
|
this.batchId,
|
|
this.lastError,
|
|
required this.retryCount,
|
|
required this.createdAt,
|
|
this.lastAttempt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['table_type'] = Variable<String>(tableType);
|
|
map['table_local_id'] = Variable<String>(tableLocalId);
|
|
map['action'] = Variable<String>(action);
|
|
map['status'] = Variable<String>(status);
|
|
{
|
|
map['payload'] = Variable<String>(
|
|
$SyncQueuesTable.$converterpayload.toSql(payload),
|
|
);
|
|
}
|
|
if (!nullToAbsent || batchId != null) {
|
|
map['batch_id'] = Variable<String>(batchId);
|
|
}
|
|
if (!nullToAbsent || lastError != null) {
|
|
map['last_error'] = Variable<String>(lastError);
|
|
}
|
|
map['retry_count'] = Variable<int>(retryCount);
|
|
map['created_at'] = Variable<DateTime>(createdAt);
|
|
if (!nullToAbsent || lastAttempt != null) {
|
|
map['last_attempt'] = Variable<DateTime>(lastAttempt);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
SyncQueuesCompanion toCompanion(bool nullToAbsent) {
|
|
return SyncQueuesCompanion(
|
|
id: Value(id),
|
|
tableType: Value(tableType),
|
|
tableLocalId: Value(tableLocalId),
|
|
action: Value(action),
|
|
status: Value(status),
|
|
payload: Value(payload),
|
|
batchId: batchId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(batchId),
|
|
lastError: lastError == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(lastError),
|
|
retryCount: Value(retryCount),
|
|
createdAt: Value(createdAt),
|
|
lastAttempt: lastAttempt == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(lastAttempt),
|
|
);
|
|
}
|
|
|
|
factory SyncQueue.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return SyncQueue(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
tableType: serializer.fromJson<String>(json['tableType']),
|
|
tableLocalId: serializer.fromJson<String>(json['tableLocalId']),
|
|
action: serializer.fromJson<String>(json['action']),
|
|
status: serializer.fromJson<String>(json['status']),
|
|
payload: serializer.fromJson<Map<String, dynamic>>(json['payload']),
|
|
batchId: serializer.fromJson<String?>(json['batchId']),
|
|
lastError: serializer.fromJson<String?>(json['lastError']),
|
|
retryCount: serializer.fromJson<int>(json['retryCount']),
|
|
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
|
lastAttempt: serializer.fromJson<DateTime?>(json['lastAttempt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'tableType': serializer.toJson<String>(tableType),
|
|
'tableLocalId': serializer.toJson<String>(tableLocalId),
|
|
'action': serializer.toJson<String>(action),
|
|
'status': serializer.toJson<String>(status),
|
|
'payload': serializer.toJson<Map<String, dynamic>>(payload),
|
|
'batchId': serializer.toJson<String?>(batchId),
|
|
'lastError': serializer.toJson<String?>(lastError),
|
|
'retryCount': serializer.toJson<int>(retryCount),
|
|
'createdAt': serializer.toJson<DateTime>(createdAt),
|
|
'lastAttempt': serializer.toJson<DateTime?>(lastAttempt),
|
|
};
|
|
}
|
|
|
|
SyncQueue copyWith({
|
|
int? id,
|
|
String? tableType,
|
|
String? tableLocalId,
|
|
String? action,
|
|
String? status,
|
|
Map<String, dynamic>? payload,
|
|
Value<String?> batchId = const Value.absent(),
|
|
Value<String?> lastError = const Value.absent(),
|
|
int? retryCount,
|
|
DateTime? createdAt,
|
|
Value<DateTime?> lastAttempt = const Value.absent(),
|
|
}) => SyncQueue(
|
|
id: id ?? this.id,
|
|
tableType: tableType ?? this.tableType,
|
|
tableLocalId: tableLocalId ?? this.tableLocalId,
|
|
action: action ?? this.action,
|
|
status: status ?? this.status,
|
|
payload: payload ?? this.payload,
|
|
batchId: batchId.present ? batchId.value : this.batchId,
|
|
lastError: lastError.present ? lastError.value : this.lastError,
|
|
retryCount: retryCount ?? this.retryCount,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
lastAttempt: lastAttempt.present ? lastAttempt.value : this.lastAttempt,
|
|
);
|
|
SyncQueue copyWithCompanion(SyncQueuesCompanion data) {
|
|
return SyncQueue(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
tableType: data.tableType.present ? data.tableType.value : this.tableType,
|
|
tableLocalId: data.tableLocalId.present
|
|
? data.tableLocalId.value
|
|
: this.tableLocalId,
|
|
action: data.action.present ? data.action.value : this.action,
|
|
status: data.status.present ? data.status.value : this.status,
|
|
payload: data.payload.present ? data.payload.value : this.payload,
|
|
batchId: data.batchId.present ? data.batchId.value : this.batchId,
|
|
lastError: data.lastError.present ? data.lastError.value : this.lastError,
|
|
retryCount: data.retryCount.present
|
|
? data.retryCount.value
|
|
: this.retryCount,
|
|
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
|
lastAttempt: data.lastAttempt.present
|
|
? data.lastAttempt.value
|
|
: this.lastAttempt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('SyncQueue(')
|
|
..write('id: $id, ')
|
|
..write('tableType: $tableType, ')
|
|
..write('tableLocalId: $tableLocalId, ')
|
|
..write('action: $action, ')
|
|
..write('status: $status, ')
|
|
..write('payload: $payload, ')
|
|
..write('batchId: $batchId, ')
|
|
..write('lastError: $lastError, ')
|
|
..write('retryCount: $retryCount, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('lastAttempt: $lastAttempt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
id,
|
|
tableType,
|
|
tableLocalId,
|
|
action,
|
|
status,
|
|
payload,
|
|
batchId,
|
|
lastError,
|
|
retryCount,
|
|
createdAt,
|
|
lastAttempt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is SyncQueue &&
|
|
other.id == this.id &&
|
|
other.tableType == this.tableType &&
|
|
other.tableLocalId == this.tableLocalId &&
|
|
other.action == this.action &&
|
|
other.status == this.status &&
|
|
other.payload == this.payload &&
|
|
other.batchId == this.batchId &&
|
|
other.lastError == this.lastError &&
|
|
other.retryCount == this.retryCount &&
|
|
other.createdAt == this.createdAt &&
|
|
other.lastAttempt == this.lastAttempt);
|
|
}
|
|
|
|
class SyncQueuesCompanion extends UpdateCompanion<SyncQueue> {
|
|
final Value<int> id;
|
|
final Value<String> tableType;
|
|
final Value<String> tableLocalId;
|
|
final Value<String> action;
|
|
final Value<String> status;
|
|
final Value<Map<String, dynamic>> payload;
|
|
final Value<String?> batchId;
|
|
final Value<String?> lastError;
|
|
final Value<int> retryCount;
|
|
final Value<DateTime> createdAt;
|
|
final Value<DateTime?> lastAttempt;
|
|
const SyncQueuesCompanion({
|
|
this.id = const Value.absent(),
|
|
this.tableType = const Value.absent(),
|
|
this.tableLocalId = const Value.absent(),
|
|
this.action = const Value.absent(),
|
|
this.status = const Value.absent(),
|
|
this.payload = const Value.absent(),
|
|
this.batchId = const Value.absent(),
|
|
this.lastError = const Value.absent(),
|
|
this.retryCount = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.lastAttempt = const Value.absent(),
|
|
});
|
|
SyncQueuesCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required String tableType,
|
|
required String tableLocalId,
|
|
required String action,
|
|
required String status,
|
|
required Map<String, dynamic> payload,
|
|
this.batchId = const Value.absent(),
|
|
this.lastError = const Value.absent(),
|
|
this.retryCount = const Value.absent(),
|
|
this.createdAt = const Value.absent(),
|
|
this.lastAttempt = const Value.absent(),
|
|
}) : tableType = Value(tableType),
|
|
tableLocalId = Value(tableLocalId),
|
|
action = Value(action),
|
|
status = Value(status),
|
|
payload = Value(payload);
|
|
static Insertable<SyncQueue> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? tableType,
|
|
Expression<String>? tableLocalId,
|
|
Expression<String>? action,
|
|
Expression<String>? status,
|
|
Expression<String>? payload,
|
|
Expression<String>? batchId,
|
|
Expression<String>? lastError,
|
|
Expression<int>? retryCount,
|
|
Expression<DateTime>? createdAt,
|
|
Expression<DateTime>? lastAttempt,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (tableType != null) 'table_type': tableType,
|
|
if (tableLocalId != null) 'table_local_id': tableLocalId,
|
|
if (action != null) 'action': action,
|
|
if (status != null) 'status': status,
|
|
if (payload != null) 'payload': payload,
|
|
if (batchId != null) 'batch_id': batchId,
|
|
if (lastError != null) 'last_error': lastError,
|
|
if (retryCount != null) 'retry_count': retryCount,
|
|
if (createdAt != null) 'created_at': createdAt,
|
|
if (lastAttempt != null) 'last_attempt': lastAttempt,
|
|
});
|
|
}
|
|
|
|
SyncQueuesCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<String>? tableType,
|
|
Value<String>? tableLocalId,
|
|
Value<String>? action,
|
|
Value<String>? status,
|
|
Value<Map<String, dynamic>>? payload,
|
|
Value<String?>? batchId,
|
|
Value<String?>? lastError,
|
|
Value<int>? retryCount,
|
|
Value<DateTime>? createdAt,
|
|
Value<DateTime?>? lastAttempt,
|
|
}) {
|
|
return SyncQueuesCompanion(
|
|
id: id ?? this.id,
|
|
tableType: tableType ?? this.tableType,
|
|
tableLocalId: tableLocalId ?? this.tableLocalId,
|
|
action: action ?? this.action,
|
|
status: status ?? this.status,
|
|
payload: payload ?? this.payload,
|
|
batchId: batchId ?? this.batchId,
|
|
lastError: lastError ?? this.lastError,
|
|
retryCount: retryCount ?? this.retryCount,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
lastAttempt: lastAttempt ?? this.lastAttempt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (tableType.present) {
|
|
map['table_type'] = Variable<String>(tableType.value);
|
|
}
|
|
if (tableLocalId.present) {
|
|
map['table_local_id'] = Variable<String>(tableLocalId.value);
|
|
}
|
|
if (action.present) {
|
|
map['action'] = Variable<String>(action.value);
|
|
}
|
|
if (status.present) {
|
|
map['status'] = Variable<String>(status.value);
|
|
}
|
|
if (payload.present) {
|
|
map['payload'] = Variable<String>(
|
|
$SyncQueuesTable.$converterpayload.toSql(payload.value),
|
|
);
|
|
}
|
|
if (batchId.present) {
|
|
map['batch_id'] = Variable<String>(batchId.value);
|
|
}
|
|
if (lastError.present) {
|
|
map['last_error'] = Variable<String>(lastError.value);
|
|
}
|
|
if (retryCount.present) {
|
|
map['retry_count'] = Variable<int>(retryCount.value);
|
|
}
|
|
if (createdAt.present) {
|
|
map['created_at'] = Variable<DateTime>(createdAt.value);
|
|
}
|
|
if (lastAttempt.present) {
|
|
map['last_attempt'] = Variable<DateTime>(lastAttempt.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('SyncQueuesCompanion(')
|
|
..write('id: $id, ')
|
|
..write('tableType: $tableType, ')
|
|
..write('tableLocalId: $tableLocalId, ')
|
|
..write('action: $action, ')
|
|
..write('status: $status, ')
|
|
..write('payload: $payload, ')
|
|
..write('batchId: $batchId, ')
|
|
..write('lastError: $lastError, ')
|
|
..write('retryCount: $retryCount, ')
|
|
..write('createdAt: $createdAt, ')
|
|
..write('lastAttempt: $lastAttempt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
abstract class _$AppDatabase extends GeneratedDatabase {
|
|
_$AppDatabase(QueryExecutor e) : super(e);
|
|
$AppDatabaseManager get managers => $AppDatabaseManager(this);
|
|
late final $TenantsTable tenants = $TenantsTable(this);
|
|
late final $TenantPaymentMethodsTable tenantPaymentMethods =
|
|
$TenantPaymentMethodsTable(this);
|
|
late final $OutletsTable outlets = $OutletsTable(this);
|
|
late final $UsersTable users = $UsersTable(this);
|
|
late final $CustomersTable customers = $CustomersTable(this);
|
|
late final $CustomerAddressesTable customerAddresses =
|
|
$CustomerAddressesTable(this);
|
|
late final $CategoriesTable categories = $CategoriesTable(this);
|
|
late final $UnitsTable units = $UnitsTable(this);
|
|
late final $ProductsTable products = $ProductsTable(this);
|
|
late final $ProductVariantsTable productVariants = $ProductVariantsTable(
|
|
this,
|
|
);
|
|
late final $ProductReviewsTable productReviews = $ProductReviewsTable(this);
|
|
late final $ProductLikesTable productLikes = $ProductLikesTable(this);
|
|
late final $RawMaterialsTable rawMaterials = $RawMaterialsTable(this);
|
|
late final $OutletInventoriesTable outletInventories =
|
|
$OutletInventoriesTable(this);
|
|
late final $ReceiptItemsTable receiptItems = $ReceiptItemsTable(this);
|
|
late final $StockCardsTable stockCards = $StockCardsTable(this);
|
|
late final $OrdersTable orders = $OrdersTable(this);
|
|
late final $OrderItemsTable orderItems = $OrderItemsTable(this);
|
|
late final $SuppliersTable suppliers = $SuppliersTable(this);
|
|
late final $PurchasesTable purchases = $PurchasesTable(this);
|
|
late final $PurchaseItemsTable purchaseItems = $PurchaseItemsTable(this);
|
|
late final $TransactionsTable transactions = $TransactionsTable(this);
|
|
late final $CampaignsTable campaigns = $CampaignsTable(this);
|
|
late final $OutletCampaignsTable outletCampaigns = $OutletCampaignsTable(
|
|
this,
|
|
);
|
|
late final $SyncQueuesTable syncQueues = $SyncQueuesTable(this);
|
|
late final TenantDao tenantDao = TenantDao(this as AppDatabase);
|
|
late final TenantPaymentMethodDao tenantPaymentMethodDao =
|
|
TenantPaymentMethodDao(this as AppDatabase);
|
|
late final UserDao userDao = UserDao(this as AppDatabase);
|
|
late final CustomerDao customerDao = CustomerDao(this as AppDatabase);
|
|
late final CustomerAddressDao customerAddressDao = CustomerAddressDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final OutletDao outletDao = OutletDao(this as AppDatabase);
|
|
late final CategoryDao categoryDao = CategoryDao(this as AppDatabase);
|
|
late final UnitDao unitDao = UnitDao(this as AppDatabase);
|
|
late final ProductDao productDao = ProductDao(this as AppDatabase);
|
|
late final ProductVariantDao productVariantDao = ProductVariantDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final ProductReviewDao productReviewDao = ProductReviewDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final ProductLikeDao productLikeDao = ProductLikeDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final RawMaterialDao rawMaterialDao = RawMaterialDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final OutletInventoryDao outletInventoryDao = OutletInventoryDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final ReceiptItemDao receiptItemDao = ReceiptItemDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final StockCardDao stockCardDao = StockCardDao(this as AppDatabase);
|
|
late final OrderDao orderDao = OrderDao(this as AppDatabase);
|
|
late final OrderItemDao orderItemDao = OrderItemDao(this as AppDatabase);
|
|
late final SupplierDao supplierDao = SupplierDao(this as AppDatabase);
|
|
late final PurchaseDao purchaseDao = PurchaseDao(this as AppDatabase);
|
|
late final PurchaseItemDao purchaseItemDao = PurchaseItemDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final TransactionDao transactionDao = TransactionDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final CampaignDao campaignDao = CampaignDao(this as AppDatabase);
|
|
late final OutletCampaignDao outletCampaignDao = OutletCampaignDao(
|
|
this as AppDatabase,
|
|
);
|
|
late final SyncQueueDao syncQueueDao = SyncQueueDao(this as AppDatabase);
|
|
@override
|
|
Iterable<TableInfo<Table, Object?>> get allTables =>
|
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
|
@override
|
|
List<DatabaseSchemaEntity> get allSchemaEntities => [
|
|
tenants,
|
|
tenantPaymentMethods,
|
|
outlets,
|
|
users,
|
|
customers,
|
|
customerAddresses,
|
|
categories,
|
|
units,
|
|
products,
|
|
productVariants,
|
|
productReviews,
|
|
productLikes,
|
|
rawMaterials,
|
|
outletInventories,
|
|
receiptItems,
|
|
stockCards,
|
|
orders,
|
|
orderItems,
|
|
suppliers,
|
|
purchases,
|
|
purchaseItems,
|
|
transactions,
|
|
campaigns,
|
|
outletCampaigns,
|
|
syncQueues,
|
|
];
|
|
}
|
|
|
|
typedef $$TenantsTableCreateCompanionBuilder =
|
|
TenantsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String businessCode,
|
|
required String businessName,
|
|
Value<String?> businessEmail,
|
|
Value<String?> businessPhone,
|
|
Value<String?> businessType,
|
|
Value<String?> localLogoPath,
|
|
Value<String?> serverLogoUrl,
|
|
Value<String?> subdomain,
|
|
Value<String?> onlinStoreName,
|
|
Value<String?> onlineOpenTime,
|
|
Value<String?> onlineCloseTime,
|
|
Value<bool> isCloseService,
|
|
Value<int> preparationTimeMinutes,
|
|
Value<int> orderIntervalMinutes,
|
|
Value<bool> allowCod,
|
|
Value<double> maxDeliveryRadiusKm,
|
|
Value<String> deliveryFeeType,
|
|
Value<double> deliveryFlatFee,
|
|
Value<double> deliveryFeePerKm,
|
|
Value<double> deliveryBaseFee,
|
|
Value<String> reviewDisplayType,
|
|
Value<String> reviewDisplayPolicy,
|
|
Value<String> subscriptionLevel,
|
|
Value<int> limitOutlet,
|
|
Value<DateTime?> subscriptionExpiresAt,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$TenantsTableUpdateCompanionBuilder =
|
|
TenantsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> businessCode,
|
|
Value<String> businessName,
|
|
Value<String?> businessEmail,
|
|
Value<String?> businessPhone,
|
|
Value<String?> businessType,
|
|
Value<String?> localLogoPath,
|
|
Value<String?> serverLogoUrl,
|
|
Value<String?> subdomain,
|
|
Value<String?> onlinStoreName,
|
|
Value<String?> onlineOpenTime,
|
|
Value<String?> onlineCloseTime,
|
|
Value<bool> isCloseService,
|
|
Value<int> preparationTimeMinutes,
|
|
Value<int> orderIntervalMinutes,
|
|
Value<bool> allowCod,
|
|
Value<double> maxDeliveryRadiusKm,
|
|
Value<String> deliveryFeeType,
|
|
Value<double> deliveryFlatFee,
|
|
Value<double> deliveryFeePerKm,
|
|
Value<double> deliveryBaseFee,
|
|
Value<String> reviewDisplayType,
|
|
Value<String> reviewDisplayPolicy,
|
|
Value<String> subscriptionLevel,
|
|
Value<int> limitOutlet,
|
|
Value<DateTime?> subscriptionExpiresAt,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
class $$TenantsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $TenantsTable> {
|
|
$$TenantsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get businessCode => $composableBuilder(
|
|
column: $table.businessCode,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get businessName => $composableBuilder(
|
|
column: $table.businessName,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get businessEmail => $composableBuilder(
|
|
column: $table.businessEmail,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get businessPhone => $composableBuilder(
|
|
column: $table.businessPhone,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get businessType => $composableBuilder(
|
|
column: $table.businessType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get localLogoPath => $composableBuilder(
|
|
column: $table.localLogoPath,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverLogoUrl => $composableBuilder(
|
|
column: $table.serverLogoUrl,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get subdomain => $composableBuilder(
|
|
column: $table.subdomain,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get onlinStoreName => $composableBuilder(
|
|
column: $table.onlinStoreName,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get onlineOpenTime => $composableBuilder(
|
|
column: $table.onlineOpenTime,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get onlineCloseTime => $composableBuilder(
|
|
column: $table.onlineCloseTime,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isCloseService => $composableBuilder(
|
|
column: $table.isCloseService,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get preparationTimeMinutes => $composableBuilder(
|
|
column: $table.preparationTimeMinutes,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get orderIntervalMinutes => $composableBuilder(
|
|
column: $table.orderIntervalMinutes,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get allowCod => $composableBuilder(
|
|
column: $table.allowCod,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get maxDeliveryRadiusKm => $composableBuilder(
|
|
column: $table.maxDeliveryRadiusKm,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get deliveryFeeType => $composableBuilder(
|
|
column: $table.deliveryFeeType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get deliveryFlatFee => $composableBuilder(
|
|
column: $table.deliveryFlatFee,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get deliveryFeePerKm => $composableBuilder(
|
|
column: $table.deliveryFeePerKm,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get deliveryBaseFee => $composableBuilder(
|
|
column: $table.deliveryBaseFee,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get reviewDisplayType => $composableBuilder(
|
|
column: $table.reviewDisplayType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get reviewDisplayPolicy => $composableBuilder(
|
|
column: $table.reviewDisplayPolicy,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get subscriptionLevel => $composableBuilder(
|
|
column: $table.subscriptionLevel,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get limitOutlet => $composableBuilder(
|
|
column: $table.limitOutlet,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get subscriptionExpiresAt => $composableBuilder(
|
|
column: $table.subscriptionExpiresAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
}
|
|
|
|
class $$TenantsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $TenantsTable> {
|
|
$$TenantsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get businessCode => $composableBuilder(
|
|
column: $table.businessCode,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get businessName => $composableBuilder(
|
|
column: $table.businessName,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get businessEmail => $composableBuilder(
|
|
column: $table.businessEmail,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get businessPhone => $composableBuilder(
|
|
column: $table.businessPhone,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get businessType => $composableBuilder(
|
|
column: $table.businessType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get localLogoPath => $composableBuilder(
|
|
column: $table.localLogoPath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverLogoUrl => $composableBuilder(
|
|
column: $table.serverLogoUrl,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get subdomain => $composableBuilder(
|
|
column: $table.subdomain,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get onlinStoreName => $composableBuilder(
|
|
column: $table.onlinStoreName,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get onlineOpenTime => $composableBuilder(
|
|
column: $table.onlineOpenTime,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get onlineCloseTime => $composableBuilder(
|
|
column: $table.onlineCloseTime,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isCloseService => $composableBuilder(
|
|
column: $table.isCloseService,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get preparationTimeMinutes => $composableBuilder(
|
|
column: $table.preparationTimeMinutes,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get orderIntervalMinutes => $composableBuilder(
|
|
column: $table.orderIntervalMinutes,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get allowCod => $composableBuilder(
|
|
column: $table.allowCod,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get maxDeliveryRadiusKm => $composableBuilder(
|
|
column: $table.maxDeliveryRadiusKm,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get deliveryFeeType => $composableBuilder(
|
|
column: $table.deliveryFeeType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get deliveryFlatFee => $composableBuilder(
|
|
column: $table.deliveryFlatFee,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get deliveryFeePerKm => $composableBuilder(
|
|
column: $table.deliveryFeePerKm,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get deliveryBaseFee => $composableBuilder(
|
|
column: $table.deliveryBaseFee,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get reviewDisplayType => $composableBuilder(
|
|
column: $table.reviewDisplayType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get reviewDisplayPolicy => $composableBuilder(
|
|
column: $table.reviewDisplayPolicy,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get subscriptionLevel => $composableBuilder(
|
|
column: $table.subscriptionLevel,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get limitOutlet => $composableBuilder(
|
|
column: $table.limitOutlet,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get subscriptionExpiresAt => $composableBuilder(
|
|
column: $table.subscriptionExpiresAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$TenantsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $TenantsTable> {
|
|
$$TenantsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get businessCode => $composableBuilder(
|
|
column: $table.businessCode,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get businessName => $composableBuilder(
|
|
column: $table.businessName,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get businessEmail => $composableBuilder(
|
|
column: $table.businessEmail,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get businessPhone => $composableBuilder(
|
|
column: $table.businessPhone,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get businessType => $composableBuilder(
|
|
column: $table.businessType,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get localLogoPath => $composableBuilder(
|
|
column: $table.localLogoPath,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get serverLogoUrl => $composableBuilder(
|
|
column: $table.serverLogoUrl,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get subdomain =>
|
|
$composableBuilder(column: $table.subdomain, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get onlinStoreName => $composableBuilder(
|
|
column: $table.onlinStoreName,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get onlineOpenTime => $composableBuilder(
|
|
column: $table.onlineOpenTime,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get onlineCloseTime => $composableBuilder(
|
|
column: $table.onlineCloseTime,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get isCloseService => $composableBuilder(
|
|
column: $table.isCloseService,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<int> get preparationTimeMinutes => $composableBuilder(
|
|
column: $table.preparationTimeMinutes,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<int> get orderIntervalMinutes => $composableBuilder(
|
|
column: $table.orderIntervalMinutes,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get allowCod =>
|
|
$composableBuilder(column: $table.allowCod, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get maxDeliveryRadiusKm => $composableBuilder(
|
|
column: $table.maxDeliveryRadiusKm,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get deliveryFeeType => $composableBuilder(
|
|
column: $table.deliveryFeeType,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get deliveryFlatFee => $composableBuilder(
|
|
column: $table.deliveryFlatFee,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get deliveryFeePerKm => $composableBuilder(
|
|
column: $table.deliveryFeePerKm,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get deliveryBaseFee => $composableBuilder(
|
|
column: $table.deliveryBaseFee,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get reviewDisplayType => $composableBuilder(
|
|
column: $table.reviewDisplayType,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get reviewDisplayPolicy => $composableBuilder(
|
|
column: $table.reviewDisplayPolicy,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get subscriptionLevel => $composableBuilder(
|
|
column: $table.subscriptionLevel,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<int> get limitOutlet => $composableBuilder(
|
|
column: $table.limitOutlet,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get subscriptionExpiresAt => $composableBuilder(
|
|
column: $table.subscriptionExpiresAt,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
}
|
|
|
|
class $$TenantsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$TenantsTable,
|
|
Tenant,
|
|
$$TenantsTableFilterComposer,
|
|
$$TenantsTableOrderingComposer,
|
|
$$TenantsTableAnnotationComposer,
|
|
$$TenantsTableCreateCompanionBuilder,
|
|
$$TenantsTableUpdateCompanionBuilder,
|
|
(Tenant, BaseReferences<_$AppDatabase, $TenantsTable, Tenant>),
|
|
Tenant,
|
|
PrefetchHooks Function()
|
|
> {
|
|
$$TenantsTableTableManager(_$AppDatabase db, $TenantsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$TenantsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$TenantsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$TenantsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> businessCode = const Value.absent(),
|
|
Value<String> businessName = const Value.absent(),
|
|
Value<String?> businessEmail = const Value.absent(),
|
|
Value<String?> businessPhone = const Value.absent(),
|
|
Value<String?> businessType = const Value.absent(),
|
|
Value<String?> localLogoPath = const Value.absent(),
|
|
Value<String?> serverLogoUrl = const Value.absent(),
|
|
Value<String?> subdomain = const Value.absent(),
|
|
Value<String?> onlinStoreName = const Value.absent(),
|
|
Value<String?> onlineOpenTime = const Value.absent(),
|
|
Value<String?> onlineCloseTime = const Value.absent(),
|
|
Value<bool> isCloseService = const Value.absent(),
|
|
Value<int> preparationTimeMinutes = const Value.absent(),
|
|
Value<int> orderIntervalMinutes = const Value.absent(),
|
|
Value<bool> allowCod = const Value.absent(),
|
|
Value<double> maxDeliveryRadiusKm = const Value.absent(),
|
|
Value<String> deliveryFeeType = const Value.absent(),
|
|
Value<double> deliveryFlatFee = const Value.absent(),
|
|
Value<double> deliveryFeePerKm = const Value.absent(),
|
|
Value<double> deliveryBaseFee = const Value.absent(),
|
|
Value<String> reviewDisplayType = const Value.absent(),
|
|
Value<String> reviewDisplayPolicy = const Value.absent(),
|
|
Value<String> subscriptionLevel = const Value.absent(),
|
|
Value<int> limitOutlet = const Value.absent(),
|
|
Value<DateTime?> subscriptionExpiresAt = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => TenantsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
businessCode: businessCode,
|
|
businessName: businessName,
|
|
businessEmail: businessEmail,
|
|
businessPhone: businessPhone,
|
|
businessType: businessType,
|
|
localLogoPath: localLogoPath,
|
|
serverLogoUrl: serverLogoUrl,
|
|
subdomain: subdomain,
|
|
onlinStoreName: onlinStoreName,
|
|
onlineOpenTime: onlineOpenTime,
|
|
onlineCloseTime: onlineCloseTime,
|
|
isCloseService: isCloseService,
|
|
preparationTimeMinutes: preparationTimeMinutes,
|
|
orderIntervalMinutes: orderIntervalMinutes,
|
|
allowCod: allowCod,
|
|
maxDeliveryRadiusKm: maxDeliveryRadiusKm,
|
|
deliveryFeeType: deliveryFeeType,
|
|
deliveryFlatFee: deliveryFlatFee,
|
|
deliveryFeePerKm: deliveryFeePerKm,
|
|
deliveryBaseFee: deliveryBaseFee,
|
|
reviewDisplayType: reviewDisplayType,
|
|
reviewDisplayPolicy: reviewDisplayPolicy,
|
|
subscriptionLevel: subscriptionLevel,
|
|
limitOutlet: limitOutlet,
|
|
subscriptionExpiresAt: subscriptionExpiresAt,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String businessCode,
|
|
required String businessName,
|
|
Value<String?> businessEmail = const Value.absent(),
|
|
Value<String?> businessPhone = const Value.absent(),
|
|
Value<String?> businessType = const Value.absent(),
|
|
Value<String?> localLogoPath = const Value.absent(),
|
|
Value<String?> serverLogoUrl = const Value.absent(),
|
|
Value<String?> subdomain = const Value.absent(),
|
|
Value<String?> onlinStoreName = const Value.absent(),
|
|
Value<String?> onlineOpenTime = const Value.absent(),
|
|
Value<String?> onlineCloseTime = const Value.absent(),
|
|
Value<bool> isCloseService = const Value.absent(),
|
|
Value<int> preparationTimeMinutes = const Value.absent(),
|
|
Value<int> orderIntervalMinutes = const Value.absent(),
|
|
Value<bool> allowCod = const Value.absent(),
|
|
Value<double> maxDeliveryRadiusKm = const Value.absent(),
|
|
Value<String> deliveryFeeType = const Value.absent(),
|
|
Value<double> deliveryFlatFee = const Value.absent(),
|
|
Value<double> deliveryFeePerKm = const Value.absent(),
|
|
Value<double> deliveryBaseFee = const Value.absent(),
|
|
Value<String> reviewDisplayType = const Value.absent(),
|
|
Value<String> reviewDisplayPolicy = const Value.absent(),
|
|
Value<String> subscriptionLevel = const Value.absent(),
|
|
Value<int> limitOutlet = const Value.absent(),
|
|
Value<DateTime?> subscriptionExpiresAt = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => TenantsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
businessCode: businessCode,
|
|
businessName: businessName,
|
|
businessEmail: businessEmail,
|
|
businessPhone: businessPhone,
|
|
businessType: businessType,
|
|
localLogoPath: localLogoPath,
|
|
serverLogoUrl: serverLogoUrl,
|
|
subdomain: subdomain,
|
|
onlinStoreName: onlinStoreName,
|
|
onlineOpenTime: onlineOpenTime,
|
|
onlineCloseTime: onlineCloseTime,
|
|
isCloseService: isCloseService,
|
|
preparationTimeMinutes: preparationTimeMinutes,
|
|
orderIntervalMinutes: orderIntervalMinutes,
|
|
allowCod: allowCod,
|
|
maxDeliveryRadiusKm: maxDeliveryRadiusKm,
|
|
deliveryFeeType: deliveryFeeType,
|
|
deliveryFlatFee: deliveryFlatFee,
|
|
deliveryFeePerKm: deliveryFeePerKm,
|
|
deliveryBaseFee: deliveryBaseFee,
|
|
reviewDisplayType: reviewDisplayType,
|
|
reviewDisplayPolicy: reviewDisplayPolicy,
|
|
subscriptionLevel: subscriptionLevel,
|
|
limitOutlet: limitOutlet,
|
|
subscriptionExpiresAt: subscriptionExpiresAt,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
|
.toList(),
|
|
prefetchHooksCallback: null,
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$TenantsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$TenantsTable,
|
|
Tenant,
|
|
$$TenantsTableFilterComposer,
|
|
$$TenantsTableOrderingComposer,
|
|
$$TenantsTableAnnotationComposer,
|
|
$$TenantsTableCreateCompanionBuilder,
|
|
$$TenantsTableUpdateCompanionBuilder,
|
|
(Tenant, BaseReferences<_$AppDatabase, $TenantsTable, Tenant>),
|
|
Tenant,
|
|
PrefetchHooks Function()
|
|
>;
|
|
typedef $$TenantPaymentMethodsTableCreateCompanionBuilder =
|
|
TenantPaymentMethodsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String?> sourceName,
|
|
Value<String?> accountNumber,
|
|
Value<String?> receipentName,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$TenantPaymentMethodsTableUpdateCompanionBuilder =
|
|
TenantPaymentMethodsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String?> sourceName,
|
|
Value<String?> accountNumber,
|
|
Value<String?> receipentName,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
class $$TenantPaymentMethodsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $TenantPaymentMethodsTable> {
|
|
$$TenantPaymentMethodsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get sourceName => $composableBuilder(
|
|
column: $table.sourceName,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get accountNumber => $composableBuilder(
|
|
column: $table.accountNumber,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get receipentName => $composableBuilder(
|
|
column: $table.receipentName,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
}
|
|
|
|
class $$TenantPaymentMethodsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $TenantPaymentMethodsTable> {
|
|
$$TenantPaymentMethodsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get sourceName => $composableBuilder(
|
|
column: $table.sourceName,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get accountNumber => $composableBuilder(
|
|
column: $table.accountNumber,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get receipentName => $composableBuilder(
|
|
column: $table.receipentName,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$TenantPaymentMethodsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $TenantPaymentMethodsTable> {
|
|
$$TenantPaymentMethodsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get sourceName => $composableBuilder(
|
|
column: $table.sourceName,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get accountNumber => $composableBuilder(
|
|
column: $table.accountNumber,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get receipentName => $composableBuilder(
|
|
column: $table.receipentName,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
}
|
|
|
|
class $$TenantPaymentMethodsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$TenantPaymentMethodsTable,
|
|
TenantPaymentMethod,
|
|
$$TenantPaymentMethodsTableFilterComposer,
|
|
$$TenantPaymentMethodsTableOrderingComposer,
|
|
$$TenantPaymentMethodsTableAnnotationComposer,
|
|
$$TenantPaymentMethodsTableCreateCompanionBuilder,
|
|
$$TenantPaymentMethodsTableUpdateCompanionBuilder,
|
|
(
|
|
TenantPaymentMethod,
|
|
BaseReferences<
|
|
_$AppDatabase,
|
|
$TenantPaymentMethodsTable,
|
|
TenantPaymentMethod
|
|
>,
|
|
),
|
|
TenantPaymentMethod,
|
|
PrefetchHooks Function()
|
|
> {
|
|
$$TenantPaymentMethodsTableTableManager(
|
|
_$AppDatabase db,
|
|
$TenantPaymentMethodsTable table,
|
|
) : super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$TenantPaymentMethodsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$TenantPaymentMethodsTableOrderingComposer(
|
|
$db: db,
|
|
$table: table,
|
|
),
|
|
createComputedFieldComposer: () =>
|
|
$$TenantPaymentMethodsTableAnnotationComposer(
|
|
$db: db,
|
|
$table: table,
|
|
),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> sourceName = const Value.absent(),
|
|
Value<String?> accountNumber = const Value.absent(),
|
|
Value<String?> receipentName = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => TenantPaymentMethodsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
sourceName: sourceName,
|
|
accountNumber: accountNumber,
|
|
receipentName: receipentName,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> sourceName = const Value.absent(),
|
|
Value<String?> accountNumber = const Value.absent(),
|
|
Value<String?> receipentName = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => TenantPaymentMethodsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
sourceName: sourceName,
|
|
accountNumber: accountNumber,
|
|
receipentName: receipentName,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
|
.toList(),
|
|
prefetchHooksCallback: null,
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$TenantPaymentMethodsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$TenantPaymentMethodsTable,
|
|
TenantPaymentMethod,
|
|
$$TenantPaymentMethodsTableFilterComposer,
|
|
$$TenantPaymentMethodsTableOrderingComposer,
|
|
$$TenantPaymentMethodsTableAnnotationComposer,
|
|
$$TenantPaymentMethodsTableCreateCompanionBuilder,
|
|
$$TenantPaymentMethodsTableUpdateCompanionBuilder,
|
|
(
|
|
TenantPaymentMethod,
|
|
BaseReferences<
|
|
_$AppDatabase,
|
|
$TenantPaymentMethodsTable,
|
|
TenantPaymentMethod
|
|
>,
|
|
),
|
|
TenantPaymentMethod,
|
|
PrefetchHooks Function()
|
|
>;
|
|
typedef $$OutletsTableCreateCompanionBuilder =
|
|
OutletsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String name,
|
|
Value<String?> email,
|
|
Value<String?> phoneNumber,
|
|
Value<String?> fullAddress,
|
|
Value<double?> latitude,
|
|
Value<double?> longitude,
|
|
Value<String?> localPhotoPath,
|
|
Value<String?> localBannerPath,
|
|
Value<String?> serverPhotoUrl,
|
|
Value<String?> serverBannerUrl,
|
|
Value<bool> isMainOutlet,
|
|
Value<bool> isActive,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$OutletsTableUpdateCompanionBuilder =
|
|
OutletsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> name,
|
|
Value<String?> email,
|
|
Value<String?> phoneNumber,
|
|
Value<String?> fullAddress,
|
|
Value<double?> latitude,
|
|
Value<double?> longitude,
|
|
Value<String?> localPhotoPath,
|
|
Value<String?> localBannerPath,
|
|
Value<String?> serverPhotoUrl,
|
|
Value<String?> serverBannerUrl,
|
|
Value<bool> isMainOutlet,
|
|
Value<bool> isActive,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$OutletsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $OutletsTable, Outlet> {
|
|
$$OutletsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static MultiTypedResultKey<$UsersTable, List<User>> _usersRefsTable(
|
|
_$AppDatabase db,
|
|
) => MultiTypedResultKey.fromTable(
|
|
db.users,
|
|
aliasName: $_aliasNameGenerator(db.outlets.localId, db.users.outletId),
|
|
);
|
|
|
|
$$UsersTableProcessedTableManager get usersRefs {
|
|
final manager = $$UsersTableTableManager($_db, $_db.users).filter(
|
|
(f) => f.outletId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_usersRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$CustomersTable, List<Customer>>
|
|
_customersRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.customers,
|
|
aliasName: $_aliasNameGenerator(db.outlets.localId, db.customers.outletId),
|
|
);
|
|
|
|
$$CustomersTableProcessedTableManager get customersRefs {
|
|
final manager = $$CustomersTableTableManager($_db, $_db.customers).filter(
|
|
(f) => f.outletId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_customersRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$OutletInventoriesTable, List<OutletInventory>>
|
|
_outletInventoriesRefsTable(_$AppDatabase db) =>
|
|
MultiTypedResultKey.fromTable(
|
|
db.outletInventories,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.outlets.localId,
|
|
db.outletInventories.outletId,
|
|
),
|
|
);
|
|
|
|
$$OutletInventoriesTableProcessedTableManager get outletInventoriesRefs {
|
|
final manager =
|
|
$$OutletInventoriesTableTableManager(
|
|
$_db,
|
|
$_db.outletInventories,
|
|
).filter(
|
|
(f) =>
|
|
f.outletId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_outletInventoriesRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$StockCardsTable, List<StockCard>>
|
|
_stockCardsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.stockCards,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.outlets.localId,
|
|
db.stockCards.receiveFromId,
|
|
),
|
|
);
|
|
|
|
$$StockCardsTableProcessedTableManager get stockCardsRefs {
|
|
final manager = $$StockCardsTableTableManager($_db, $_db.stockCards).filter(
|
|
(f) =>
|
|
f.receiveFromId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_stockCardsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$OrdersTable, List<Order>> _ordersRefsTable(
|
|
_$AppDatabase db,
|
|
) => MultiTypedResultKey.fromTable(
|
|
db.orders,
|
|
aliasName: $_aliasNameGenerator(db.outlets.localId, db.orders.outletId),
|
|
);
|
|
|
|
$$OrdersTableProcessedTableManager get ordersRefs {
|
|
final manager = $$OrdersTableTableManager($_db, $_db.orders).filter(
|
|
(f) => f.outletId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_ordersRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$PurchasesTable, List<Purchase>>
|
|
_purchasesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.purchases,
|
|
aliasName: $_aliasNameGenerator(db.outlets.localId, db.purchases.outletId),
|
|
);
|
|
|
|
$$PurchasesTableProcessedTableManager get purchasesRefs {
|
|
final manager = $$PurchasesTableTableManager($_db, $_db.purchases).filter(
|
|
(f) => f.outletId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_purchasesRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$TransactionsTable, List<Transaction>>
|
|
_transactionsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.transactions,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.outlets.localId,
|
|
db.transactions.outletId,
|
|
),
|
|
);
|
|
|
|
$$TransactionsTableProcessedTableManager get transactionsRefs {
|
|
final manager = $$TransactionsTableTableManager($_db, $_db.transactions)
|
|
.filter(
|
|
(f) =>
|
|
f.outletId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$OutletCampaignsTable, List<OutletCampaign>>
|
|
_outletCampaignsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.outletCampaigns,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.outlets.localId,
|
|
db.outletCampaigns.outletId,
|
|
),
|
|
);
|
|
|
|
$$OutletCampaignsTableProcessedTableManager get outletCampaignsRefs {
|
|
final manager =
|
|
$$OutletCampaignsTableTableManager($_db, $_db.outletCampaigns).filter(
|
|
(f) =>
|
|
f.outletId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_outletCampaignsRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$OutletsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $OutletsTable> {
|
|
$$OutletsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get email => $composableBuilder(
|
|
column: $table.email,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get fullAddress => $composableBuilder(
|
|
column: $table.fullAddress,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get latitude => $composableBuilder(
|
|
column: $table.latitude,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get longitude => $composableBuilder(
|
|
column: $table.longitude,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get localPhotoPath => $composableBuilder(
|
|
column: $table.localPhotoPath,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get localBannerPath => $composableBuilder(
|
|
column: $table.localBannerPath,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverPhotoUrl => $composableBuilder(
|
|
column: $table.serverPhotoUrl,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverBannerUrl => $composableBuilder(
|
|
column: $table.serverBannerUrl,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isMainOutlet => $composableBuilder(
|
|
column: $table.isMainOutlet,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isActive => $composableBuilder(
|
|
column: $table.isActive,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> usersRefs(
|
|
Expression<bool> Function($$UsersTableFilterComposer f) f,
|
|
) {
|
|
final $$UsersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> customersRefs(
|
|
Expression<bool> Function($$CustomersTableFilterComposer f) f,
|
|
) {
|
|
final $$CustomersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> outletInventoriesRefs(
|
|
Expression<bool> Function($$OutletInventoriesTableFilterComposer f) f,
|
|
) {
|
|
final $$OutletInventoriesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.outletInventories,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletInventoriesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outletInventories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> stockCardsRefs(
|
|
Expression<bool> Function($$StockCardsTableFilterComposer f) f,
|
|
) {
|
|
final $$StockCardsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.stockCards,
|
|
getReferencedColumn: (t) => t.receiveFromId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$StockCardsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.stockCards,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> ordersRefs(
|
|
Expression<bool> Function($$OrdersTableFilterComposer f) f,
|
|
) {
|
|
final $$OrdersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orders,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrdersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.orders,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> purchasesRefs(
|
|
Expression<bool> Function($$PurchasesTableFilterComposer f) f,
|
|
) {
|
|
final $$PurchasesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.purchases,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchasesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.purchases,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> transactionsRefs(
|
|
Expression<bool> Function($$TransactionsTableFilterComposer f) f,
|
|
) {
|
|
final $$TransactionsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.transactions,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$TransactionsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.transactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> outletCampaignsRefs(
|
|
Expression<bool> Function($$OutletCampaignsTableFilterComposer f) f,
|
|
) {
|
|
final $$OutletCampaignsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.outletCampaigns,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletCampaignsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outletCampaigns,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$OutletsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $OutletsTable> {
|
|
$$OutletsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get email => $composableBuilder(
|
|
column: $table.email,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get fullAddress => $composableBuilder(
|
|
column: $table.fullAddress,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get latitude => $composableBuilder(
|
|
column: $table.latitude,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get longitude => $composableBuilder(
|
|
column: $table.longitude,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get localPhotoPath => $composableBuilder(
|
|
column: $table.localPhotoPath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get localBannerPath => $composableBuilder(
|
|
column: $table.localBannerPath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverPhotoUrl => $composableBuilder(
|
|
column: $table.serverPhotoUrl,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverBannerUrl => $composableBuilder(
|
|
column: $table.serverBannerUrl,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isMainOutlet => $composableBuilder(
|
|
column: $table.isMainOutlet,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isActive => $composableBuilder(
|
|
column: $table.isActive,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$OutletsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $OutletsTable> {
|
|
$$OutletsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get email =>
|
|
$composableBuilder(column: $table.email, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get fullAddress => $composableBuilder(
|
|
column: $table.fullAddress,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get latitude =>
|
|
$composableBuilder(column: $table.latitude, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get longitude =>
|
|
$composableBuilder(column: $table.longitude, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get localPhotoPath => $composableBuilder(
|
|
column: $table.localPhotoPath,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get localBannerPath => $composableBuilder(
|
|
column: $table.localBannerPath,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get serverPhotoUrl => $composableBuilder(
|
|
column: $table.serverPhotoUrl,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get serverBannerUrl => $composableBuilder(
|
|
column: $table.serverBannerUrl,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get isMainOutlet => $composableBuilder(
|
|
column: $table.isMainOutlet,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get isActive =>
|
|
$composableBuilder(column: $table.isActive, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
Expression<T> usersRefs<T extends Object>(
|
|
Expression<T> Function($$UsersTableAnnotationComposer a) f,
|
|
) {
|
|
final $$UsersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> customersRefs<T extends Object>(
|
|
Expression<T> Function($$CustomersTableAnnotationComposer a) f,
|
|
) {
|
|
final $$CustomersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> outletInventoriesRefs<T extends Object>(
|
|
Expression<T> Function($$OutletInventoriesTableAnnotationComposer a) f,
|
|
) {
|
|
final $$OutletInventoriesTableAnnotationComposer composer =
|
|
$composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.outletInventories,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletInventoriesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outletInventories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> stockCardsRefs<T extends Object>(
|
|
Expression<T> Function($$StockCardsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$StockCardsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.stockCards,
|
|
getReferencedColumn: (t) => t.receiveFromId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$StockCardsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.stockCards,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> ordersRefs<T extends Object>(
|
|
Expression<T> Function($$OrdersTableAnnotationComposer a) f,
|
|
) {
|
|
final $$OrdersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orders,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrdersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.orders,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> purchasesRefs<T extends Object>(
|
|
Expression<T> Function($$PurchasesTableAnnotationComposer a) f,
|
|
) {
|
|
final $$PurchasesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.purchases,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchasesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.purchases,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> transactionsRefs<T extends Object>(
|
|
Expression<T> Function($$TransactionsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$TransactionsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.transactions,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$TransactionsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.transactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> outletCampaignsRefs<T extends Object>(
|
|
Expression<T> Function($$OutletCampaignsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$OutletCampaignsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.outletCampaigns,
|
|
getReferencedColumn: (t) => t.outletId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletCampaignsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outletCampaigns,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$OutletsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$OutletsTable,
|
|
Outlet,
|
|
$$OutletsTableFilterComposer,
|
|
$$OutletsTableOrderingComposer,
|
|
$$OutletsTableAnnotationComposer,
|
|
$$OutletsTableCreateCompanionBuilder,
|
|
$$OutletsTableUpdateCompanionBuilder,
|
|
(Outlet, $$OutletsTableReferences),
|
|
Outlet,
|
|
PrefetchHooks Function({
|
|
bool usersRefs,
|
|
bool customersRefs,
|
|
bool outletInventoriesRefs,
|
|
bool stockCardsRefs,
|
|
bool ordersRefs,
|
|
bool purchasesRefs,
|
|
bool transactionsRefs,
|
|
bool outletCampaignsRefs,
|
|
})
|
|
> {
|
|
$$OutletsTableTableManager(_$AppDatabase db, $OutletsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$OutletsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$OutletsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$OutletsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> fullAddress = const Value.absent(),
|
|
Value<double?> latitude = const Value.absent(),
|
|
Value<double?> longitude = const Value.absent(),
|
|
Value<String?> localPhotoPath = const Value.absent(),
|
|
Value<String?> localBannerPath = const Value.absent(),
|
|
Value<String?> serverPhotoUrl = const Value.absent(),
|
|
Value<String?> serverBannerUrl = const Value.absent(),
|
|
Value<bool> isMainOutlet = const Value.absent(),
|
|
Value<bool> isActive = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OutletsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
name: name,
|
|
email: email,
|
|
phoneNumber: phoneNumber,
|
|
fullAddress: fullAddress,
|
|
latitude: latitude,
|
|
longitude: longitude,
|
|
localPhotoPath: localPhotoPath,
|
|
localBannerPath: localBannerPath,
|
|
serverPhotoUrl: serverPhotoUrl,
|
|
serverBannerUrl: serverBannerUrl,
|
|
isMainOutlet: isMainOutlet,
|
|
isActive: isActive,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String name,
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> fullAddress = const Value.absent(),
|
|
Value<double?> latitude = const Value.absent(),
|
|
Value<double?> longitude = const Value.absent(),
|
|
Value<String?> localPhotoPath = const Value.absent(),
|
|
Value<String?> localBannerPath = const Value.absent(),
|
|
Value<String?> serverPhotoUrl = const Value.absent(),
|
|
Value<String?> serverBannerUrl = const Value.absent(),
|
|
Value<bool> isMainOutlet = const Value.absent(),
|
|
Value<bool> isActive = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OutletsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
name: name,
|
|
email: email,
|
|
phoneNumber: phoneNumber,
|
|
fullAddress: fullAddress,
|
|
latitude: latitude,
|
|
longitude: longitude,
|
|
localPhotoPath: localPhotoPath,
|
|
localBannerPath: localBannerPath,
|
|
serverPhotoUrl: serverPhotoUrl,
|
|
serverBannerUrl: serverBannerUrl,
|
|
isMainOutlet: isMainOutlet,
|
|
isActive: isActive,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$OutletsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
usersRefs = false,
|
|
customersRefs = false,
|
|
outletInventoriesRefs = false,
|
|
stockCardsRefs = false,
|
|
ordersRefs = false,
|
|
purchasesRefs = false,
|
|
transactionsRefs = false,
|
|
outletCampaignsRefs = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (usersRefs) db.users,
|
|
if (customersRefs) db.customers,
|
|
if (outletInventoriesRefs) db.outletInventories,
|
|
if (stockCardsRefs) db.stockCards,
|
|
if (ordersRefs) db.orders,
|
|
if (purchasesRefs) db.purchases,
|
|
if (transactionsRefs) db.transactions,
|
|
if (outletCampaignsRefs) db.outletCampaigns,
|
|
],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (usersRefs)
|
|
await $_getPrefetchedData<Outlet, $OutletsTable, User>(
|
|
currentTable: table,
|
|
referencedTable: $$OutletsTableReferences
|
|
._usersRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OutletsTableReferences(db, table, p0).usersRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.outletId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (customersRefs)
|
|
await $_getPrefetchedData<
|
|
Outlet,
|
|
$OutletsTable,
|
|
Customer
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$OutletsTableReferences
|
|
._customersRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OutletsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).customersRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.outletId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (outletInventoriesRefs)
|
|
await $_getPrefetchedData<
|
|
Outlet,
|
|
$OutletsTable,
|
|
OutletInventory
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$OutletsTableReferences
|
|
._outletInventoriesRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OutletsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).outletInventoriesRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.outletId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (stockCardsRefs)
|
|
await $_getPrefetchedData<
|
|
Outlet,
|
|
$OutletsTable,
|
|
StockCard
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$OutletsTableReferences
|
|
._stockCardsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OutletsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).stockCardsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.receiveFromId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (ordersRefs)
|
|
await $_getPrefetchedData<Outlet, $OutletsTable, Order>(
|
|
currentTable: table,
|
|
referencedTable: $$OutletsTableReferences
|
|
._ordersRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OutletsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).ordersRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.outletId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (purchasesRefs)
|
|
await $_getPrefetchedData<
|
|
Outlet,
|
|
$OutletsTable,
|
|
Purchase
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$OutletsTableReferences
|
|
._purchasesRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OutletsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).purchasesRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.outletId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (transactionsRefs)
|
|
await $_getPrefetchedData<
|
|
Outlet,
|
|
$OutletsTable,
|
|
Transaction
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$OutletsTableReferences
|
|
._transactionsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OutletsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).transactionsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.outletId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (outletCampaignsRefs)
|
|
await $_getPrefetchedData<
|
|
Outlet,
|
|
$OutletsTable,
|
|
OutletCampaign
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$OutletsTableReferences
|
|
._outletCampaignsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OutletsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).outletCampaignsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.outletId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$OutletsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$OutletsTable,
|
|
Outlet,
|
|
$$OutletsTableFilterComposer,
|
|
$$OutletsTableOrderingComposer,
|
|
$$OutletsTableAnnotationComposer,
|
|
$$OutletsTableCreateCompanionBuilder,
|
|
$$OutletsTableUpdateCompanionBuilder,
|
|
(Outlet, $$OutletsTableReferences),
|
|
Outlet,
|
|
PrefetchHooks Function({
|
|
bool usersRefs,
|
|
bool customersRefs,
|
|
bool outletInventoriesRefs,
|
|
bool stockCardsRefs,
|
|
bool ordersRefs,
|
|
bool purchasesRefs,
|
|
bool transactionsRefs,
|
|
bool outletCampaignsRefs,
|
|
})
|
|
>;
|
|
typedef $$UsersTableCreateCompanionBuilder =
|
|
UsersCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String outletId,
|
|
required String name,
|
|
Value<String?> email,
|
|
Value<String?> phoneNumber,
|
|
Value<String?> passwordHash,
|
|
required String role,
|
|
Value<String?> placeOfBirth,
|
|
Value<String?> dateOfBirth,
|
|
Value<String?> shiftName,
|
|
Value<String?> shiftStartTime,
|
|
Value<String?> shiftEndTime,
|
|
Value<bool> isActive,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$UsersTableUpdateCompanionBuilder =
|
|
UsersCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> outletId,
|
|
Value<String> name,
|
|
Value<String?> email,
|
|
Value<String?> phoneNumber,
|
|
Value<String?> passwordHash,
|
|
Value<String> role,
|
|
Value<String?> placeOfBirth,
|
|
Value<String?> dateOfBirth,
|
|
Value<String?> shiftName,
|
|
Value<String?> shiftStartTime,
|
|
Value<String?> shiftEndTime,
|
|
Value<bool> isActive,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$UsersTableReferences
|
|
extends BaseReferences<_$AppDatabase, $UsersTable, User> {
|
|
$$UsersTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $OutletsTable _outletIdTable(_$AppDatabase db) => db.outlets
|
|
.createAlias($_aliasNameGenerator(db.users.outletId, db.outlets.localId));
|
|
|
|
$$OutletsTableProcessedTableManager get outletId {
|
|
final $_column = $_itemColumn<String>('outlet_id')!;
|
|
|
|
final manager = $$OutletsTableTableManager(
|
|
$_db,
|
|
$_db.outlets,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_outletIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$StockCardsTable, List<StockCard>>
|
|
_stockCardsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.stockCards,
|
|
aliasName: $_aliasNameGenerator(db.users.localId, db.stockCards.userId),
|
|
);
|
|
|
|
$$StockCardsTableProcessedTableManager get stockCardsRefs {
|
|
final manager = $$StockCardsTableTableManager($_db, $_db.stockCards).filter(
|
|
(f) => f.userId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_stockCardsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$OrdersTable, List<Order>> _ordersRefsTable(
|
|
_$AppDatabase db,
|
|
) => MultiTypedResultKey.fromTable(
|
|
db.orders,
|
|
aliasName: $_aliasNameGenerator(db.users.localId, db.orders.userId),
|
|
);
|
|
|
|
$$OrdersTableProcessedTableManager get ordersRefs {
|
|
final manager = $$OrdersTableTableManager($_db, $_db.orders).filter(
|
|
(f) => f.userId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_ordersRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$PurchasesTable, List<Purchase>>
|
|
_purchasesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.purchases,
|
|
aliasName: $_aliasNameGenerator(db.users.localId, db.purchases.userId),
|
|
);
|
|
|
|
$$PurchasesTableProcessedTableManager get purchasesRefs {
|
|
final manager = $$PurchasesTableTableManager($_db, $_db.purchases).filter(
|
|
(f) => f.userId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_purchasesRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$TransactionsTable, List<Transaction>>
|
|
_transactionsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.transactions,
|
|
aliasName: $_aliasNameGenerator(db.users.localId, db.transactions.userId),
|
|
);
|
|
|
|
$$TransactionsTableProcessedTableManager get transactionsRefs {
|
|
final manager = $$TransactionsTableTableManager($_db, $_db.transactions)
|
|
.filter(
|
|
(f) => f.userId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$UsersTableFilterComposer extends Composer<_$AppDatabase, $UsersTable> {
|
|
$$UsersTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get email => $composableBuilder(
|
|
column: $table.email,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get passwordHash => $composableBuilder(
|
|
column: $table.passwordHash,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get role => $composableBuilder(
|
|
column: $table.role,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get placeOfBirth => $composableBuilder(
|
|
column: $table.placeOfBirth,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get dateOfBirth => $composableBuilder(
|
|
column: $table.dateOfBirth,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get shiftName => $composableBuilder(
|
|
column: $table.shiftName,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get shiftStartTime => $composableBuilder(
|
|
column: $table.shiftStartTime,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get shiftEndTime => $composableBuilder(
|
|
column: $table.shiftEndTime,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isActive => $composableBuilder(
|
|
column: $table.isActive,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$OutletsTableFilterComposer get outletId {
|
|
final $$OutletsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> stockCardsRefs(
|
|
Expression<bool> Function($$StockCardsTableFilterComposer f) f,
|
|
) {
|
|
final $$StockCardsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.stockCards,
|
|
getReferencedColumn: (t) => t.userId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$StockCardsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.stockCards,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> ordersRefs(
|
|
Expression<bool> Function($$OrdersTableFilterComposer f) f,
|
|
) {
|
|
final $$OrdersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orders,
|
|
getReferencedColumn: (t) => t.userId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrdersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.orders,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> purchasesRefs(
|
|
Expression<bool> Function($$PurchasesTableFilterComposer f) f,
|
|
) {
|
|
final $$PurchasesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.purchases,
|
|
getReferencedColumn: (t) => t.userId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchasesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.purchases,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> transactionsRefs(
|
|
Expression<bool> Function($$TransactionsTableFilterComposer f) f,
|
|
) {
|
|
final $$TransactionsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.transactions,
|
|
getReferencedColumn: (t) => t.userId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$TransactionsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.transactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$UsersTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $UsersTable> {
|
|
$$UsersTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get email => $composableBuilder(
|
|
column: $table.email,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get passwordHash => $composableBuilder(
|
|
column: $table.passwordHash,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get role => $composableBuilder(
|
|
column: $table.role,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get placeOfBirth => $composableBuilder(
|
|
column: $table.placeOfBirth,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get dateOfBirth => $composableBuilder(
|
|
column: $table.dateOfBirth,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get shiftName => $composableBuilder(
|
|
column: $table.shiftName,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get shiftStartTime => $composableBuilder(
|
|
column: $table.shiftStartTime,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get shiftEndTime => $composableBuilder(
|
|
column: $table.shiftEndTime,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isActive => $composableBuilder(
|
|
column: $table.isActive,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$OutletsTableOrderingComposer get outletId {
|
|
final $$OutletsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$UsersTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $UsersTable> {
|
|
$$UsersTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get email =>
|
|
$composableBuilder(column: $table.email, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get passwordHash => $composableBuilder(
|
|
column: $table.passwordHash,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get role =>
|
|
$composableBuilder(column: $table.role, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get placeOfBirth => $composableBuilder(
|
|
column: $table.placeOfBirth,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get dateOfBirth => $composableBuilder(
|
|
column: $table.dateOfBirth,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get shiftName =>
|
|
$composableBuilder(column: $table.shiftName, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get shiftStartTime => $composableBuilder(
|
|
column: $table.shiftStartTime,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get shiftEndTime => $composableBuilder(
|
|
column: $table.shiftEndTime,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get isActive =>
|
|
$composableBuilder(column: $table.isActive, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
$$OutletsTableAnnotationComposer get outletId {
|
|
final $$OutletsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> stockCardsRefs<T extends Object>(
|
|
Expression<T> Function($$StockCardsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$StockCardsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.stockCards,
|
|
getReferencedColumn: (t) => t.userId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$StockCardsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.stockCards,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> ordersRefs<T extends Object>(
|
|
Expression<T> Function($$OrdersTableAnnotationComposer a) f,
|
|
) {
|
|
final $$OrdersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orders,
|
|
getReferencedColumn: (t) => t.userId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrdersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.orders,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> purchasesRefs<T extends Object>(
|
|
Expression<T> Function($$PurchasesTableAnnotationComposer a) f,
|
|
) {
|
|
final $$PurchasesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.purchases,
|
|
getReferencedColumn: (t) => t.userId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchasesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.purchases,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> transactionsRefs<T extends Object>(
|
|
Expression<T> Function($$TransactionsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$TransactionsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.transactions,
|
|
getReferencedColumn: (t) => t.userId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$TransactionsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.transactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$UsersTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$UsersTable,
|
|
User,
|
|
$$UsersTableFilterComposer,
|
|
$$UsersTableOrderingComposer,
|
|
$$UsersTableAnnotationComposer,
|
|
$$UsersTableCreateCompanionBuilder,
|
|
$$UsersTableUpdateCompanionBuilder,
|
|
(User, $$UsersTableReferences),
|
|
User,
|
|
PrefetchHooks Function({
|
|
bool outletId,
|
|
bool stockCardsRefs,
|
|
bool ordersRefs,
|
|
bool purchasesRefs,
|
|
bool transactionsRefs,
|
|
})
|
|
> {
|
|
$$UsersTableTableManager(_$AppDatabase db, $UsersTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$UsersTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$UsersTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$UsersTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> outletId = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> passwordHash = const Value.absent(),
|
|
Value<String> role = const Value.absent(),
|
|
Value<String?> placeOfBirth = const Value.absent(),
|
|
Value<String?> dateOfBirth = const Value.absent(),
|
|
Value<String?> shiftName = const Value.absent(),
|
|
Value<String?> shiftStartTime = const Value.absent(),
|
|
Value<String?> shiftEndTime = const Value.absent(),
|
|
Value<bool> isActive = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => UsersCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletId: outletId,
|
|
name: name,
|
|
email: email,
|
|
phoneNumber: phoneNumber,
|
|
passwordHash: passwordHash,
|
|
role: role,
|
|
placeOfBirth: placeOfBirth,
|
|
dateOfBirth: dateOfBirth,
|
|
shiftName: shiftName,
|
|
shiftStartTime: shiftStartTime,
|
|
shiftEndTime: shiftEndTime,
|
|
isActive: isActive,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String outletId,
|
|
required String name,
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> passwordHash = const Value.absent(),
|
|
required String role,
|
|
Value<String?> placeOfBirth = const Value.absent(),
|
|
Value<String?> dateOfBirth = const Value.absent(),
|
|
Value<String?> shiftName = const Value.absent(),
|
|
Value<String?> shiftStartTime = const Value.absent(),
|
|
Value<String?> shiftEndTime = const Value.absent(),
|
|
Value<bool> isActive = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => UsersCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletId: outletId,
|
|
name: name,
|
|
email: email,
|
|
phoneNumber: phoneNumber,
|
|
passwordHash: passwordHash,
|
|
role: role,
|
|
placeOfBirth: placeOfBirth,
|
|
dateOfBirth: dateOfBirth,
|
|
shiftName: shiftName,
|
|
shiftStartTime: shiftStartTime,
|
|
shiftEndTime: shiftEndTime,
|
|
isActive: isActive,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) =>
|
|
(e.readTable(table), $$UsersTableReferences(db, table, e)),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
outletId = false,
|
|
stockCardsRefs = false,
|
|
ordersRefs = false,
|
|
purchasesRefs = false,
|
|
transactionsRefs = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (stockCardsRefs) db.stockCards,
|
|
if (ordersRefs) db.orders,
|
|
if (purchasesRefs) db.purchases,
|
|
if (transactionsRefs) db.transactions,
|
|
],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (outletId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.outletId,
|
|
referencedTable: $$UsersTableReferences
|
|
._outletIdTable(db),
|
|
referencedColumn: $$UsersTableReferences
|
|
._outletIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (stockCardsRefs)
|
|
await $_getPrefetchedData<User, $UsersTable, StockCard>(
|
|
currentTable: table,
|
|
referencedTable: $$UsersTableReferences
|
|
._stockCardsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$UsersTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).stockCardsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.userId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (ordersRefs)
|
|
await $_getPrefetchedData<User, $UsersTable, Order>(
|
|
currentTable: table,
|
|
referencedTable: $$UsersTableReferences
|
|
._ordersRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$UsersTableReferences(db, table, p0).ordersRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.userId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (purchasesRefs)
|
|
await $_getPrefetchedData<User, $UsersTable, Purchase>(
|
|
currentTable: table,
|
|
referencedTable: $$UsersTableReferences
|
|
._purchasesRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$UsersTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).purchasesRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.userId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (transactionsRefs)
|
|
await $_getPrefetchedData<
|
|
User,
|
|
$UsersTable,
|
|
Transaction
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$UsersTableReferences
|
|
._transactionsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$UsersTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).transactionsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.userId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$UsersTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$UsersTable,
|
|
User,
|
|
$$UsersTableFilterComposer,
|
|
$$UsersTableOrderingComposer,
|
|
$$UsersTableAnnotationComposer,
|
|
$$UsersTableCreateCompanionBuilder,
|
|
$$UsersTableUpdateCompanionBuilder,
|
|
(User, $$UsersTableReferences),
|
|
User,
|
|
PrefetchHooks Function({
|
|
bool outletId,
|
|
bool stockCardsRefs,
|
|
bool ordersRefs,
|
|
bool purchasesRefs,
|
|
bool transactionsRefs,
|
|
})
|
|
>;
|
|
typedef $$CustomersTableCreateCompanionBuilder =
|
|
CustomersCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String outletId,
|
|
required String name,
|
|
Value<String?> email,
|
|
Value<String?> phoneNumber,
|
|
Value<String?> passwordHash,
|
|
required String source,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$CustomersTableUpdateCompanionBuilder =
|
|
CustomersCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> outletId,
|
|
Value<String> name,
|
|
Value<String?> email,
|
|
Value<String?> phoneNumber,
|
|
Value<String?> passwordHash,
|
|
Value<String> source,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$CustomersTableReferences
|
|
extends BaseReferences<_$AppDatabase, $CustomersTable, Customer> {
|
|
$$CustomersTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $OutletsTable _outletIdTable(_$AppDatabase db) =>
|
|
db.outlets.createAlias(
|
|
$_aliasNameGenerator(db.customers.outletId, db.outlets.localId),
|
|
);
|
|
|
|
$$OutletsTableProcessedTableManager get outletId {
|
|
final $_column = $_itemColumn<String>('outlet_id')!;
|
|
|
|
final manager = $$OutletsTableTableManager(
|
|
$_db,
|
|
$_db.outlets,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_outletIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<
|
|
$CustomerAddressesTable,
|
|
List<CustomerAddressesData>
|
|
>
|
|
_customerAddressesRefsTable(_$AppDatabase db) =>
|
|
MultiTypedResultKey.fromTable(
|
|
db.customerAddresses,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.customers.localId,
|
|
db.customerAddresses.customerId,
|
|
),
|
|
);
|
|
|
|
$$CustomerAddressesTableProcessedTableManager get customerAddressesRefs {
|
|
final manager =
|
|
$$CustomerAddressesTableTableManager(
|
|
$_db,
|
|
$_db.customerAddresses,
|
|
).filter(
|
|
(f) =>
|
|
f.customerId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_customerAddressesRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$ProductReviewsTable, List<ProductReview>>
|
|
_productReviewsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.productReviews,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.customers.localId,
|
|
db.productReviews.customerId,
|
|
),
|
|
);
|
|
|
|
$$ProductReviewsTableProcessedTableManager get productReviewsRefs {
|
|
final manager = $$ProductReviewsTableTableManager($_db, $_db.productReviews)
|
|
.filter(
|
|
(f) =>
|
|
f.customerId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_productReviewsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$ProductLikesTable, List<ProductLike>>
|
|
_productLikesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.productLikes,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.customers.localId,
|
|
db.productLikes.customerId,
|
|
),
|
|
);
|
|
|
|
$$ProductLikesTableProcessedTableManager get productLikesRefs {
|
|
final manager = $$ProductLikesTableTableManager($_db, $_db.productLikes)
|
|
.filter(
|
|
(f) =>
|
|
f.customerId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_productLikesRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$OrdersTable, List<Order>> _ordersRefsTable(
|
|
_$AppDatabase db,
|
|
) => MultiTypedResultKey.fromTable(
|
|
db.orders,
|
|
aliasName: $_aliasNameGenerator(db.customers.localId, db.orders.customerId),
|
|
);
|
|
|
|
$$OrdersTableProcessedTableManager get ordersRefs {
|
|
final manager = $$OrdersTableTableManager($_db, $_db.orders).filter(
|
|
(f) => f.customerId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_ordersRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$CustomersTableFilterComposer
|
|
extends Composer<_$AppDatabase, $CustomersTable> {
|
|
$$CustomersTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get email => $composableBuilder(
|
|
column: $table.email,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get passwordHash => $composableBuilder(
|
|
column: $table.passwordHash,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get source => $composableBuilder(
|
|
column: $table.source,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$OutletsTableFilterComposer get outletId {
|
|
final $$OutletsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> customerAddressesRefs(
|
|
Expression<bool> Function($$CustomerAddressesTableFilterComposer f) f,
|
|
) {
|
|
final $$CustomerAddressesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.customerAddresses,
|
|
getReferencedColumn: (t) => t.customerId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomerAddressesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.customerAddresses,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> productReviewsRefs(
|
|
Expression<bool> Function($$ProductReviewsTableFilterComposer f) f,
|
|
) {
|
|
final $$ProductReviewsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productReviews,
|
|
getReferencedColumn: (t) => t.customerId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductReviewsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.productReviews,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> productLikesRefs(
|
|
Expression<bool> Function($$ProductLikesTableFilterComposer f) f,
|
|
) {
|
|
final $$ProductLikesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productLikes,
|
|
getReferencedColumn: (t) => t.customerId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductLikesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.productLikes,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> ordersRefs(
|
|
Expression<bool> Function($$OrdersTableFilterComposer f) f,
|
|
) {
|
|
final $$OrdersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orders,
|
|
getReferencedColumn: (t) => t.customerId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrdersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.orders,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CustomersTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $CustomersTable> {
|
|
$$CustomersTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get email => $composableBuilder(
|
|
column: $table.email,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get passwordHash => $composableBuilder(
|
|
column: $table.passwordHash,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get source => $composableBuilder(
|
|
column: $table.source,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$OutletsTableOrderingComposer get outletId {
|
|
final $$OutletsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$CustomersTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $CustomersTable> {
|
|
$$CustomersTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get email =>
|
|
$composableBuilder(column: $table.email, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get passwordHash => $composableBuilder(
|
|
column: $table.passwordHash,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get source =>
|
|
$composableBuilder(column: $table.source, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
$$OutletsTableAnnotationComposer get outletId {
|
|
final $$OutletsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> customerAddressesRefs<T extends Object>(
|
|
Expression<T> Function($$CustomerAddressesTableAnnotationComposer a) f,
|
|
) {
|
|
final $$CustomerAddressesTableAnnotationComposer composer =
|
|
$composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.customerAddresses,
|
|
getReferencedColumn: (t) => t.customerId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomerAddressesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.customerAddresses,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> productReviewsRefs<T extends Object>(
|
|
Expression<T> Function($$ProductReviewsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$ProductReviewsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productReviews,
|
|
getReferencedColumn: (t) => t.customerId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductReviewsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.productReviews,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> productLikesRefs<T extends Object>(
|
|
Expression<T> Function($$ProductLikesTableAnnotationComposer a) f,
|
|
) {
|
|
final $$ProductLikesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productLikes,
|
|
getReferencedColumn: (t) => t.customerId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductLikesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.productLikes,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> ordersRefs<T extends Object>(
|
|
Expression<T> Function($$OrdersTableAnnotationComposer a) f,
|
|
) {
|
|
final $$OrdersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orders,
|
|
getReferencedColumn: (t) => t.customerId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrdersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.orders,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CustomersTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$CustomersTable,
|
|
Customer,
|
|
$$CustomersTableFilterComposer,
|
|
$$CustomersTableOrderingComposer,
|
|
$$CustomersTableAnnotationComposer,
|
|
$$CustomersTableCreateCompanionBuilder,
|
|
$$CustomersTableUpdateCompanionBuilder,
|
|
(Customer, $$CustomersTableReferences),
|
|
Customer,
|
|
PrefetchHooks Function({
|
|
bool outletId,
|
|
bool customerAddressesRefs,
|
|
bool productReviewsRefs,
|
|
bool productLikesRefs,
|
|
bool ordersRefs,
|
|
})
|
|
> {
|
|
$$CustomersTableTableManager(_$AppDatabase db, $CustomersTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$CustomersTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$CustomersTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$CustomersTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> outletId = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> passwordHash = const Value.absent(),
|
|
Value<String> source = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => CustomersCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletId: outletId,
|
|
name: name,
|
|
email: email,
|
|
phoneNumber: phoneNumber,
|
|
passwordHash: passwordHash,
|
|
source: source,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String outletId,
|
|
required String name,
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> passwordHash = const Value.absent(),
|
|
required String source,
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => CustomersCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletId: outletId,
|
|
name: name,
|
|
email: email,
|
|
phoneNumber: phoneNumber,
|
|
passwordHash: passwordHash,
|
|
source: source,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$CustomersTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
outletId = false,
|
|
customerAddressesRefs = false,
|
|
productReviewsRefs = false,
|
|
productLikesRefs = false,
|
|
ordersRefs = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (customerAddressesRefs) db.customerAddresses,
|
|
if (productReviewsRefs) db.productReviews,
|
|
if (productLikesRefs) db.productLikes,
|
|
if (ordersRefs) db.orders,
|
|
],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (outletId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.outletId,
|
|
referencedTable: $$CustomersTableReferences
|
|
._outletIdTable(db),
|
|
referencedColumn: $$CustomersTableReferences
|
|
._outletIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (customerAddressesRefs)
|
|
await $_getPrefetchedData<
|
|
Customer,
|
|
$CustomersTable,
|
|
CustomerAddressesData
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$CustomersTableReferences
|
|
._customerAddressesRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$CustomersTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).customerAddressesRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.customerId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (productReviewsRefs)
|
|
await $_getPrefetchedData<
|
|
Customer,
|
|
$CustomersTable,
|
|
ProductReview
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$CustomersTableReferences
|
|
._productReviewsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$CustomersTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).productReviewsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.customerId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (productLikesRefs)
|
|
await $_getPrefetchedData<
|
|
Customer,
|
|
$CustomersTable,
|
|
ProductLike
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$CustomersTableReferences
|
|
._productLikesRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$CustomersTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).productLikesRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.customerId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (ordersRefs)
|
|
await $_getPrefetchedData<
|
|
Customer,
|
|
$CustomersTable,
|
|
Order
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$CustomersTableReferences
|
|
._ordersRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$CustomersTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).ordersRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.customerId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$CustomersTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$CustomersTable,
|
|
Customer,
|
|
$$CustomersTableFilterComposer,
|
|
$$CustomersTableOrderingComposer,
|
|
$$CustomersTableAnnotationComposer,
|
|
$$CustomersTableCreateCompanionBuilder,
|
|
$$CustomersTableUpdateCompanionBuilder,
|
|
(Customer, $$CustomersTableReferences),
|
|
Customer,
|
|
PrefetchHooks Function({
|
|
bool outletId,
|
|
bool customerAddressesRefs,
|
|
bool productReviewsRefs,
|
|
bool productLikesRefs,
|
|
bool ordersRefs,
|
|
})
|
|
>;
|
|
typedef $$CustomerAddressesTableCreateCompanionBuilder =
|
|
CustomerAddressesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String customerId,
|
|
Value<String?> label,
|
|
Value<String?> fullAddress,
|
|
Value<double?> latitude,
|
|
Value<double?> longitude,
|
|
Value<String?> notes,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$CustomerAddressesTableUpdateCompanionBuilder =
|
|
CustomerAddressesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> customerId,
|
|
Value<String?> label,
|
|
Value<String?> fullAddress,
|
|
Value<double?> latitude,
|
|
Value<double?> longitude,
|
|
Value<String?> notes,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$CustomerAddressesTableReferences
|
|
extends
|
|
BaseReferences<
|
|
_$AppDatabase,
|
|
$CustomerAddressesTable,
|
|
CustomerAddressesData
|
|
> {
|
|
$$CustomerAddressesTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $CustomersTable _customerIdTable(_$AppDatabase db) =>
|
|
db.customers.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.customerAddresses.customerId,
|
|
db.customers.localId,
|
|
),
|
|
);
|
|
|
|
$$CustomersTableProcessedTableManager get customerId {
|
|
final $_column = $_itemColumn<String>('customer_id')!;
|
|
|
|
final manager = $$CustomersTableTableManager(
|
|
$_db,
|
|
$_db.customers,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_customerIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$CustomerAddressesTableFilterComposer
|
|
extends Composer<_$AppDatabase, $CustomerAddressesTable> {
|
|
$$CustomerAddressesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get label => $composableBuilder(
|
|
column: $table.label,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get fullAddress => $composableBuilder(
|
|
column: $table.fullAddress,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get latitude => $composableBuilder(
|
|
column: $table.latitude,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get longitude => $composableBuilder(
|
|
column: $table.longitude,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$CustomersTableFilterComposer get customerId {
|
|
final $$CustomersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$CustomerAddressesTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $CustomerAddressesTable> {
|
|
$$CustomerAddressesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get label => $composableBuilder(
|
|
column: $table.label,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get fullAddress => $composableBuilder(
|
|
column: $table.fullAddress,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get latitude => $composableBuilder(
|
|
column: $table.latitude,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get longitude => $composableBuilder(
|
|
column: $table.longitude,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$CustomersTableOrderingComposer get customerId {
|
|
final $$CustomersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$CustomerAddressesTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $CustomerAddressesTable> {
|
|
$$CustomerAddressesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get label =>
|
|
$composableBuilder(column: $table.label, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get fullAddress => $composableBuilder(
|
|
column: $table.fullAddress,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get latitude =>
|
|
$composableBuilder(column: $table.latitude, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get longitude =>
|
|
$composableBuilder(column: $table.longitude, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get notes =>
|
|
$composableBuilder(column: $table.notes, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
$$CustomersTableAnnotationComposer get customerId {
|
|
final $$CustomersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$CustomerAddressesTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$CustomerAddressesTable,
|
|
CustomerAddressesData,
|
|
$$CustomerAddressesTableFilterComposer,
|
|
$$CustomerAddressesTableOrderingComposer,
|
|
$$CustomerAddressesTableAnnotationComposer,
|
|
$$CustomerAddressesTableCreateCompanionBuilder,
|
|
$$CustomerAddressesTableUpdateCompanionBuilder,
|
|
(CustomerAddressesData, $$CustomerAddressesTableReferences),
|
|
CustomerAddressesData,
|
|
PrefetchHooks Function({bool customerId})
|
|
> {
|
|
$$CustomerAddressesTableTableManager(
|
|
_$AppDatabase db,
|
|
$CustomerAddressesTable table,
|
|
) : super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$CustomerAddressesTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$CustomerAddressesTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$CustomerAddressesTableAnnotationComposer(
|
|
$db: db,
|
|
$table: table,
|
|
),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> customerId = const Value.absent(),
|
|
Value<String?> label = const Value.absent(),
|
|
Value<String?> fullAddress = const Value.absent(),
|
|
Value<double?> latitude = const Value.absent(),
|
|
Value<double?> longitude = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => CustomerAddressesCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
customerId: customerId,
|
|
label: label,
|
|
fullAddress: fullAddress,
|
|
latitude: latitude,
|
|
longitude: longitude,
|
|
notes: notes,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String customerId,
|
|
Value<String?> label = const Value.absent(),
|
|
Value<String?> fullAddress = const Value.absent(),
|
|
Value<double?> latitude = const Value.absent(),
|
|
Value<double?> longitude = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => CustomerAddressesCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
customerId: customerId,
|
|
label: label,
|
|
fullAddress: fullAddress,
|
|
latitude: latitude,
|
|
longitude: longitude,
|
|
notes: notes,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$CustomerAddressesTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({customerId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (customerId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.customerId,
|
|
referencedTable:
|
|
$$CustomerAddressesTableReferences
|
|
._customerIdTable(db),
|
|
referencedColumn:
|
|
$$CustomerAddressesTableReferences
|
|
._customerIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$CustomerAddressesTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$CustomerAddressesTable,
|
|
CustomerAddressesData,
|
|
$$CustomerAddressesTableFilterComposer,
|
|
$$CustomerAddressesTableOrderingComposer,
|
|
$$CustomerAddressesTableAnnotationComposer,
|
|
$$CustomerAddressesTableCreateCompanionBuilder,
|
|
$$CustomerAddressesTableUpdateCompanionBuilder,
|
|
(CustomerAddressesData, $$CustomerAddressesTableReferences),
|
|
CustomerAddressesData,
|
|
PrefetchHooks Function({bool customerId})
|
|
>;
|
|
typedef $$CategoriesTableCreateCompanionBuilder =
|
|
CategoriesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String name,
|
|
Value<String?> localImagePath,
|
|
Value<String?> serverImageUrl,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$CategoriesTableUpdateCompanionBuilder =
|
|
CategoriesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> name,
|
|
Value<String?> localImagePath,
|
|
Value<String?> serverImageUrl,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$CategoriesTableReferences
|
|
extends BaseReferences<_$AppDatabase, $CategoriesTable, Category> {
|
|
$$CategoriesTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static MultiTypedResultKey<$ProductsTable, List<Product>> _productsRefsTable(
|
|
_$AppDatabase db,
|
|
) => MultiTypedResultKey.fromTable(
|
|
db.products,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.categories.localId,
|
|
db.products.categoryId,
|
|
),
|
|
);
|
|
|
|
$$ProductsTableProcessedTableManager get productsRefs {
|
|
final manager = $$ProductsTableTableManager($_db, $_db.products).filter(
|
|
(f) => f.categoryId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_productsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$CategoriesTableFilterComposer
|
|
extends Composer<_$AppDatabase, $CategoriesTable> {
|
|
$$CategoriesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get localImagePath => $composableBuilder(
|
|
column: $table.localImagePath,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverImageUrl => $composableBuilder(
|
|
column: $table.serverImageUrl,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> productsRefs(
|
|
Expression<bool> Function($$ProductsTableFilterComposer f) f,
|
|
) {
|
|
final $$ProductsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.categoryId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CategoriesTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $CategoriesTable> {
|
|
$$CategoriesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get localImagePath => $composableBuilder(
|
|
column: $table.localImagePath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverImageUrl => $composableBuilder(
|
|
column: $table.serverImageUrl,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$CategoriesTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $CategoriesTable> {
|
|
$$CategoriesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get localImagePath => $composableBuilder(
|
|
column: $table.localImagePath,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get serverImageUrl => $composableBuilder(
|
|
column: $table.serverImageUrl,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
Expression<T> productsRefs<T extends Object>(
|
|
Expression<T> Function($$ProductsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$ProductsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.categoryId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CategoriesTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$CategoriesTable,
|
|
Category,
|
|
$$CategoriesTableFilterComposer,
|
|
$$CategoriesTableOrderingComposer,
|
|
$$CategoriesTableAnnotationComposer,
|
|
$$CategoriesTableCreateCompanionBuilder,
|
|
$$CategoriesTableUpdateCompanionBuilder,
|
|
(Category, $$CategoriesTableReferences),
|
|
Category,
|
|
PrefetchHooks Function({bool productsRefs})
|
|
> {
|
|
$$CategoriesTableTableManager(_$AppDatabase db, $CategoriesTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$CategoriesTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$CategoriesTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$CategoriesTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<String?> localImagePath = const Value.absent(),
|
|
Value<String?> serverImageUrl = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => CategoriesCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
name: name,
|
|
localImagePath: localImagePath,
|
|
serverImageUrl: serverImageUrl,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String name,
|
|
Value<String?> localImagePath = const Value.absent(),
|
|
Value<String?> serverImageUrl = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => CategoriesCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
name: name,
|
|
localImagePath: localImagePath,
|
|
serverImageUrl: serverImageUrl,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$CategoriesTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({productsRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [if (productsRefs) db.products],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (productsRefs)
|
|
await $_getPrefetchedData<
|
|
Category,
|
|
$CategoriesTable,
|
|
Product
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$CategoriesTableReferences
|
|
._productsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$CategoriesTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).productsRefs,
|
|
referencedItemsForCurrentItem: (item, referencedItems) =>
|
|
referencedItems.where(
|
|
(e) => e.categoryId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$CategoriesTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$CategoriesTable,
|
|
Category,
|
|
$$CategoriesTableFilterComposer,
|
|
$$CategoriesTableOrderingComposer,
|
|
$$CategoriesTableAnnotationComposer,
|
|
$$CategoriesTableCreateCompanionBuilder,
|
|
$$CategoriesTableUpdateCompanionBuilder,
|
|
(Category, $$CategoriesTableReferences),
|
|
Category,
|
|
PrefetchHooks Function({bool productsRefs})
|
|
>;
|
|
typedef $$UnitsTableCreateCompanionBuilder =
|
|
UnitsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String name,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$UnitsTableUpdateCompanionBuilder =
|
|
UnitsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> name,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$UnitsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $UnitsTable, Unit> {
|
|
$$UnitsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static MultiTypedResultKey<$ProductsTable, List<Product>> _productsRefsTable(
|
|
_$AppDatabase db,
|
|
) => MultiTypedResultKey.fromTable(
|
|
db.products,
|
|
aliasName: $_aliasNameGenerator(db.units.localId, db.products.unitId),
|
|
);
|
|
|
|
$$ProductsTableProcessedTableManager get productsRefs {
|
|
final manager = $$ProductsTableTableManager($_db, $_db.products).filter(
|
|
(f) => f.unitId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_productsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$RawMaterialsTable, List<RawMaterial>>
|
|
_rawMaterialsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.rawMaterials,
|
|
aliasName: $_aliasNameGenerator(db.units.localId, db.rawMaterials.unitId),
|
|
);
|
|
|
|
$$RawMaterialsTableProcessedTableManager get rawMaterialsRefs {
|
|
final manager = $$RawMaterialsTableTableManager($_db, $_db.rawMaterials)
|
|
.filter(
|
|
(f) => f.unitId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_rawMaterialsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$UnitsTableFilterComposer extends Composer<_$AppDatabase, $UnitsTable> {
|
|
$$UnitsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> productsRefs(
|
|
Expression<bool> Function($$ProductsTableFilterComposer f) f,
|
|
) {
|
|
final $$ProductsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.unitId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> rawMaterialsRefs(
|
|
Expression<bool> Function($$RawMaterialsTableFilterComposer f) f,
|
|
) {
|
|
final $$RawMaterialsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.rawMaterials,
|
|
getReferencedColumn: (t) => t.unitId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$RawMaterialsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.rawMaterials,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$UnitsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $UnitsTable> {
|
|
$$UnitsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$UnitsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $UnitsTable> {
|
|
$$UnitsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
Expression<T> productsRefs<T extends Object>(
|
|
Expression<T> Function($$ProductsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$ProductsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.unitId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> rawMaterialsRefs<T extends Object>(
|
|
Expression<T> Function($$RawMaterialsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$RawMaterialsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.rawMaterials,
|
|
getReferencedColumn: (t) => t.unitId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$RawMaterialsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.rawMaterials,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$UnitsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$UnitsTable,
|
|
Unit,
|
|
$$UnitsTableFilterComposer,
|
|
$$UnitsTableOrderingComposer,
|
|
$$UnitsTableAnnotationComposer,
|
|
$$UnitsTableCreateCompanionBuilder,
|
|
$$UnitsTableUpdateCompanionBuilder,
|
|
(Unit, $$UnitsTableReferences),
|
|
Unit,
|
|
PrefetchHooks Function({bool productsRefs, bool rawMaterialsRefs})
|
|
> {
|
|
$$UnitsTableTableManager(_$AppDatabase db, $UnitsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$UnitsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$UnitsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$UnitsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => UnitsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
name: name,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String name,
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => UnitsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
name: name,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) =>
|
|
(e.readTable(table), $$UnitsTableReferences(db, table, e)),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({productsRefs = false, rawMaterialsRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (productsRefs) db.products,
|
|
if (rawMaterialsRefs) db.rawMaterials,
|
|
],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (productsRefs)
|
|
await $_getPrefetchedData<Unit, $UnitsTable, Product>(
|
|
currentTable: table,
|
|
referencedTable: $$UnitsTableReferences
|
|
._productsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$UnitsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).productsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.unitId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (rawMaterialsRefs)
|
|
await $_getPrefetchedData<
|
|
Unit,
|
|
$UnitsTable,
|
|
RawMaterial
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$UnitsTableReferences
|
|
._rawMaterialsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$UnitsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).rawMaterialsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.unitId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$UnitsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$UnitsTable,
|
|
Unit,
|
|
$$UnitsTableFilterComposer,
|
|
$$UnitsTableOrderingComposer,
|
|
$$UnitsTableAnnotationComposer,
|
|
$$UnitsTableCreateCompanionBuilder,
|
|
$$UnitsTableUpdateCompanionBuilder,
|
|
(Unit, $$UnitsTableReferences),
|
|
Unit,
|
|
PrefetchHooks Function({bool productsRefs, bool rawMaterialsRefs})
|
|
>;
|
|
typedef $$ProductsTableCreateCompanionBuilder =
|
|
ProductsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String categoryId,
|
|
required String unitId,
|
|
required String name,
|
|
Value<List<String>?> localImagePath,
|
|
Value<List<String>?> serverImageUrl,
|
|
Value<bool> hasVariant,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$ProductsTableUpdateCompanionBuilder =
|
|
ProductsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> categoryId,
|
|
Value<String> unitId,
|
|
Value<String> name,
|
|
Value<List<String>?> localImagePath,
|
|
Value<List<String>?> serverImageUrl,
|
|
Value<bool> hasVariant,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$ProductsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $ProductsTable, Product> {
|
|
$$ProductsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $CategoriesTable _categoryIdTable(_$AppDatabase db) =>
|
|
db.categories.createAlias(
|
|
$_aliasNameGenerator(db.products.categoryId, db.categories.localId),
|
|
);
|
|
|
|
$$CategoriesTableProcessedTableManager get categoryId {
|
|
final $_column = $_itemColumn<String>('category_id')!;
|
|
|
|
final manager = $$CategoriesTableTableManager(
|
|
$_db,
|
|
$_db.categories,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_categoryIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $UnitsTable _unitIdTable(_$AppDatabase db) => db.units.createAlias(
|
|
$_aliasNameGenerator(db.products.unitId, db.units.localId),
|
|
);
|
|
|
|
$$UnitsTableProcessedTableManager get unitId {
|
|
final $_column = $_itemColumn<String>('unit_id')!;
|
|
|
|
final manager = $$UnitsTableTableManager(
|
|
$_db,
|
|
$_db.units,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_unitIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$ProductVariantsTable, List<ProductVariant>>
|
|
_productVariantsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.productVariants,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.products.localId,
|
|
db.productVariants.productId,
|
|
),
|
|
);
|
|
|
|
$$ProductVariantsTableProcessedTableManager get productVariantsRefs {
|
|
final manager =
|
|
$$ProductVariantsTableTableManager($_db, $_db.productVariants).filter(
|
|
(f) =>
|
|
f.productId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_productVariantsRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$ProductLikesTable, List<ProductLike>>
|
|
_productLikesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.productLikes,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.products.localId,
|
|
db.productLikes.productId,
|
|
),
|
|
);
|
|
|
|
$$ProductLikesTableProcessedTableManager get productLikesRefs {
|
|
final manager = $$ProductLikesTableTableManager($_db, $_db.productLikes)
|
|
.filter(
|
|
(f) =>
|
|
f.productId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_productLikesRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$ProductsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $ProductsTable> {
|
|
$$ProductsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnWithTypeConverterFilters<List<String>?, List<String>, String>
|
|
get localImagePath => $composableBuilder(
|
|
column: $table.localImagePath,
|
|
builder: (column) => ColumnWithTypeConverterFilters(column),
|
|
);
|
|
|
|
ColumnWithTypeConverterFilters<List<String>?, List<String>, String>
|
|
get serverImageUrl => $composableBuilder(
|
|
column: $table.serverImageUrl,
|
|
builder: (column) => ColumnWithTypeConverterFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get hasVariant => $composableBuilder(
|
|
column: $table.hasVariant,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$CategoriesTableFilterComposer get categoryId {
|
|
final $$CategoriesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.categoryId,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UnitsTableFilterComposer get unitId {
|
|
final $$UnitsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.unitId,
|
|
referencedTable: $db.units,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UnitsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.units,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> productVariantsRefs(
|
|
Expression<bool> Function($$ProductVariantsTableFilterComposer f) f,
|
|
) {
|
|
final $$ProductVariantsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.productId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> productLikesRefs(
|
|
Expression<bool> Function($$ProductLikesTableFilterComposer f) f,
|
|
) {
|
|
final $$ProductLikesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productLikes,
|
|
getReferencedColumn: (t) => t.productId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductLikesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.productLikes,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$ProductsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $ProductsTable> {
|
|
$$ProductsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get localImagePath => $composableBuilder(
|
|
column: $table.localImagePath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverImageUrl => $composableBuilder(
|
|
column: $table.serverImageUrl,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get hasVariant => $composableBuilder(
|
|
column: $table.hasVariant,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$CategoriesTableOrderingComposer get categoryId {
|
|
final $$CategoriesTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.categoryId,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UnitsTableOrderingComposer get unitId {
|
|
final $$UnitsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.unitId,
|
|
referencedTable: $db.units,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UnitsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.units,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ProductsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $ProductsTable> {
|
|
$$ProductsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumnWithTypeConverter<List<String>?, String> get localImagePath =>
|
|
$composableBuilder(
|
|
column: $table.localImagePath,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumnWithTypeConverter<List<String>?, String> get serverImageUrl =>
|
|
$composableBuilder(
|
|
column: $table.serverImageUrl,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get hasVariant => $composableBuilder(
|
|
column: $table.hasVariant,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
$$CategoriesTableAnnotationComposer get categoryId {
|
|
final $$CategoriesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.categoryId,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UnitsTableAnnotationComposer get unitId {
|
|
final $$UnitsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.unitId,
|
|
referencedTable: $db.units,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UnitsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.units,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> productVariantsRefs<T extends Object>(
|
|
Expression<T> Function($$ProductVariantsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$ProductVariantsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.productId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> productLikesRefs<T extends Object>(
|
|
Expression<T> Function($$ProductLikesTableAnnotationComposer a) f,
|
|
) {
|
|
final $$ProductLikesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productLikes,
|
|
getReferencedColumn: (t) => t.productId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductLikesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.productLikes,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$ProductsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$ProductsTable,
|
|
Product,
|
|
$$ProductsTableFilterComposer,
|
|
$$ProductsTableOrderingComposer,
|
|
$$ProductsTableAnnotationComposer,
|
|
$$ProductsTableCreateCompanionBuilder,
|
|
$$ProductsTableUpdateCompanionBuilder,
|
|
(Product, $$ProductsTableReferences),
|
|
Product,
|
|
PrefetchHooks Function({
|
|
bool categoryId,
|
|
bool unitId,
|
|
bool productVariantsRefs,
|
|
bool productLikesRefs,
|
|
})
|
|
> {
|
|
$$ProductsTableTableManager(_$AppDatabase db, $ProductsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$ProductsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$ProductsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$ProductsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> categoryId = const Value.absent(),
|
|
Value<String> unitId = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<List<String>?> localImagePath = const Value.absent(),
|
|
Value<List<String>?> serverImageUrl = const Value.absent(),
|
|
Value<bool> hasVariant = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ProductsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
categoryId: categoryId,
|
|
unitId: unitId,
|
|
name: name,
|
|
localImagePath: localImagePath,
|
|
serverImageUrl: serverImageUrl,
|
|
hasVariant: hasVariant,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String categoryId,
|
|
required String unitId,
|
|
required String name,
|
|
Value<List<String>?> localImagePath = const Value.absent(),
|
|
Value<List<String>?> serverImageUrl = const Value.absent(),
|
|
Value<bool> hasVariant = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ProductsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
categoryId: categoryId,
|
|
unitId: unitId,
|
|
name: name,
|
|
localImagePath: localImagePath,
|
|
serverImageUrl: serverImageUrl,
|
|
hasVariant: hasVariant,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$ProductsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
categoryId = false,
|
|
unitId = false,
|
|
productVariantsRefs = false,
|
|
productLikesRefs = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (productVariantsRefs) db.productVariants,
|
|
if (productLikesRefs) db.productLikes,
|
|
],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (categoryId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.categoryId,
|
|
referencedTable: $$ProductsTableReferences
|
|
._categoryIdTable(db),
|
|
referencedColumn: $$ProductsTableReferences
|
|
._categoryIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (unitId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.unitId,
|
|
referencedTable: $$ProductsTableReferences
|
|
._unitIdTable(db),
|
|
referencedColumn: $$ProductsTableReferences
|
|
._unitIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (productVariantsRefs)
|
|
await $_getPrefetchedData<
|
|
Product,
|
|
$ProductsTable,
|
|
ProductVariant
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$ProductsTableReferences
|
|
._productVariantsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$ProductsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).productVariantsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.productId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (productLikesRefs)
|
|
await $_getPrefetchedData<
|
|
Product,
|
|
$ProductsTable,
|
|
ProductLike
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$ProductsTableReferences
|
|
._productLikesRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$ProductsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).productLikesRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.productId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$ProductsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$ProductsTable,
|
|
Product,
|
|
$$ProductsTableFilterComposer,
|
|
$$ProductsTableOrderingComposer,
|
|
$$ProductsTableAnnotationComposer,
|
|
$$ProductsTableCreateCompanionBuilder,
|
|
$$ProductsTableUpdateCompanionBuilder,
|
|
(Product, $$ProductsTableReferences),
|
|
Product,
|
|
PrefetchHooks Function({
|
|
bool categoryId,
|
|
bool unitId,
|
|
bool productVariantsRefs,
|
|
bool productLikesRefs,
|
|
})
|
|
>;
|
|
typedef $$ProductVariantsTableCreateCompanionBuilder =
|
|
ProductVariantsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String productId,
|
|
required String name,
|
|
Value<String?> localImagePath,
|
|
Value<String?> serverImageUrl,
|
|
Value<bool> isVisibleOnline,
|
|
Value<int> totalRating,
|
|
Value<double> averageRating,
|
|
Value<double> totalSold,
|
|
Value<bool> isProductVariant,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$ProductVariantsTableUpdateCompanionBuilder =
|
|
ProductVariantsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> productId,
|
|
Value<String> name,
|
|
Value<String?> localImagePath,
|
|
Value<String?> serverImageUrl,
|
|
Value<bool> isVisibleOnline,
|
|
Value<int> totalRating,
|
|
Value<double> averageRating,
|
|
Value<double> totalSold,
|
|
Value<bool> isProductVariant,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$ProductVariantsTableReferences
|
|
extends
|
|
BaseReferences<_$AppDatabase, $ProductVariantsTable, ProductVariant> {
|
|
$$ProductVariantsTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $ProductsTable _productIdTable(_$AppDatabase db) =>
|
|
db.products.createAlias(
|
|
$_aliasNameGenerator(db.productVariants.productId, db.products.localId),
|
|
);
|
|
|
|
$$ProductsTableProcessedTableManager get productId {
|
|
final $_column = $_itemColumn<String>('product_id')!;
|
|
|
|
final manager = $$ProductsTableTableManager(
|
|
$_db,
|
|
$_db.products,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_productIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$ProductReviewsTable, List<ProductReview>>
|
|
_productReviewsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.productReviews,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.productVariants.localId,
|
|
db.productReviews.productVariantId,
|
|
),
|
|
);
|
|
|
|
$$ProductReviewsTableProcessedTableManager get productReviewsRefs {
|
|
final manager = $$ProductReviewsTableTableManager($_db, $_db.productReviews)
|
|
.filter(
|
|
(f) => f.productVariantId.localId.sqlEquals(
|
|
$_itemColumn<String>('local_id')!,
|
|
),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_productReviewsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$ReceiptItemsTable, List<ReceiptItem>>
|
|
_receiptItemsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.receiptItems,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.productVariants.localId,
|
|
db.receiptItems.productVariantId,
|
|
),
|
|
);
|
|
|
|
$$ReceiptItemsTableProcessedTableManager get receiptItemsRefs {
|
|
final manager = $$ReceiptItemsTableTableManager($_db, $_db.receiptItems)
|
|
.filter(
|
|
(f) => f.productVariantId.localId.sqlEquals(
|
|
$_itemColumn<String>('local_id')!,
|
|
),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_receiptItemsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$OrderItemsTable, List<OrderItem>>
|
|
_orderItemsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.orderItems,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.productVariants.localId,
|
|
db.orderItems.productVariantId,
|
|
),
|
|
);
|
|
|
|
$$OrderItemsTableProcessedTableManager get orderItemsRefs {
|
|
final manager = $$OrderItemsTableTableManager($_db, $_db.orderItems).filter(
|
|
(f) => f.productVariantId.localId.sqlEquals(
|
|
$_itemColumn<String>('local_id')!,
|
|
),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_orderItemsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$ProductVariantsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $ProductVariantsTable> {
|
|
$$ProductVariantsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get localImagePath => $composableBuilder(
|
|
column: $table.localImagePath,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverImageUrl => $composableBuilder(
|
|
column: $table.serverImageUrl,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isVisibleOnline => $composableBuilder(
|
|
column: $table.isVisibleOnline,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get totalRating => $composableBuilder(
|
|
column: $table.totalRating,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get averageRating => $composableBuilder(
|
|
column: $table.averageRating,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get totalSold => $composableBuilder(
|
|
column: $table.totalSold,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isProductVariant => $composableBuilder(
|
|
column: $table.isProductVariant,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$ProductsTableFilterComposer get productId {
|
|
final $$ProductsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> productReviewsRefs(
|
|
Expression<bool> Function($$ProductReviewsTableFilterComposer f) f,
|
|
) {
|
|
final $$ProductReviewsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productReviews,
|
|
getReferencedColumn: (t) => t.productVariantId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductReviewsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.productReviews,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> receiptItemsRefs(
|
|
Expression<bool> Function($$ReceiptItemsTableFilterComposer f) f,
|
|
) {
|
|
final $$ReceiptItemsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.receiptItems,
|
|
getReferencedColumn: (t) => t.productVariantId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ReceiptItemsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.receiptItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> orderItemsRefs(
|
|
Expression<bool> Function($$OrderItemsTableFilterComposer f) f,
|
|
) {
|
|
final $$OrderItemsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orderItems,
|
|
getReferencedColumn: (t) => t.productVariantId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrderItemsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.orderItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$ProductVariantsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $ProductVariantsTable> {
|
|
$$ProductVariantsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get localImagePath => $composableBuilder(
|
|
column: $table.localImagePath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverImageUrl => $composableBuilder(
|
|
column: $table.serverImageUrl,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isVisibleOnline => $composableBuilder(
|
|
column: $table.isVisibleOnline,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get totalRating => $composableBuilder(
|
|
column: $table.totalRating,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get averageRating => $composableBuilder(
|
|
column: $table.averageRating,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get totalSold => $composableBuilder(
|
|
column: $table.totalSold,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isProductVariant => $composableBuilder(
|
|
column: $table.isProductVariant,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$ProductsTableOrderingComposer get productId {
|
|
final $$ProductsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ProductVariantsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $ProductVariantsTable> {
|
|
$$ProductVariantsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get localImagePath => $composableBuilder(
|
|
column: $table.localImagePath,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get serverImageUrl => $composableBuilder(
|
|
column: $table.serverImageUrl,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get isVisibleOnline => $composableBuilder(
|
|
column: $table.isVisibleOnline,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<int> get totalRating => $composableBuilder(
|
|
column: $table.totalRating,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get averageRating => $composableBuilder(
|
|
column: $table.averageRating,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get totalSold =>
|
|
$composableBuilder(column: $table.totalSold, builder: (column) => column);
|
|
|
|
GeneratedColumn<bool> get isProductVariant => $composableBuilder(
|
|
column: $table.isProductVariant,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
$$ProductsTableAnnotationComposer get productId {
|
|
final $$ProductsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> productReviewsRefs<T extends Object>(
|
|
Expression<T> Function($$ProductReviewsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$ProductReviewsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.productReviews,
|
|
getReferencedColumn: (t) => t.productVariantId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductReviewsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.productReviews,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> receiptItemsRefs<T extends Object>(
|
|
Expression<T> Function($$ReceiptItemsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$ReceiptItemsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.receiptItems,
|
|
getReferencedColumn: (t) => t.productVariantId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ReceiptItemsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.receiptItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> orderItemsRefs<T extends Object>(
|
|
Expression<T> Function($$OrderItemsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$OrderItemsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orderItems,
|
|
getReferencedColumn: (t) => t.productVariantId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrderItemsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.orderItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$ProductVariantsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$ProductVariantsTable,
|
|
ProductVariant,
|
|
$$ProductVariantsTableFilterComposer,
|
|
$$ProductVariantsTableOrderingComposer,
|
|
$$ProductVariantsTableAnnotationComposer,
|
|
$$ProductVariantsTableCreateCompanionBuilder,
|
|
$$ProductVariantsTableUpdateCompanionBuilder,
|
|
(ProductVariant, $$ProductVariantsTableReferences),
|
|
ProductVariant,
|
|
PrefetchHooks Function({
|
|
bool productId,
|
|
bool productReviewsRefs,
|
|
bool receiptItemsRefs,
|
|
bool orderItemsRefs,
|
|
})
|
|
> {
|
|
$$ProductVariantsTableTableManager(
|
|
_$AppDatabase db,
|
|
$ProductVariantsTable table,
|
|
) : super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$ProductVariantsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$ProductVariantsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$ProductVariantsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> productId = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<String?> localImagePath = const Value.absent(),
|
|
Value<String?> serverImageUrl = const Value.absent(),
|
|
Value<bool> isVisibleOnline = const Value.absent(),
|
|
Value<int> totalRating = const Value.absent(),
|
|
Value<double> averageRating = const Value.absent(),
|
|
Value<double> totalSold = const Value.absent(),
|
|
Value<bool> isProductVariant = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ProductVariantsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
productId: productId,
|
|
name: name,
|
|
localImagePath: localImagePath,
|
|
serverImageUrl: serverImageUrl,
|
|
isVisibleOnline: isVisibleOnline,
|
|
totalRating: totalRating,
|
|
averageRating: averageRating,
|
|
totalSold: totalSold,
|
|
isProductVariant: isProductVariant,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String productId,
|
|
required String name,
|
|
Value<String?> localImagePath = const Value.absent(),
|
|
Value<String?> serverImageUrl = const Value.absent(),
|
|
Value<bool> isVisibleOnline = const Value.absent(),
|
|
Value<int> totalRating = const Value.absent(),
|
|
Value<double> averageRating = const Value.absent(),
|
|
Value<double> totalSold = const Value.absent(),
|
|
Value<bool> isProductVariant = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ProductVariantsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
productId: productId,
|
|
name: name,
|
|
localImagePath: localImagePath,
|
|
serverImageUrl: serverImageUrl,
|
|
isVisibleOnline: isVisibleOnline,
|
|
totalRating: totalRating,
|
|
averageRating: averageRating,
|
|
totalSold: totalSold,
|
|
isProductVariant: isProductVariant,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$ProductVariantsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
productId = false,
|
|
productReviewsRefs = false,
|
|
receiptItemsRefs = false,
|
|
orderItemsRefs = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (productReviewsRefs) db.productReviews,
|
|
if (receiptItemsRefs) db.receiptItems,
|
|
if (orderItemsRefs) db.orderItems,
|
|
],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (productId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.productId,
|
|
referencedTable:
|
|
$$ProductVariantsTableReferences
|
|
._productIdTable(db),
|
|
referencedColumn:
|
|
$$ProductVariantsTableReferences
|
|
._productIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (productReviewsRefs)
|
|
await $_getPrefetchedData<
|
|
ProductVariant,
|
|
$ProductVariantsTable,
|
|
ProductReview
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$ProductVariantsTableReferences
|
|
._productReviewsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$ProductVariantsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).productReviewsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.productVariantId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (receiptItemsRefs)
|
|
await $_getPrefetchedData<
|
|
ProductVariant,
|
|
$ProductVariantsTable,
|
|
ReceiptItem
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$ProductVariantsTableReferences
|
|
._receiptItemsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$ProductVariantsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).receiptItemsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.productVariantId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (orderItemsRefs)
|
|
await $_getPrefetchedData<
|
|
ProductVariant,
|
|
$ProductVariantsTable,
|
|
OrderItem
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$ProductVariantsTableReferences
|
|
._orderItemsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$ProductVariantsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).orderItemsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.productVariantId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$ProductVariantsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$ProductVariantsTable,
|
|
ProductVariant,
|
|
$$ProductVariantsTableFilterComposer,
|
|
$$ProductVariantsTableOrderingComposer,
|
|
$$ProductVariantsTableAnnotationComposer,
|
|
$$ProductVariantsTableCreateCompanionBuilder,
|
|
$$ProductVariantsTableUpdateCompanionBuilder,
|
|
(ProductVariant, $$ProductVariantsTableReferences),
|
|
ProductVariant,
|
|
PrefetchHooks Function({
|
|
bool productId,
|
|
bool productReviewsRefs,
|
|
bool receiptItemsRefs,
|
|
bool orderItemsRefs,
|
|
})
|
|
>;
|
|
typedef $$ProductReviewsTableCreateCompanionBuilder =
|
|
ProductReviewsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String?> customerId,
|
|
required String productVariantId,
|
|
Value<String?> customerNameSnapshot,
|
|
Value<int> rating,
|
|
Value<String?> comment,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$ProductReviewsTableUpdateCompanionBuilder =
|
|
ProductReviewsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String?> customerId,
|
|
Value<String> productVariantId,
|
|
Value<String?> customerNameSnapshot,
|
|
Value<int> rating,
|
|
Value<String?> comment,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$ProductReviewsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $ProductReviewsTable, ProductReview> {
|
|
$$ProductReviewsTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $CustomersTable _customerIdTable(_$AppDatabase db) =>
|
|
db.customers.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.productReviews.customerId,
|
|
db.customers.localId,
|
|
),
|
|
);
|
|
|
|
$$CustomersTableProcessedTableManager? get customerId {
|
|
final $_column = $_itemColumn<String>('customer_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$CustomersTableTableManager(
|
|
$_db,
|
|
$_db.customers,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_customerIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $ProductVariantsTable _productVariantIdTable(_$AppDatabase db) =>
|
|
db.productVariants.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.productReviews.productVariantId,
|
|
db.productVariants.localId,
|
|
),
|
|
);
|
|
|
|
$$ProductVariantsTableProcessedTableManager get productVariantId {
|
|
final $_column = $_itemColumn<String>('product_variant_id')!;
|
|
|
|
final manager = $$ProductVariantsTableTableManager(
|
|
$_db,
|
|
$_db.productVariants,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_productVariantIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$ProductReviewsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $ProductReviewsTable> {
|
|
$$ProductReviewsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get customerNameSnapshot => $composableBuilder(
|
|
column: $table.customerNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get rating => $composableBuilder(
|
|
column: $table.rating,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get comment => $composableBuilder(
|
|
column: $table.comment,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$CustomersTableFilterComposer get customerId {
|
|
final $$CustomersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$ProductVariantsTableFilterComposer get productVariantId {
|
|
final $$ProductVariantsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productVariantId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ProductReviewsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $ProductReviewsTable> {
|
|
$$ProductReviewsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get customerNameSnapshot => $composableBuilder(
|
|
column: $table.customerNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get rating => $composableBuilder(
|
|
column: $table.rating,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get comment => $composableBuilder(
|
|
column: $table.comment,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$CustomersTableOrderingComposer get customerId {
|
|
final $$CustomersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$ProductVariantsTableOrderingComposer get productVariantId {
|
|
final $$ProductVariantsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productVariantId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ProductReviewsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $ProductReviewsTable> {
|
|
$$ProductReviewsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get customerNameSnapshot => $composableBuilder(
|
|
column: $table.customerNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<int> get rating =>
|
|
$composableBuilder(column: $table.rating, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get comment =>
|
|
$composableBuilder(column: $table.comment, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
$$CustomersTableAnnotationComposer get customerId {
|
|
final $$CustomersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$ProductVariantsTableAnnotationComposer get productVariantId {
|
|
final $$ProductVariantsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productVariantId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ProductReviewsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$ProductReviewsTable,
|
|
ProductReview,
|
|
$$ProductReviewsTableFilterComposer,
|
|
$$ProductReviewsTableOrderingComposer,
|
|
$$ProductReviewsTableAnnotationComposer,
|
|
$$ProductReviewsTableCreateCompanionBuilder,
|
|
$$ProductReviewsTableUpdateCompanionBuilder,
|
|
(ProductReview, $$ProductReviewsTableReferences),
|
|
ProductReview,
|
|
PrefetchHooks Function({bool customerId, bool productVariantId})
|
|
> {
|
|
$$ProductReviewsTableTableManager(
|
|
_$AppDatabase db,
|
|
$ProductReviewsTable table,
|
|
) : super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$ProductReviewsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$ProductReviewsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$ProductReviewsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> customerId = const Value.absent(),
|
|
Value<String> productVariantId = const Value.absent(),
|
|
Value<String?> customerNameSnapshot = const Value.absent(),
|
|
Value<int> rating = const Value.absent(),
|
|
Value<String?> comment = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ProductReviewsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
customerId: customerId,
|
|
productVariantId: productVariantId,
|
|
customerNameSnapshot: customerNameSnapshot,
|
|
rating: rating,
|
|
comment: comment,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> customerId = const Value.absent(),
|
|
required String productVariantId,
|
|
Value<String?> customerNameSnapshot = const Value.absent(),
|
|
Value<int> rating = const Value.absent(),
|
|
Value<String?> comment = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ProductReviewsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
customerId: customerId,
|
|
productVariantId: productVariantId,
|
|
customerNameSnapshot: customerNameSnapshot,
|
|
rating: rating,
|
|
comment: comment,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$ProductReviewsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({customerId = false, productVariantId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (customerId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.customerId,
|
|
referencedTable:
|
|
$$ProductReviewsTableReferences
|
|
._customerIdTable(db),
|
|
referencedColumn:
|
|
$$ProductReviewsTableReferences
|
|
._customerIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (productVariantId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.productVariantId,
|
|
referencedTable:
|
|
$$ProductReviewsTableReferences
|
|
._productVariantIdTable(db),
|
|
referencedColumn:
|
|
$$ProductReviewsTableReferences
|
|
._productVariantIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$ProductReviewsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$ProductReviewsTable,
|
|
ProductReview,
|
|
$$ProductReviewsTableFilterComposer,
|
|
$$ProductReviewsTableOrderingComposer,
|
|
$$ProductReviewsTableAnnotationComposer,
|
|
$$ProductReviewsTableCreateCompanionBuilder,
|
|
$$ProductReviewsTableUpdateCompanionBuilder,
|
|
(ProductReview, $$ProductReviewsTableReferences),
|
|
ProductReview,
|
|
PrefetchHooks Function({bool customerId, bool productVariantId})
|
|
>;
|
|
typedef $$ProductLikesTableCreateCompanionBuilder =
|
|
ProductLikesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String?> customerId,
|
|
required String productId,
|
|
Value<bool> isLike,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$ProductLikesTableUpdateCompanionBuilder =
|
|
ProductLikesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String?> customerId,
|
|
Value<String> productId,
|
|
Value<bool> isLike,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$ProductLikesTableReferences
|
|
extends BaseReferences<_$AppDatabase, $ProductLikesTable, ProductLike> {
|
|
$$ProductLikesTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $CustomersTable _customerIdTable(_$AppDatabase db) =>
|
|
db.customers.createAlias(
|
|
$_aliasNameGenerator(db.productLikes.customerId, db.customers.localId),
|
|
);
|
|
|
|
$$CustomersTableProcessedTableManager? get customerId {
|
|
final $_column = $_itemColumn<String>('customer_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$CustomersTableTableManager(
|
|
$_db,
|
|
$_db.customers,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_customerIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $ProductsTable _productIdTable(_$AppDatabase db) =>
|
|
db.products.createAlias(
|
|
$_aliasNameGenerator(db.productLikes.productId, db.products.localId),
|
|
);
|
|
|
|
$$ProductsTableProcessedTableManager get productId {
|
|
final $_column = $_itemColumn<String>('product_id')!;
|
|
|
|
final manager = $$ProductsTableTableManager(
|
|
$_db,
|
|
$_db.products,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_productIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$ProductLikesTableFilterComposer
|
|
extends Composer<_$AppDatabase, $ProductLikesTable> {
|
|
$$ProductLikesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isLike => $composableBuilder(
|
|
column: $table.isLike,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$CustomersTableFilterComposer get customerId {
|
|
final $$CustomersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$ProductsTableFilterComposer get productId {
|
|
final $$ProductsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ProductLikesTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $ProductLikesTable> {
|
|
$$ProductLikesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isLike => $composableBuilder(
|
|
column: $table.isLike,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$CustomersTableOrderingComposer get customerId {
|
|
final $$CustomersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$ProductsTableOrderingComposer get productId {
|
|
final $$ProductsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ProductLikesTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $ProductLikesTable> {
|
|
$$ProductLikesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<bool> get isLike =>
|
|
$composableBuilder(column: $table.isLike, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
$$CustomersTableAnnotationComposer get customerId {
|
|
final $$CustomersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$ProductsTableAnnotationComposer get productId {
|
|
final $$ProductsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productId,
|
|
referencedTable: $db.products,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.products,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ProductLikesTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$ProductLikesTable,
|
|
ProductLike,
|
|
$$ProductLikesTableFilterComposer,
|
|
$$ProductLikesTableOrderingComposer,
|
|
$$ProductLikesTableAnnotationComposer,
|
|
$$ProductLikesTableCreateCompanionBuilder,
|
|
$$ProductLikesTableUpdateCompanionBuilder,
|
|
(ProductLike, $$ProductLikesTableReferences),
|
|
ProductLike,
|
|
PrefetchHooks Function({bool customerId, bool productId})
|
|
> {
|
|
$$ProductLikesTableTableManager(_$AppDatabase db, $ProductLikesTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$ProductLikesTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$ProductLikesTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$ProductLikesTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> customerId = const Value.absent(),
|
|
Value<String> productId = const Value.absent(),
|
|
Value<bool> isLike = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ProductLikesCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
customerId: customerId,
|
|
productId: productId,
|
|
isLike: isLike,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> customerId = const Value.absent(),
|
|
required String productId,
|
|
Value<bool> isLike = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ProductLikesCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
customerId: customerId,
|
|
productId: productId,
|
|
isLike: isLike,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$ProductLikesTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({customerId = false, productId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (customerId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.customerId,
|
|
referencedTable: $$ProductLikesTableReferences
|
|
._customerIdTable(db),
|
|
referencedColumn: $$ProductLikesTableReferences
|
|
._customerIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (productId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.productId,
|
|
referencedTable: $$ProductLikesTableReferences
|
|
._productIdTable(db),
|
|
referencedColumn: $$ProductLikesTableReferences
|
|
._productIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$ProductLikesTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$ProductLikesTable,
|
|
ProductLike,
|
|
$$ProductLikesTableFilterComposer,
|
|
$$ProductLikesTableOrderingComposer,
|
|
$$ProductLikesTableAnnotationComposer,
|
|
$$ProductLikesTableCreateCompanionBuilder,
|
|
$$ProductLikesTableUpdateCompanionBuilder,
|
|
(ProductLike, $$ProductLikesTableReferences),
|
|
ProductLike,
|
|
PrefetchHooks Function({bool customerId, bool productId})
|
|
>;
|
|
typedef $$RawMaterialsTableCreateCompanionBuilder =
|
|
RawMaterialsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String unitId,
|
|
required String name,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$RawMaterialsTableUpdateCompanionBuilder =
|
|
RawMaterialsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> unitId,
|
|
Value<String> name,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$RawMaterialsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $RawMaterialsTable, RawMaterial> {
|
|
$$RawMaterialsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $UnitsTable _unitIdTable(_$AppDatabase db) => db.units.createAlias(
|
|
$_aliasNameGenerator(db.rawMaterials.unitId, db.units.localId),
|
|
);
|
|
|
|
$$UnitsTableProcessedTableManager get unitId {
|
|
final $_column = $_itemColumn<String>('unit_id')!;
|
|
|
|
final manager = $$UnitsTableTableManager(
|
|
$_db,
|
|
$_db.units,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_unitIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$ReceiptItemsTable, List<ReceiptItem>>
|
|
_receiptItemsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.receiptItems,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.rawMaterials.localId,
|
|
db.receiptItems.rawMaterialId,
|
|
),
|
|
);
|
|
|
|
$$ReceiptItemsTableProcessedTableManager get receiptItemsRefs {
|
|
final manager = $$ReceiptItemsTableTableManager($_db, $_db.receiptItems)
|
|
.filter(
|
|
(f) => f.rawMaterialId.localId.sqlEquals(
|
|
$_itemColumn<String>('local_id')!,
|
|
),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_receiptItemsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$RawMaterialsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $RawMaterialsTable> {
|
|
$$RawMaterialsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$UnitsTableFilterComposer get unitId {
|
|
final $$UnitsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.unitId,
|
|
referencedTable: $db.units,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UnitsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.units,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> receiptItemsRefs(
|
|
Expression<bool> Function($$ReceiptItemsTableFilterComposer f) f,
|
|
) {
|
|
final $$ReceiptItemsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.receiptItems,
|
|
getReferencedColumn: (t) => t.rawMaterialId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ReceiptItemsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.receiptItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$RawMaterialsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $RawMaterialsTable> {
|
|
$$RawMaterialsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$UnitsTableOrderingComposer get unitId {
|
|
final $$UnitsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.unitId,
|
|
referencedTable: $db.units,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UnitsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.units,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$RawMaterialsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $RawMaterialsTable> {
|
|
$$RawMaterialsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
$$UnitsTableAnnotationComposer get unitId {
|
|
final $$UnitsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.unitId,
|
|
referencedTable: $db.units,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UnitsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.units,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> receiptItemsRefs<T extends Object>(
|
|
Expression<T> Function($$ReceiptItemsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$ReceiptItemsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.receiptItems,
|
|
getReferencedColumn: (t) => t.rawMaterialId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ReceiptItemsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.receiptItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$RawMaterialsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$RawMaterialsTable,
|
|
RawMaterial,
|
|
$$RawMaterialsTableFilterComposer,
|
|
$$RawMaterialsTableOrderingComposer,
|
|
$$RawMaterialsTableAnnotationComposer,
|
|
$$RawMaterialsTableCreateCompanionBuilder,
|
|
$$RawMaterialsTableUpdateCompanionBuilder,
|
|
(RawMaterial, $$RawMaterialsTableReferences),
|
|
RawMaterial,
|
|
PrefetchHooks Function({bool unitId, bool receiptItemsRefs})
|
|
> {
|
|
$$RawMaterialsTableTableManager(_$AppDatabase db, $RawMaterialsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$RawMaterialsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$RawMaterialsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$RawMaterialsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> unitId = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => RawMaterialsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
unitId: unitId,
|
|
name: name,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String unitId,
|
|
required String name,
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => RawMaterialsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
unitId: unitId,
|
|
name: name,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$RawMaterialsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({unitId = false, receiptItemsRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [if (receiptItemsRefs) db.receiptItems],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (unitId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.unitId,
|
|
referencedTable: $$RawMaterialsTableReferences
|
|
._unitIdTable(db),
|
|
referencedColumn: $$RawMaterialsTableReferences
|
|
._unitIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (receiptItemsRefs)
|
|
await $_getPrefetchedData<
|
|
RawMaterial,
|
|
$RawMaterialsTable,
|
|
ReceiptItem
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$RawMaterialsTableReferences
|
|
._receiptItemsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$RawMaterialsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).receiptItemsRefs,
|
|
referencedItemsForCurrentItem: (item, referencedItems) =>
|
|
referencedItems.where(
|
|
(e) => e.rawMaterialId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$RawMaterialsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$RawMaterialsTable,
|
|
RawMaterial,
|
|
$$RawMaterialsTableFilterComposer,
|
|
$$RawMaterialsTableOrderingComposer,
|
|
$$RawMaterialsTableAnnotationComposer,
|
|
$$RawMaterialsTableCreateCompanionBuilder,
|
|
$$RawMaterialsTableUpdateCompanionBuilder,
|
|
(RawMaterial, $$RawMaterialsTableReferences),
|
|
RawMaterial,
|
|
PrefetchHooks Function({bool unitId, bool receiptItemsRefs})
|
|
>;
|
|
typedef $$OutletInventoriesTableCreateCompanionBuilder =
|
|
OutletInventoriesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String outletId,
|
|
required String itemType,
|
|
required String itemId,
|
|
Value<String> stockType,
|
|
Value<double> stock,
|
|
Value<double> sellingPrice,
|
|
Value<double> costPrice,
|
|
Value<double> purchasePrice,
|
|
Value<bool?> isDeleteByOwner,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$OutletInventoriesTableUpdateCompanionBuilder =
|
|
OutletInventoriesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> outletId,
|
|
Value<String> itemType,
|
|
Value<String> itemId,
|
|
Value<String> stockType,
|
|
Value<double> stock,
|
|
Value<double> sellingPrice,
|
|
Value<double> costPrice,
|
|
Value<double> purchasePrice,
|
|
Value<bool?> isDeleteByOwner,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$OutletInventoriesTableReferences
|
|
extends
|
|
BaseReferences<
|
|
_$AppDatabase,
|
|
$OutletInventoriesTable,
|
|
OutletInventory
|
|
> {
|
|
$$OutletInventoriesTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $OutletsTable _outletIdTable(_$AppDatabase db) =>
|
|
db.outlets.createAlias(
|
|
$_aliasNameGenerator(db.outletInventories.outletId, db.outlets.localId),
|
|
);
|
|
|
|
$$OutletsTableProcessedTableManager get outletId {
|
|
final $_column = $_itemColumn<String>('outlet_id')!;
|
|
|
|
final manager = $$OutletsTableTableManager(
|
|
$_db,
|
|
$_db.outlets,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_outletIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$StockCardsTable, List<StockCard>>
|
|
_stockCardsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.stockCards,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.outletInventories.localId,
|
|
db.stockCards.outletInventoryId,
|
|
),
|
|
);
|
|
|
|
$$StockCardsTableProcessedTableManager get stockCardsRefs {
|
|
final manager = $$StockCardsTableTableManager($_db, $_db.stockCards).filter(
|
|
(f) => f.outletInventoryId.localId.sqlEquals(
|
|
$_itemColumn<String>('local_id')!,
|
|
),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_stockCardsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$OutletInventoriesTableFilterComposer
|
|
extends Composer<_$AppDatabase, $OutletInventoriesTable> {
|
|
$$OutletInventoriesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get itemType => $composableBuilder(
|
|
column: $table.itemType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get itemId => $composableBuilder(
|
|
column: $table.itemId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get stockType => $composableBuilder(
|
|
column: $table.stockType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get stock => $composableBuilder(
|
|
column: $table.stock,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get sellingPrice => $composableBuilder(
|
|
column: $table.sellingPrice,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get costPrice => $composableBuilder(
|
|
column: $table.costPrice,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get purchasePrice => $composableBuilder(
|
|
column: $table.purchasePrice,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isDeleteByOwner => $composableBuilder(
|
|
column: $table.isDeleteByOwner,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$OutletsTableFilterComposer get outletId {
|
|
final $$OutletsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> stockCardsRefs(
|
|
Expression<bool> Function($$StockCardsTableFilterComposer f) f,
|
|
) {
|
|
final $$StockCardsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.stockCards,
|
|
getReferencedColumn: (t) => t.outletInventoryId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$StockCardsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.stockCards,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$OutletInventoriesTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $OutletInventoriesTable> {
|
|
$$OutletInventoriesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get itemType => $composableBuilder(
|
|
column: $table.itemType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get itemId => $composableBuilder(
|
|
column: $table.itemId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get stockType => $composableBuilder(
|
|
column: $table.stockType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get stock => $composableBuilder(
|
|
column: $table.stock,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get sellingPrice => $composableBuilder(
|
|
column: $table.sellingPrice,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get costPrice => $composableBuilder(
|
|
column: $table.costPrice,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get purchasePrice => $composableBuilder(
|
|
column: $table.purchasePrice,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isDeleteByOwner => $composableBuilder(
|
|
column: $table.isDeleteByOwner,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$OutletsTableOrderingComposer get outletId {
|
|
final $$OutletsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$OutletInventoriesTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $OutletInventoriesTable> {
|
|
$$OutletInventoriesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get itemType =>
|
|
$composableBuilder(column: $table.itemType, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get itemId =>
|
|
$composableBuilder(column: $table.itemId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get stockType =>
|
|
$composableBuilder(column: $table.stockType, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get stock =>
|
|
$composableBuilder(column: $table.stock, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get sellingPrice => $composableBuilder(
|
|
column: $table.sellingPrice,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get costPrice =>
|
|
$composableBuilder(column: $table.costPrice, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get purchasePrice => $composableBuilder(
|
|
column: $table.purchasePrice,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get isDeleteByOwner => $composableBuilder(
|
|
column: $table.isDeleteByOwner,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
$$OutletsTableAnnotationComposer get outletId {
|
|
final $$OutletsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> stockCardsRefs<T extends Object>(
|
|
Expression<T> Function($$StockCardsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$StockCardsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.stockCards,
|
|
getReferencedColumn: (t) => t.outletInventoryId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$StockCardsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.stockCards,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$OutletInventoriesTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$OutletInventoriesTable,
|
|
OutletInventory,
|
|
$$OutletInventoriesTableFilterComposer,
|
|
$$OutletInventoriesTableOrderingComposer,
|
|
$$OutletInventoriesTableAnnotationComposer,
|
|
$$OutletInventoriesTableCreateCompanionBuilder,
|
|
$$OutletInventoriesTableUpdateCompanionBuilder,
|
|
(OutletInventory, $$OutletInventoriesTableReferences),
|
|
OutletInventory,
|
|
PrefetchHooks Function({bool outletId, bool stockCardsRefs})
|
|
> {
|
|
$$OutletInventoriesTableTableManager(
|
|
_$AppDatabase db,
|
|
$OutletInventoriesTable table,
|
|
) : super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$OutletInventoriesTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$OutletInventoriesTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$OutletInventoriesTableAnnotationComposer(
|
|
$db: db,
|
|
$table: table,
|
|
),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> outletId = const Value.absent(),
|
|
Value<String> itemType = const Value.absent(),
|
|
Value<String> itemId = const Value.absent(),
|
|
Value<String> stockType = const Value.absent(),
|
|
Value<double> stock = const Value.absent(),
|
|
Value<double> sellingPrice = const Value.absent(),
|
|
Value<double> costPrice = const Value.absent(),
|
|
Value<double> purchasePrice = const Value.absent(),
|
|
Value<bool?> isDeleteByOwner = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OutletInventoriesCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletId: outletId,
|
|
itemType: itemType,
|
|
itemId: itemId,
|
|
stockType: stockType,
|
|
stock: stock,
|
|
sellingPrice: sellingPrice,
|
|
costPrice: costPrice,
|
|
purchasePrice: purchasePrice,
|
|
isDeleteByOwner: isDeleteByOwner,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String outletId,
|
|
required String itemType,
|
|
required String itemId,
|
|
Value<String> stockType = const Value.absent(),
|
|
Value<double> stock = const Value.absent(),
|
|
Value<double> sellingPrice = const Value.absent(),
|
|
Value<double> costPrice = const Value.absent(),
|
|
Value<double> purchasePrice = const Value.absent(),
|
|
Value<bool?> isDeleteByOwner = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OutletInventoriesCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletId: outletId,
|
|
itemType: itemType,
|
|
itemId: itemId,
|
|
stockType: stockType,
|
|
stock: stock,
|
|
sellingPrice: sellingPrice,
|
|
costPrice: costPrice,
|
|
purchasePrice: purchasePrice,
|
|
isDeleteByOwner: isDeleteByOwner,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$OutletInventoriesTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({outletId = false, stockCardsRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [if (stockCardsRefs) db.stockCards],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (outletId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.outletId,
|
|
referencedTable:
|
|
$$OutletInventoriesTableReferences
|
|
._outletIdTable(db),
|
|
referencedColumn:
|
|
$$OutletInventoriesTableReferences
|
|
._outletIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (stockCardsRefs)
|
|
await $_getPrefetchedData<
|
|
OutletInventory,
|
|
$OutletInventoriesTable,
|
|
StockCard
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$OutletInventoriesTableReferences
|
|
._stockCardsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OutletInventoriesTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).stockCardsRefs,
|
|
referencedItemsForCurrentItem: (item, referencedItems) =>
|
|
referencedItems.where(
|
|
(e) => e.outletInventoryId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$OutletInventoriesTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$OutletInventoriesTable,
|
|
OutletInventory,
|
|
$$OutletInventoriesTableFilterComposer,
|
|
$$OutletInventoriesTableOrderingComposer,
|
|
$$OutletInventoriesTableAnnotationComposer,
|
|
$$OutletInventoriesTableCreateCompanionBuilder,
|
|
$$OutletInventoriesTableUpdateCompanionBuilder,
|
|
(OutletInventory, $$OutletInventoriesTableReferences),
|
|
OutletInventory,
|
|
PrefetchHooks Function({bool outletId, bool stockCardsRefs})
|
|
>;
|
|
typedef $$ReceiptItemsTableCreateCompanionBuilder =
|
|
ReceiptItemsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String?> productVariantId,
|
|
Value<String?> rawMaterialId,
|
|
Value<double> quantity,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$ReceiptItemsTableUpdateCompanionBuilder =
|
|
ReceiptItemsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String?> productVariantId,
|
|
Value<String?> rawMaterialId,
|
|
Value<double> quantity,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$ReceiptItemsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $ReceiptItemsTable, ReceiptItem> {
|
|
$$ReceiptItemsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $ProductVariantsTable _productVariantIdTable(_$AppDatabase db) =>
|
|
db.productVariants.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.receiptItems.productVariantId,
|
|
db.productVariants.localId,
|
|
),
|
|
);
|
|
|
|
$$ProductVariantsTableProcessedTableManager? get productVariantId {
|
|
final $_column = $_itemColumn<String>('product_variant_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$ProductVariantsTableTableManager(
|
|
$_db,
|
|
$_db.productVariants,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_productVariantIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $RawMaterialsTable _rawMaterialIdTable(_$AppDatabase db) =>
|
|
db.rawMaterials.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.receiptItems.rawMaterialId,
|
|
db.rawMaterials.localId,
|
|
),
|
|
);
|
|
|
|
$$RawMaterialsTableProcessedTableManager? get rawMaterialId {
|
|
final $_column = $_itemColumn<String>('raw_material_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$RawMaterialsTableTableManager(
|
|
$_db,
|
|
$_db.rawMaterials,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_rawMaterialIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$ReceiptItemsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $ReceiptItemsTable> {
|
|
$$ReceiptItemsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get quantity => $composableBuilder(
|
|
column: $table.quantity,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$ProductVariantsTableFilterComposer get productVariantId {
|
|
final $$ProductVariantsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productVariantId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$RawMaterialsTableFilterComposer get rawMaterialId {
|
|
final $$RawMaterialsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.rawMaterialId,
|
|
referencedTable: $db.rawMaterials,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$RawMaterialsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.rawMaterials,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ReceiptItemsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $ReceiptItemsTable> {
|
|
$$ReceiptItemsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get quantity => $composableBuilder(
|
|
column: $table.quantity,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$ProductVariantsTableOrderingComposer get productVariantId {
|
|
final $$ProductVariantsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productVariantId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$RawMaterialsTableOrderingComposer get rawMaterialId {
|
|
final $$RawMaterialsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.rawMaterialId,
|
|
referencedTable: $db.rawMaterials,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$RawMaterialsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.rawMaterials,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ReceiptItemsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $ReceiptItemsTable> {
|
|
$$ReceiptItemsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get quantity =>
|
|
$composableBuilder(column: $table.quantity, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
$$ProductVariantsTableAnnotationComposer get productVariantId {
|
|
final $$ProductVariantsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productVariantId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$RawMaterialsTableAnnotationComposer get rawMaterialId {
|
|
final $$RawMaterialsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.rawMaterialId,
|
|
referencedTable: $db.rawMaterials,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$RawMaterialsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.rawMaterials,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$ReceiptItemsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$ReceiptItemsTable,
|
|
ReceiptItem,
|
|
$$ReceiptItemsTableFilterComposer,
|
|
$$ReceiptItemsTableOrderingComposer,
|
|
$$ReceiptItemsTableAnnotationComposer,
|
|
$$ReceiptItemsTableCreateCompanionBuilder,
|
|
$$ReceiptItemsTableUpdateCompanionBuilder,
|
|
(ReceiptItem, $$ReceiptItemsTableReferences),
|
|
ReceiptItem,
|
|
PrefetchHooks Function({bool productVariantId, bool rawMaterialId})
|
|
> {
|
|
$$ReceiptItemsTableTableManager(_$AppDatabase db, $ReceiptItemsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$ReceiptItemsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$ReceiptItemsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$ReceiptItemsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> productVariantId = const Value.absent(),
|
|
Value<String?> rawMaterialId = const Value.absent(),
|
|
Value<double> quantity = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ReceiptItemsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
productVariantId: productVariantId,
|
|
rawMaterialId: rawMaterialId,
|
|
quantity: quantity,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String?> productVariantId = const Value.absent(),
|
|
Value<String?> rawMaterialId = const Value.absent(),
|
|
Value<double> quantity = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => ReceiptItemsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
productVariantId: productVariantId,
|
|
rawMaterialId: rawMaterialId,
|
|
quantity: quantity,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$ReceiptItemsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({productVariantId = false, rawMaterialId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (productVariantId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.productVariantId,
|
|
referencedTable:
|
|
$$ReceiptItemsTableReferences
|
|
._productVariantIdTable(db),
|
|
referencedColumn:
|
|
$$ReceiptItemsTableReferences
|
|
._productVariantIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (rawMaterialId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.rawMaterialId,
|
|
referencedTable:
|
|
$$ReceiptItemsTableReferences
|
|
._rawMaterialIdTable(db),
|
|
referencedColumn:
|
|
$$ReceiptItemsTableReferences
|
|
._rawMaterialIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$ReceiptItemsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$ReceiptItemsTable,
|
|
ReceiptItem,
|
|
$$ReceiptItemsTableFilterComposer,
|
|
$$ReceiptItemsTableOrderingComposer,
|
|
$$ReceiptItemsTableAnnotationComposer,
|
|
$$ReceiptItemsTableCreateCompanionBuilder,
|
|
$$ReceiptItemsTableUpdateCompanionBuilder,
|
|
(ReceiptItem, $$ReceiptItemsTableReferences),
|
|
ReceiptItem,
|
|
PrefetchHooks Function({bool productVariantId, bool rawMaterialId})
|
|
>;
|
|
typedef $$StockCardsTableCreateCompanionBuilder =
|
|
StockCardsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String outletInventoryId,
|
|
required String userId,
|
|
required String type,
|
|
Value<String?> receiveFromId,
|
|
Value<double> qtyChange,
|
|
Value<double> currentStock,
|
|
Value<String> stockType,
|
|
Value<bool> modeChange,
|
|
Value<String?> modeBeforeChange,
|
|
Value<String?> modeAfterChange,
|
|
Value<double> costPrice,
|
|
Value<String?> referenceId,
|
|
Value<String?> documentNumber,
|
|
Value<String?> notes,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$StockCardsTableUpdateCompanionBuilder =
|
|
StockCardsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> outletInventoryId,
|
|
Value<String> userId,
|
|
Value<String> type,
|
|
Value<String?> receiveFromId,
|
|
Value<double> qtyChange,
|
|
Value<double> currentStock,
|
|
Value<String> stockType,
|
|
Value<bool> modeChange,
|
|
Value<String?> modeBeforeChange,
|
|
Value<String?> modeAfterChange,
|
|
Value<double> costPrice,
|
|
Value<String?> referenceId,
|
|
Value<String?> documentNumber,
|
|
Value<String?> notes,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$StockCardsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $StockCardsTable, StockCard> {
|
|
$$StockCardsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $OutletInventoriesTable _outletInventoryIdTable(_$AppDatabase db) =>
|
|
db.outletInventories.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.stockCards.outletInventoryId,
|
|
db.outletInventories.localId,
|
|
),
|
|
);
|
|
|
|
$$OutletInventoriesTableProcessedTableManager get outletInventoryId {
|
|
final $_column = $_itemColumn<String>('outlet_inventory_id')!;
|
|
|
|
final manager = $$OutletInventoriesTableTableManager(
|
|
$_db,
|
|
$_db.outletInventories,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_outletInventoryIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
|
|
$_aliasNameGenerator(db.stockCards.userId, db.users.localId),
|
|
);
|
|
|
|
$$UsersTableProcessedTableManager get userId {
|
|
final $_column = $_itemColumn<String>('user_id')!;
|
|
|
|
final manager = $$UsersTableTableManager(
|
|
$_db,
|
|
$_db.users,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $OutletsTable _receiveFromIdTable(_$AppDatabase db) =>
|
|
db.outlets.createAlias(
|
|
$_aliasNameGenerator(db.stockCards.receiveFromId, db.outlets.localId),
|
|
);
|
|
|
|
$$OutletsTableProcessedTableManager? get receiveFromId {
|
|
final $_column = $_itemColumn<String>('receive_from_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$OutletsTableTableManager(
|
|
$_db,
|
|
$_db.outlets,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_receiveFromIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$StockCardsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $StockCardsTable> {
|
|
$$StockCardsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get type => $composableBuilder(
|
|
column: $table.type,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get qtyChange => $composableBuilder(
|
|
column: $table.qtyChange,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get currentStock => $composableBuilder(
|
|
column: $table.currentStock,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get stockType => $composableBuilder(
|
|
column: $table.stockType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get modeChange => $composableBuilder(
|
|
column: $table.modeChange,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get modeBeforeChange => $composableBuilder(
|
|
column: $table.modeBeforeChange,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get modeAfterChange => $composableBuilder(
|
|
column: $table.modeAfterChange,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get costPrice => $composableBuilder(
|
|
column: $table.costPrice,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get referenceId => $composableBuilder(
|
|
column: $table.referenceId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get documentNumber => $composableBuilder(
|
|
column: $table.documentNumber,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$OutletInventoriesTableFilterComposer get outletInventoryId {
|
|
final $$OutletInventoriesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletInventoryId,
|
|
referencedTable: $db.outletInventories,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletInventoriesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outletInventories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableFilterComposer get userId {
|
|
final $$UsersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$OutletsTableFilterComposer get receiveFromId {
|
|
final $$OutletsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.receiveFromId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$StockCardsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $StockCardsTable> {
|
|
$$StockCardsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get type => $composableBuilder(
|
|
column: $table.type,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get qtyChange => $composableBuilder(
|
|
column: $table.qtyChange,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get currentStock => $composableBuilder(
|
|
column: $table.currentStock,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get stockType => $composableBuilder(
|
|
column: $table.stockType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get modeChange => $composableBuilder(
|
|
column: $table.modeChange,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get modeBeforeChange => $composableBuilder(
|
|
column: $table.modeBeforeChange,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get modeAfterChange => $composableBuilder(
|
|
column: $table.modeAfterChange,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get costPrice => $composableBuilder(
|
|
column: $table.costPrice,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get referenceId => $composableBuilder(
|
|
column: $table.referenceId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get documentNumber => $composableBuilder(
|
|
column: $table.documentNumber,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$OutletInventoriesTableOrderingComposer get outletInventoryId {
|
|
final $$OutletInventoriesTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletInventoryId,
|
|
referencedTable: $db.outletInventories,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletInventoriesTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.outletInventories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableOrderingComposer get userId {
|
|
final $$UsersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$OutletsTableOrderingComposer get receiveFromId {
|
|
final $$OutletsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.receiveFromId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$StockCardsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $StockCardsTable> {
|
|
$$StockCardsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get type =>
|
|
$composableBuilder(column: $table.type, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get qtyChange =>
|
|
$composableBuilder(column: $table.qtyChange, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get currentStock => $composableBuilder(
|
|
column: $table.currentStock,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get stockType =>
|
|
$composableBuilder(column: $table.stockType, builder: (column) => column);
|
|
|
|
GeneratedColumn<bool> get modeChange => $composableBuilder(
|
|
column: $table.modeChange,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get modeBeforeChange => $composableBuilder(
|
|
column: $table.modeBeforeChange,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get modeAfterChange => $composableBuilder(
|
|
column: $table.modeAfterChange,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get costPrice =>
|
|
$composableBuilder(column: $table.costPrice, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get referenceId => $composableBuilder(
|
|
column: $table.referenceId,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get documentNumber => $composableBuilder(
|
|
column: $table.documentNumber,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get notes =>
|
|
$composableBuilder(column: $table.notes, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
$$OutletInventoriesTableAnnotationComposer get outletInventoryId {
|
|
final $$OutletInventoriesTableAnnotationComposer composer =
|
|
$composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletInventoryId,
|
|
referencedTable: $db.outletInventories,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletInventoriesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outletInventories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableAnnotationComposer get userId {
|
|
final $$UsersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$OutletsTableAnnotationComposer get receiveFromId {
|
|
final $$OutletsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.receiveFromId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$StockCardsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$StockCardsTable,
|
|
StockCard,
|
|
$$StockCardsTableFilterComposer,
|
|
$$StockCardsTableOrderingComposer,
|
|
$$StockCardsTableAnnotationComposer,
|
|
$$StockCardsTableCreateCompanionBuilder,
|
|
$$StockCardsTableUpdateCompanionBuilder,
|
|
(StockCard, $$StockCardsTableReferences),
|
|
StockCard,
|
|
PrefetchHooks Function({
|
|
bool outletInventoryId,
|
|
bool userId,
|
|
bool receiveFromId,
|
|
})
|
|
> {
|
|
$$StockCardsTableTableManager(_$AppDatabase db, $StockCardsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$StockCardsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$StockCardsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$StockCardsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> outletInventoryId = const Value.absent(),
|
|
Value<String> userId = const Value.absent(),
|
|
Value<String> type = const Value.absent(),
|
|
Value<String?> receiveFromId = const Value.absent(),
|
|
Value<double> qtyChange = const Value.absent(),
|
|
Value<double> currentStock = const Value.absent(),
|
|
Value<String> stockType = const Value.absent(),
|
|
Value<bool> modeChange = const Value.absent(),
|
|
Value<String?> modeBeforeChange = const Value.absent(),
|
|
Value<String?> modeAfterChange = const Value.absent(),
|
|
Value<double> costPrice = const Value.absent(),
|
|
Value<String?> referenceId = const Value.absent(),
|
|
Value<String?> documentNumber = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => StockCardsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletInventoryId: outletInventoryId,
|
|
userId: userId,
|
|
type: type,
|
|
receiveFromId: receiveFromId,
|
|
qtyChange: qtyChange,
|
|
currentStock: currentStock,
|
|
stockType: stockType,
|
|
modeChange: modeChange,
|
|
modeBeforeChange: modeBeforeChange,
|
|
modeAfterChange: modeAfterChange,
|
|
costPrice: costPrice,
|
|
referenceId: referenceId,
|
|
documentNumber: documentNumber,
|
|
notes: notes,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String outletInventoryId,
|
|
required String userId,
|
|
required String type,
|
|
Value<String?> receiveFromId = const Value.absent(),
|
|
Value<double> qtyChange = const Value.absent(),
|
|
Value<double> currentStock = const Value.absent(),
|
|
Value<String> stockType = const Value.absent(),
|
|
Value<bool> modeChange = const Value.absent(),
|
|
Value<String?> modeBeforeChange = const Value.absent(),
|
|
Value<String?> modeAfterChange = const Value.absent(),
|
|
Value<double> costPrice = const Value.absent(),
|
|
Value<String?> referenceId = const Value.absent(),
|
|
Value<String?> documentNumber = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => StockCardsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletInventoryId: outletInventoryId,
|
|
userId: userId,
|
|
type: type,
|
|
receiveFromId: receiveFromId,
|
|
qtyChange: qtyChange,
|
|
currentStock: currentStock,
|
|
stockType: stockType,
|
|
modeChange: modeChange,
|
|
modeBeforeChange: modeBeforeChange,
|
|
modeAfterChange: modeAfterChange,
|
|
costPrice: costPrice,
|
|
referenceId: referenceId,
|
|
documentNumber: documentNumber,
|
|
notes: notes,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$StockCardsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
outletInventoryId = false,
|
|
userId = false,
|
|
receiveFromId = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (outletInventoryId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.outletInventoryId,
|
|
referencedTable: $$StockCardsTableReferences
|
|
._outletInventoryIdTable(db),
|
|
referencedColumn:
|
|
$$StockCardsTableReferences
|
|
._outletInventoryIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (userId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.userId,
|
|
referencedTable: $$StockCardsTableReferences
|
|
._userIdTable(db),
|
|
referencedColumn:
|
|
$$StockCardsTableReferences
|
|
._userIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (receiveFromId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.receiveFromId,
|
|
referencedTable: $$StockCardsTableReferences
|
|
._receiveFromIdTable(db),
|
|
referencedColumn:
|
|
$$StockCardsTableReferences
|
|
._receiveFromIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$StockCardsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$StockCardsTable,
|
|
StockCard,
|
|
$$StockCardsTableFilterComposer,
|
|
$$StockCardsTableOrderingComposer,
|
|
$$StockCardsTableAnnotationComposer,
|
|
$$StockCardsTableCreateCompanionBuilder,
|
|
$$StockCardsTableUpdateCompanionBuilder,
|
|
(StockCard, $$StockCardsTableReferences),
|
|
StockCard,
|
|
PrefetchHooks Function({
|
|
bool outletInventoryId,
|
|
bool userId,
|
|
bool receiveFromId,
|
|
})
|
|
>;
|
|
typedef $$OrdersTableCreateCompanionBuilder =
|
|
OrdersCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String orderNumber,
|
|
required String outletId,
|
|
required String outletNameSnapshot,
|
|
Value<String?> customerId,
|
|
Value<String?> customerNameSnapshot,
|
|
Value<String?> customerEmailSnapshot,
|
|
Value<String?> customerPhoneNumberSnapshot,
|
|
required String userId,
|
|
required String adminNameSnapshot,
|
|
required String source,
|
|
Value<bool?> alreadyRead,
|
|
required String orderStatus,
|
|
Value<bool?> isCancellation,
|
|
Value<bool?> cancellationAccepted,
|
|
Value<String?> approvalProccess,
|
|
Value<String?> canceledBy,
|
|
Value<String?> deliveryType,
|
|
Value<String?> deliveryPrefrence,
|
|
Value<double> shippingCost,
|
|
Value<double> totalOrder,
|
|
Value<double> discount,
|
|
Value<double> tax,
|
|
Value<double> totalAmount,
|
|
Value<double> amountPaid,
|
|
Value<double> changeAmount,
|
|
Value<String?> notes,
|
|
Value<String?> paymentProofPath,
|
|
Value<String?> paymentProofUrl,
|
|
Value<String?> paymentMethod,
|
|
Value<Map<String, dynamic>?> customerAddressSnapshot,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$OrdersTableUpdateCompanionBuilder =
|
|
OrdersCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> orderNumber,
|
|
Value<String> outletId,
|
|
Value<String> outletNameSnapshot,
|
|
Value<String?> customerId,
|
|
Value<String?> customerNameSnapshot,
|
|
Value<String?> customerEmailSnapshot,
|
|
Value<String?> customerPhoneNumberSnapshot,
|
|
Value<String> userId,
|
|
Value<String> adminNameSnapshot,
|
|
Value<String> source,
|
|
Value<bool?> alreadyRead,
|
|
Value<String> orderStatus,
|
|
Value<bool?> isCancellation,
|
|
Value<bool?> cancellationAccepted,
|
|
Value<String?> approvalProccess,
|
|
Value<String?> canceledBy,
|
|
Value<String?> deliveryType,
|
|
Value<String?> deliveryPrefrence,
|
|
Value<double> shippingCost,
|
|
Value<double> totalOrder,
|
|
Value<double> discount,
|
|
Value<double> tax,
|
|
Value<double> totalAmount,
|
|
Value<double> amountPaid,
|
|
Value<double> changeAmount,
|
|
Value<String?> notes,
|
|
Value<String?> paymentProofPath,
|
|
Value<String?> paymentProofUrl,
|
|
Value<String?> paymentMethod,
|
|
Value<Map<String, dynamic>?> customerAddressSnapshot,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$OrdersTableReferences
|
|
extends BaseReferences<_$AppDatabase, $OrdersTable, Order> {
|
|
$$OrdersTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $OutletsTable _outletIdTable(_$AppDatabase db) =>
|
|
db.outlets.createAlias(
|
|
$_aliasNameGenerator(db.orders.outletId, db.outlets.localId),
|
|
);
|
|
|
|
$$OutletsTableProcessedTableManager get outletId {
|
|
final $_column = $_itemColumn<String>('outlet_id')!;
|
|
|
|
final manager = $$OutletsTableTableManager(
|
|
$_db,
|
|
$_db.outlets,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_outletIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $CustomersTable _customerIdTable(_$AppDatabase db) =>
|
|
db.customers.createAlias(
|
|
$_aliasNameGenerator(db.orders.customerId, db.customers.localId),
|
|
);
|
|
|
|
$$CustomersTableProcessedTableManager? get customerId {
|
|
final $_column = $_itemColumn<String>('customer_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$CustomersTableTableManager(
|
|
$_db,
|
|
$_db.customers,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_customerIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
|
|
$_aliasNameGenerator(db.orders.userId, db.users.localId),
|
|
);
|
|
|
|
$$UsersTableProcessedTableManager get userId {
|
|
final $_column = $_itemColumn<String>('user_id')!;
|
|
|
|
final manager = $$UsersTableTableManager(
|
|
$_db,
|
|
$_db.users,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$OrderItemsTable, List<OrderItem>>
|
|
_orderItemsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.orderItems,
|
|
aliasName: $_aliasNameGenerator(db.orders.localId, db.orderItems.orderId),
|
|
);
|
|
|
|
$$OrderItemsTableProcessedTableManager get orderItemsRefs {
|
|
final manager = $$OrderItemsTableTableManager($_db, $_db.orderItems).filter(
|
|
(f) => f.orderId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_orderItemsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$OrdersTableFilterComposer
|
|
extends Composer<_$AppDatabase, $OrdersTable> {
|
|
$$OrdersTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get orderNumber => $composableBuilder(
|
|
column: $table.orderNumber,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get outletNameSnapshot => $composableBuilder(
|
|
column: $table.outletNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get customerNameSnapshot => $composableBuilder(
|
|
column: $table.customerNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get customerEmailSnapshot => $composableBuilder(
|
|
column: $table.customerEmailSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get customerPhoneNumberSnapshot => $composableBuilder(
|
|
column: $table.customerPhoneNumberSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get adminNameSnapshot => $composableBuilder(
|
|
column: $table.adminNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get source => $composableBuilder(
|
|
column: $table.source,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get alreadyRead => $composableBuilder(
|
|
column: $table.alreadyRead,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get orderStatus => $composableBuilder(
|
|
column: $table.orderStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isCancellation => $composableBuilder(
|
|
column: $table.isCancellation,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get cancellationAccepted => $composableBuilder(
|
|
column: $table.cancellationAccepted,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get approvalProccess => $composableBuilder(
|
|
column: $table.approvalProccess,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get canceledBy => $composableBuilder(
|
|
column: $table.canceledBy,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get deliveryType => $composableBuilder(
|
|
column: $table.deliveryType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get deliveryPrefrence => $composableBuilder(
|
|
column: $table.deliveryPrefrence,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get shippingCost => $composableBuilder(
|
|
column: $table.shippingCost,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get totalOrder => $composableBuilder(
|
|
column: $table.totalOrder,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get discount => $composableBuilder(
|
|
column: $table.discount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get tax => $composableBuilder(
|
|
column: $table.tax,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get totalAmount => $composableBuilder(
|
|
column: $table.totalAmount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amountPaid => $composableBuilder(
|
|
column: $table.amountPaid,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get changeAmount => $composableBuilder(
|
|
column: $table.changeAmount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get paymentProofPath => $composableBuilder(
|
|
column: $table.paymentProofPath,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get paymentProofUrl => $composableBuilder(
|
|
column: $table.paymentProofUrl,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get paymentMethod => $composableBuilder(
|
|
column: $table.paymentMethod,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnWithTypeConverterFilters<
|
|
Map<String, dynamic>?,
|
|
Map<String, dynamic>,
|
|
String
|
|
>
|
|
get customerAddressSnapshot => $composableBuilder(
|
|
column: $table.customerAddressSnapshot,
|
|
builder: (column) => ColumnWithTypeConverterFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$OutletsTableFilterComposer get outletId {
|
|
final $$OutletsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$CustomersTableFilterComposer get customerId {
|
|
final $$CustomersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableFilterComposer get userId {
|
|
final $$UsersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> orderItemsRefs(
|
|
Expression<bool> Function($$OrderItemsTableFilterComposer f) f,
|
|
) {
|
|
final $$OrderItemsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orderItems,
|
|
getReferencedColumn: (t) => t.orderId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrderItemsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.orderItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$OrdersTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $OrdersTable> {
|
|
$$OrdersTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get orderNumber => $composableBuilder(
|
|
column: $table.orderNumber,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get outletNameSnapshot => $composableBuilder(
|
|
column: $table.outletNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get customerNameSnapshot => $composableBuilder(
|
|
column: $table.customerNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get customerEmailSnapshot => $composableBuilder(
|
|
column: $table.customerEmailSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get customerPhoneNumberSnapshot => $composableBuilder(
|
|
column: $table.customerPhoneNumberSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get adminNameSnapshot => $composableBuilder(
|
|
column: $table.adminNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get source => $composableBuilder(
|
|
column: $table.source,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get alreadyRead => $composableBuilder(
|
|
column: $table.alreadyRead,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get orderStatus => $composableBuilder(
|
|
column: $table.orderStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isCancellation => $composableBuilder(
|
|
column: $table.isCancellation,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get cancellationAccepted => $composableBuilder(
|
|
column: $table.cancellationAccepted,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get approvalProccess => $composableBuilder(
|
|
column: $table.approvalProccess,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get canceledBy => $composableBuilder(
|
|
column: $table.canceledBy,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get deliveryType => $composableBuilder(
|
|
column: $table.deliveryType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get deliveryPrefrence => $composableBuilder(
|
|
column: $table.deliveryPrefrence,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get shippingCost => $composableBuilder(
|
|
column: $table.shippingCost,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get totalOrder => $composableBuilder(
|
|
column: $table.totalOrder,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get discount => $composableBuilder(
|
|
column: $table.discount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get tax => $composableBuilder(
|
|
column: $table.tax,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get totalAmount => $composableBuilder(
|
|
column: $table.totalAmount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amountPaid => $composableBuilder(
|
|
column: $table.amountPaid,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get changeAmount => $composableBuilder(
|
|
column: $table.changeAmount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get paymentProofPath => $composableBuilder(
|
|
column: $table.paymentProofPath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get paymentProofUrl => $composableBuilder(
|
|
column: $table.paymentProofUrl,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get paymentMethod => $composableBuilder(
|
|
column: $table.paymentMethod,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get customerAddressSnapshot => $composableBuilder(
|
|
column: $table.customerAddressSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$OutletsTableOrderingComposer get outletId {
|
|
final $$OutletsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$CustomersTableOrderingComposer get customerId {
|
|
final $$CustomersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableOrderingComposer get userId {
|
|
final $$UsersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$OrdersTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $OrdersTable> {
|
|
$$OrdersTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get orderNumber => $composableBuilder(
|
|
column: $table.orderNumber,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get outletNameSnapshot => $composableBuilder(
|
|
column: $table.outletNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get customerNameSnapshot => $composableBuilder(
|
|
column: $table.customerNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get customerEmailSnapshot => $composableBuilder(
|
|
column: $table.customerEmailSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get customerPhoneNumberSnapshot => $composableBuilder(
|
|
column: $table.customerPhoneNumberSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get adminNameSnapshot => $composableBuilder(
|
|
column: $table.adminNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get source =>
|
|
$composableBuilder(column: $table.source, builder: (column) => column);
|
|
|
|
GeneratedColumn<bool> get alreadyRead => $composableBuilder(
|
|
column: $table.alreadyRead,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get orderStatus => $composableBuilder(
|
|
column: $table.orderStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get isCancellation => $composableBuilder(
|
|
column: $table.isCancellation,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get cancellationAccepted => $composableBuilder(
|
|
column: $table.cancellationAccepted,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get approvalProccess => $composableBuilder(
|
|
column: $table.approvalProccess,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get canceledBy => $composableBuilder(
|
|
column: $table.canceledBy,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get deliveryType => $composableBuilder(
|
|
column: $table.deliveryType,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get deliveryPrefrence => $composableBuilder(
|
|
column: $table.deliveryPrefrence,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get shippingCost => $composableBuilder(
|
|
column: $table.shippingCost,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get totalOrder => $composableBuilder(
|
|
column: $table.totalOrder,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get discount =>
|
|
$composableBuilder(column: $table.discount, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get tax =>
|
|
$composableBuilder(column: $table.tax, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get totalAmount => $composableBuilder(
|
|
column: $table.totalAmount,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get amountPaid => $composableBuilder(
|
|
column: $table.amountPaid,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get changeAmount => $composableBuilder(
|
|
column: $table.changeAmount,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get notes =>
|
|
$composableBuilder(column: $table.notes, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get paymentProofPath => $composableBuilder(
|
|
column: $table.paymentProofPath,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get paymentProofUrl => $composableBuilder(
|
|
column: $table.paymentProofUrl,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get paymentMethod => $composableBuilder(
|
|
column: $table.paymentMethod,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumnWithTypeConverter<Map<String, dynamic>?, String>
|
|
get customerAddressSnapshot => $composableBuilder(
|
|
column: $table.customerAddressSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
$$OutletsTableAnnotationComposer get outletId {
|
|
final $$OutletsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$CustomersTableAnnotationComposer get customerId {
|
|
final $$CustomersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.customerId,
|
|
referencedTable: $db.customers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CustomersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.customers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableAnnotationComposer get userId {
|
|
final $$UsersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> orderItemsRefs<T extends Object>(
|
|
Expression<T> Function($$OrderItemsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$OrderItemsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.orderItems,
|
|
getReferencedColumn: (t) => t.orderId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrderItemsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.orderItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$OrdersTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$OrdersTable,
|
|
Order,
|
|
$$OrdersTableFilterComposer,
|
|
$$OrdersTableOrderingComposer,
|
|
$$OrdersTableAnnotationComposer,
|
|
$$OrdersTableCreateCompanionBuilder,
|
|
$$OrdersTableUpdateCompanionBuilder,
|
|
(Order, $$OrdersTableReferences),
|
|
Order,
|
|
PrefetchHooks Function({
|
|
bool outletId,
|
|
bool customerId,
|
|
bool userId,
|
|
bool orderItemsRefs,
|
|
})
|
|
> {
|
|
$$OrdersTableTableManager(_$AppDatabase db, $OrdersTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$OrdersTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$OrdersTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$OrdersTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> orderNumber = const Value.absent(),
|
|
Value<String> outletId = const Value.absent(),
|
|
Value<String> outletNameSnapshot = const Value.absent(),
|
|
Value<String?> customerId = const Value.absent(),
|
|
Value<String?> customerNameSnapshot = const Value.absent(),
|
|
Value<String?> customerEmailSnapshot = const Value.absent(),
|
|
Value<String?> customerPhoneNumberSnapshot =
|
|
const Value.absent(),
|
|
Value<String> userId = const Value.absent(),
|
|
Value<String> adminNameSnapshot = const Value.absent(),
|
|
Value<String> source = const Value.absent(),
|
|
Value<bool?> alreadyRead = const Value.absent(),
|
|
Value<String> orderStatus = const Value.absent(),
|
|
Value<bool?> isCancellation = const Value.absent(),
|
|
Value<bool?> cancellationAccepted = const Value.absent(),
|
|
Value<String?> approvalProccess = const Value.absent(),
|
|
Value<String?> canceledBy = const Value.absent(),
|
|
Value<String?> deliveryType = const Value.absent(),
|
|
Value<String?> deliveryPrefrence = const Value.absent(),
|
|
Value<double> shippingCost = const Value.absent(),
|
|
Value<double> totalOrder = const Value.absent(),
|
|
Value<double> discount = const Value.absent(),
|
|
Value<double> tax = const Value.absent(),
|
|
Value<double> totalAmount = const Value.absent(),
|
|
Value<double> amountPaid = const Value.absent(),
|
|
Value<double> changeAmount = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<String?> paymentProofPath = const Value.absent(),
|
|
Value<String?> paymentProofUrl = const Value.absent(),
|
|
Value<String?> paymentMethod = const Value.absent(),
|
|
Value<Map<String, dynamic>?> customerAddressSnapshot =
|
|
const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OrdersCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
orderNumber: orderNumber,
|
|
outletId: outletId,
|
|
outletNameSnapshot: outletNameSnapshot,
|
|
customerId: customerId,
|
|
customerNameSnapshot: customerNameSnapshot,
|
|
customerEmailSnapshot: customerEmailSnapshot,
|
|
customerPhoneNumberSnapshot: customerPhoneNumberSnapshot,
|
|
userId: userId,
|
|
adminNameSnapshot: adminNameSnapshot,
|
|
source: source,
|
|
alreadyRead: alreadyRead,
|
|
orderStatus: orderStatus,
|
|
isCancellation: isCancellation,
|
|
cancellationAccepted: cancellationAccepted,
|
|
approvalProccess: approvalProccess,
|
|
canceledBy: canceledBy,
|
|
deliveryType: deliveryType,
|
|
deliveryPrefrence: deliveryPrefrence,
|
|
shippingCost: shippingCost,
|
|
totalOrder: totalOrder,
|
|
discount: discount,
|
|
tax: tax,
|
|
totalAmount: totalAmount,
|
|
amountPaid: amountPaid,
|
|
changeAmount: changeAmount,
|
|
notes: notes,
|
|
paymentProofPath: paymentProofPath,
|
|
paymentProofUrl: paymentProofUrl,
|
|
paymentMethod: paymentMethod,
|
|
customerAddressSnapshot: customerAddressSnapshot,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String orderNumber,
|
|
required String outletId,
|
|
required String outletNameSnapshot,
|
|
Value<String?> customerId = const Value.absent(),
|
|
Value<String?> customerNameSnapshot = const Value.absent(),
|
|
Value<String?> customerEmailSnapshot = const Value.absent(),
|
|
Value<String?> customerPhoneNumberSnapshot =
|
|
const Value.absent(),
|
|
required String userId,
|
|
required String adminNameSnapshot,
|
|
required String source,
|
|
Value<bool?> alreadyRead = const Value.absent(),
|
|
required String orderStatus,
|
|
Value<bool?> isCancellation = const Value.absent(),
|
|
Value<bool?> cancellationAccepted = const Value.absent(),
|
|
Value<String?> approvalProccess = const Value.absent(),
|
|
Value<String?> canceledBy = const Value.absent(),
|
|
Value<String?> deliveryType = const Value.absent(),
|
|
Value<String?> deliveryPrefrence = const Value.absent(),
|
|
Value<double> shippingCost = const Value.absent(),
|
|
Value<double> totalOrder = const Value.absent(),
|
|
Value<double> discount = const Value.absent(),
|
|
Value<double> tax = const Value.absent(),
|
|
Value<double> totalAmount = const Value.absent(),
|
|
Value<double> amountPaid = const Value.absent(),
|
|
Value<double> changeAmount = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<String?> paymentProofPath = const Value.absent(),
|
|
Value<String?> paymentProofUrl = const Value.absent(),
|
|
Value<String?> paymentMethod = const Value.absent(),
|
|
Value<Map<String, dynamic>?> customerAddressSnapshot =
|
|
const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OrdersCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
orderNumber: orderNumber,
|
|
outletId: outletId,
|
|
outletNameSnapshot: outletNameSnapshot,
|
|
customerId: customerId,
|
|
customerNameSnapshot: customerNameSnapshot,
|
|
customerEmailSnapshot: customerEmailSnapshot,
|
|
customerPhoneNumberSnapshot: customerPhoneNumberSnapshot,
|
|
userId: userId,
|
|
adminNameSnapshot: adminNameSnapshot,
|
|
source: source,
|
|
alreadyRead: alreadyRead,
|
|
orderStatus: orderStatus,
|
|
isCancellation: isCancellation,
|
|
cancellationAccepted: cancellationAccepted,
|
|
approvalProccess: approvalProccess,
|
|
canceledBy: canceledBy,
|
|
deliveryType: deliveryType,
|
|
deliveryPrefrence: deliveryPrefrence,
|
|
shippingCost: shippingCost,
|
|
totalOrder: totalOrder,
|
|
discount: discount,
|
|
tax: tax,
|
|
totalAmount: totalAmount,
|
|
amountPaid: amountPaid,
|
|
changeAmount: changeAmount,
|
|
notes: notes,
|
|
paymentProofPath: paymentProofPath,
|
|
paymentProofUrl: paymentProofUrl,
|
|
paymentMethod: paymentMethod,
|
|
customerAddressSnapshot: customerAddressSnapshot,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) =>
|
|
(e.readTable(table), $$OrdersTableReferences(db, table, e)),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
outletId = false,
|
|
customerId = false,
|
|
userId = false,
|
|
orderItemsRefs = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [if (orderItemsRefs) db.orderItems],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (outletId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.outletId,
|
|
referencedTable: $$OrdersTableReferences
|
|
._outletIdTable(db),
|
|
referencedColumn: $$OrdersTableReferences
|
|
._outletIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (customerId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.customerId,
|
|
referencedTable: $$OrdersTableReferences
|
|
._customerIdTable(db),
|
|
referencedColumn: $$OrdersTableReferences
|
|
._customerIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (userId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.userId,
|
|
referencedTable: $$OrdersTableReferences
|
|
._userIdTable(db),
|
|
referencedColumn: $$OrdersTableReferences
|
|
._userIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (orderItemsRefs)
|
|
await $_getPrefetchedData<
|
|
Order,
|
|
$OrdersTable,
|
|
OrderItem
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$OrdersTableReferences
|
|
._orderItemsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$OrdersTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).orderItemsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.orderId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$OrdersTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$OrdersTable,
|
|
Order,
|
|
$$OrdersTableFilterComposer,
|
|
$$OrdersTableOrderingComposer,
|
|
$$OrdersTableAnnotationComposer,
|
|
$$OrdersTableCreateCompanionBuilder,
|
|
$$OrdersTableUpdateCompanionBuilder,
|
|
(Order, $$OrdersTableReferences),
|
|
Order,
|
|
PrefetchHooks Function({
|
|
bool outletId,
|
|
bool customerId,
|
|
bool userId,
|
|
bool orderItemsRefs,
|
|
})
|
|
>;
|
|
typedef $$OrderItemsTableCreateCompanionBuilder =
|
|
OrderItemsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String orderId,
|
|
required String productVariantId,
|
|
Value<double> quantity,
|
|
Value<String?> productImageSnapshot,
|
|
Value<String?> productImageUrlSnapshot,
|
|
required String productNameSnapshot,
|
|
Value<String?> productVariantNameSnapshot,
|
|
Value<double> sellingPriceSnapshot,
|
|
Value<double> subtotal,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$OrderItemsTableUpdateCompanionBuilder =
|
|
OrderItemsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> orderId,
|
|
Value<String> productVariantId,
|
|
Value<double> quantity,
|
|
Value<String?> productImageSnapshot,
|
|
Value<String?> productImageUrlSnapshot,
|
|
Value<String> productNameSnapshot,
|
|
Value<String?> productVariantNameSnapshot,
|
|
Value<double> sellingPriceSnapshot,
|
|
Value<double> subtotal,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$OrderItemsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $OrderItemsTable, OrderItem> {
|
|
$$OrderItemsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $OrdersTable _orderIdTable(_$AppDatabase db) => db.orders.createAlias(
|
|
$_aliasNameGenerator(db.orderItems.orderId, db.orders.localId),
|
|
);
|
|
|
|
$$OrdersTableProcessedTableManager get orderId {
|
|
final $_column = $_itemColumn<String>('order_id')!;
|
|
|
|
final manager = $$OrdersTableTableManager(
|
|
$_db,
|
|
$_db.orders,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_orderIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $ProductVariantsTable _productVariantIdTable(_$AppDatabase db) =>
|
|
db.productVariants.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.orderItems.productVariantId,
|
|
db.productVariants.localId,
|
|
),
|
|
);
|
|
|
|
$$ProductVariantsTableProcessedTableManager get productVariantId {
|
|
final $_column = $_itemColumn<String>('product_variant_id')!;
|
|
|
|
final manager = $$ProductVariantsTableTableManager(
|
|
$_db,
|
|
$_db.productVariants,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_productVariantIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$OrderItemsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $OrderItemsTable> {
|
|
$$OrderItemsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get quantity => $composableBuilder(
|
|
column: $table.quantity,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get productImageSnapshot => $composableBuilder(
|
|
column: $table.productImageSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get productImageUrlSnapshot => $composableBuilder(
|
|
column: $table.productImageUrlSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get productNameSnapshot => $composableBuilder(
|
|
column: $table.productNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get productVariantNameSnapshot => $composableBuilder(
|
|
column: $table.productVariantNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get sellingPriceSnapshot => $composableBuilder(
|
|
column: $table.sellingPriceSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get subtotal => $composableBuilder(
|
|
column: $table.subtotal,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$OrdersTableFilterComposer get orderId {
|
|
final $$OrdersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.orderId,
|
|
referencedTable: $db.orders,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrdersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.orders,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$ProductVariantsTableFilterComposer get productVariantId {
|
|
final $$ProductVariantsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productVariantId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$OrderItemsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $OrderItemsTable> {
|
|
$$OrderItemsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get quantity => $composableBuilder(
|
|
column: $table.quantity,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get productImageSnapshot => $composableBuilder(
|
|
column: $table.productImageSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get productImageUrlSnapshot => $composableBuilder(
|
|
column: $table.productImageUrlSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get productNameSnapshot => $composableBuilder(
|
|
column: $table.productNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get productVariantNameSnapshot => $composableBuilder(
|
|
column: $table.productVariantNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get sellingPriceSnapshot => $composableBuilder(
|
|
column: $table.sellingPriceSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get subtotal => $composableBuilder(
|
|
column: $table.subtotal,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$OrdersTableOrderingComposer get orderId {
|
|
final $$OrdersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.orderId,
|
|
referencedTable: $db.orders,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrdersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.orders,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$ProductVariantsTableOrderingComposer get productVariantId {
|
|
final $$ProductVariantsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productVariantId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$OrderItemsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $OrderItemsTable> {
|
|
$$OrderItemsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get quantity =>
|
|
$composableBuilder(column: $table.quantity, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get productImageSnapshot => $composableBuilder(
|
|
column: $table.productImageSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get productImageUrlSnapshot => $composableBuilder(
|
|
column: $table.productImageUrlSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get productNameSnapshot => $composableBuilder(
|
|
column: $table.productNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get productVariantNameSnapshot => $composableBuilder(
|
|
column: $table.productVariantNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get sellingPriceSnapshot => $composableBuilder(
|
|
column: $table.sellingPriceSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get subtotal =>
|
|
$composableBuilder(column: $table.subtotal, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
$$OrdersTableAnnotationComposer get orderId {
|
|
final $$OrdersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.orderId,
|
|
referencedTable: $db.orders,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OrdersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.orders,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$ProductVariantsTableAnnotationComposer get productVariantId {
|
|
final $$ProductVariantsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.productVariantId,
|
|
referencedTable: $db.productVariants,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$ProductVariantsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.productVariants,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$OrderItemsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$OrderItemsTable,
|
|
OrderItem,
|
|
$$OrderItemsTableFilterComposer,
|
|
$$OrderItemsTableOrderingComposer,
|
|
$$OrderItemsTableAnnotationComposer,
|
|
$$OrderItemsTableCreateCompanionBuilder,
|
|
$$OrderItemsTableUpdateCompanionBuilder,
|
|
(OrderItem, $$OrderItemsTableReferences),
|
|
OrderItem,
|
|
PrefetchHooks Function({bool orderId, bool productVariantId})
|
|
> {
|
|
$$OrderItemsTableTableManager(_$AppDatabase db, $OrderItemsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$OrderItemsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$OrderItemsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$OrderItemsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> orderId = const Value.absent(),
|
|
Value<String> productVariantId = const Value.absent(),
|
|
Value<double> quantity = const Value.absent(),
|
|
Value<String?> productImageSnapshot = const Value.absent(),
|
|
Value<String?> productImageUrlSnapshot = const Value.absent(),
|
|
Value<String> productNameSnapshot = const Value.absent(),
|
|
Value<String?> productVariantNameSnapshot =
|
|
const Value.absent(),
|
|
Value<double> sellingPriceSnapshot = const Value.absent(),
|
|
Value<double> subtotal = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OrderItemsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
orderId: orderId,
|
|
productVariantId: productVariantId,
|
|
quantity: quantity,
|
|
productImageSnapshot: productImageSnapshot,
|
|
productImageUrlSnapshot: productImageUrlSnapshot,
|
|
productNameSnapshot: productNameSnapshot,
|
|
productVariantNameSnapshot: productVariantNameSnapshot,
|
|
sellingPriceSnapshot: sellingPriceSnapshot,
|
|
subtotal: subtotal,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String orderId,
|
|
required String productVariantId,
|
|
Value<double> quantity = const Value.absent(),
|
|
Value<String?> productImageSnapshot = const Value.absent(),
|
|
Value<String?> productImageUrlSnapshot = const Value.absent(),
|
|
required String productNameSnapshot,
|
|
Value<String?> productVariantNameSnapshot =
|
|
const Value.absent(),
|
|
Value<double> sellingPriceSnapshot = const Value.absent(),
|
|
Value<double> subtotal = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OrderItemsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
orderId: orderId,
|
|
productVariantId: productVariantId,
|
|
quantity: quantity,
|
|
productImageSnapshot: productImageSnapshot,
|
|
productImageUrlSnapshot: productImageUrlSnapshot,
|
|
productNameSnapshot: productNameSnapshot,
|
|
productVariantNameSnapshot: productVariantNameSnapshot,
|
|
sellingPriceSnapshot: sellingPriceSnapshot,
|
|
subtotal: subtotal,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$OrderItemsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({orderId = false, productVariantId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (orderId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.orderId,
|
|
referencedTable: $$OrderItemsTableReferences
|
|
._orderIdTable(db),
|
|
referencedColumn: $$OrderItemsTableReferences
|
|
._orderIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (productVariantId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.productVariantId,
|
|
referencedTable: $$OrderItemsTableReferences
|
|
._productVariantIdTable(db),
|
|
referencedColumn: $$OrderItemsTableReferences
|
|
._productVariantIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$OrderItemsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$OrderItemsTable,
|
|
OrderItem,
|
|
$$OrderItemsTableFilterComposer,
|
|
$$OrderItemsTableOrderingComposer,
|
|
$$OrderItemsTableAnnotationComposer,
|
|
$$OrderItemsTableCreateCompanionBuilder,
|
|
$$OrderItemsTableUpdateCompanionBuilder,
|
|
(OrderItem, $$OrderItemsTableReferences),
|
|
OrderItem,
|
|
PrefetchHooks Function({bool orderId, bool productVariantId})
|
|
>;
|
|
typedef $$SuppliersTableCreateCompanionBuilder =
|
|
SuppliersCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String name,
|
|
Value<String?> email,
|
|
Value<String?> phoneNumber,
|
|
Value<String?> address,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$SuppliersTableUpdateCompanionBuilder =
|
|
SuppliersCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> name,
|
|
Value<String?> email,
|
|
Value<String?> phoneNumber,
|
|
Value<String?> address,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$SuppliersTableReferences
|
|
extends BaseReferences<_$AppDatabase, $SuppliersTable, Supplier> {
|
|
$$SuppliersTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static MultiTypedResultKey<$PurchasesTable, List<Purchase>>
|
|
_purchasesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.purchases,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.suppliers.localId,
|
|
db.purchases.supplierId,
|
|
),
|
|
);
|
|
|
|
$$PurchasesTableProcessedTableManager get purchasesRefs {
|
|
final manager = $$PurchasesTableTableManager($_db, $_db.purchases).filter(
|
|
(f) => f.supplierId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_purchasesRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$SuppliersTableFilterComposer
|
|
extends Composer<_$AppDatabase, $SuppliersTable> {
|
|
$$SuppliersTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get email => $composableBuilder(
|
|
column: $table.email,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get address => $composableBuilder(
|
|
column: $table.address,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> purchasesRefs(
|
|
Expression<bool> Function($$PurchasesTableFilterComposer f) f,
|
|
) {
|
|
final $$PurchasesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.purchases,
|
|
getReferencedColumn: (t) => t.supplierId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchasesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.purchases,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$SuppliersTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $SuppliersTable> {
|
|
$$SuppliersTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get email => $composableBuilder(
|
|
column: $table.email,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get address => $composableBuilder(
|
|
column: $table.address,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$SuppliersTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $SuppliersTable> {
|
|
$$SuppliersTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get email =>
|
|
$composableBuilder(column: $table.email, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get phoneNumber => $composableBuilder(
|
|
column: $table.phoneNumber,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get address =>
|
|
$composableBuilder(column: $table.address, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
Expression<T> purchasesRefs<T extends Object>(
|
|
Expression<T> Function($$PurchasesTableAnnotationComposer a) f,
|
|
) {
|
|
final $$PurchasesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.purchases,
|
|
getReferencedColumn: (t) => t.supplierId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchasesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.purchases,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$SuppliersTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$SuppliersTable,
|
|
Supplier,
|
|
$$SuppliersTableFilterComposer,
|
|
$$SuppliersTableOrderingComposer,
|
|
$$SuppliersTableAnnotationComposer,
|
|
$$SuppliersTableCreateCompanionBuilder,
|
|
$$SuppliersTableUpdateCompanionBuilder,
|
|
(Supplier, $$SuppliersTableReferences),
|
|
Supplier,
|
|
PrefetchHooks Function({bool purchasesRefs})
|
|
> {
|
|
$$SuppliersTableTableManager(_$AppDatabase db, $SuppliersTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$SuppliersTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$SuppliersTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$SuppliersTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> address = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => SuppliersCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
name: name,
|
|
email: email,
|
|
phoneNumber: phoneNumber,
|
|
address: address,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String name,
|
|
Value<String?> email = const Value.absent(),
|
|
Value<String?> phoneNumber = const Value.absent(),
|
|
Value<String?> address = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => SuppliersCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
name: name,
|
|
email: email,
|
|
phoneNumber: phoneNumber,
|
|
address: address,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$SuppliersTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({purchasesRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [if (purchasesRefs) db.purchases],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (purchasesRefs)
|
|
await $_getPrefetchedData<
|
|
Supplier,
|
|
$SuppliersTable,
|
|
Purchase
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$SuppliersTableReferences
|
|
._purchasesRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$SuppliersTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).purchasesRefs,
|
|
referencedItemsForCurrentItem: (item, referencedItems) =>
|
|
referencedItems.where(
|
|
(e) => e.supplierId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$SuppliersTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$SuppliersTable,
|
|
Supplier,
|
|
$$SuppliersTableFilterComposer,
|
|
$$SuppliersTableOrderingComposer,
|
|
$$SuppliersTableAnnotationComposer,
|
|
$$SuppliersTableCreateCompanionBuilder,
|
|
$$SuppliersTableUpdateCompanionBuilder,
|
|
(Supplier, $$SuppliersTableReferences),
|
|
Supplier,
|
|
PrefetchHooks Function({bool purchasesRefs})
|
|
>;
|
|
typedef $$PurchasesTableCreateCompanionBuilder =
|
|
PurchasesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String purchaseNumber,
|
|
required String outletId,
|
|
required String outletNameSnapshot,
|
|
Value<String?> supplierId,
|
|
Value<String?> supplierNameSnapshot,
|
|
Value<String?> supplierEmailSnapshot,
|
|
Value<String?> supplierPhoneNumberSnapshot,
|
|
required String userId,
|
|
required String adminNameSnapshot,
|
|
required String purchaseStatus,
|
|
Value<double> totalPurchase,
|
|
Value<double> discount,
|
|
Value<double> tax,
|
|
required String paymentStatus,
|
|
Value<double> totalAmount,
|
|
Value<double> amountPaid,
|
|
Value<double> changeAmount,
|
|
Value<double> underPaymentAmount,
|
|
Value<double> debtAmount,
|
|
Value<String?> paymentProofPath,
|
|
Value<String?> paymentProofUrl,
|
|
Value<String?> notes,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$PurchasesTableUpdateCompanionBuilder =
|
|
PurchasesCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> purchaseNumber,
|
|
Value<String> outletId,
|
|
Value<String> outletNameSnapshot,
|
|
Value<String?> supplierId,
|
|
Value<String?> supplierNameSnapshot,
|
|
Value<String?> supplierEmailSnapshot,
|
|
Value<String?> supplierPhoneNumberSnapshot,
|
|
Value<String> userId,
|
|
Value<String> adminNameSnapshot,
|
|
Value<String> purchaseStatus,
|
|
Value<double> totalPurchase,
|
|
Value<double> discount,
|
|
Value<double> tax,
|
|
Value<String> paymentStatus,
|
|
Value<double> totalAmount,
|
|
Value<double> amountPaid,
|
|
Value<double> changeAmount,
|
|
Value<double> underPaymentAmount,
|
|
Value<double> debtAmount,
|
|
Value<String?> paymentProofPath,
|
|
Value<String?> paymentProofUrl,
|
|
Value<String?> notes,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$PurchasesTableReferences
|
|
extends BaseReferences<_$AppDatabase, $PurchasesTable, Purchase> {
|
|
$$PurchasesTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $OutletsTable _outletIdTable(_$AppDatabase db) =>
|
|
db.outlets.createAlias(
|
|
$_aliasNameGenerator(db.purchases.outletId, db.outlets.localId),
|
|
);
|
|
|
|
$$OutletsTableProcessedTableManager get outletId {
|
|
final $_column = $_itemColumn<String>('outlet_id')!;
|
|
|
|
final manager = $$OutletsTableTableManager(
|
|
$_db,
|
|
$_db.outlets,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_outletIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $SuppliersTable _supplierIdTable(_$AppDatabase db) =>
|
|
db.suppliers.createAlias(
|
|
$_aliasNameGenerator(db.purchases.supplierId, db.suppliers.localId),
|
|
);
|
|
|
|
$$SuppliersTableProcessedTableManager? get supplierId {
|
|
final $_column = $_itemColumn<String>('supplier_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$SuppliersTableTableManager(
|
|
$_db,
|
|
$_db.suppliers,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_supplierIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
|
|
$_aliasNameGenerator(db.purchases.userId, db.users.localId),
|
|
);
|
|
|
|
$$UsersTableProcessedTableManager get userId {
|
|
final $_column = $_itemColumn<String>('user_id')!;
|
|
|
|
final manager = $$UsersTableTableManager(
|
|
$_db,
|
|
$_db.users,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$PurchaseItemsTable, List<PurchaseItem>>
|
|
_purchaseItemsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.purchaseItems,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.purchases.localId,
|
|
db.purchaseItems.purchaseId,
|
|
),
|
|
);
|
|
|
|
$$PurchaseItemsTableProcessedTableManager get purchaseItemsRefs {
|
|
final manager = $$PurchaseItemsTableTableManager($_db, $_db.purchaseItems)
|
|
.filter(
|
|
(f) =>
|
|
f.purchaseId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_purchaseItemsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$PurchasesTableFilterComposer
|
|
extends Composer<_$AppDatabase, $PurchasesTable> {
|
|
$$PurchasesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get purchaseNumber => $composableBuilder(
|
|
column: $table.purchaseNumber,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get outletNameSnapshot => $composableBuilder(
|
|
column: $table.outletNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get supplierNameSnapshot => $composableBuilder(
|
|
column: $table.supplierNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get supplierEmailSnapshot => $composableBuilder(
|
|
column: $table.supplierEmailSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get supplierPhoneNumberSnapshot => $composableBuilder(
|
|
column: $table.supplierPhoneNumberSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get adminNameSnapshot => $composableBuilder(
|
|
column: $table.adminNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get purchaseStatus => $composableBuilder(
|
|
column: $table.purchaseStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get totalPurchase => $composableBuilder(
|
|
column: $table.totalPurchase,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get discount => $composableBuilder(
|
|
column: $table.discount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get tax => $composableBuilder(
|
|
column: $table.tax,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get paymentStatus => $composableBuilder(
|
|
column: $table.paymentStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get totalAmount => $composableBuilder(
|
|
column: $table.totalAmount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amountPaid => $composableBuilder(
|
|
column: $table.amountPaid,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get changeAmount => $composableBuilder(
|
|
column: $table.changeAmount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get underPaymentAmount => $composableBuilder(
|
|
column: $table.underPaymentAmount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get debtAmount => $composableBuilder(
|
|
column: $table.debtAmount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get paymentProofPath => $composableBuilder(
|
|
column: $table.paymentProofPath,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get paymentProofUrl => $composableBuilder(
|
|
column: $table.paymentProofUrl,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$OutletsTableFilterComposer get outletId {
|
|
final $$OutletsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$SuppliersTableFilterComposer get supplierId {
|
|
final $$SuppliersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.supplierId,
|
|
referencedTable: $db.suppliers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SuppliersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.suppliers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableFilterComposer get userId {
|
|
final $$UsersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> purchaseItemsRefs(
|
|
Expression<bool> Function($$PurchaseItemsTableFilterComposer f) f,
|
|
) {
|
|
final $$PurchaseItemsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.purchaseItems,
|
|
getReferencedColumn: (t) => t.purchaseId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchaseItemsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.purchaseItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$PurchasesTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $PurchasesTable> {
|
|
$$PurchasesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get purchaseNumber => $composableBuilder(
|
|
column: $table.purchaseNumber,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get outletNameSnapshot => $composableBuilder(
|
|
column: $table.outletNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get supplierNameSnapshot => $composableBuilder(
|
|
column: $table.supplierNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get supplierEmailSnapshot => $composableBuilder(
|
|
column: $table.supplierEmailSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get supplierPhoneNumberSnapshot => $composableBuilder(
|
|
column: $table.supplierPhoneNumberSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get adminNameSnapshot => $composableBuilder(
|
|
column: $table.adminNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get purchaseStatus => $composableBuilder(
|
|
column: $table.purchaseStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get totalPurchase => $composableBuilder(
|
|
column: $table.totalPurchase,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get discount => $composableBuilder(
|
|
column: $table.discount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get tax => $composableBuilder(
|
|
column: $table.tax,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get paymentStatus => $composableBuilder(
|
|
column: $table.paymentStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get totalAmount => $composableBuilder(
|
|
column: $table.totalAmount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amountPaid => $composableBuilder(
|
|
column: $table.amountPaid,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get changeAmount => $composableBuilder(
|
|
column: $table.changeAmount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get underPaymentAmount => $composableBuilder(
|
|
column: $table.underPaymentAmount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get debtAmount => $composableBuilder(
|
|
column: $table.debtAmount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get paymentProofPath => $composableBuilder(
|
|
column: $table.paymentProofPath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get paymentProofUrl => $composableBuilder(
|
|
column: $table.paymentProofUrl,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$OutletsTableOrderingComposer get outletId {
|
|
final $$OutletsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$SuppliersTableOrderingComposer get supplierId {
|
|
final $$SuppliersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.supplierId,
|
|
referencedTable: $db.suppliers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SuppliersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.suppliers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableOrderingComposer get userId {
|
|
final $$UsersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PurchasesTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $PurchasesTable> {
|
|
$$PurchasesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get purchaseNumber => $composableBuilder(
|
|
column: $table.purchaseNumber,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get outletNameSnapshot => $composableBuilder(
|
|
column: $table.outletNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get supplierNameSnapshot => $composableBuilder(
|
|
column: $table.supplierNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get supplierEmailSnapshot => $composableBuilder(
|
|
column: $table.supplierEmailSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get supplierPhoneNumberSnapshot => $composableBuilder(
|
|
column: $table.supplierPhoneNumberSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get adminNameSnapshot => $composableBuilder(
|
|
column: $table.adminNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get purchaseStatus => $composableBuilder(
|
|
column: $table.purchaseStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get totalPurchase => $composableBuilder(
|
|
column: $table.totalPurchase,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get discount =>
|
|
$composableBuilder(column: $table.discount, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get tax =>
|
|
$composableBuilder(column: $table.tax, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get paymentStatus => $composableBuilder(
|
|
column: $table.paymentStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get totalAmount => $composableBuilder(
|
|
column: $table.totalAmount,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get amountPaid => $composableBuilder(
|
|
column: $table.amountPaid,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get changeAmount => $composableBuilder(
|
|
column: $table.changeAmount,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get underPaymentAmount => $composableBuilder(
|
|
column: $table.underPaymentAmount,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get debtAmount => $composableBuilder(
|
|
column: $table.debtAmount,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get paymentProofPath => $composableBuilder(
|
|
column: $table.paymentProofPath,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get paymentProofUrl => $composableBuilder(
|
|
column: $table.paymentProofUrl,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get notes =>
|
|
$composableBuilder(column: $table.notes, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
$$OutletsTableAnnotationComposer get outletId {
|
|
final $$OutletsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$SuppliersTableAnnotationComposer get supplierId {
|
|
final $$SuppliersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.supplierId,
|
|
referencedTable: $db.suppliers,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SuppliersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.suppliers,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableAnnotationComposer get userId {
|
|
final $$UsersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> purchaseItemsRefs<T extends Object>(
|
|
Expression<T> Function($$PurchaseItemsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$PurchaseItemsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.purchaseItems,
|
|
getReferencedColumn: (t) => t.purchaseId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchaseItemsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.purchaseItems,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$PurchasesTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$PurchasesTable,
|
|
Purchase,
|
|
$$PurchasesTableFilterComposer,
|
|
$$PurchasesTableOrderingComposer,
|
|
$$PurchasesTableAnnotationComposer,
|
|
$$PurchasesTableCreateCompanionBuilder,
|
|
$$PurchasesTableUpdateCompanionBuilder,
|
|
(Purchase, $$PurchasesTableReferences),
|
|
Purchase,
|
|
PrefetchHooks Function({
|
|
bool outletId,
|
|
bool supplierId,
|
|
bool userId,
|
|
bool purchaseItemsRefs,
|
|
})
|
|
> {
|
|
$$PurchasesTableTableManager(_$AppDatabase db, $PurchasesTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$PurchasesTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$PurchasesTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$PurchasesTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> purchaseNumber = const Value.absent(),
|
|
Value<String> outletId = const Value.absent(),
|
|
Value<String> outletNameSnapshot = const Value.absent(),
|
|
Value<String?> supplierId = const Value.absent(),
|
|
Value<String?> supplierNameSnapshot = const Value.absent(),
|
|
Value<String?> supplierEmailSnapshot = const Value.absent(),
|
|
Value<String?> supplierPhoneNumberSnapshot =
|
|
const Value.absent(),
|
|
Value<String> userId = const Value.absent(),
|
|
Value<String> adminNameSnapshot = const Value.absent(),
|
|
Value<String> purchaseStatus = const Value.absent(),
|
|
Value<double> totalPurchase = const Value.absent(),
|
|
Value<double> discount = const Value.absent(),
|
|
Value<double> tax = const Value.absent(),
|
|
Value<String> paymentStatus = const Value.absent(),
|
|
Value<double> totalAmount = const Value.absent(),
|
|
Value<double> amountPaid = const Value.absent(),
|
|
Value<double> changeAmount = const Value.absent(),
|
|
Value<double> underPaymentAmount = const Value.absent(),
|
|
Value<double> debtAmount = const Value.absent(),
|
|
Value<String?> paymentProofPath = const Value.absent(),
|
|
Value<String?> paymentProofUrl = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PurchasesCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
purchaseNumber: purchaseNumber,
|
|
outletId: outletId,
|
|
outletNameSnapshot: outletNameSnapshot,
|
|
supplierId: supplierId,
|
|
supplierNameSnapshot: supplierNameSnapshot,
|
|
supplierEmailSnapshot: supplierEmailSnapshot,
|
|
supplierPhoneNumberSnapshot: supplierPhoneNumberSnapshot,
|
|
userId: userId,
|
|
adminNameSnapshot: adminNameSnapshot,
|
|
purchaseStatus: purchaseStatus,
|
|
totalPurchase: totalPurchase,
|
|
discount: discount,
|
|
tax: tax,
|
|
paymentStatus: paymentStatus,
|
|
totalAmount: totalAmount,
|
|
amountPaid: amountPaid,
|
|
changeAmount: changeAmount,
|
|
underPaymentAmount: underPaymentAmount,
|
|
debtAmount: debtAmount,
|
|
paymentProofPath: paymentProofPath,
|
|
paymentProofUrl: paymentProofUrl,
|
|
notes: notes,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String purchaseNumber,
|
|
required String outletId,
|
|
required String outletNameSnapshot,
|
|
Value<String?> supplierId = const Value.absent(),
|
|
Value<String?> supplierNameSnapshot = const Value.absent(),
|
|
Value<String?> supplierEmailSnapshot = const Value.absent(),
|
|
Value<String?> supplierPhoneNumberSnapshot =
|
|
const Value.absent(),
|
|
required String userId,
|
|
required String adminNameSnapshot,
|
|
required String purchaseStatus,
|
|
Value<double> totalPurchase = const Value.absent(),
|
|
Value<double> discount = const Value.absent(),
|
|
Value<double> tax = const Value.absent(),
|
|
required String paymentStatus,
|
|
Value<double> totalAmount = const Value.absent(),
|
|
Value<double> amountPaid = const Value.absent(),
|
|
Value<double> changeAmount = const Value.absent(),
|
|
Value<double> underPaymentAmount = const Value.absent(),
|
|
Value<double> debtAmount = const Value.absent(),
|
|
Value<String?> paymentProofPath = const Value.absent(),
|
|
Value<String?> paymentProofUrl = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PurchasesCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
purchaseNumber: purchaseNumber,
|
|
outletId: outletId,
|
|
outletNameSnapshot: outletNameSnapshot,
|
|
supplierId: supplierId,
|
|
supplierNameSnapshot: supplierNameSnapshot,
|
|
supplierEmailSnapshot: supplierEmailSnapshot,
|
|
supplierPhoneNumberSnapshot: supplierPhoneNumberSnapshot,
|
|
userId: userId,
|
|
adminNameSnapshot: adminNameSnapshot,
|
|
purchaseStatus: purchaseStatus,
|
|
totalPurchase: totalPurchase,
|
|
discount: discount,
|
|
tax: tax,
|
|
paymentStatus: paymentStatus,
|
|
totalAmount: totalAmount,
|
|
amountPaid: amountPaid,
|
|
changeAmount: changeAmount,
|
|
underPaymentAmount: underPaymentAmount,
|
|
debtAmount: debtAmount,
|
|
paymentProofPath: paymentProofPath,
|
|
paymentProofUrl: paymentProofUrl,
|
|
notes: notes,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$PurchasesTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
outletId = false,
|
|
supplierId = false,
|
|
userId = false,
|
|
purchaseItemsRefs = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (purchaseItemsRefs) db.purchaseItems,
|
|
],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (outletId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.outletId,
|
|
referencedTable: $$PurchasesTableReferences
|
|
._outletIdTable(db),
|
|
referencedColumn: $$PurchasesTableReferences
|
|
._outletIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (supplierId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.supplierId,
|
|
referencedTable: $$PurchasesTableReferences
|
|
._supplierIdTable(db),
|
|
referencedColumn: $$PurchasesTableReferences
|
|
._supplierIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (userId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.userId,
|
|
referencedTable: $$PurchasesTableReferences
|
|
._userIdTable(db),
|
|
referencedColumn: $$PurchasesTableReferences
|
|
._userIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (purchaseItemsRefs)
|
|
await $_getPrefetchedData<
|
|
Purchase,
|
|
$PurchasesTable,
|
|
PurchaseItem
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$PurchasesTableReferences
|
|
._purchaseItemsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$PurchasesTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).purchaseItemsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.purchaseId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$PurchasesTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$PurchasesTable,
|
|
Purchase,
|
|
$$PurchasesTableFilterComposer,
|
|
$$PurchasesTableOrderingComposer,
|
|
$$PurchasesTableAnnotationComposer,
|
|
$$PurchasesTableCreateCompanionBuilder,
|
|
$$PurchasesTableUpdateCompanionBuilder,
|
|
(Purchase, $$PurchasesTableReferences),
|
|
Purchase,
|
|
PrefetchHooks Function({
|
|
bool outletId,
|
|
bool supplierId,
|
|
bool userId,
|
|
bool purchaseItemsRefs,
|
|
})
|
|
>;
|
|
typedef $$PurchaseItemsTableCreateCompanionBuilder =
|
|
PurchaseItemsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String purchaseId,
|
|
required String itemType,
|
|
required String itemId,
|
|
Value<double> quantity,
|
|
Value<String?> itemImageSnapshot,
|
|
Value<String?> itemImageUrlSnapshot,
|
|
required String itemNameSnapshot,
|
|
Value<String?> itemVariantNameSnapshot,
|
|
Value<double> purchasePriceSnaphot,
|
|
Value<double> subtotal,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$PurchaseItemsTableUpdateCompanionBuilder =
|
|
PurchaseItemsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> purchaseId,
|
|
Value<String> itemType,
|
|
Value<String> itemId,
|
|
Value<double> quantity,
|
|
Value<String?> itemImageSnapshot,
|
|
Value<String?> itemImageUrlSnapshot,
|
|
Value<String> itemNameSnapshot,
|
|
Value<String?> itemVariantNameSnapshot,
|
|
Value<double> purchasePriceSnaphot,
|
|
Value<double> subtotal,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$PurchaseItemsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $PurchaseItemsTable, PurchaseItem> {
|
|
$$PurchaseItemsTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $PurchasesTable _purchaseIdTable(_$AppDatabase db) =>
|
|
db.purchases.createAlias(
|
|
$_aliasNameGenerator(db.purchaseItems.purchaseId, db.purchases.localId),
|
|
);
|
|
|
|
$$PurchasesTableProcessedTableManager get purchaseId {
|
|
final $_column = $_itemColumn<String>('purchase_id')!;
|
|
|
|
final manager = $$PurchasesTableTableManager(
|
|
$_db,
|
|
$_db.purchases,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_purchaseIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$PurchaseItemsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $PurchaseItemsTable> {
|
|
$$PurchaseItemsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get itemType => $composableBuilder(
|
|
column: $table.itemType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get itemId => $composableBuilder(
|
|
column: $table.itemId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get quantity => $composableBuilder(
|
|
column: $table.quantity,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get itemImageSnapshot => $composableBuilder(
|
|
column: $table.itemImageSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get itemImageUrlSnapshot => $composableBuilder(
|
|
column: $table.itemImageUrlSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get itemNameSnapshot => $composableBuilder(
|
|
column: $table.itemNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get itemVariantNameSnapshot => $composableBuilder(
|
|
column: $table.itemVariantNameSnapshot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get purchasePriceSnaphot => $composableBuilder(
|
|
column: $table.purchasePriceSnaphot,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get subtotal => $composableBuilder(
|
|
column: $table.subtotal,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$PurchasesTableFilterComposer get purchaseId {
|
|
final $$PurchasesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.purchaseId,
|
|
referencedTable: $db.purchases,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchasesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.purchases,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PurchaseItemsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $PurchaseItemsTable> {
|
|
$$PurchaseItemsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get itemType => $composableBuilder(
|
|
column: $table.itemType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get itemId => $composableBuilder(
|
|
column: $table.itemId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get quantity => $composableBuilder(
|
|
column: $table.quantity,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get itemImageSnapshot => $composableBuilder(
|
|
column: $table.itemImageSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get itemImageUrlSnapshot => $composableBuilder(
|
|
column: $table.itemImageUrlSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get itemNameSnapshot => $composableBuilder(
|
|
column: $table.itemNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get itemVariantNameSnapshot => $composableBuilder(
|
|
column: $table.itemVariantNameSnapshot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get purchasePriceSnaphot => $composableBuilder(
|
|
column: $table.purchasePriceSnaphot,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get subtotal => $composableBuilder(
|
|
column: $table.subtotal,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$PurchasesTableOrderingComposer get purchaseId {
|
|
final $$PurchasesTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.purchaseId,
|
|
referencedTable: $db.purchases,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchasesTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.purchases,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PurchaseItemsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $PurchaseItemsTable> {
|
|
$$PurchaseItemsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get itemType =>
|
|
$composableBuilder(column: $table.itemType, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get itemId =>
|
|
$composableBuilder(column: $table.itemId, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get quantity =>
|
|
$composableBuilder(column: $table.quantity, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get itemImageSnapshot => $composableBuilder(
|
|
column: $table.itemImageSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get itemImageUrlSnapshot => $composableBuilder(
|
|
column: $table.itemImageUrlSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get itemNameSnapshot => $composableBuilder(
|
|
column: $table.itemNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get itemVariantNameSnapshot => $composableBuilder(
|
|
column: $table.itemVariantNameSnapshot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get purchasePriceSnaphot => $composableBuilder(
|
|
column: $table.purchasePriceSnaphot,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<double> get subtotal =>
|
|
$composableBuilder(column: $table.subtotal, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
$$PurchasesTableAnnotationComposer get purchaseId {
|
|
final $$PurchasesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.purchaseId,
|
|
referencedTable: $db.purchases,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PurchasesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.purchases,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PurchaseItemsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$PurchaseItemsTable,
|
|
PurchaseItem,
|
|
$$PurchaseItemsTableFilterComposer,
|
|
$$PurchaseItemsTableOrderingComposer,
|
|
$$PurchaseItemsTableAnnotationComposer,
|
|
$$PurchaseItemsTableCreateCompanionBuilder,
|
|
$$PurchaseItemsTableUpdateCompanionBuilder,
|
|
(PurchaseItem, $$PurchaseItemsTableReferences),
|
|
PurchaseItem,
|
|
PrefetchHooks Function({bool purchaseId})
|
|
> {
|
|
$$PurchaseItemsTableTableManager(_$AppDatabase db, $PurchaseItemsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$PurchaseItemsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$PurchaseItemsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$PurchaseItemsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> purchaseId = const Value.absent(),
|
|
Value<String> itemType = const Value.absent(),
|
|
Value<String> itemId = const Value.absent(),
|
|
Value<double> quantity = const Value.absent(),
|
|
Value<String?> itemImageSnapshot = const Value.absent(),
|
|
Value<String?> itemImageUrlSnapshot = const Value.absent(),
|
|
Value<String> itemNameSnapshot = const Value.absent(),
|
|
Value<String?> itemVariantNameSnapshot = const Value.absent(),
|
|
Value<double> purchasePriceSnaphot = const Value.absent(),
|
|
Value<double> subtotal = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PurchaseItemsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
purchaseId: purchaseId,
|
|
itemType: itemType,
|
|
itemId: itemId,
|
|
quantity: quantity,
|
|
itemImageSnapshot: itemImageSnapshot,
|
|
itemImageUrlSnapshot: itemImageUrlSnapshot,
|
|
itemNameSnapshot: itemNameSnapshot,
|
|
itemVariantNameSnapshot: itemVariantNameSnapshot,
|
|
purchasePriceSnaphot: purchasePriceSnaphot,
|
|
subtotal: subtotal,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String purchaseId,
|
|
required String itemType,
|
|
required String itemId,
|
|
Value<double> quantity = const Value.absent(),
|
|
Value<String?> itemImageSnapshot = const Value.absent(),
|
|
Value<String?> itemImageUrlSnapshot = const Value.absent(),
|
|
required String itemNameSnapshot,
|
|
Value<String?> itemVariantNameSnapshot = const Value.absent(),
|
|
Value<double> purchasePriceSnaphot = const Value.absent(),
|
|
Value<double> subtotal = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PurchaseItemsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
purchaseId: purchaseId,
|
|
itemType: itemType,
|
|
itemId: itemId,
|
|
quantity: quantity,
|
|
itemImageSnapshot: itemImageSnapshot,
|
|
itemImageUrlSnapshot: itemImageUrlSnapshot,
|
|
itemNameSnapshot: itemNameSnapshot,
|
|
itemVariantNameSnapshot: itemVariantNameSnapshot,
|
|
purchasePriceSnaphot: purchasePriceSnaphot,
|
|
subtotal: subtotal,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$PurchaseItemsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({purchaseId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (purchaseId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.purchaseId,
|
|
referencedTable: $$PurchaseItemsTableReferences
|
|
._purchaseIdTable(db),
|
|
referencedColumn: $$PurchaseItemsTableReferences
|
|
._purchaseIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$PurchaseItemsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$PurchaseItemsTable,
|
|
PurchaseItem,
|
|
$$PurchaseItemsTableFilterComposer,
|
|
$$PurchaseItemsTableOrderingComposer,
|
|
$$PurchaseItemsTableAnnotationComposer,
|
|
$$PurchaseItemsTableCreateCompanionBuilder,
|
|
$$PurchaseItemsTableUpdateCompanionBuilder,
|
|
(PurchaseItem, $$PurchaseItemsTableReferences),
|
|
PurchaseItem,
|
|
PrefetchHooks Function({bool purchaseId})
|
|
>;
|
|
typedef $$TransactionsTableCreateCompanionBuilder =
|
|
TransactionsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String outletId,
|
|
required String userId,
|
|
required String referenceType,
|
|
required String referenceId,
|
|
required String referenceNumber,
|
|
Value<String?> stakeholder,
|
|
required String transactionType,
|
|
required String category,
|
|
Value<double> amount,
|
|
Value<String?> note,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$TransactionsTableUpdateCompanionBuilder =
|
|
TransactionsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> outletId,
|
|
Value<String> userId,
|
|
Value<String> referenceType,
|
|
Value<String> referenceId,
|
|
Value<String> referenceNumber,
|
|
Value<String?> stakeholder,
|
|
Value<String> transactionType,
|
|
Value<String> category,
|
|
Value<double> amount,
|
|
Value<String?> note,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$TransactionsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $TransactionsTable, Transaction> {
|
|
$$TransactionsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $OutletsTable _outletIdTable(_$AppDatabase db) =>
|
|
db.outlets.createAlias(
|
|
$_aliasNameGenerator(db.transactions.outletId, db.outlets.localId),
|
|
);
|
|
|
|
$$OutletsTableProcessedTableManager get outletId {
|
|
final $_column = $_itemColumn<String>('outlet_id')!;
|
|
|
|
final manager = $$OutletsTableTableManager(
|
|
$_db,
|
|
$_db.outlets,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_outletIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
|
|
$_aliasNameGenerator(db.transactions.userId, db.users.localId),
|
|
);
|
|
|
|
$$UsersTableProcessedTableManager get userId {
|
|
final $_column = $_itemColumn<String>('user_id')!;
|
|
|
|
final manager = $$UsersTableTableManager(
|
|
$_db,
|
|
$_db.users,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $TransactionsTable> {
|
|
$$TransactionsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get referenceType => $composableBuilder(
|
|
column: $table.referenceType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get referenceId => $composableBuilder(
|
|
column: $table.referenceId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get referenceNumber => $composableBuilder(
|
|
column: $table.referenceNumber,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get stakeholder => $composableBuilder(
|
|
column: $table.stakeholder,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get transactionType => $composableBuilder(
|
|
column: $table.transactionType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get category => $composableBuilder(
|
|
column: $table.category,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get note => $composableBuilder(
|
|
column: $table.note,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$OutletsTableFilterComposer get outletId {
|
|
final $$OutletsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableFilterComposer get userId {
|
|
final $$UsersTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $TransactionsTable> {
|
|
$$TransactionsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get referenceType => $composableBuilder(
|
|
column: $table.referenceType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get referenceId => $composableBuilder(
|
|
column: $table.referenceId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get referenceNumber => $composableBuilder(
|
|
column: $table.referenceNumber,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get stakeholder => $composableBuilder(
|
|
column: $table.stakeholder,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get transactionType => $composableBuilder(
|
|
column: $table.transactionType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get category => $composableBuilder(
|
|
column: $table.category,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get note => $composableBuilder(
|
|
column: $table.note,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$OutletsTableOrderingComposer get outletId {
|
|
final $$OutletsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableOrderingComposer get userId {
|
|
final $$UsersTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $TransactionsTable> {
|
|
$$TransactionsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get referenceType => $composableBuilder(
|
|
column: $table.referenceType,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get referenceId => $composableBuilder(
|
|
column: $table.referenceId,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get referenceNumber => $composableBuilder(
|
|
column: $table.referenceNumber,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get stakeholder => $composableBuilder(
|
|
column: $table.stakeholder,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get transactionType => $composableBuilder(
|
|
column: $table.transactionType,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get category =>
|
|
$composableBuilder(column: $table.category, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get amount =>
|
|
$composableBuilder(column: $table.amount, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get note =>
|
|
$composableBuilder(column: $table.note, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
$$OutletsTableAnnotationComposer get outletId {
|
|
final $$OutletsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$UsersTableAnnotationComposer get userId {
|
|
final $$UsersTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.userId,
|
|
referencedTable: $db.users,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$UsersTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.users,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$TransactionsTable,
|
|
Transaction,
|
|
$$TransactionsTableFilterComposer,
|
|
$$TransactionsTableOrderingComposer,
|
|
$$TransactionsTableAnnotationComposer,
|
|
$$TransactionsTableCreateCompanionBuilder,
|
|
$$TransactionsTableUpdateCompanionBuilder,
|
|
(Transaction, $$TransactionsTableReferences),
|
|
Transaction,
|
|
PrefetchHooks Function({bool outletId, bool userId})
|
|
> {
|
|
$$TransactionsTableTableManager(_$AppDatabase db, $TransactionsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$TransactionsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$TransactionsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$TransactionsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> outletId = const Value.absent(),
|
|
Value<String> userId = const Value.absent(),
|
|
Value<String> referenceType = const Value.absent(),
|
|
Value<String> referenceId = const Value.absent(),
|
|
Value<String> referenceNumber = const Value.absent(),
|
|
Value<String?> stakeholder = const Value.absent(),
|
|
Value<String> transactionType = const Value.absent(),
|
|
Value<String> category = const Value.absent(),
|
|
Value<double> amount = const Value.absent(),
|
|
Value<String?> note = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => TransactionsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletId: outletId,
|
|
userId: userId,
|
|
referenceType: referenceType,
|
|
referenceId: referenceId,
|
|
referenceNumber: referenceNumber,
|
|
stakeholder: stakeholder,
|
|
transactionType: transactionType,
|
|
category: category,
|
|
amount: amount,
|
|
note: note,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String outletId,
|
|
required String userId,
|
|
required String referenceType,
|
|
required String referenceId,
|
|
required String referenceNumber,
|
|
Value<String?> stakeholder = const Value.absent(),
|
|
required String transactionType,
|
|
required String category,
|
|
Value<double> amount = const Value.absent(),
|
|
Value<String?> note = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => TransactionsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
outletId: outletId,
|
|
userId: userId,
|
|
referenceType: referenceType,
|
|
referenceId: referenceId,
|
|
referenceNumber: referenceNumber,
|
|
stakeholder: stakeholder,
|
|
transactionType: transactionType,
|
|
category: category,
|
|
amount: amount,
|
|
note: note,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$TransactionsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({outletId = false, userId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (outletId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.outletId,
|
|
referencedTable: $$TransactionsTableReferences
|
|
._outletIdTable(db),
|
|
referencedColumn: $$TransactionsTableReferences
|
|
._outletIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (userId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.userId,
|
|
referencedTable: $$TransactionsTableReferences
|
|
._userIdTable(db),
|
|
referencedColumn: $$TransactionsTableReferences
|
|
._userIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$TransactionsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$TransactionsTable,
|
|
Transaction,
|
|
$$TransactionsTableFilterComposer,
|
|
$$TransactionsTableOrderingComposer,
|
|
$$TransactionsTableAnnotationComposer,
|
|
$$TransactionsTableCreateCompanionBuilder,
|
|
$$TransactionsTableUpdateCompanionBuilder,
|
|
(Transaction, $$TransactionsTableReferences),
|
|
Transaction,
|
|
PrefetchHooks Function({bool outletId, bool userId})
|
|
>;
|
|
typedef $$CampaignsTableCreateCompanionBuilder =
|
|
CampaignsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String title,
|
|
required String localBannerPath,
|
|
Value<String?> serverBannerUrl,
|
|
Value<DateTime?> startDate,
|
|
Value<DateTime?> endDate,
|
|
Value<String?> actionType,
|
|
Value<String?> actionReferenceId,
|
|
Value<bool> isActive,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$CampaignsTableUpdateCompanionBuilder =
|
|
CampaignsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> title,
|
|
Value<String> localBannerPath,
|
|
Value<String?> serverBannerUrl,
|
|
Value<DateTime?> startDate,
|
|
Value<DateTime?> endDate,
|
|
Value<String?> actionType,
|
|
Value<String?> actionReferenceId,
|
|
Value<bool> isActive,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$CampaignsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $CampaignsTable, Campaign> {
|
|
$$CampaignsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static MultiTypedResultKey<$OutletCampaignsTable, List<OutletCampaign>>
|
|
_outletCampaignsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.outletCampaigns,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.campaigns.localId,
|
|
db.outletCampaigns.campaignId,
|
|
),
|
|
);
|
|
|
|
$$OutletCampaignsTableProcessedTableManager get outletCampaignsRefs {
|
|
final manager =
|
|
$$OutletCampaignsTableTableManager($_db, $_db.outletCampaigns).filter(
|
|
(f) =>
|
|
f.campaignId.localId.sqlEquals($_itemColumn<String>('local_id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_outletCampaignsRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$CampaignsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $CampaignsTable> {
|
|
$$CampaignsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get title => $composableBuilder(
|
|
column: $table.title,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get localBannerPath => $composableBuilder(
|
|
column: $table.localBannerPath,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverBannerUrl => $composableBuilder(
|
|
column: $table.serverBannerUrl,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get startDate => $composableBuilder(
|
|
column: $table.startDate,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get endDate => $composableBuilder(
|
|
column: $table.endDate,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get actionType => $composableBuilder(
|
|
column: $table.actionType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get actionReferenceId => $composableBuilder(
|
|
column: $table.actionReferenceId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isActive => $composableBuilder(
|
|
column: $table.isActive,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> outletCampaignsRefs(
|
|
Expression<bool> Function($$OutletCampaignsTableFilterComposer f) f,
|
|
) {
|
|
final $$OutletCampaignsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.outletCampaigns,
|
|
getReferencedColumn: (t) => t.campaignId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletCampaignsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outletCampaigns,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CampaignsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $CampaignsTable> {
|
|
$$CampaignsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get title => $composableBuilder(
|
|
column: $table.title,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get localBannerPath => $composableBuilder(
|
|
column: $table.localBannerPath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverBannerUrl => $composableBuilder(
|
|
column: $table.serverBannerUrl,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get startDate => $composableBuilder(
|
|
column: $table.startDate,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get endDate => $composableBuilder(
|
|
column: $table.endDate,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get actionType => $composableBuilder(
|
|
column: $table.actionType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get actionReferenceId => $composableBuilder(
|
|
column: $table.actionReferenceId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isActive => $composableBuilder(
|
|
column: $table.isActive,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$CampaignsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $CampaignsTable> {
|
|
$$CampaignsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get title =>
|
|
$composableBuilder(column: $table.title, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get localBannerPath => $composableBuilder(
|
|
column: $table.localBannerPath,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get serverBannerUrl => $composableBuilder(
|
|
column: $table.serverBannerUrl,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get startDate =>
|
|
$composableBuilder(column: $table.startDate, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get endDate =>
|
|
$composableBuilder(column: $table.endDate, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get actionType => $composableBuilder(
|
|
column: $table.actionType,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get actionReferenceId => $composableBuilder(
|
|
column: $table.actionReferenceId,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get isActive =>
|
|
$composableBuilder(column: $table.isActive, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
Expression<T> outletCampaignsRefs<T extends Object>(
|
|
Expression<T> Function($$OutletCampaignsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$OutletCampaignsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.localId,
|
|
referencedTable: $db.outletCampaigns,
|
|
getReferencedColumn: (t) => t.campaignId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletCampaignsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outletCampaigns,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CampaignsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$CampaignsTable,
|
|
Campaign,
|
|
$$CampaignsTableFilterComposer,
|
|
$$CampaignsTableOrderingComposer,
|
|
$$CampaignsTableAnnotationComposer,
|
|
$$CampaignsTableCreateCompanionBuilder,
|
|
$$CampaignsTableUpdateCompanionBuilder,
|
|
(Campaign, $$CampaignsTableReferences),
|
|
Campaign,
|
|
PrefetchHooks Function({bool outletCampaignsRefs})
|
|
> {
|
|
$$CampaignsTableTableManager(_$AppDatabase db, $CampaignsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$CampaignsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$CampaignsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$CampaignsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> title = const Value.absent(),
|
|
Value<String> localBannerPath = const Value.absent(),
|
|
Value<String?> serverBannerUrl = const Value.absent(),
|
|
Value<DateTime?> startDate = const Value.absent(),
|
|
Value<DateTime?> endDate = const Value.absent(),
|
|
Value<String?> actionType = const Value.absent(),
|
|
Value<String?> actionReferenceId = const Value.absent(),
|
|
Value<bool> isActive = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => CampaignsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
title: title,
|
|
localBannerPath: localBannerPath,
|
|
serverBannerUrl: serverBannerUrl,
|
|
startDate: startDate,
|
|
endDate: endDate,
|
|
actionType: actionType,
|
|
actionReferenceId: actionReferenceId,
|
|
isActive: isActive,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String title,
|
|
required String localBannerPath,
|
|
Value<String?> serverBannerUrl = const Value.absent(),
|
|
Value<DateTime?> startDate = const Value.absent(),
|
|
Value<DateTime?> endDate = const Value.absent(),
|
|
Value<String?> actionType = const Value.absent(),
|
|
Value<String?> actionReferenceId = const Value.absent(),
|
|
Value<bool> isActive = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => CampaignsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
title: title,
|
|
localBannerPath: localBannerPath,
|
|
serverBannerUrl: serverBannerUrl,
|
|
startDate: startDate,
|
|
endDate: endDate,
|
|
actionType: actionType,
|
|
actionReferenceId: actionReferenceId,
|
|
isActive: isActive,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$CampaignsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({outletCampaignsRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (outletCampaignsRefs) db.outletCampaigns,
|
|
],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (outletCampaignsRefs)
|
|
await $_getPrefetchedData<
|
|
Campaign,
|
|
$CampaignsTable,
|
|
OutletCampaign
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$CampaignsTableReferences
|
|
._outletCampaignsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$CampaignsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).outletCampaignsRefs,
|
|
referencedItemsForCurrentItem: (item, referencedItems) =>
|
|
referencedItems.where(
|
|
(e) => e.campaignId == item.localId,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$CampaignsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$CampaignsTable,
|
|
Campaign,
|
|
$$CampaignsTableFilterComposer,
|
|
$$CampaignsTableOrderingComposer,
|
|
$$CampaignsTableAnnotationComposer,
|
|
$$CampaignsTableCreateCompanionBuilder,
|
|
$$CampaignsTableUpdateCompanionBuilder,
|
|
(Campaign, $$CampaignsTableReferences),
|
|
Campaign,
|
|
PrefetchHooks Function({bool outletCampaignsRefs})
|
|
>;
|
|
typedef $$OutletCampaignsTableCreateCompanionBuilder =
|
|
OutletCampaignsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
required String campaignId,
|
|
Value<String?> outletId,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$OutletCampaignsTableUpdateCompanionBuilder =
|
|
OutletCampaignsCompanion Function({
|
|
Value<String> localId,
|
|
Value<String?> serverId,
|
|
Value<String> campaignId,
|
|
Value<String?> outletId,
|
|
Value<String> syncStatus,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime> updatedAt,
|
|
Value<DateTime?> deletedAt,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$OutletCampaignsTableReferences
|
|
extends
|
|
BaseReferences<_$AppDatabase, $OutletCampaignsTable, OutletCampaign> {
|
|
$$OutletCampaignsTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $CampaignsTable _campaignIdTable(_$AppDatabase db) =>
|
|
db.campaigns.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.outletCampaigns.campaignId,
|
|
db.campaigns.localId,
|
|
),
|
|
);
|
|
|
|
$$CampaignsTableProcessedTableManager get campaignId {
|
|
final $_column = $_itemColumn<String>('campaign_id')!;
|
|
|
|
final manager = $$CampaignsTableTableManager(
|
|
$_db,
|
|
$_db.campaigns,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_campaignIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $OutletsTable _outletIdTable(_$AppDatabase db) =>
|
|
db.outlets.createAlias(
|
|
$_aliasNameGenerator(db.outletCampaigns.outletId, db.outlets.localId),
|
|
);
|
|
|
|
$$OutletsTableProcessedTableManager? get outletId {
|
|
final $_column = $_itemColumn<String>('outlet_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$OutletsTableTableManager(
|
|
$_db,
|
|
$_db.outlets,
|
|
).filter((f) => f.localId.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_outletIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$OutletCampaignsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $OutletCampaignsTable> {
|
|
$$OutletCampaignsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$CampaignsTableFilterComposer get campaignId {
|
|
final $$CampaignsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.campaignId,
|
|
referencedTable: $db.campaigns,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CampaignsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.campaigns,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$OutletsTableFilterComposer get outletId {
|
|
final $$OutletsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$OutletCampaignsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $OutletCampaignsTable> {
|
|
$$OutletCampaignsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get localId => $composableBuilder(
|
|
column: $table.localId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get serverId => $composableBuilder(
|
|
column: $table.serverId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
|
|
column: $table.deletedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$CampaignsTableOrderingComposer get campaignId {
|
|
final $$CampaignsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.campaignId,
|
|
referencedTable: $db.campaigns,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CampaignsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.campaigns,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$OutletsTableOrderingComposer get outletId {
|
|
final $$OutletsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$OutletCampaignsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $OutletCampaignsTable> {
|
|
$$OutletCampaignsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get localId =>
|
|
$composableBuilder(column: $table.localId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get serverId =>
|
|
$composableBuilder(column: $table.serverId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get syncStatus => $composableBuilder(
|
|
column: $table.syncStatus,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get deletedAt =>
|
|
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
|
|
|
|
$$CampaignsTableAnnotationComposer get campaignId {
|
|
final $$CampaignsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.campaignId,
|
|
referencedTable: $db.campaigns,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CampaignsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.campaigns,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$OutletsTableAnnotationComposer get outletId {
|
|
final $$OutletsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.outletId,
|
|
referencedTable: $db.outlets,
|
|
getReferencedColumn: (t) => t.localId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$OutletsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.outlets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$OutletCampaignsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$OutletCampaignsTable,
|
|
OutletCampaign,
|
|
$$OutletCampaignsTableFilterComposer,
|
|
$$OutletCampaignsTableOrderingComposer,
|
|
$$OutletCampaignsTableAnnotationComposer,
|
|
$$OutletCampaignsTableCreateCompanionBuilder,
|
|
$$OutletCampaignsTableUpdateCompanionBuilder,
|
|
(OutletCampaign, $$OutletCampaignsTableReferences),
|
|
OutletCampaign,
|
|
PrefetchHooks Function({bool campaignId, bool outletId})
|
|
> {
|
|
$$OutletCampaignsTableTableManager(
|
|
_$AppDatabase db,
|
|
$OutletCampaignsTable table,
|
|
) : super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$OutletCampaignsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$OutletCampaignsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$OutletCampaignsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
Value<String> campaignId = const Value.absent(),
|
|
Value<String?> outletId = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OutletCampaignsCompanion(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
campaignId: campaignId,
|
|
outletId: outletId,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<String> localId = const Value.absent(),
|
|
Value<String?> serverId = const Value.absent(),
|
|
required String campaignId,
|
|
Value<String?> outletId = const Value.absent(),
|
|
Value<String> syncStatus = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
Value<DateTime?> deletedAt = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => OutletCampaignsCompanion.insert(
|
|
localId: localId,
|
|
serverId: serverId,
|
|
campaignId: campaignId,
|
|
outletId: outletId,
|
|
syncStatus: syncStatus,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
deletedAt: deletedAt,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$OutletCampaignsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({campaignId = false, outletId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (campaignId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.campaignId,
|
|
referencedTable:
|
|
$$OutletCampaignsTableReferences
|
|
._campaignIdTable(db),
|
|
referencedColumn:
|
|
$$OutletCampaignsTableReferences
|
|
._campaignIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
if (outletId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.outletId,
|
|
referencedTable:
|
|
$$OutletCampaignsTableReferences
|
|
._outletIdTable(db),
|
|
referencedColumn:
|
|
$$OutletCampaignsTableReferences
|
|
._outletIdTable(db)
|
|
.localId,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$OutletCampaignsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$OutletCampaignsTable,
|
|
OutletCampaign,
|
|
$$OutletCampaignsTableFilterComposer,
|
|
$$OutletCampaignsTableOrderingComposer,
|
|
$$OutletCampaignsTableAnnotationComposer,
|
|
$$OutletCampaignsTableCreateCompanionBuilder,
|
|
$$OutletCampaignsTableUpdateCompanionBuilder,
|
|
(OutletCampaign, $$OutletCampaignsTableReferences),
|
|
OutletCampaign,
|
|
PrefetchHooks Function({bool campaignId, bool outletId})
|
|
>;
|
|
typedef $$SyncQueuesTableCreateCompanionBuilder =
|
|
SyncQueuesCompanion Function({
|
|
Value<int> id,
|
|
required String tableType,
|
|
required String tableLocalId,
|
|
required String action,
|
|
required String status,
|
|
required Map<String, dynamic> payload,
|
|
Value<String?> batchId,
|
|
Value<String?> lastError,
|
|
Value<int> retryCount,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime?> lastAttempt,
|
|
});
|
|
typedef $$SyncQueuesTableUpdateCompanionBuilder =
|
|
SyncQueuesCompanion Function({
|
|
Value<int> id,
|
|
Value<String> tableType,
|
|
Value<String> tableLocalId,
|
|
Value<String> action,
|
|
Value<String> status,
|
|
Value<Map<String, dynamic>> payload,
|
|
Value<String?> batchId,
|
|
Value<String?> lastError,
|
|
Value<int> retryCount,
|
|
Value<DateTime> createdAt,
|
|
Value<DateTime?> lastAttempt,
|
|
});
|
|
|
|
class $$SyncQueuesTableFilterComposer
|
|
extends Composer<_$AppDatabase, $SyncQueuesTable> {
|
|
$$SyncQueuesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get tableType => $composableBuilder(
|
|
column: $table.tableType,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get tableLocalId => $composableBuilder(
|
|
column: $table.tableLocalId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get action => $composableBuilder(
|
|
column: $table.action,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get status => $composableBuilder(
|
|
column: $table.status,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnWithTypeConverterFilters<
|
|
Map<String, dynamic>,
|
|
Map<String, dynamic>,
|
|
String
|
|
>
|
|
get payload => $composableBuilder(
|
|
column: $table.payload,
|
|
builder: (column) => ColumnWithTypeConverterFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get batchId => $composableBuilder(
|
|
column: $table.batchId,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get lastError => $composableBuilder(
|
|
column: $table.lastError,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get retryCount => $composableBuilder(
|
|
column: $table.retryCount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get lastAttempt => $composableBuilder(
|
|
column: $table.lastAttempt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
}
|
|
|
|
class $$SyncQueuesTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $SyncQueuesTable> {
|
|
$$SyncQueuesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get tableType => $composableBuilder(
|
|
column: $table.tableType,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get tableLocalId => $composableBuilder(
|
|
column: $table.tableLocalId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get action => $composableBuilder(
|
|
column: $table.action,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get status => $composableBuilder(
|
|
column: $table.status,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get payload => $composableBuilder(
|
|
column: $table.payload,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get batchId => $composableBuilder(
|
|
column: $table.batchId,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get lastError => $composableBuilder(
|
|
column: $table.lastError,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get retryCount => $composableBuilder(
|
|
column: $table.retryCount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
|
column: $table.createdAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get lastAttempt => $composableBuilder(
|
|
column: $table.lastAttempt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$SyncQueuesTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $SyncQueuesTable> {
|
|
$$SyncQueuesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get tableType =>
|
|
$composableBuilder(column: $table.tableType, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get tableLocalId => $composableBuilder(
|
|
column: $table.tableLocalId,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get action =>
|
|
$composableBuilder(column: $table.action, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get status =>
|
|
$composableBuilder(column: $table.status, builder: (column) => column);
|
|
|
|
GeneratedColumnWithTypeConverter<Map<String, dynamic>, String> get payload =>
|
|
$composableBuilder(column: $table.payload, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get batchId =>
|
|
$composableBuilder(column: $table.batchId, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get lastError =>
|
|
$composableBuilder(column: $table.lastError, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get retryCount => $composableBuilder(
|
|
column: $table.retryCount,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get createdAt =>
|
|
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get lastAttempt => $composableBuilder(
|
|
column: $table.lastAttempt,
|
|
builder: (column) => column,
|
|
);
|
|
}
|
|
|
|
class $$SyncQueuesTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$SyncQueuesTable,
|
|
SyncQueue,
|
|
$$SyncQueuesTableFilterComposer,
|
|
$$SyncQueuesTableOrderingComposer,
|
|
$$SyncQueuesTableAnnotationComposer,
|
|
$$SyncQueuesTableCreateCompanionBuilder,
|
|
$$SyncQueuesTableUpdateCompanionBuilder,
|
|
(
|
|
SyncQueue,
|
|
BaseReferences<_$AppDatabase, $SyncQueuesTable, SyncQueue>,
|
|
),
|
|
SyncQueue,
|
|
PrefetchHooks Function()
|
|
> {
|
|
$$SyncQueuesTableTableManager(_$AppDatabase db, $SyncQueuesTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$SyncQueuesTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$SyncQueuesTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$SyncQueuesTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<String> tableType = const Value.absent(),
|
|
Value<String> tableLocalId = const Value.absent(),
|
|
Value<String> action = const Value.absent(),
|
|
Value<String> status = const Value.absent(),
|
|
Value<Map<String, dynamic>> payload = const Value.absent(),
|
|
Value<String?> batchId = const Value.absent(),
|
|
Value<String?> lastError = const Value.absent(),
|
|
Value<int> retryCount = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime?> lastAttempt = const Value.absent(),
|
|
}) => SyncQueuesCompanion(
|
|
id: id,
|
|
tableType: tableType,
|
|
tableLocalId: tableLocalId,
|
|
action: action,
|
|
status: status,
|
|
payload: payload,
|
|
batchId: batchId,
|
|
lastError: lastError,
|
|
retryCount: retryCount,
|
|
createdAt: createdAt,
|
|
lastAttempt: lastAttempt,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required String tableType,
|
|
required String tableLocalId,
|
|
required String action,
|
|
required String status,
|
|
required Map<String, dynamic> payload,
|
|
Value<String?> batchId = const Value.absent(),
|
|
Value<String?> lastError = const Value.absent(),
|
|
Value<int> retryCount = const Value.absent(),
|
|
Value<DateTime> createdAt = const Value.absent(),
|
|
Value<DateTime?> lastAttempt = const Value.absent(),
|
|
}) => SyncQueuesCompanion.insert(
|
|
id: id,
|
|
tableType: tableType,
|
|
tableLocalId: tableLocalId,
|
|
action: action,
|
|
status: status,
|
|
payload: payload,
|
|
batchId: batchId,
|
|
lastError: lastError,
|
|
retryCount: retryCount,
|
|
createdAt: createdAt,
|
|
lastAttempt: lastAttempt,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
|
.toList(),
|
|
prefetchHooksCallback: null,
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$SyncQueuesTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$SyncQueuesTable,
|
|
SyncQueue,
|
|
$$SyncQueuesTableFilterComposer,
|
|
$$SyncQueuesTableOrderingComposer,
|
|
$$SyncQueuesTableAnnotationComposer,
|
|
$$SyncQueuesTableCreateCompanionBuilder,
|
|
$$SyncQueuesTableUpdateCompanionBuilder,
|
|
(SyncQueue, BaseReferences<_$AppDatabase, $SyncQueuesTable, SyncQueue>),
|
|
SyncQueue,
|
|
PrefetchHooks Function()
|
|
>;
|
|
|
|
class $AppDatabaseManager {
|
|
final _$AppDatabase _db;
|
|
$AppDatabaseManager(this._db);
|
|
$$TenantsTableTableManager get tenants =>
|
|
$$TenantsTableTableManager(_db, _db.tenants);
|
|
$$TenantPaymentMethodsTableTableManager get tenantPaymentMethods =>
|
|
$$TenantPaymentMethodsTableTableManager(_db, _db.tenantPaymentMethods);
|
|
$$OutletsTableTableManager get outlets =>
|
|
$$OutletsTableTableManager(_db, _db.outlets);
|
|
$$UsersTableTableManager get users =>
|
|
$$UsersTableTableManager(_db, _db.users);
|
|
$$CustomersTableTableManager get customers =>
|
|
$$CustomersTableTableManager(_db, _db.customers);
|
|
$$CustomerAddressesTableTableManager get customerAddresses =>
|
|
$$CustomerAddressesTableTableManager(_db, _db.customerAddresses);
|
|
$$CategoriesTableTableManager get categories =>
|
|
$$CategoriesTableTableManager(_db, _db.categories);
|
|
$$UnitsTableTableManager get units =>
|
|
$$UnitsTableTableManager(_db, _db.units);
|
|
$$ProductsTableTableManager get products =>
|
|
$$ProductsTableTableManager(_db, _db.products);
|
|
$$ProductVariantsTableTableManager get productVariants =>
|
|
$$ProductVariantsTableTableManager(_db, _db.productVariants);
|
|
$$ProductReviewsTableTableManager get productReviews =>
|
|
$$ProductReviewsTableTableManager(_db, _db.productReviews);
|
|
$$ProductLikesTableTableManager get productLikes =>
|
|
$$ProductLikesTableTableManager(_db, _db.productLikes);
|
|
$$RawMaterialsTableTableManager get rawMaterials =>
|
|
$$RawMaterialsTableTableManager(_db, _db.rawMaterials);
|
|
$$OutletInventoriesTableTableManager get outletInventories =>
|
|
$$OutletInventoriesTableTableManager(_db, _db.outletInventories);
|
|
$$ReceiptItemsTableTableManager get receiptItems =>
|
|
$$ReceiptItemsTableTableManager(_db, _db.receiptItems);
|
|
$$StockCardsTableTableManager get stockCards =>
|
|
$$StockCardsTableTableManager(_db, _db.stockCards);
|
|
$$OrdersTableTableManager get orders =>
|
|
$$OrdersTableTableManager(_db, _db.orders);
|
|
$$OrderItemsTableTableManager get orderItems =>
|
|
$$OrderItemsTableTableManager(_db, _db.orderItems);
|
|
$$SuppliersTableTableManager get suppliers =>
|
|
$$SuppliersTableTableManager(_db, _db.suppliers);
|
|
$$PurchasesTableTableManager get purchases =>
|
|
$$PurchasesTableTableManager(_db, _db.purchases);
|
|
$$PurchaseItemsTableTableManager get purchaseItems =>
|
|
$$PurchaseItemsTableTableManager(_db, _db.purchaseItems);
|
|
$$TransactionsTableTableManager get transactions =>
|
|
$$TransactionsTableTableManager(_db, _db.transactions);
|
|
$$CampaignsTableTableManager get campaigns =>
|
|
$$CampaignsTableTableManager(_db, _db.campaigns);
|
|
$$OutletCampaignsTableTableManager get outletCampaigns =>
|
|
$$OutletCampaignsTableTableManager(_db, _db.outletCampaigns);
|
|
$$SyncQueuesTableTableManager get syncQueues =>
|
|
$$SyncQueuesTableTableManager(_db, _db.syncQueues);
|
|
}
|