feat: Add color and icon properties to categories, enhance category management in UI
This commit is contained in:
@@ -682,6 +682,28 @@ class $CategoriesTable extends Categories
|
||||
),
|
||||
defaultValue: const Constant(true),
|
||||
);
|
||||
static const VerificationMeta _colorValueMeta = const VerificationMeta(
|
||||
'colorValue',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<int> colorValue = GeneratedColumn<int>(
|
||||
'color_value',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.int,
|
||||
requiredDuringInsert: false,
|
||||
);
|
||||
static const VerificationMeta _iconCodePointMeta = const VerificationMeta(
|
||||
'iconCodePoint',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<int> iconCodePoint = GeneratedColumn<int>(
|
||||
'icon_code_point',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.int,
|
||||
requiredDuringInsert: false,
|
||||
);
|
||||
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
||||
'updatedAt',
|
||||
);
|
||||
@@ -700,6 +722,8 @@ class $CategoriesTable extends Categories
|
||||
serverVersion,
|
||||
isDeleted,
|
||||
isDirty,
|
||||
colorValue,
|
||||
iconCodePoint,
|
||||
updatedAt,
|
||||
];
|
||||
@override
|
||||
@@ -751,6 +775,21 @@ class $CategoriesTable extends Categories
|
||||
isDirty.isAcceptableOrUnknown(data['is_dirty']!, _isDirtyMeta),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('color_value')) {
|
||||
context.handle(
|
||||
_colorValueMeta,
|
||||
colorValue.isAcceptableOrUnknown(data['color_value']!, _colorValueMeta),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('icon_code_point')) {
|
||||
context.handle(
|
||||
_iconCodePointMeta,
|
||||
iconCodePoint.isAcceptableOrUnknown(
|
||||
data['icon_code_point']!,
|
||||
_iconCodePointMeta,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('updated_at')) {
|
||||
context.handle(
|
||||
_updatedAtMeta,
|
||||
@@ -788,6 +827,14 @@ class $CategoriesTable extends Categories
|
||||
DriftSqlType.bool,
|
||||
data['${effectivePrefix}is_dirty'],
|
||||
)!,
|
||||
colorValue: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}color_value'],
|
||||
),
|
||||
iconCodePoint: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}icon_code_point'],
|
||||
),
|
||||
updatedAt: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}updated_at'],
|
||||
@@ -807,6 +854,8 @@ class DbCategory extends DataClass implements Insertable<DbCategory> {
|
||||
final int serverVersion;
|
||||
final bool isDeleted;
|
||||
final bool isDirty;
|
||||
final int? colorValue;
|
||||
final int? iconCodePoint;
|
||||
final DateTime updatedAt;
|
||||
const DbCategory({
|
||||
required this.id,
|
||||
@@ -814,6 +863,8 @@ class DbCategory extends DataClass implements Insertable<DbCategory> {
|
||||
required this.serverVersion,
|
||||
required this.isDeleted,
|
||||
required this.isDirty,
|
||||
this.colorValue,
|
||||
this.iconCodePoint,
|
||||
required this.updatedAt,
|
||||
});
|
||||
@override
|
||||
@@ -824,6 +875,12 @@ class DbCategory extends DataClass implements Insertable<DbCategory> {
|
||||
map['server_version'] = Variable<int>(serverVersion);
|
||||
map['is_deleted'] = Variable<bool>(isDeleted);
|
||||
map['is_dirty'] = Variable<bool>(isDirty);
|
||||
if (!nullToAbsent || colorValue != null) {
|
||||
map['color_value'] = Variable<int>(colorValue);
|
||||
}
|
||||
if (!nullToAbsent || iconCodePoint != null) {
|
||||
map['icon_code_point'] = Variable<int>(iconCodePoint);
|
||||
}
|
||||
map['updated_at'] = Variable<DateTime>(updatedAt);
|
||||
return map;
|
||||
}
|
||||
@@ -835,6 +892,12 @@ class DbCategory extends DataClass implements Insertable<DbCategory> {
|
||||
serverVersion: Value(serverVersion),
|
||||
isDeleted: Value(isDeleted),
|
||||
isDirty: Value(isDirty),
|
||||
colorValue: colorValue == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value<int?>(colorValue),
|
||||
iconCodePoint: iconCodePoint == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value<int?>(iconCodePoint),
|
||||
updatedAt: Value(updatedAt),
|
||||
);
|
||||
}
|
||||
@@ -850,6 +913,8 @@ class DbCategory extends DataClass implements Insertable<DbCategory> {
|
||||
serverVersion: serializer.fromJson<int>(json['serverVersion']),
|
||||
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
|
||||
isDirty: serializer.fromJson<bool>(json['isDirty']),
|
||||
colorValue: serializer.fromJson<int?>(json['colorValue']),
|
||||
iconCodePoint: serializer.fromJson<int?>(json['iconCodePoint']),
|
||||
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
||||
);
|
||||
}
|
||||
@@ -862,6 +927,8 @@ class DbCategory extends DataClass implements Insertable<DbCategory> {
|
||||
'serverVersion': serializer.toJson<int>(serverVersion),
|
||||
'isDeleted': serializer.toJson<bool>(isDeleted),
|
||||
'isDirty': serializer.toJson<bool>(isDirty),
|
||||
'colorValue': serializer.toJson<int?>(colorValue),
|
||||
'iconCodePoint': serializer.toJson<int?>(iconCodePoint),
|
||||
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
||||
};
|
||||
}
|
||||
@@ -872,6 +939,8 @@ class DbCategory extends DataClass implements Insertable<DbCategory> {
|
||||
int? serverVersion,
|
||||
bool? isDeleted,
|
||||
bool? isDirty,
|
||||
int? colorValue,
|
||||
int? iconCodePoint,
|
||||
DateTime? updatedAt,
|
||||
}) => DbCategory(
|
||||
id: id ?? this.id,
|
||||
@@ -879,6 +948,8 @@ class DbCategory extends DataClass implements Insertable<DbCategory> {
|
||||
serverVersion: serverVersion ?? this.serverVersion,
|
||||
isDeleted: isDeleted ?? this.isDeleted,
|
||||
isDirty: isDirty ?? this.isDirty,
|
||||
colorValue: colorValue ?? this.colorValue,
|
||||
iconCodePoint: iconCodePoint ?? this.iconCodePoint,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
);
|
||||
DbCategory copyWithCompanion(CategoriesCompanion data) {
|
||||
@@ -892,6 +963,12 @@ class DbCategory extends DataClass implements Insertable<DbCategory> {
|
||||
: this.serverVersion,
|
||||
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
|
||||
isDirty: data.isDirty.present ? data.isDirty.value : this.isDirty,
|
||||
colorValue: data.colorValue.present
|
||||
? data.colorValue.value
|
||||
: this.colorValue,
|
||||
iconCodePoint: data.iconCodePoint.present
|
||||
? data.iconCodePoint.value
|
||||
: this.iconCodePoint,
|
||||
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
||||
);
|
||||
}
|
||||
@@ -938,12 +1015,16 @@ class CategoriesCompanion extends UpdateCompanion<DbCategory> {
|
||||
final Value<bool> isDirty;
|
||||
final Value<DateTime> updatedAt;
|
||||
final Value<int> rowid;
|
||||
final Value<int?> colorValue;
|
||||
final Value<int?> iconCodePoint;
|
||||
const CategoriesCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.encryptedName = const Value.absent(),
|
||||
this.serverVersion = const Value.absent(),
|
||||
this.isDeleted = const Value.absent(),
|
||||
this.isDirty = const Value.absent(),
|
||||
this.colorValue = const Value.absent(),
|
||||
this.iconCodePoint = const Value.absent(),
|
||||
this.updatedAt = const Value.absent(),
|
||||
this.rowid = const Value.absent(),
|
||||
});
|
||||
@@ -953,6 +1034,8 @@ class CategoriesCompanion extends UpdateCompanion<DbCategory> {
|
||||
this.serverVersion = const Value.absent(),
|
||||
this.isDeleted = const Value.absent(),
|
||||
this.isDirty = const Value.absent(),
|
||||
this.colorValue = const Value.absent(),
|
||||
this.iconCodePoint = const Value.absent(),
|
||||
required DateTime updatedAt,
|
||||
this.rowid = const Value.absent(),
|
||||
}) : id = Value(id),
|
||||
@@ -964,6 +1047,8 @@ class CategoriesCompanion extends UpdateCompanion<DbCategory> {
|
||||
Expression<int>? serverVersion,
|
||||
Expression<bool>? isDeleted,
|
||||
Expression<bool>? isDirty,
|
||||
Expression<int>? colorValue,
|
||||
Expression<int>? iconCodePoint,
|
||||
Expression<DateTime>? updatedAt,
|
||||
Expression<int>? rowid,
|
||||
}) {
|
||||
@@ -973,6 +1058,8 @@ class CategoriesCompanion extends UpdateCompanion<DbCategory> {
|
||||
if (serverVersion != null) 'server_version': serverVersion,
|
||||
if (isDeleted != null) 'is_deleted': isDeleted,
|
||||
if (isDirty != null) 'is_dirty': isDirty,
|
||||
if (colorValue != null) 'color_value': colorValue,
|
||||
if (iconCodePoint != null) 'icon_code_point': iconCodePoint,
|
||||
if (updatedAt != null) 'updated_at': updatedAt,
|
||||
if (rowid != null) 'rowid': rowid,
|
||||
});
|
||||
@@ -984,6 +1071,8 @@ class CategoriesCompanion extends UpdateCompanion<DbCategory> {
|
||||
Value<int>? serverVersion,
|
||||
Value<bool>? isDeleted,
|
||||
Value<bool>? isDirty,
|
||||
Value<int>? colorValue,
|
||||
Value<int>? iconCodePoint,
|
||||
Value<DateTime>? updatedAt,
|
||||
Value<int>? rowid,
|
||||
}) {
|
||||
@@ -993,6 +1082,8 @@ class CategoriesCompanion extends UpdateCompanion<DbCategory> {
|
||||
serverVersion: serverVersion ?? this.serverVersion,
|
||||
isDeleted: isDeleted ?? this.isDeleted,
|
||||
isDirty: isDirty ?? this.isDirty,
|
||||
colorValue: colorValue ?? this.colorValue,
|
||||
iconCodePoint: iconCodePoint ?? this.iconCodePoint,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
rowid: rowid ?? this.rowid,
|
||||
);
|
||||
@@ -1016,6 +1107,12 @@ class CategoriesCompanion extends UpdateCompanion<DbCategory> {
|
||||
if (isDirty.present) {
|
||||
map['is_dirty'] = Variable<bool>(isDirty.value);
|
||||
}
|
||||
if (colorValue.present) {
|
||||
map['color_value'] = Variable<int>(colorValue.value);
|
||||
}
|
||||
if (iconCodePoint.present) {
|
||||
map['icon_code_point'] = Variable<int>(iconCodePoint.value);
|
||||
}
|
||||
if (updatedAt.present) {
|
||||
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user