Skip to content

Commit 35fa931

Browse files
committed
fix(data): correct admin user seeding logic
Fixes a bug in `DatabaseSeedingService` where the code was incorrectly attempting to access properties on a `User` object as if it were a `Map`. The logic now correctly accesses the `.roles` property and uses the `User` object from the fixture list directly.
1 parent 31bddd2 commit 35fa931

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/src/services/database_seeding_service.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,10 @@ class DatabaseSeedingService {
255255
// Seed Admin User
256256
_log.fine('Seeding admin user...');
257257
// Find the admin user in the fixture data.
258-
final adminUserData = usersFixturesData.firstWhere(
259-
(user) => (user['roles'] as List).contains(UserRoles.admin),
258+
final adminUser = usersFixturesData.firstWhere(
259+
(user) => user.roles.contains(UserRoles.admin),
260260
orElse: () => throw StateError('Admin user not found in fixtures.'),
261261
);
262-
final adminUser = User.fromJson(adminUserData);
263262
await _connection.execute(
264263
Sql.named(
265264
'INSERT INTO users (id, email, roles) '

0 commit comments

Comments
 (0)