Skip to content

Commit e700c64

Browse files
committed
fix(database): update remote config JSON key and improve related code
- Change JSON key from 'user_preference_limits' to 'user_preference_config' - Update 'user_preference_limits' references to 'user_preference_config' in SQL queries - Replace 'remoteConfig' variable with 'remoteConfigFixtureData' constant - Update 'limits' retrieval from 'userPreferenceLimits' to 'userPreferenceConfig' - Change 'headlineDensity' from 'normal' to 'standard' in auth service These changes improve consistency and accuracy in database schema and code references.
1 parent d56d246 commit e700c64

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/src/services/auth_service.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class AuthService {
204204
),
205205
language: 'en',
206206
feedPreferences: const FeedDisplayPreferences(
207-
headlineDensity: HeadlineDensity.normal,
207+
headlineDensity: HeadlineDensity.standard,
208208
headlineImageStyle: HeadlineImageStyle.largeThumbnail,
209209
showSourceInHeadlineFeed: true,
210210
showPublishDateInHeadlineFeed: true,
@@ -303,7 +303,7 @@ class AuthService {
303303
),
304304
language: 'en',
305305
feedPreferences: const FeedDisplayPreferences(
306-
headlineDensity: HeadlineDensity.normal,
306+
headlineDensity: HeadlineDensity.standard,
307307
headlineImageStyle: HeadlineImageStyle.largeThumbnail,
308308
showSourceInHeadlineFeed: true,
309309
showPublishDateInHeadlineFeed: true,

lib/src/services/database_seeding_service.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class DatabaseSeedingService {
5151
await _connection.execute('''
5252
CREATE TABLE IF NOT EXISTS remote_config (
5353
id TEXT PRIMARY KEY,
54-
user_preference_limits JSONB NOT NULL,
54+
user_preference_config JSONB NOT NULL,
5555
ad_config JSONB NOT NULL,
5656
account_action_config JSONB NOT NULL,
5757
app_status JSONB NOT NULL,
@@ -291,22 +291,22 @@ class DatabaseSeedingService {
291291
try {
292292
// Seed RemoteConfig
293293
_log.fine('Seeding RemoteConfig...');
294-
final remoteConfig = remoteConfigFixture;
294+
const remoteConfig = remoteConfigFixtureData;
295295
// The `remote_config` table has multiple JSONB columns. We must
296296
// provide an explicit map with JSON-encoded values to avoid a
297297
// "superfluous variables" error from the postgres driver.
298298
await _connection.execute(
299299
Sql.named(
300-
'INSERT INTO remote_config (id, user_preference_limits, ad_config, '
300+
'INSERT INTO remote_config (id, user_preference_config, ad_config, '
301301
'account_action_config, app_status) VALUES (@id, '
302-
'@user_preference_limits, @ad_config, @account_action_config, '
302+
'@user_preference_config, @ad_config, @account_action_config, '
303303
'@app_status) '
304304
'ON CONFLICT (id) DO NOTHING',
305305
),
306306
parameters: {
307307
'id': remoteConfig.id,
308-
'user_preference_limits':
309-
jsonEncode(remoteConfig.userPreferenceLimits.toJson()),
308+
'user_preference_config':
309+
jsonEncode(remoteConfig.userPreferenceConfig.toJson()),
310310
'ad_config': jsonEncode(remoteConfig.adConfig.toJson()),
311311
'account_action_config':
312312
jsonEncode(remoteConfig.accountActionConfig.toJson()),

lib/src/services/default_user_preference_limit_service.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DefaultUserPreferenceLimitService implements UserPreferenceLimitService {
3030
try {
3131
// 1. Fetch the remote configuration to get limits
3232
final remoteConfig = await _remoteConfigRepository.read(id: _remoteConfigId);
33-
final limits = remoteConfig.userPreferenceLimits;
33+
final limits = remoteConfig.userPreferenceConfig;
3434

3535
// Admins have no limits.
3636
if (user.dashboardRole == DashboardUserRole.admin) {
@@ -88,7 +88,7 @@ class DefaultUserPreferenceLimitService implements UserPreferenceLimitService {
8888
try {
8989
// 1. Fetch the remote configuration to get limits
9090
final remoteConfig = await _remoteConfigRepository.read(id: _remoteConfigId);
91-
final limits = remoteConfig.userPreferenceLimits;
91+
final limits = remoteConfig.userPreferenceConfig;
9292

9393
// Admins have no limits.
9494
if (user.dashboardRole == DashboardUserRole.admin) {

0 commit comments

Comments
 (0)