s
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
This commit is contained in:
parent
10f827534c
commit
22340d78ef
4 changed files with 26 additions and 26 deletions
|
|
@ -26,7 +26,7 @@ class JsonMapConverter extends TypeConverter<Map<String, dynamic>?, String?> {
|
|||
}
|
||||
}
|
||||
|
||||
class JsonListConverter extends TypeConverter<List<dynamic>, String> {
|
||||
class JsonListConverter extends TypeConverter<List<dynamic>, String?> {
|
||||
const JsonListConverter();
|
||||
|
||||
@override
|
||||
|
|
@ -46,12 +46,12 @@ class JsonListConverter extends TypeConverter<List<dynamic>, String> {
|
|||
}
|
||||
}
|
||||
|
||||
class StringListConverter extends TypeConverter<List<String>, String> {
|
||||
class StringListConverter extends TypeConverter<List<String>, String?> {
|
||||
const StringListConverter();
|
||||
|
||||
@override
|
||||
List<String> fromSql(String fromDb) {
|
||||
if (fromDb.isEmpty || fromDb == '[]') return [];
|
||||
List<String> fromSql(String? fromDb) {
|
||||
if (fromDb == null || fromDb.isEmpty || fromDb == '[]') return [];
|
||||
try {
|
||||
final decoded = json.decode(fromDb);
|
||||
return (decoded as List).map((e) => e as String).toList();
|
||||
|
|
@ -93,12 +93,12 @@ class DateTimeListConverter extends TypeConverter<List<DateTime>?, String> {
|
|||
}
|
||||
}
|
||||
|
||||
class IntListConverter extends TypeConverter<List<int>, String> {
|
||||
class IntListConverter extends TypeConverter<List<int>, String?> {
|
||||
const IntListConverter();
|
||||
|
||||
@override
|
||||
List<int> fromSql(String fromDb) {
|
||||
if (fromDb.isEmpty || fromDb == '[]') return [];
|
||||
List<int> fromSql(String? fromDb) {
|
||||
if (fromDb == null || fromDb.isEmpty || fromDb == '[]') return [];
|
||||
try {
|
||||
final decoded = json.decode(fromDb);
|
||||
return (decoded as List).map((e) => e as int).toList();
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> {
|
|||
GeneratedColumn<String>(
|
||||
'purchases',
|
||||
aliasedName,
|
||||
false,
|
||||
true,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
defaultValue: const Constant('[]'),
|
||||
|
|
@ -240,7 +240,7 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> {
|
|||
attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}purchases'],
|
||||
)!,
|
||||
),
|
||||
),
|
||||
createdAt: attachedDatabase.typeMapping.read(
|
||||
PgTypes.timestampWithTimezone,
|
||||
|
|
@ -262,7 +262,7 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> {
|
|||
return $UsersTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static TypeConverter<List<String>, String> $converterpurchases =
|
||||
static TypeConverter<List<String>, String?> $converterpurchases =
|
||||
const StringListConverter();
|
||||
}
|
||||
|
||||
|
|
@ -1058,15 +1058,15 @@ class $UserDatasTable extends UserDatas
|
|||
return $UserDatasTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static TypeConverter<List<dynamic>, String> $converterwords =
|
||||
static TypeConverter<List<dynamic>, String?> $converterwords =
|
||||
const JsonListConverter();
|
||||
static TypeConverter<List<String>, String> $convertertags =
|
||||
static TypeConverter<List<String>, String?> $convertertags =
|
||||
const StringListConverter();
|
||||
static TypeConverter<List<dynamic>, String> $converterpackProgress =
|
||||
static TypeConverter<List<dynamic>, String?> $converterpackProgress =
|
||||
const JsonListConverter();
|
||||
static TypeConverter<List<DateTime>?, String> $converterstudyDates =
|
||||
const DateTimeListConverter();
|
||||
static TypeConverter<List<dynamic>, String> $converterachievements =
|
||||
static TypeConverter<List<dynamic>, String?> $converterachievements =
|
||||
const JsonListConverter();
|
||||
static TypeConverter<Map<String, dynamic>?, String?>
|
||||
$convertercategoryMinutes = const JsonMapConverter();
|
||||
|
|
@ -3641,7 +3641,7 @@ class $CardPacksTable extends CardPacks
|
|||
return $CardPacksTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static TypeConverter<List<String>, String> $convertercardsOrder =
|
||||
static TypeConverter<List<String>, String?> $convertercardsOrder =
|
||||
const StringListConverter();
|
||||
}
|
||||
|
||||
|
|
@ -6734,7 +6734,7 @@ class $SubscriptionPlansTable extends SubscriptionPlans
|
|||
|
||||
static TypeConverter<Map<String, dynamic>?, String?> $converterui =
|
||||
const JsonMapConverter();
|
||||
static TypeConverter<List<dynamic>, String> $converterfeatures =
|
||||
static TypeConverter<List<dynamic>, String?> $converterfeatures =
|
||||
const JsonListConverter();
|
||||
}
|
||||
|
||||
|
|
@ -7314,7 +7314,7 @@ class $UserSubscriptionsTable extends UserSubscriptions
|
|||
return $UserSubscriptionsTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static TypeConverter<List<dynamic>, String> $converterfeatures =
|
||||
static TypeConverter<List<dynamic>, String?> $converterfeatures =
|
||||
const JsonListConverter();
|
||||
}
|
||||
|
||||
|
|
@ -7944,9 +7944,9 @@ class $PaymentsTable extends Payments with TableInfo<$PaymentsTable, Payment> {
|
|||
return $PaymentsTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static TypeConverter<List<dynamic>, String> $converterproducts =
|
||||
static TypeConverter<List<dynamic>, String?> $converterproducts =
|
||||
const JsonListConverter();
|
||||
static TypeConverter<List<String>, String> $converterpacks =
|
||||
static TypeConverter<List<String>, String?> $converterpacks =
|
||||
const StringListConverter();
|
||||
}
|
||||
|
||||
|
|
@ -11232,9 +11232,9 @@ class $UserTasksTable extends UserTasks
|
|||
return $UserTasksTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static TypeConverter<List<dynamic>, String> $converterrewards =
|
||||
static TypeConverter<List<dynamic>, String?> $converterrewards =
|
||||
const JsonListConverter();
|
||||
static TypeConverter<List<String>, String> $convertertags =
|
||||
static TypeConverter<List<String>, String?> $convertertags =
|
||||
const StringListConverter();
|
||||
}
|
||||
|
||||
|
|
@ -12949,9 +12949,9 @@ class $PromoCodesCampaignsTable extends PromoCodesCampaigns
|
|||
return $PromoCodesCampaignsTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static TypeConverter<List<dynamic>, String> $converterproducts =
|
||||
static TypeConverter<List<dynamic>, String?> $converterproducts =
|
||||
const JsonListConverter();
|
||||
static TypeConverter<List<String>, String> $convertertags =
|
||||
static TypeConverter<List<String>, String?> $convertertags =
|
||||
const StringListConverter();
|
||||
}
|
||||
|
||||
|
|
@ -14131,7 +14131,7 @@ class $DiscountCampaignsTable extends DiscountCampaigns
|
|||
return $DiscountCampaignsTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static TypeConverter<List<String>, String> $convertertags =
|
||||
static TypeConverter<List<String>, String?> $convertertags =
|
||||
const StringListConverter();
|
||||
}
|
||||
|
||||
|
|
@ -14665,7 +14665,7 @@ class $DiscountsTable extends Discounts
|
|||
return $DiscountsTable(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
static TypeConverter<List<dynamic>, String> $converterproducts =
|
||||
static TypeConverter<List<dynamic>, String?> $converterproducts =
|
||||
const JsonListConverter();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class Users extends Table {
|
|||
|
||||
// Purchases (JSON array)
|
||||
TextColumn get purchases => text()
|
||||
.nullable()
|
||||
.withDefault(const Constant('[]'))
|
||||
.map(const StringListConverter())();
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ class UserManager {
|
|||
externalUserId: externalId,
|
||||
name: drift.Value(name),
|
||||
email: drift.Value(email),
|
||||
// Explicitly set fields with default values to ensure they're returned by insertReturning
|
||||
admin: drift.Value(false),
|
||||
purchases: drift.Value([]),
|
||||
createdAt: drift.Value(PgDateTime(now)),
|
||||
|
|
|
|||
Loading…
Reference in a new issue