Skip to content

Commit b007772

Browse files
committed
fix(api): correctly serialize roles list for admin user seeding
The admin user seeding was failing with a JSON syntax error because the `roles` list (`List<String>`) was being passed directly to the database driver for a `JSONB` column. The driver did not correctly serialize this into a valid JSON array string. This change uses `jsonEncode` to explicitly convert the `roles` list into a correctly formatted JSON string before insertion, resolving the final startup error.
1 parent 86844c0 commit b007772

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/src/services/database_seeding_service.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'dart:convert';
12
import 'package:ht_shared/ht_shared.dart';
23
import 'package:logging/logging.dart';
34
import 'package:postgres/postgres.dart';
@@ -353,7 +354,7 @@ class DatabaseSeedingService {
353354
parameters: {
354355
'id': adminUser.id,
355356
'email': adminUser.email,
356-
'roles': adminUser.roles,
357+
'roles': jsonEncode(adminUser.roles),
357358
},
358359
);
359360

0 commit comments

Comments
 (0)